diff --git a/README.md b/README.md index 1ea5c16b..c53cb8a0 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ Import packages or modules for build your own application - [ ] Frost - [ ] Musig2 - [ ] Miniscript -- [ ] CLI +- [x] CLI - [ ] Breez SDK compatible - [ ] DLC message diff --git a/package-lock.json b/package-lock.json index c001b3b0..e5d975ea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "bip66": "^2.0.0", "bitcoinjs-lib": "^6.1.6", "bitcoinjs-message": "^2.2.0", + "commander": "^12.1.0", "lightningdevkit-node-net": "0.0.12-4.0", "node-fetch": "^3.0.0", "secp256k1": "^5.0.0", @@ -2721,6 +2722,16 @@ "joi": "^17.2.1" } }, + "node_modules/@react-native-community/cli/node_modules/commander": { + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", + "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": "^12.20.0 || >=14" + } + }, "node_modules/@react-native/assets-registry": { "version": "0.75.3", "resolved": "https://registry.npmjs.org/@react-native/assets-registry/-/assets-registry-0.75.3.tgz", @@ -4200,13 +4211,12 @@ "peer": true }, "node_modules/commander": { - "version": "9.5.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", - "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", + "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==", "license": "MIT", - "peer": true, "engines": { - "node": "^12.20.0 || >=14" + "node": ">=18" } }, "node_modules/commondir": { @@ -7752,6 +7762,16 @@ } } }, + "node_modules/react-native/node_modules/commander": { + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", + "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": "^12.20.0 || >=14" + } + }, "node_modules/react-refresh": { "version": "0.14.2", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.2.tgz", diff --git a/package.json b/package.json index bbbb74ac..8bbc59fd 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,8 @@ "tiny-secp256k1": "^2.0.0", "wif": "^5.0.0", "@nostr-dev-kit/ndk": "^2.10.0", - "@synonymdev/react-native-ldk": "^0.0.152" + "@synonymdev/react-native-ldk": "^0.0.152", + "commander": "^12.1.0" }, "publishConfig": { "registry": "https://registry.npmjs.org", diff --git a/src/cli/cli.js b/src/cli/cli.js new file mode 100644 index 00000000..891c44e5 --- /dev/null +++ b/src/cli/cli.js @@ -0,0 +1,15 @@ +#!/usr/bin/env node + +const { program } = require('commander'); +const { myLibraryFunction } = require('./lib'); // Import your library functions here + +program + .version('1.0.0') + .description('A CLI for My Library') + .option('-n, --name ', 'Provide a name') + .action((options) => { + console.log('Name:', options.name); + myLibraryFunction(options.name); // Call the library function + }); + +program.parse(process.argv);