-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbbgenerator-ui.ts
More file actions
27 lines (24 loc) · 925 Bytes
/
Copy pathbbgenerator-ui.ts
File metadata and controls
27 lines (24 loc) · 925 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import program from 'commander';
import UIGenerator from './core/UIGenerator';
import { Options } from './core/types';
import { success, initLogo } from './core/utils';
async function run(entityName: string, options: Options): Promise<void> {
initLogo();
const uiGenerator: UIGenerator = new UIGenerator(options);
await uiGenerator.run(entityName);
console.log();
success(uiGenerator.rootEntity);
};
program
.usage('[options] <entityName>')
.option('-t, --type [type]', 'Тип создаваемой сущности')
.option('-p, --path [path]', 'Путь до папки c компонентом', process.cwd())
.action(file => {
const componentName: string = typeof file === 'string' ? file : '';
run(componentName, {
name: componentName,
path: program.path,
type: program.type,
});
})
.parse(process.argv);