Skip to content

Commit a984882

Browse files
committedSep 2, 2021
feat(create-tsbb): add output options.
1 parent 217d46b commit a984882

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed
 

‎packages/create-tsbb/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Usage: create-tsbb <app-name> [options] [--help|h]
4545
Options:
4646
--version, -v Show version number
4747
--help, -h Displays help information.
48+
--output, -o Output directory.
4849
--example, -e Example from: https://jaywcjlove.github.io/tsbb , default: "basic"
4950
--force, -f Overwrite target directory if it exists. default: false
5051
--path, -p Specify the download target git address. default: "https://jaywcjlove.github.io/tsbb"

‎packages/create-tsbb/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@
3939
"tsbb": "^3.0.3"
4040
},
4141
"dependencies": {
42-
"create-kkt": "2.1.6"
42+
"create-kkt": "2.2.0"
4343
}
4444
}

‎packages/create-tsbb/src/cli.ts

+16-4
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,26 @@ import { create } from 'create-kkt';
55

66
async function run(): Promise<void> {
77
try {
8-
const argvs = minimist(process.argv.slice(2));
8+
const argvs = minimist(process.argv.slice(2), {
9+
alias: {
10+
output: 'o',
11+
force: 'f',
12+
path: 'p',
13+
example: 'e',
14+
},
15+
default: {
16+
path: 'http://jaywcjlove.github.io/tsbb/',
17+
output: '.',
18+
force: false,
19+
example: 'basic',
20+
},
21+
});
922
if (argvs.h || argvs.help) {
1023
console.log('\n Usage: create-tsbb <app-name> [options] [--help|h]');
1124
console.log('\n Options:');
1225
console.log(' --version, -v', 'Show version number');
1326
console.log(' --help, -h', 'Displays help information.');
27+
console.log(' --output, -o', 'Output directory.');
1428
console.log(
1529
' --example, -e',
1630
'Example from: \x1b[34mhttp://jaywcjlove.github.io/tsbb/ \x1b[0m , default: "basic"',
@@ -31,9 +45,7 @@ async function run(): Promise<void> {
3145
return;
3246
}
3347
argvs.appName = argvs._[0];
34-
argvs.path = argvs.p = argvs.path || argvs.p || 'http://jaywcjlove.github.io/tsbb/';
35-
argvs.force = argvs.f = argvs.force || argvs.f || false;
36-
argvs.example = argvs.e = (argvs.example || argvs.e || 'basic').toLocaleLowerCase();
48+
argvs.example = argvs.e = String(argvs.example).toLocaleLowerCase();
3749
create(argvs, exampleHelp);
3850
} catch (error) {
3951
console.log(`\x1b[31m${error.message}\x1b[0m`);

0 commit comments

Comments
 (0)
Please sign in to comment.