mirror of
https://github.com/youzan/vant.git
synced 2025-10-17 16:44:21 +00:00
fix(cli): fix some bugs of create-vant-cli-app
This commit is contained in:
@@ -44,21 +44,21 @@ export class VanGenerator extends Generator {
|
||||
this.fs.copy(join(TEMPLATES, from), this.destinationPath(to || from));
|
||||
};
|
||||
|
||||
const copyTpl = (name: string) => {
|
||||
const copyTpl = (name: string, target?: string) => {
|
||||
this.fs.copyTpl(
|
||||
join(TEMPLATES, name),
|
||||
this.destinationPath(name),
|
||||
this.destinationPath(target || name),
|
||||
this.inputs
|
||||
);
|
||||
};
|
||||
|
||||
copy('.gitignore');
|
||||
copy('.eslintignore');
|
||||
copyTpl('package.json.tpl', 'package.json');
|
||||
copyTpl('vant.config.js');
|
||||
copy('babel.config.js');
|
||||
copy('gitignore.tpl', '.gitignore');
|
||||
copy('eslintignore.tpl', '.eslintignore');
|
||||
copy('src/**/*', 'src');
|
||||
copy('docs/**/*', 'docs');
|
||||
copyTpl('package.json');
|
||||
copyTpl('vant.config.js');
|
||||
}
|
||||
|
||||
install() {
|
||||
|
@@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import inquirer from 'inquirer';
|
||||
import { mkdirSync, existsSync } from 'fs-extra';
|
||||
import { ensureDir } from 'fs-extra';
|
||||
import { VanGenerator } from './generator';
|
||||
|
||||
const PROMPTS = [
|
||||
@@ -13,15 +15,10 @@ const PROMPTS = [
|
||||
export default async function run() {
|
||||
const { name } = await inquirer.prompt(PROMPTS);
|
||||
|
||||
if (!existsSync(name)) {
|
||||
mkdirSync(name);
|
||||
}
|
||||
ensureDir(name);
|
||||
|
||||
const generator = new VanGenerator(name);
|
||||
|
||||
return new Promise(resolve => {
|
||||
generator.run(resolve);
|
||||
});
|
||||
generator.run();
|
||||
}
|
||||
|
||||
run();
|
||||
|
Reference in New Issue
Block a user