mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-05-21 22:09:16 +08:00
fix(cli): fix some bugs of create-vant-cli-app
This commit is contained in:
parent
5bb9a31e28
commit
df6edc4864
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "create-vant-cli-app",
|
||||
"version": "1.0.0",
|
||||
"version": "0.0.1",
|
||||
"description": "Create Vant Cli App",
|
||||
"main": "lib/index.js",
|
||||
"bin": {
|
||||
@ -14,6 +14,10 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/youzan/vant/tree/dev/packages/create-vant-cli-app"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"generators"
|
||||
],
|
||||
"keywords": [
|
||||
"vant"
|
||||
],
|
||||
|
@ -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();
|
||||
|
@ -21,8 +21,7 @@
|
||||
"lib",
|
||||
"site",
|
||||
"template",
|
||||
"preset.js",
|
||||
"generators"
|
||||
"preset.js"
|
||||
],
|
||||
"keywords": [
|
||||
"vant"
|
||||
@ -41,7 +40,6 @@
|
||||
"@types/postcss-load-config": "^2.0.1",
|
||||
"@types/sass": "^1.16.0",
|
||||
"@types/shelljs": "^0.8.6",
|
||||
"@types/source-map": "^0.5.7",
|
||||
"@types/webpack": "^4.41.2",
|
||||
"@types/webpack-dev-server": "^3.9.0",
|
||||
"@types/webpack-merge": "^4.1.5"
|
||||
@ -124,13 +122,5 @@
|
||||
"global-require": 0,
|
||||
"import/no-dynamic-require": 0
|
||||
}
|
||||
},
|
||||
"stylelint": {
|
||||
"extends": [
|
||||
"@vant/stylelint-config"
|
||||
]
|
||||
},
|
||||
"prettier": {
|
||||
"singleQuote": true
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user