Skip to content

Commit

Permalink
Update release (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
escottalexander authored Jan 9, 2025
2 parents 6a25218 + 2b1b8af commit 7b73766
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/slimy-jars-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eth-tech-tree": patch
---

add version flag
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
],
"license": "MIT",
"devDependencies": {
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-typescript": "11.1.0",
"@types/ncp": "2.0.5",
"@types/node": "18.16.0",
Expand Down
3 changes: 2 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import typescript from "@rollup/plugin-typescript";
import autoExternal from "rollup-plugin-auto-external";
import json from '@rollup/plugin-json';

export default {
input: "src/cli.ts",
Expand All @@ -8,6 +9,6 @@ export default {
format: "es",
sourcemap: true,
},
plugins: [autoExternal(), typescript({ exclude: ["challenges/**"] })],
plugins: [autoExternal(), typescript({ exclude: ["challenges/**"] }), json()],
external: ["@inquirer/core"],
};
6 changes: 6 additions & 0 deletions src/tasks/handle-command.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { CommandOptions } from "./parse-command-arguments-and-options";
import { removeStorage, setupChallenge, submitChallenge } from "../actions";
import { version } from '../../package.json'

export async function handleCommand(commands: CommandOptions) {
const { command, installLocation, challenge, contractAddress, dev, help } = commands;
Expand All @@ -9,6 +10,11 @@ export async function handleCommand(commands: CommandOptions) {
return;
}

if (command === 'version') {
console.log(version)
return
}

if (command === "setup") {
await setupChallenge(challenge as string, installLocation as string);
}
Expand Down
6 changes: 5 additions & 1 deletion src/tasks/parse-command-arguments-and-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ export async function parseCommandArgumentsAndOptions(
"--dev": Boolean,
"--help": Boolean,
"-h": "--help",
"--version": Boolean,
"-v": "--version"
},
{
argv: args,
Expand All @@ -79,7 +81,9 @@ export async function parseCommandArgumentsAndOptions(

const help = parsedArgs["--help"] ?? parsedArgs._[0] === 'help' ?? false;

const command = parsedArgs._[0] ?? null;
const version = parsedArgs["--version"] ?? parsedArgs._[0] === 'version' ?? false;

const command = version ? 'version' : parsedArgs._[0] ?? null;

const argumentObject: Partial<CommandOptions> = {
dev,
Expand Down
1 change: 1 addition & 0 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"esModuleInterop": true,
"sourceMap": true,
"skipLibCheck": true,
"moduleResolution": "node"
"moduleResolution": "node",
"resolveJsonModule": true
},
"exclude": ["node_modules"]
}
38 changes: 38 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,20 @@ __metadata:
languageName: node
linkType: hard

"@rollup/plugin-json@npm:^6.1.0":
version: 6.1.0
resolution: "@rollup/plugin-json@npm:6.1.0"
dependencies:
"@rollup/pluginutils": ^5.1.0
peerDependencies:
rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0
peerDependenciesMeta:
rollup:
optional: true
checksum: cc018d20c80242a2b8b44fae61a968049cf31bb8406218187cc7cda35747616594e79452dd65722e7da6dd825b392e90d4599d43cd4461a02fefa2865945164e
languageName: node
linkType: hard

"@rollup/plugin-typescript@npm:11.1.0":
version: 11.1.0
resolution: "@rollup/plugin-typescript@npm:11.1.0"
Expand Down Expand Up @@ -592,6 +606,22 @@ __metadata:
languageName: node
linkType: hard

"@rollup/pluginutils@npm:^5.1.0":
version: 5.1.4
resolution: "@rollup/pluginutils@npm:5.1.4"
dependencies:
"@types/estree": ^1.0.0
estree-walker: ^2.0.2
picomatch: ^4.0.2
peerDependencies:
rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0
peerDependenciesMeta:
rollup:
optional: true
checksum: dc0294580effbf68965ed7939c9e469b8c8847b59842e4691fd10d0a8d0b178600bd912694c409ae33600c9059efce72e96f25917cff983afd57f092a7aeb8d2
languageName: node
linkType: hard

"@samverschueren/stream-to-observable@npm:^0.3.0":
version: 0.3.1
resolution: "@samverschueren/stream-to-observable@npm:0.3.1"
Expand Down Expand Up @@ -1784,6 +1814,7 @@ __metadata:
dependencies:
"@changesets/cli": ^2.26.2
"@inquirer/prompts": ^7.1.0
"@rollup/plugin-json": ^6.1.0
"@rollup/plugin-typescript": 11.1.0
"@types/ncp": 2.0.5
"@types/node": 18.16.0
Expand Down Expand Up @@ -3847,6 +3878,13 @@ __metadata:
languageName: node
linkType: hard

"picomatch@npm:^4.0.2":
version: 4.0.2
resolution: "picomatch@npm:4.0.2"
checksum: a7a5188c954f82c6585720e9143297ccd0e35ad8072231608086ca950bee672d51b0ef676254af0788205e59bd4e4deb4e7708769226bed725bf13370a7d1464
languageName: node
linkType: hard

"pify@npm:^3.0.0":
version: 3.0.0
resolution: "pify@npm:3.0.0"
Expand Down

0 comments on commit 7b73766

Please sign in to comment.