1 | #!/usr/bin/env node
|
2 | import fs from 'fs-extra';
|
3 | import { execSync } from 'child_process';
|
4 |
|
5 | const [, , ...args] = process.argv;
|
6 |
|
7 | async function main() {
|
8 | if (args[0] === 'init') {
|
9 | const dir = process.cwd();
|
10 | await fs.copy(__dirname + '/../template/', dir);
|
11 | await fs.rename(dir + '/_tsconfig.json', dir + '/tsconfig.json');
|
12 | execSync('npm install');
|
13 | // execSync('npm link back-base');
|
14 | try {
|
15 | execSync('git init');
|
16 | execSync('git add .');
|
17 | } catch (e) {}
|
18 | }
|
19 | }
|
20 | main().catch(err => console.error(err));
|