@roastduck/npm_monorepo_cli 1.0.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/dist/index.d.ts +2 -0
- package/dist/index.js +24 -0
- package/package.json +25 -0
- package/src/index.ts +29 -0
- package/tsconfig.json +15 -0
package/dist/index.d.ts
ADDED
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 '@roastduck/npm_monorepo_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,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@roastduck/npm_monorepo_cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
|
+
},
|
|
11
|
+
"bin": {
|
|
12
|
+
"num-calc": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [],
|
|
15
|
+
"author": "",
|
|
16
|
+
"license": "ISC",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@roastduck/npm_monorepo_core": "^1.0.0",
|
|
19
|
+
"chalk": "^5.6.2",
|
|
20
|
+
"commander": "^14.0.3"
|
|
21
|
+
},
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
}
|
|
25
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { add, minus } from '@roastduck/npm_monorepo_core';
|
|
5
|
+
|
|
6
|
+
const program = new Command();
|
|
7
|
+
|
|
8
|
+
program
|
|
9
|
+
.name('num cli')
|
|
10
|
+
.description('计算数字加减')
|
|
11
|
+
.version('0.0.1');
|
|
12
|
+
|
|
13
|
+
program.command('add')
|
|
14
|
+
.description('加法')
|
|
15
|
+
.argument('a', '第一个数字')
|
|
16
|
+
.argument('b', '第二个数字')
|
|
17
|
+
.action((a: string, b: string) => {
|
|
18
|
+
console.log(chalk.green(add(+a, +b)))
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
program.command('minus')
|
|
22
|
+
.description('减法')
|
|
23
|
+
.argument('a', '第一个数字')
|
|
24
|
+
.argument('b', '第二个数字')
|
|
25
|
+
.action((a: string, b: string) => {
|
|
26
|
+
console.log(chalk.cyan(minus(+a, +b)))
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
program.parse();
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"outDir": "dist",
|
|
4
|
+
"rootDir": "src",
|
|
5
|
+
"types": [ "node" ],
|
|
6
|
+
"target": "es2016",
|
|
7
|
+
"module": "NodeNext",
|
|
8
|
+
"moduleResolution": "NodeNext",
|
|
9
|
+
"declaration": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"strict": true,
|
|
13
|
+
"skipLibCheck": true,
|
|
14
|
+
}
|
|
15
|
+
}
|