@lightfish/cli 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ # @lightfish/cli
2
+
3
+ ## 1.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 数字加减 cli
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @lightfish/core@1.1.0
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander';
3
+ import chalk from "chalk";
4
+ import { add, minus } from '@lightfish/core';
5
+ const program = new Command();
6
+ program
7
+ .name('num cli')
8
+ .description('计算数字加减')
9
+ .version('0.0.1');
10
+ program.command('add')
11
+ .description('加法')
12
+ .argument('a', '第一个数字')
13
+ .argument('b', '第二个数字')
14
+ .action((a, b) => {
15
+ console.log(chalk.green(add(+a, +b)));
16
+ });
17
+ program.command('minus')
18
+ .description('减法')
19
+ .argument('a', '第一个数字')
20
+ .argument('b', '第二个数字')
21
+ .action((a, b) => {
22
+ console.log(chalk.cyan(minus(+a, +b)));
23
+ });
24
+ program.parse();
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@lightfish/cli",
3
+ "version": "1.1.0",
4
+ "description": "",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "keywords": [],
9
+ "author": "",
10
+ "license": "ISC",
11
+ "dependencies": {
12
+ "chalk": "^5.3.0",
13
+ "commander": "^11.1.0",
14
+ "@lightfish/core": "^1.1.0"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "scripts": {
20
+ "build": "tsc"
21
+ }
22
+ }
package/src/index.ts ADDED
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from "commander";
3
+ import chalk from "chalk";
4
+ import { add, minus } from "@lightfish/core";
5
+
6
+ const program = new Command();
7
+
8
+ program.name("num cli").description("计算数字加减").version("0.0.1");
9
+
10
+ program
11
+ .command("add")
12
+ .description("加法")
13
+ .argument("a", "第一个数字")
14
+ .argument("b", "第二个数字")
15
+ .action((a: string, b: string) => {
16
+ console.log(chalk.green(add(+a, +b)));
17
+ });
18
+
19
+ program
20
+ .command("minus")
21
+ .description("减法")
22
+ .argument("a", "第一个数字")
23
+ .argument("b", "第二个数字")
24
+ .action((a: string, b: string) => {
25
+ console.log(chalk.cyan(minus(+a, +b)));
26
+ });
27
+
28
+ program.parse();
package/tsconfig.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2016",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "nodenext",
6
+ "forceConsistentCasingInFileNames": true,
7
+ "strict": true,
8
+ "skipLibCheck": true,
9
+ "outDir": "dist",
10
+ "declaration": true
11
+ }
12
+ }