mirror of
https://github.com/youzan/vant.git
synced 2025-10-21 03:11:15 +00:00
chore(cli): extract create-vant-cli-app package
This commit is contained in:
27
packages/create-vant-cli-app/src/index.ts
Normal file
27
packages/create-vant-cli-app/src/index.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import inquirer from 'inquirer';
|
||||
import { mkdirSync, existsSync } from 'fs-extra';
|
||||
import { VanGenerator } from './generator';
|
||||
|
||||
const PROMPTS = [
|
||||
{
|
||||
type: 'input',
|
||||
name: 'name',
|
||||
message: 'Your package name'
|
||||
}
|
||||
];
|
||||
|
||||
export default async function run() {
|
||||
const { name } = await inquirer.prompt(PROMPTS);
|
||||
|
||||
if (!existsSync(name)) {
|
||||
mkdirSync(name);
|
||||
}
|
||||
|
||||
const generator = new VanGenerator(name);
|
||||
|
||||
return new Promise(resolve => {
|
||||
generator.run(resolve);
|
||||
});
|
||||
}
|
||||
|
||||
run();
|
Reference in New Issue
Block a user