Skip to content

Commit 2064eed

Browse files
committed
Add version option
1 parent 299d4e5 commit 2064eed

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
/dist
55
/node_modules
66
/test/cli/tmp
7+
/src/bin/package.json

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tikui/cli",
3-
"version": "2.4.3",
3+
"version": "2.5.0",
44
"description": "Command lines tool for Tikui",
55
"main": "index.js",
66
"files": [
@@ -14,7 +14,7 @@
1414
"format": "prettier . --check",
1515
"format:fix": "prettier . --write",
1616
"clean": "rimraf dist",
17-
"build": "npm run clean && tsc && cp -r src/cli/generate-project dist/cli/generate-project",
17+
"build": "npm run clean && cp ./package.json src/bin/package.json && tsc && cp -r src/cli/generate-project dist/cli/generate-project",
1818
"test": "jest",
1919
"test:watch": "jest --watch",
2020
"test:watchAll": "jest --watchAll",

src/bin/tikuicli.ts

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { program } from 'commander';
55
import { createComponent } from '@/cli/create-component';
66
import * as path from 'path';
77
import { generateProject } from '@/cli/generate-project';
8+
import * as process from 'node:process';
9+
import { version } from './package.json';
810

911
try {
1012
program
@@ -26,6 +28,8 @@ try {
2628
console.log(`Generating project ${project} to ${path.resolve(destination)}`); // eslint-disable-line no-console
2729
});
2830

31+
program.version(version, '-v, --version', 'current version');
32+
2933
program.parse(process.argv);
3034
} catch (e) {
3135
console.error(e.message); // eslint-disable-line no-console

tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"emitDecoratorMetadata": true,
88
"moduleResolution": "node",
99
"outDir": "dist",
10+
"resolveJsonModule": true,
1011
"paths": {
1112
"@/*": ["src/*"]
1213
},

0 commit comments

Comments
 (0)