From d36d23a4c768e4def2aec5d89ca0854d91f95f1a Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Sun, 29 Nov 2020 10:50:56 +0800 Subject: [PATCH] fix(create-vant-cli-app): incorrect compiler-sfc name --- .../generators/{templates => }/vue2/.eslintignore | 0 .../generators/{templates => }/vue2/.gitignore | 0 .../generators/{templates => }/vue2/babel.config.js | 0 .../generators/{templates => }/vue2/docs/home.md | 0 .../generators/{templates => }/vue2/docs/quickstart.md | 0 .../generators/{templates => }/vue2/package.json.tpl | 0 .../{templates => }/vue2/src/demo-button/README.md | 0 .../{templates => }/vue2/src/demo-button/demo/index.vue | 0 .../{templates => }/vue2/src/demo-button/index.vue | 0 .../src/demo-button/test/__snapshots__/index.spec.js.snap | 0 .../vue3 => vue2}/src/demo-button/test/index.spec.js | 0 .../generators/{templates => }/vue2/vant.config.js | 0 .../generators/{templates => }/vue3/.eslintignore | 0 .../generators/{templates => }/vue3/.gitignore | 0 .../generators/{templates => }/vue3/babel.config.js | 0 .../generators/{templates => }/vue3/docs/home.md | 0 .../generators/{templates => }/vue3/docs/quickstart.md | 0 .../generators/{templates => }/vue3/package.json.tpl | 2 +- .../{templates => }/vue3/src/demo-button/README.md | 0 .../{templates => }/vue3/src/demo-button/demo/index.vue | 0 .../{templates => }/vue3/src/demo-button/index.vue | 0 .../src/demo-button/test/__snapshots__/index.spec.js.snap | 0 .../vue2 => vue3}/src/demo-button/test/index.spec.js | 2 +- .../generators/{templates => }/vue3/vant.config.js | 0 packages/create-vant-cli-app/src/generator.ts | 5 +---- 25 files changed, 3 insertions(+), 6 deletions(-) rename packages/create-vant-cli-app/generators/{templates => }/vue2/.eslintignore (100%) rename packages/create-vant-cli-app/generators/{templates => }/vue2/.gitignore (100%) rename packages/create-vant-cli-app/generators/{templates => }/vue2/babel.config.js (100%) rename packages/create-vant-cli-app/generators/{templates => }/vue2/docs/home.md (100%) rename packages/create-vant-cli-app/generators/{templates => }/vue2/docs/quickstart.md (100%) rename packages/create-vant-cli-app/generators/{templates => }/vue2/package.json.tpl (100%) rename packages/create-vant-cli-app/generators/{templates => }/vue2/src/demo-button/README.md (100%) rename packages/create-vant-cli-app/generators/{templates => }/vue2/src/demo-button/demo/index.vue (100%) rename packages/create-vant-cli-app/generators/{templates => }/vue2/src/demo-button/index.vue (100%) rename packages/create-vant-cli-app/generators/{templates => }/vue2/src/demo-button/test/__snapshots__/index.spec.js.snap (100%) rename packages/create-vant-cli-app/generators/{templates/vue3 => vue2}/src/demo-button/test/index.spec.js (100%) rename packages/create-vant-cli-app/generators/{templates => }/vue2/vant.config.js (100%) rename packages/create-vant-cli-app/generators/{templates => }/vue3/.eslintignore (100%) rename packages/create-vant-cli-app/generators/{templates => }/vue3/.gitignore (100%) rename packages/create-vant-cli-app/generators/{templates => }/vue3/babel.config.js (100%) rename packages/create-vant-cli-app/generators/{templates => }/vue3/docs/home.md (100%) rename packages/create-vant-cli-app/generators/{templates => }/vue3/docs/quickstart.md (100%) rename packages/create-vant-cli-app/generators/{templates => }/vue3/package.json.tpl (97%) rename packages/create-vant-cli-app/generators/{templates => }/vue3/src/demo-button/README.md (100%) rename packages/create-vant-cli-app/generators/{templates => }/vue3/src/demo-button/demo/index.vue (100%) rename packages/create-vant-cli-app/generators/{templates => }/vue3/src/demo-button/index.vue (100%) rename packages/create-vant-cli-app/generators/{templates => }/vue3/src/demo-button/test/__snapshots__/index.spec.js.snap (100%) rename packages/create-vant-cli-app/generators/{templates/vue2 => vue3}/src/demo-button/test/index.spec.js (77%) rename packages/create-vant-cli-app/generators/{templates => }/vue3/vant.config.js (100%) diff --git a/packages/create-vant-cli-app/generators/templates/vue2/.eslintignore b/packages/create-vant-cli-app/generators/vue2/.eslintignore similarity index 100% rename from packages/create-vant-cli-app/generators/templates/vue2/.eslintignore rename to packages/create-vant-cli-app/generators/vue2/.eslintignore diff --git a/packages/create-vant-cli-app/generators/templates/vue2/.gitignore b/packages/create-vant-cli-app/generators/vue2/.gitignore similarity index 100% rename from packages/create-vant-cli-app/generators/templates/vue2/.gitignore rename to packages/create-vant-cli-app/generators/vue2/.gitignore diff --git a/packages/create-vant-cli-app/generators/templates/vue2/babel.config.js b/packages/create-vant-cli-app/generators/vue2/babel.config.js similarity index 100% rename from packages/create-vant-cli-app/generators/templates/vue2/babel.config.js rename to packages/create-vant-cli-app/generators/vue2/babel.config.js diff --git a/packages/create-vant-cli-app/generators/templates/vue2/docs/home.md b/packages/create-vant-cli-app/generators/vue2/docs/home.md similarity index 100% rename from packages/create-vant-cli-app/generators/templates/vue2/docs/home.md rename to packages/create-vant-cli-app/generators/vue2/docs/home.md diff --git a/packages/create-vant-cli-app/generators/templates/vue2/docs/quickstart.md b/packages/create-vant-cli-app/generators/vue2/docs/quickstart.md similarity index 100% rename from packages/create-vant-cli-app/generators/templates/vue2/docs/quickstart.md rename to packages/create-vant-cli-app/generators/vue2/docs/quickstart.md diff --git a/packages/create-vant-cli-app/generators/templates/vue2/package.json.tpl b/packages/create-vant-cli-app/generators/vue2/package.json.tpl similarity index 100% rename from packages/create-vant-cli-app/generators/templates/vue2/package.json.tpl rename to packages/create-vant-cli-app/generators/vue2/package.json.tpl diff --git a/packages/create-vant-cli-app/generators/templates/vue2/src/demo-button/README.md b/packages/create-vant-cli-app/generators/vue2/src/demo-button/README.md similarity index 100% rename from packages/create-vant-cli-app/generators/templates/vue2/src/demo-button/README.md rename to packages/create-vant-cli-app/generators/vue2/src/demo-button/README.md diff --git a/packages/create-vant-cli-app/generators/templates/vue2/src/demo-button/demo/index.vue b/packages/create-vant-cli-app/generators/vue2/src/demo-button/demo/index.vue similarity index 100% rename from packages/create-vant-cli-app/generators/templates/vue2/src/demo-button/demo/index.vue rename to packages/create-vant-cli-app/generators/vue2/src/demo-button/demo/index.vue diff --git a/packages/create-vant-cli-app/generators/templates/vue2/src/demo-button/index.vue b/packages/create-vant-cli-app/generators/vue2/src/demo-button/index.vue similarity index 100% rename from packages/create-vant-cli-app/generators/templates/vue2/src/demo-button/index.vue rename to packages/create-vant-cli-app/generators/vue2/src/demo-button/index.vue diff --git a/packages/create-vant-cli-app/generators/templates/vue2/src/demo-button/test/__snapshots__/index.spec.js.snap b/packages/create-vant-cli-app/generators/vue2/src/demo-button/test/__snapshots__/index.spec.js.snap similarity index 100% rename from packages/create-vant-cli-app/generators/templates/vue2/src/demo-button/test/__snapshots__/index.spec.js.snap rename to packages/create-vant-cli-app/generators/vue2/src/demo-button/test/__snapshots__/index.spec.js.snap diff --git a/packages/create-vant-cli-app/generators/templates/vue3/src/demo-button/test/index.spec.js b/packages/create-vant-cli-app/generators/vue2/src/demo-button/test/index.spec.js similarity index 100% rename from packages/create-vant-cli-app/generators/templates/vue3/src/demo-button/test/index.spec.js rename to packages/create-vant-cli-app/generators/vue2/src/demo-button/test/index.spec.js diff --git a/packages/create-vant-cli-app/generators/templates/vue2/vant.config.js b/packages/create-vant-cli-app/generators/vue2/vant.config.js similarity index 100% rename from packages/create-vant-cli-app/generators/templates/vue2/vant.config.js rename to packages/create-vant-cli-app/generators/vue2/vant.config.js diff --git a/packages/create-vant-cli-app/generators/templates/vue3/.eslintignore b/packages/create-vant-cli-app/generators/vue3/.eslintignore similarity index 100% rename from packages/create-vant-cli-app/generators/templates/vue3/.eslintignore rename to packages/create-vant-cli-app/generators/vue3/.eslintignore diff --git a/packages/create-vant-cli-app/generators/templates/vue3/.gitignore b/packages/create-vant-cli-app/generators/vue3/.gitignore similarity index 100% rename from packages/create-vant-cli-app/generators/templates/vue3/.gitignore rename to packages/create-vant-cli-app/generators/vue3/.gitignore diff --git a/packages/create-vant-cli-app/generators/templates/vue3/babel.config.js b/packages/create-vant-cli-app/generators/vue3/babel.config.js similarity index 100% rename from packages/create-vant-cli-app/generators/templates/vue3/babel.config.js rename to packages/create-vant-cli-app/generators/vue3/babel.config.js diff --git a/packages/create-vant-cli-app/generators/templates/vue3/docs/home.md b/packages/create-vant-cli-app/generators/vue3/docs/home.md similarity index 100% rename from packages/create-vant-cli-app/generators/templates/vue3/docs/home.md rename to packages/create-vant-cli-app/generators/vue3/docs/home.md diff --git a/packages/create-vant-cli-app/generators/templates/vue3/docs/quickstart.md b/packages/create-vant-cli-app/generators/vue3/docs/quickstart.md similarity index 100% rename from packages/create-vant-cli-app/generators/templates/vue3/docs/quickstart.md rename to packages/create-vant-cli-app/generators/vue3/docs/quickstart.md diff --git a/packages/create-vant-cli-app/generators/templates/vue3/package.json.tpl b/packages/create-vant-cli-app/generators/vue3/package.json.tpl similarity index 97% rename from packages/create-vant-cli-app/generators/templates/vue3/package.json.tpl rename to packages/create-vant-cli-app/generators/vue3/package.json.tpl index 223361931..75adcd95e 100644 --- a/packages/create-vant-cli-app/generators/templates/vue3/package.json.tpl +++ b/packages/create-vant-cli-app/generators/vue3/package.json.tpl @@ -34,7 +34,7 @@ }, "devDependencies": { "@vant/cli": "^3.0.0", - "@vue/sfc-compiler": "^3.0.0", + "@vue/compiler-sfc": "^3.0.0", "babel-plugin-import": "^1.13.0", "vue": "^3.0.0" }, diff --git a/packages/create-vant-cli-app/generators/templates/vue3/src/demo-button/README.md b/packages/create-vant-cli-app/generators/vue3/src/demo-button/README.md similarity index 100% rename from packages/create-vant-cli-app/generators/templates/vue3/src/demo-button/README.md rename to packages/create-vant-cli-app/generators/vue3/src/demo-button/README.md diff --git a/packages/create-vant-cli-app/generators/templates/vue3/src/demo-button/demo/index.vue b/packages/create-vant-cli-app/generators/vue3/src/demo-button/demo/index.vue similarity index 100% rename from packages/create-vant-cli-app/generators/templates/vue3/src/demo-button/demo/index.vue rename to packages/create-vant-cli-app/generators/vue3/src/demo-button/demo/index.vue diff --git a/packages/create-vant-cli-app/generators/templates/vue3/src/demo-button/index.vue b/packages/create-vant-cli-app/generators/vue3/src/demo-button/index.vue similarity index 100% rename from packages/create-vant-cli-app/generators/templates/vue3/src/demo-button/index.vue rename to packages/create-vant-cli-app/generators/vue3/src/demo-button/index.vue diff --git a/packages/create-vant-cli-app/generators/templates/vue3/src/demo-button/test/__snapshots__/index.spec.js.snap b/packages/create-vant-cli-app/generators/vue3/src/demo-button/test/__snapshots__/index.spec.js.snap similarity index 100% rename from packages/create-vant-cli-app/generators/templates/vue3/src/demo-button/test/__snapshots__/index.spec.js.snap rename to packages/create-vant-cli-app/generators/vue3/src/demo-button/test/__snapshots__/index.spec.js.snap diff --git a/packages/create-vant-cli-app/generators/templates/vue2/src/demo-button/test/index.spec.js b/packages/create-vant-cli-app/generators/vue3/src/demo-button/test/index.spec.js similarity index 77% rename from packages/create-vant-cli-app/generators/templates/vue2/src/demo-button/test/index.spec.js rename to packages/create-vant-cli-app/generators/vue3/src/demo-button/test/index.spec.js index 87c961d6c..d87d7d531 100644 --- a/packages/create-vant-cli-app/generators/templates/vue2/src/demo-button/test/index.spec.js +++ b/packages/create-vant-cli-app/generators/vue3/src/demo-button/test/index.spec.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import DemoButton from '..'; +import DemoButton from '../../demo-button'; test('render demo button', () => { const wrapper = mount(DemoButton); diff --git a/packages/create-vant-cli-app/generators/templates/vue3/vant.config.js b/packages/create-vant-cli-app/generators/vue3/vant.config.js similarity index 100% rename from packages/create-vant-cli-app/generators/templates/vue3/vant.config.js rename to packages/create-vant-cli-app/generators/vue3/vant.config.js diff --git a/packages/create-vant-cli-app/src/generator.ts b/packages/create-vant-cli-app/src/generator.ts index 0ab11c7dc..3052998cd 100644 --- a/packages/create-vant-cli-app/src/generator.ts +++ b/packages/create-vant-cli-app/src/generator.ts @@ -6,7 +6,6 @@ import { CWD, GENERATOR_DIR } from './constant'; import Yeoman from 'yeoman-environment'; import Generator from 'yeoman-generator'; -const TEMPLATES_ROOT = join(GENERATOR_DIR, 'templates'); const PROMPTS = [ { name: 'vueVersion', @@ -64,14 +63,12 @@ export class VanGenerator extends Generator { writing() { consola.info(`Creating project in ${join(CWD, this.inputs.name)}\n`); - const templatePath = join(TEMPLATES_ROOT, this.inputs.vueVersion); + const templatePath = join(GENERATOR_DIR, this.inputs.vueVersion); const templateFiles = glob.sync(join(templatePath, '**', '*'), { dot: true, }); const destinationRoot = this.destinationRoot(); - console.log(templateFiles); - templateFiles.forEach((filePath) => { const outputPath = filePath .replace('.tpl', '')