Skip to content

Commit

Permalink
basic commander stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
d-roak committed Jul 15, 2024
1 parent d055224 commit dec8e10
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 3 deletions.
Empty file added packages/node/configs/node.json
Empty file.
Empty file.
6 changes: 4 additions & 2 deletions packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
"scripts": {
"build": "tsc -b",
"clean": "rm -rf dist/ node_modules/",
"cli": "tsx ./src/index.ts",
"node": "tsx ./src/run_node.ts",
"prebuild": "node -p \"'export const VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts",
"prepack": "tsc -b",
"relay": "tsx ./src/run_relay.ts",
"start": "tsx ./src/index.ts",
"test": "vitest"
},
"devDependencies": {
Expand All @@ -38,6 +39,7 @@
"dependencies": {
"@topology-foundation/crdt": "0.0.20",
"@topology-foundation/network": "0.0.20",
"@topology-foundation/object": "0.0.20"
"@topology-foundation/object": "0.0.20",
"commander": "^12.1.0"
}
}
11 changes: 11 additions & 0 deletions packages/node/src/cli/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Command } from "commander";
import { VERSION } from "../version";

export const program = new Command();

program.version(VERSION);
program.command("start").action(async () => {
// const { start } = await import("./run_node");
// await start();
console.log("start");
});
9 changes: 9 additions & 0 deletions packages/node/src/run.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { program } from "./cli";
import { TopologyNode } from ".";

export async function start() {
const node = new TopologyNode();
node.start();
}

program.parse(process.argv);
3 changes: 2 additions & 1 deletion packages/node/src/run_node.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { program } from "./cli";
import { TopologyNode } from ".";

export async function start() {
const node = new TopologyNode();
node.start();
}

start();
program.parse(process.argv);
1 change: 1 addition & 0 deletions packages/node/src/version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const VERSION = "0.0.20";
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2108,6 +2108,11 @@ commander@^10.0.1:
resolved "https://registry.yarnpkg.com/commander/-/commander-10.0.1.tgz#881ee46b4f77d1c1dccc5823433aa39b022cbe06"
integrity sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==

commander@^12.1.0:
version "12.1.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-12.1.0.tgz#01423b36f501259fdaac4d0e4d60c96c991585d3"
integrity sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==

commander@^2.20.0:
version "2.20.3"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
Expand Down

0 comments on commit dec8e10

Please sign in to comment.