create-vue 3.3.3 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +2 -2
  3. package/outfile.cjs +101 -46
  4. package/package.json +7 -6
  5. package/template/base/index.html +3 -3
  6. package/template/base/node_modules/.bin/vite +2 -2
  7. package/template/base/package.json +4 -4
  8. package/template/base/src/assets/main.css +1 -1
  9. package/template/code/router/src/components/WelcomeItem.vue +0 -1
  10. package/template/config/cypress/node_modules/.bin/cypress +2 -2
  11. package/template/config/cypress/package.json +3 -3
  12. package/template/config/cypress-ct/node_modules/.bin/cypress +2 -2
  13. package/template/config/cypress-ct/package.json +4 -4
  14. package/template/config/jsx/node_modules/.bin/vite +2 -2
  15. package/template/config/jsx/package.json +2 -2
  16. package/template/config/pinia/package.json +2 -2
  17. package/template/config/playwright/_gitignore +2 -0
  18. package/template/config/playwright/e2e/vue.spec.js +8 -0
  19. package/template/config/playwright/e2e/vue.spec.ts +8 -0
  20. package/template/config/playwright/node_modules/.bin/playwright +17 -0
  21. package/template/config/playwright/package.json +8 -0
  22. package/template/config/playwright/playwright.config.js +112 -0
  23. package/template/config/playwright/playwright.config.ts +112 -0
  24. package/template/config/router/package.json +1 -1
  25. package/template/config/typescript/node_modules/.bin/vue-tsc +2 -2
  26. package/template/config/typescript/package.json +2 -2
  27. package/template/config/vitest/node_modules/.bin/vitest +2 -2
  28. package/template/config/vitest/package.json +5 -5
  29. package/template/tsconfig/base/tsconfig.config.json +1 -1
package/LICENSE CHANGED
@@ -150,7 +150,7 @@ Repository: git+https://github.com/marvinhagemeister/kolorist.git
150
150
 
151
151
  License: MIT
152
152
  By: James Halliday
153
- Repository: git://github.com/substack/minimist.git
153
+ Repository: git://github.com/minimistjs/minimist.git
154
154
 
155
155
  > This software is released under the MIT license:
156
156
  >
package/README.md CHANGED
@@ -9,13 +9,13 @@ The recommended way to start a Vite-powered Vue project
9
9
  ## Usage
10
10
 
11
11
  ```sh
12
- npm init vue@3
12
+ npm create vue@3
13
13
  ```
14
14
 
15
15
  Or, if you need to support IE11, you can create a Vue 2 project with:
16
16
 
17
17
  ```sh
18
- npm init vue@2
18
+ npm create vue@2
19
19
  ```
20
20
 
21
21
  Note that the version number (`@3` or `@2`) MUST NOT be omitted, otherwise `npm` may resolve to a cached and outdated version of the package.
package/outfile.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- /*! create-vue v3.3.3 | MIT */
2
+ /*! create-vue v3.4.0 | MIT */
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -30,9 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  ));
31
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
32
 
33
- // node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js
33
+ // node_modules/.pnpm/minimist@1.2.7/node_modules/minimist/index.js
34
34
  var require_minimist = __commonJS({
35
- "node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js"(exports, module2) {
35
+ "node_modules/.pnpm/minimist@1.2.7/node_modules/minimist/index.js"(exports, module2) {
36
36
  module2.exports = function(args, opts) {
37
37
  if (!opts)
38
38
  opts = {};
@@ -3102,7 +3102,7 @@ var require_dist = __commonJS({
3102
3102
  }
3103
3103
  });
3104
3104
 
3105
- // node_modules/.pnpm/@vue+create-eslint-config@0.1.2/node_modules/@vue/create-eslint-config/templates/prettierrc-airbnb.json
3105
+ // node_modules/.pnpm/@vue+create-eslint-config@0.1.3/node_modules/@vue/create-eslint-config/templates/prettierrc-airbnb.json
3106
3106
  var prettierrc_airbnb_exports = {};
3107
3107
  __export(prettierrc_airbnb_exports, {
3108
3108
  $schema: () => $schema,
@@ -3123,7 +3123,7 @@ __export(prettierrc_airbnb_exports, {
3123
3123
  });
3124
3124
  var $schema, arrowParens, bracketSameLine, bracketSpacing, endOfLine, jsxSingleQuote, printWidth, proseWrap, quoteProps, semi, singleQuote, tabWidth, trailingComma, useTabs, prettierrc_airbnb_default;
3125
3125
  var init_prettierrc_airbnb = __esm({
3126
- "node_modules/.pnpm/@vue+create-eslint-config@0.1.2/node_modules/@vue/create-eslint-config/templates/prettierrc-airbnb.json"() {
3126
+ "node_modules/.pnpm/@vue+create-eslint-config@0.1.3/node_modules/@vue/create-eslint-config/templates/prettierrc-airbnb.json"() {
3127
3127
  $schema = "https://json.schemastore.org/prettierrc";
3128
3128
  arrowParens = "always";
3129
3129
  bracketSameLine = false;
@@ -3157,7 +3157,7 @@ var init_prettierrc_airbnb = __esm({
3157
3157
  }
3158
3158
  });
3159
3159
 
3160
- // node_modules/.pnpm/@vue+create-eslint-config@0.1.2/node_modules/@vue/create-eslint-config/templates/prettierrc-standard.json
3160
+ // node_modules/.pnpm/@vue+create-eslint-config@0.1.3/node_modules/@vue/create-eslint-config/templates/prettierrc-standard.json
3161
3161
  var prettierrc_standard_exports = {};
3162
3162
  __export(prettierrc_standard_exports, {
3163
3163
  $schema: () => $schema2,
@@ -3176,7 +3176,7 @@ __export(prettierrc_standard_exports, {
3176
3176
  });
3177
3177
  var $schema2, arrowParens2, bracketSameLine2, bracketSpacing2, jsxSingleQuote2, proseWrap2, quoteProps2, semi2, singleQuote2, tabWidth2, trailingComma2, useTabs2, prettierrc_standard_default;
3178
3178
  var init_prettierrc_standard = __esm({
3179
- "node_modules/.pnpm/@vue+create-eslint-config@0.1.2/node_modules/@vue/create-eslint-config/templates/prettierrc-standard.json"() {
3179
+ "node_modules/.pnpm/@vue+create-eslint-config@0.1.3/node_modules/@vue/create-eslint-config/templates/prettierrc-standard.json"() {
3180
3180
  $schema2 = "https://json.schemastore.org/prettierrc";
3181
3181
  arrowParens2 = "always";
3182
3182
  bracketSameLine2 = false;
@@ -3206,15 +3206,15 @@ var init_prettierrc_standard = __esm({
3206
3206
  }
3207
3207
  });
3208
3208
 
3209
- // node_modules/.pnpm/@vue+create-eslint-config@0.1.2/node_modules/@vue/create-eslint-config/templates/prettierrcs.cjs
3209
+ // node_modules/.pnpm/@vue+create-eslint-config@0.1.3/node_modules/@vue/create-eslint-config/templates/prettierrcs.cjs
3210
3210
  var require_prettierrcs = __commonJS({
3211
- "node_modules/.pnpm/@vue+create-eslint-config@0.1.2/node_modules/@vue/create-eslint-config/templates/prettierrcs.cjs"(exports) {
3211
+ "node_modules/.pnpm/@vue+create-eslint-config@0.1.3/node_modules/@vue/create-eslint-config/templates/prettierrcs.cjs"(exports) {
3212
3212
  exports.airbnb = (init_prettierrc_airbnb(), __toCommonJS(prettierrc_airbnb_exports));
3213
3213
  exports.standard = (init_prettierrc_standard(), __toCommonJS(prettierrc_standard_exports));
3214
3214
  }
3215
3215
  });
3216
3216
 
3217
- // node_modules/.pnpm/@vue+create-eslint-config@0.1.2/node_modules/@vue/create-eslint-config/package.json
3217
+ // node_modules/.pnpm/@vue+create-eslint-config@0.1.3/node_modules/@vue/create-eslint-config/package.json
3218
3218
  var package_exports = {};
3219
3219
  __export(package_exports, {
3220
3220
  author: () => author,
@@ -3238,9 +3238,9 @@ __export(package_exports, {
3238
3238
  });
3239
3239
  var name, version, description, type, main, bin, engines, repository, keywords, author, license, bugs, homepage, publishConfig, dependencies, devDependencies, scripts, package_default;
3240
3240
  var init_package = __esm({
3241
- "node_modules/.pnpm/@vue+create-eslint-config@0.1.2/node_modules/@vue/create-eslint-config/package.json"() {
3241
+ "node_modules/.pnpm/@vue+create-eslint-config@0.1.3/node_modules/@vue/create-eslint-config/package.json"() {
3242
3242
  name = "@vue/create-eslint-config";
3243
- version = "0.1.2";
3243
+ version = "0.1.3";
3244
3244
  description = "Utility to setup ESLint in Vue.js projects.";
3245
3245
  type = "module";
3246
3246
  main = "index.js";
@@ -3312,9 +3312,9 @@ var init_package = __esm({
3312
3312
  }
3313
3313
  });
3314
3314
 
3315
- // node_modules/.pnpm/@vue+create-eslint-config@0.1.2/node_modules/@vue/create-eslint-config/versionMap.cjs
3315
+ // node_modules/.pnpm/@vue+create-eslint-config@0.1.3/node_modules/@vue/create-eslint-config/versionMap.cjs
3316
3316
  var require_versionMap = __commonJS({
3317
- "node_modules/.pnpm/@vue+create-eslint-config@0.1.2/node_modules/@vue/create-eslint-config/versionMap.cjs"(exports, module2) {
3317
+ "node_modules/.pnpm/@vue+create-eslint-config@0.1.3/node_modules/@vue/create-eslint-config/versionMap.cjs"(exports, module2) {
3318
3318
  module2.exports = (init_package(), __toCommonJS(package_exports)).devDependencies;
3319
3319
  }
3320
3320
  });
@@ -3325,7 +3325,7 @@ var path4 = __toESM(require("path"), 1);
3325
3325
  var import_minimist = __toESM(require_minimist(), 1);
3326
3326
  var import_prompts = __toESM(require_lib(), 1);
3327
3327
 
3328
- // node_modules/.pnpm/kolorist@1.5.1/node_modules/kolorist/dist/esm/index.mjs
3328
+ // node_modules/.pnpm/kolorist@1.6.0/node_modules/kolorist/dist/esm/index.mjs
3329
3329
  var enabled = true;
3330
3330
  var globalVar = typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
3331
3331
  var supportLevel = 0;
@@ -3472,6 +3472,12 @@ function renderTemplate(src, dest) {
3472
3472
  if (filename.startsWith("_")) {
3473
3473
  dest = path.resolve(path.dirname(dest), filename.replace(/^_/, "."));
3474
3474
  }
3475
+ if (filename === "_gitignore" && fs.existsSync(dest)) {
3476
+ const existing = fs.readFileSync(dest, "utf8");
3477
+ const newGitignore = fs.readFileSync(src, "utf8");
3478
+ fs.writeFileSync(dest, existing + "\n" + newGitignore);
3479
+ return;
3480
+ }
3475
3481
  fs.copyFileSync(src, dest);
3476
3482
  }
3477
3483
  var renderTemplate_default = renderTemplate;
@@ -3511,11 +3517,15 @@ function postOrderDirectoryTraverse(dir, dirCallback, fileCallback) {
3511
3517
  }
3512
3518
 
3513
3519
  // utils/getCommand.ts
3514
- function getCommand(packageManager, scriptName) {
3520
+ function getCommand(packageManager, scriptName, args) {
3515
3521
  if (scriptName === "install") {
3516
3522
  return packageManager === "yarn" ? "yarn" : `${packageManager} install`;
3517
3523
  }
3518
- return packageManager === "npm" ? `npm run ${scriptName}` : `${packageManager} ${scriptName}`;
3524
+ if (args) {
3525
+ return packageManager === "npm" ? `npm run ${scriptName} -- ${args}` : `${packageManager} ${scriptName} ${args}`;
3526
+ } else {
3527
+ return packageManager === "npm" ? `npm run ${scriptName}` : `${packageManager} ${scriptName}`;
3528
+ }
3519
3529
  }
3520
3530
 
3521
3531
  // utils/generateReadme.ts
@@ -3539,9 +3549,11 @@ function generateReadme({
3539
3549
  needsTypeScript,
3540
3550
  needsCypress,
3541
3551
  needsCypressCT,
3552
+ needsPlaywright,
3542
3553
  needsVitest,
3543
3554
  needsEslint
3544
3555
  }) {
3556
+ const commandFor = (scriptName, args) => getCommand(packageManager, scriptName, args);
3545
3557
  let readme = `# ${projectName}
3546
3558
 
3547
3559
  This template should help get you started developing with Vue 3 in Vite.
@@ -3558,19 +3570,19 @@ See [Vite Configuration Reference](https://vitejs.dev/config/).
3558
3570
 
3559
3571
  `;
3560
3572
  let npmScriptsDescriptions = `\`\`\`sh
3561
- ${getCommand(packageManager, "install")}
3573
+ ${commandFor("install")}
3562
3574
  \`\`\`
3563
3575
 
3564
3576
  ### Compile and Hot-Reload for Development
3565
3577
 
3566
3578
  \`\`\`sh
3567
- ${getCommand(packageManager, "dev")}
3579
+ ${commandFor("dev")}
3568
3580
  \`\`\`
3569
3581
 
3570
3582
  ### ${needsTypeScript ? "Type-Check, " : ""}Compile and Minify for Production
3571
3583
 
3572
3584
  \`\`\`sh
3573
- ${getCommand(packageManager, "build")}
3585
+ ${commandFor("build")}
3574
3586
  \`\`\`
3575
3587
  `;
3576
3588
  if (needsVitest) {
@@ -3578,7 +3590,7 @@ ${getCommand(packageManager, "build")}
3578
3590
  ### Run Unit Tests with [Vitest](https://vitest.dev/)
3579
3591
 
3580
3592
  \`\`\`sh
3581
- ${getCommand(packageManager, "test:unit")}
3593
+ ${commandFor("test:unit")}
3582
3594
  \`\`\`
3583
3595
  `;
3584
3596
  }
@@ -3587,10 +3599,7 @@ ${getCommand(packageManager, "test:unit")}
3587
3599
  ### Run Headed Component Tests with [Cypress Component Testing](https://on.cypress.io/component)
3588
3600
 
3589
3601
  \`\`\`sh
3590
- ${getCommand(packageManager, "test:unit")} # or \`${getCommand(
3591
- packageManager,
3592
- "test:unit:ci"
3593
- )}\` for headless testing
3602
+ ${commandFor("test:unit:dev")} # or \`${commandFor("test:unit")}\` for headless testing
3594
3603
  \`\`\`
3595
3604
  `;
3596
3605
  }
@@ -3599,11 +3608,39 @@ ${getCommand(packageManager, "test:unit")} # or \`${getCommand(
3599
3608
  ### Run End-to-End Tests with [Cypress](https://www.cypress.io/)
3600
3609
 
3601
3610
  \`\`\`sh
3602
- ${getCommand(packageManager, "build")}
3603
- ${getCommand(packageManager, "test:e2e")} # or \`${getCommand(
3604
- packageManager,
3605
- "test:e2e:ci"
3606
- )}\` for headless testing
3611
+ ${commandFor("test:e2e:dev")}
3612
+ \`\`\`
3613
+
3614
+ This runs the end-to-end tests against the Vite development server.
3615
+ It is much faster than the production build.
3616
+
3617
+ But it's still recommended to test the production build with \`test:e2e\` before deploying (e.g. in CI environments):
3618
+
3619
+ \`\`\`sh
3620
+ ${commandFor("build")}
3621
+ ${commandFor("test:e2e")}
3622
+ \`\`\`
3623
+ `;
3624
+ }
3625
+ if (needsPlaywright) {
3626
+ npmScriptsDescriptions += `
3627
+ ### Run End-to-End Tests with [Playwright](https://playwright.dev)
3628
+
3629
+ \`\`\`sh
3630
+ # Install browsers for the first run
3631
+ npx playwright install
3632
+
3633
+ # When testing on CI, must build the project first
3634
+ ${commandFor("build")}
3635
+
3636
+ # Runs the end-to-end tests
3637
+ ${commandFor("test:e2e")}
3638
+ # Runs the tests only on Chromium
3639
+ ${commandFor("test:e2e", "--project=chromium")}
3640
+ # Runs the tests of a specific file
3641
+ ${commandFor("test:e2e", "tests/example.spec.ts")}
3642
+ # Runs the tests in debug mode
3643
+ ${commandFor("test:e2e", "--debug")}
3607
3644
  \`\`\`
3608
3645
  `;
3609
3646
  }
@@ -3612,7 +3649,7 @@ ${getCommand(packageManager, "test:e2e")} # or \`${getCommand(
3612
3649
  ### Lint with [ESLint](https://eslint.org/)
3613
3650
 
3614
3651
  \`\`\`sh
3615
- ${getCommand(packageManager, "lint")}
3652
+ ${commandFor("lint")}
3616
3653
  \`\`\`
3617
3654
  `;
3618
3655
  }
@@ -3624,10 +3661,10 @@ ${getCommand(packageManager, "lint")}
3624
3661
  var fs3 = __toESM(require("fs"), 1);
3625
3662
  var path3 = __toESM(require("path"), 1);
3626
3663
 
3627
- // node_modules/.pnpm/@vue+create-eslint-config@0.1.2/node_modules/@vue/create-eslint-config/index.js
3664
+ // node_modules/.pnpm/@vue+create-eslint-config@0.1.3/node_modules/@vue/create-eslint-config/index.js
3628
3665
  var import_javascript_stringify = __toESM(require_dist(), 1);
3629
3666
 
3630
- // node_modules/.pnpm/@vue+create-eslint-config@0.1.2/node_modules/@vue/create-eslint-config/templates/editorconfigs.js
3667
+ // node_modules/.pnpm/@vue+create-eslint-config@0.1.3/node_modules/@vue/create-eslint-config/templates/editorconfigs.js
3631
3668
  var editorconfigs_exports = {};
3632
3669
  __export(editorconfigs_exports, {
3633
3670
  airbnb: () => airbnb,
@@ -3654,7 +3691,7 @@ insert_final_newline = true
3654
3691
  trim_trailing_whitespace = true
3655
3692
  `;
3656
3693
 
3657
- // node_modules/.pnpm/@vue+create-eslint-config@0.1.2/node_modules/@vue/create-eslint-config/index.js
3694
+ // node_modules/.pnpm/@vue+create-eslint-config@0.1.3/node_modules/@vue/create-eslint-config/index.js
3658
3695
  var import_prettierrcs = __toESM(require_prettierrcs(), 1);
3659
3696
  var import_versionMap = __toESM(require_versionMap(), 1);
3660
3697
  function stringifyJS(value, styleGuide) {
@@ -3691,7 +3728,7 @@ function createConfig({
3691
3728
  hasTypeScript = false,
3692
3729
  needsPrettier = false,
3693
3730
  additionalConfig = {},
3694
- additionalDependenices = {}
3731
+ additionalDependencies = {}
3695
3732
  }) {
3696
3733
  const pkg = { devDependencies: {} };
3697
3734
  const addDependency = (name2) => {
@@ -3736,7 +3773,7 @@ function createConfig({
3736
3773
  addDependency("prettier");
3737
3774
  addDependencyAndExtend("@vue/eslint-config-prettier");
3738
3775
  }
3739
- deepMerge2(pkg.devDependencies, additionalDependenices);
3776
+ deepMerge2(pkg.devDependencies, additionalDependencies);
3740
3777
  deepMerge2(eslintConfig, additionalConfig);
3741
3778
  const files = {
3742
3779
  ".eslintrc.cjs": ""
@@ -3776,7 +3813,10 @@ function renderEslint(rootDir, { needsTypeScript, needsCypress, needsCypressCT,
3776
3813
  if (needsCypress) {
3777
3814
  additionalConfig.overrides = [
3778
3815
  {
3779
- files: needsCypressCT ? ["**/__tests__/*.{cy,spec}.{js,ts,jsx,tsx}", "cypress/e2e/**.{cy,spec}.{js,ts,jsx,tsx}"] : ["cypress/e2e/**.{cy,spec}.{js,ts,jsx,tsx}"],
3816
+ files: needsCypressCT ? [
3817
+ "**/__tests__/*.{cy,spec}.{js,ts,jsx,tsx}",
3818
+ "cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}"
3819
+ ] : ["cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}"],
3780
3820
  extends: ["plugin:cypress/recommended"]
3781
3821
  }
3782
3822
  ];
@@ -3802,7 +3842,6 @@ function renderEslint(rootDir, { needsTypeScript, needsCypress, needsCypressCT,
3802
3842
  fs3.writeFileSync(packageJsonPath, JSON.stringify(updatedPkg, null, 2) + "\n", "utf-8");
3803
3843
  for (const [fileName, content] of Object.entries(files)) {
3804
3844
  const fullPath = path3.resolve(rootDir, fileName);
3805
- console.log(fullPath, content);
3806
3845
  fs3.writeFileSync(fullPath, content, "utf-8");
3807
3846
  }
3808
3847
  }
@@ -3854,7 +3893,7 @@ ${banner_default}
3854
3893
  },
3855
3894
  boolean: true
3856
3895
  });
3857
- const isFeatureFlagsUsed = typeof (argv.default ?? argv.ts ?? argv.jsx ?? argv.router ?? argv.pinia ?? argv.tests ?? argv.vitest ?? argv.cypress ?? argv.eslint) === "boolean";
3896
+ const isFeatureFlagsUsed = typeof (argv.default ?? argv.ts ?? argv.jsx ?? argv.router ?? argv.pinia ?? argv.tests ?? argv.vitest ?? argv.cypress ?? argv.playwright ?? argv.eslint) === "boolean";
3858
3897
  let targetDir = argv._[0];
3859
3898
  const defaultProjectName = !targetDir ? "vue-project" : targetDir;
3860
3899
  const forceOverwrite = argv.force;
@@ -3934,12 +3973,22 @@ ${banner_default}
3934
3973
  inactive: "No"
3935
3974
  },
3936
3975
  {
3937
- name: "needsCypress",
3938
- type: () => isFeatureFlagsUsed ? null : "toggle",
3939
- message: (prev, answers) => answers.needsVitest ? "Add Cypress for End-to-End testing?" : "Add Cypress for both Unit and End-to-End testing?",
3940
- initial: false,
3941
- active: "Yes",
3942
- inactive: "No"
3976
+ name: "needsE2eTesting",
3977
+ type: () => isFeatureFlagsUsed ? null : "select",
3978
+ message: "Add an End-to-End Testing Solution?",
3979
+ initial: 0,
3980
+ choices: (prev, anwsers) => [
3981
+ { title: "No", value: false },
3982
+ {
3983
+ title: "Cypress",
3984
+ description: anwsers.needsVitest ? void 0 : "also supports unit testing with Cypress Component Testing",
3985
+ value: "cypress"
3986
+ },
3987
+ {
3988
+ title: "Playwright",
3989
+ value: "playwright"
3990
+ }
3991
+ ]
3943
3992
  },
3944
3993
  {
3945
3994
  name: "needsEslint",
@@ -3981,12 +4030,14 @@ ${banner_default}
3981
4030
  needsTypeScript = argv.typescript,
3982
4031
  needsRouter = argv.router,
3983
4032
  needsPinia = argv.pinia,
3984
- needsCypress = argv.cypress || argv.tests,
3985
4033
  needsVitest = argv.vitest || argv.tests,
3986
4034
  needsEslint = argv.eslint || argv["eslint-with-prettier"],
3987
4035
  needsPrettier = argv["eslint-with-prettier"]
3988
4036
  } = result;
4037
+ const { needsE2eTesting } = result;
4038
+ const needsCypress = argv.cypress || argv.tests || needsE2eTesting === "cypress";
3989
4039
  const needsCypressCT = needsCypress && !needsVitest;
4040
+ const needsPlaywright = argv.playwright || needsE2eTesting === "playwright";
3990
4041
  const root = path4.join(cwd, targetDir);
3991
4042
  if (fs4.existsSync(root) && shouldOverwrite) {
3992
4043
  emptyDir(root);
@@ -4021,6 +4072,9 @@ Scaffolding project in ${root}...`);
4021
4072
  if (needsCypressCT) {
4022
4073
  render("config/cypress-ct");
4023
4074
  }
4075
+ if (needsPlaywright) {
4076
+ render("config/playwright");
4077
+ }
4024
4078
  if (needsTypeScript) {
4025
4079
  render("config/typescript");
4026
4080
  render("tsconfig/base");
@@ -4091,6 +4145,7 @@ Scaffolding project in ${root}...`);
4091
4145
  needsTypeScript,
4092
4146
  needsVitest,
4093
4147
  needsCypress,
4148
+ needsPlaywright,
4094
4149
  needsCypressCT,
4095
4150
  needsEslint
4096
4151
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-vue",
3
- "version": "3.3.3",
3
+ "version": "3.4.0",
4
4
  "description": "An easy way to start a Vue project",
5
5
  "type": "module",
6
6
  "bin": {
@@ -25,16 +25,17 @@
25
25
  },
26
26
  "homepage": "https://github.com/vuejs/create-vue#readme",
27
27
  "devDependencies": {
28
- "@types/eslint": "^8.4.6",
29
- "@types/prompts": "^2.0.14",
30
- "@vue/create-eslint-config": "^0.1.2",
28
+ "@types/eslint": "^8.4.7",
29
+ "@types/node": "^16.11.68",
30
+ "@types/prompts": "^2.4.1",
31
+ "@vue/create-eslint-config": "^0.1.3",
31
32
  "@vue/tsconfig": "^0.1.3",
32
33
  "esbuild": "^0.14.53",
33
34
  "esbuild-plugin-license": "^1.2.2",
34
35
  "husky": "^8.0.1",
35
- "kolorist": "^1.5.1",
36
+ "kolorist": "^1.6.0",
36
37
  "lint-staged": "^13.0.3",
37
- "minimist": "^1.2.6",
38
+ "minimist": "^1.2.7",
38
39
  "npm-run-all": "^4.1.5",
39
40
  "prettier": "^2.7.1",
40
41
  "prompts": "^2.4.2",
@@ -1,9 +1,9 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
3
  <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" href="/favicon.ico" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
4
+ <meta charset="UTF-8">
5
+ <link rel="icon" href="/favicon.ico">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
7
  <title>Vite App</title>
8
8
  </head>
9
9
  <body>
@@ -11,7 +11,7 @@ else
11
11
  export NODE_PATH="$NODE_PATH:/Users/haoqun/Developer/vuejs/create-vue/node_modules/.pnpm/node_modules"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
- exec "$basedir/node" "$basedir/../../../../node_modules/.pnpm/vite@3.0.9/node_modules/vite/bin/vite.js" "$@"
14
+ exec "$basedir/node" "$basedir/../../../../node_modules/.pnpm/vite@3.1.8/node_modules/vite/bin/vite.js" "$@"
15
15
  else
16
- exec node "$basedir/../../../../node_modules/.pnpm/vite@3.0.9/node_modules/vite/bin/vite.js" "$@"
16
+ exec node "$basedir/../../../../node_modules/.pnpm/vite@3.1.8/node_modules/vite/bin/vite.js" "$@"
17
17
  fi
@@ -2,13 +2,13 @@
2
2
  "scripts": {
3
3
  "dev": "vite",
4
4
  "build": "vite build",
5
- "preview": "vite preview --port 4173"
5
+ "preview": "vite preview"
6
6
  },
7
7
  "dependencies": {
8
- "vue": "^3.2.38"
8
+ "vue": "^3.2.41"
9
9
  },
10
10
  "devDependencies": {
11
- "@vitejs/plugin-vue": "^3.0.3",
12
- "vite": "^3.0.9"
11
+ "@vitejs/plugin-vue": "^3.1.2",
12
+ "vite": "^3.1.8"
13
13
  }
14
14
  }
@@ -1,4 +1,4 @@
1
- @import "./base.css";
1
+ @import './base.css';
2
2
 
3
3
  #app {
4
4
  max-width: 1280px;
@@ -29,7 +29,6 @@ i {
29
29
  place-content: center;
30
30
  width: 32px;
31
31
  height: 32px;
32
-
33
32
  color: var(--color-text);
34
33
  }
35
34
 
@@ -11,7 +11,7 @@ else
11
11
  export NODE_PATH="$NODE_PATH:/Users/haoqun/Developer/vuejs/create-vue/node_modules/.pnpm/node_modules"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
- exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/cypress@10.7.0/node_modules/cypress/bin/cypress" "$@"
14
+ exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/cypress@10.10.0/node_modules/cypress/bin/cypress" "$@"
15
15
  else
16
- exec node "$basedir/../../../../../node_modules/.pnpm/cypress@10.7.0/node_modules/cypress/bin/cypress" "$@"
16
+ exec node "$basedir/../../../../../node_modules/.pnpm/cypress@10.10.0/node_modules/cypress/bin/cypress" "$@"
17
17
  fi
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "scripts": {
3
- "test:e2e": "start-server-and-test preview http://localhost:4173/ 'cypress open --e2e'",
4
- "test:e2e:ci": "start-server-and-test preview http://localhost:4173/ 'cypress run --e2e'"
3
+ "test:e2e": "start-server-and-test preview :4173 'cypress run --e2e'",
4
+ "test:e2e:dev": "start-server-and-test 'vite dev --port 4173' :4173 'cypress open --e2e'"
5
5
  },
6
6
  "devDependencies": {
7
- "cypress": "^10.7.0",
7
+ "cypress": "^10.10.0",
8
8
  "start-server-and-test": "^1.14.0"
9
9
  }
10
10
  }
@@ -11,7 +11,7 @@ else
11
11
  export NODE_PATH="$NODE_PATH:/Users/haoqun/Developer/vuejs/create-vue/node_modules/.pnpm/node_modules"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
- exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/cypress@10.7.0/node_modules/cypress/bin/cypress" "$@"
14
+ exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/cypress@10.10.0/node_modules/cypress/bin/cypress" "$@"
15
15
  else
16
- exec node "$basedir/../../../../../node_modules/.pnpm/cypress@10.7.0/node_modules/cypress/bin/cypress" "$@"
16
+ exec node "$basedir/../../../../../node_modules/.pnpm/cypress@10.10.0/node_modules/cypress/bin/cypress" "$@"
17
17
  fi
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "scripts": {
3
- "test:unit": "cypress open --component",
4
- "test:unit:ci": "cypress run --component --quiet --reporter spec"
3
+ "test:unit": "cypress run --component",
4
+ "test:unit:dev": "cypress open --component"
5
5
  },
6
6
  "dependencies": {
7
- "vue": "^3.2.38"
7
+ "vue": "^3.2.41"
8
8
  },
9
9
  "devDependencies": {
10
- "cypress": "^10.7.0"
10
+ "cypress": "^10.10.0"
11
11
  }
12
12
  }
@@ -11,7 +11,7 @@ else
11
11
  export NODE_PATH="$NODE_PATH:/Users/haoqun/Developer/vuejs/create-vue/node_modules/.pnpm/node_modules"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
- exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/vite@3.0.9/node_modules/vite/bin/vite.js" "$@"
14
+ exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/vite@3.1.8/node_modules/vite/bin/vite.js" "$@"
15
15
  else
16
- exec node "$basedir/../../../../../node_modules/.pnpm/vite@3.0.9/node_modules/vite/bin/vite.js" "$@"
16
+ exec node "$basedir/../../../../../node_modules/.pnpm/vite@3.1.8/node_modules/vite/bin/vite.js" "$@"
17
17
  fi
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "dependencies": {
3
- "vue": "^3.2.38"
3
+ "vue": "^3.2.41"
4
4
  },
5
5
  "devDependencies": {
6
6
  "@vitejs/plugin-vue-jsx": "^2.0.1",
7
- "vite": "^3.0.9"
7
+ "vite": "^3.1.8"
8
8
  }
9
9
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "dependencies": {
3
- "pinia": "^2.0.21",
4
- "vue": "^3.2.38"
3
+ "pinia": "^2.0.23",
4
+ "vue": "^3.2.41"
5
5
  }
6
6
  }
@@ -0,0 +1,2 @@
1
+ test-results/
2
+ playwright-report/
@@ -0,0 +1,8 @@
1
+ const { test, expect } = require('@playwright/test');
2
+
3
+ // See here how to get started:
4
+ // https://playwright.dev/docs/intro
5
+ test('visits the app root url', async ({ page }) => {
6
+ await page.goto('/');
7
+ await expect(page.locator('div.greetings > h1')).toHaveText('You did it!');
8
+ })
@@ -0,0 +1,8 @@
1
+ import { test, expect } from '@playwright/test';
2
+
3
+ // See here how to get started:
4
+ // https://playwright.dev/docs/intro
5
+ test('visits the app root url', async ({ page }) => {
6
+ await page.goto('/');
7
+ await expect(page.locator('div.greetings > h1')).toHaveText('You did it!');
8
+ })
@@ -0,0 +1,17 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
6
+ esac
7
+
8
+ if [ -z "$NODE_PATH" ]; then
9
+ export NODE_PATH="/Users/haoqun/Developer/vuejs/create-vue/node_modules/.pnpm/node_modules"
10
+ else
11
+ export NODE_PATH="$NODE_PATH:/Users/haoqun/Developer/vuejs/create-vue/node_modules/.pnpm/node_modules"
12
+ fi
13
+ if [ -x "$basedir/node" ]; then
14
+ exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/@playwright+test@1.27.1/node_modules/@playwright/test/cli.js" "$@"
15
+ else
16
+ exec node "$basedir/../../../../../node_modules/.pnpm/@playwright+test@1.27.1/node_modules/@playwright/test/cli.js" "$@"
17
+ fi
@@ -0,0 +1,8 @@
1
+ {
2
+ "scripts": {
3
+ "test:e2e": "playwright test"
4
+ },
5
+ "devDependencies": {
6
+ "@playwright/test": "^1.27.1"
7
+ }
8
+ }
@@ -0,0 +1,112 @@
1
+ // @ts-check
2
+ const { devices } = require('@playwright/test')
3
+
4
+ /**
5
+ * Read environment variables from file.
6
+ * https://github.com/motdotla/dotenv
7
+ */
8
+ // require('dotenv').config();
9
+
10
+ /**
11
+ * @see https://playwright.dev/docs/test-configuration
12
+ * @type {import('@playwright/test').PlaywrightTestConfig}
13
+ */
14
+ const config = {
15
+ testDir: './e2e',
16
+ /* Maximum time one test can run for. */
17
+ timeout: 30 * 1000,
18
+ expect: {
19
+ /**
20
+ * Maximum time expect() should wait for the condition to be met.
21
+ * For example in `await expect(locator).toHaveText();`
22
+ */
23
+ timeout: 5000
24
+ },
25
+ /* Fail the build on CI if you accidentally left test.only in the source code. */
26
+ forbidOnly: !!process.env.CI,
27
+ /* Retry on CI only */
28
+ retries: process.env.CI ? 2 : 0,
29
+ /* Opt out of parallel tests on CI. */
30
+ workers: process.env.CI ? 1 : undefined,
31
+ /* Reporter to use. See https://playwright.dev/docs/test-reporters */
32
+ reporter: 'html',
33
+ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
34
+ use: {
35
+ /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
36
+ actionTimeout: 0,
37
+ /* Base URL to use in actions like `await page.goto('/')`. */
38
+ baseURL: 'http://localhost:5173',
39
+
40
+ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
41
+ trace: 'on-first-retry',
42
+
43
+ /* Only on CI systems run the tests headless */
44
+ headless: !!process.env.CI
45
+ },
46
+
47
+ /* Configure projects for major browsers */
48
+ projects: [
49
+ {
50
+ name: 'chromium',
51
+ use: {
52
+ ...devices['Desktop Chrome']
53
+ }
54
+ },
55
+ {
56
+ name: 'firefox',
57
+ use: {
58
+ ...devices['Desktop Firefox']
59
+ }
60
+ },
61
+ {
62
+ name: 'webkit',
63
+ use: {
64
+ ...devices['Desktop Safari']
65
+ }
66
+ }
67
+
68
+ /* Test against mobile viewports. */
69
+ // {
70
+ // name: 'Mobile Chrome',
71
+ // use: {
72
+ // ...devices['Pixel 5'],
73
+ // },
74
+ // },
75
+ // {
76
+ // name: 'Mobile Safari',
77
+ // use: {
78
+ // ...devices['iPhone 12'],
79
+ // },
80
+ // },
81
+
82
+ /* Test against branded browsers. */
83
+ // {
84
+ // name: 'Microsoft Edge',
85
+ // use: {
86
+ // channel: 'msedge',
87
+ // },
88
+ // },
89
+ // {
90
+ // name: 'Google Chrome',
91
+ // use: {
92
+ // channel: 'chrome',
93
+ // },
94
+ // },
95
+ ],
96
+
97
+ /* Folder for test artifacts such as screenshots, videos, traces, etc. */
98
+ // outputDir: 'test-results/',
99
+
100
+ /* Run your local dev server before starting the tests */
101
+ webServer: {
102
+ /**
103
+ * Use the dev server by default for faster feedback loop.
104
+ * Use the preview server on CI for more realistic testing.
105
+ */
106
+ command: process.env.CI ? 'vite preview --port 5173' : 'vite dev',
107
+ port: 5173,
108
+ reuseExistingServer: !process.env.CI
109
+ }
110
+ }
111
+
112
+ module.exports = config
@@ -0,0 +1,112 @@
1
+ import type { PlaywrightTestConfig } from '@playwright/test'
2
+ import { devices } from '@playwright/test'
3
+
4
+ /**
5
+ * Read environment variables from file.
6
+ * https://github.com/motdotla/dotenv
7
+ */
8
+ // require('dotenv').config();
9
+
10
+ /**
11
+ * See https://playwright.dev/docs/test-configuration.
12
+ */
13
+ const config: PlaywrightTestConfig = {
14
+ testDir: './e2e',
15
+ /* Maximum time one test can run for. */
16
+ timeout: 30 * 1000,
17
+ expect: {
18
+ /**
19
+ * Maximum time expect() should wait for the condition to be met.
20
+ * For example in `await expect(locator).toHaveText();`
21
+ */
22
+ timeout: 5000
23
+ },
24
+ /* Fail the build on CI if you accidentally left test.only in the source code. */
25
+ forbidOnly: !!process.env.CI,
26
+ /* Retry on CI only */
27
+ retries: process.env.CI ? 2 : 0,
28
+ /* Opt out of parallel tests on CI. */
29
+ workers: process.env.CI ? 1 : undefined,
30
+ /* Reporter to use. See https://playwright.dev/docs/test-reporters */
31
+ reporter: 'html',
32
+ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
33
+ use: {
34
+ /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
35
+ actionTimeout: 0,
36
+ /* Base URL to use in actions like `await page.goto('/')`. */
37
+ baseURL: 'http://localhost:5173',
38
+
39
+ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
40
+ trace: 'on-first-retry',
41
+
42
+ /* Only on CI systems run the tests headless */
43
+ headless: !!process.env.CI
44
+ },
45
+
46
+ /* Configure projects for major browsers */
47
+ projects: [
48
+ {
49
+ name: 'chromium',
50
+ use: {
51
+ ...devices['Desktop Chrome']
52
+ }
53
+ },
54
+ {
55
+ name: 'firefox',
56
+ use: {
57
+ ...devices['Desktop Firefox']
58
+ }
59
+ },
60
+ {
61
+ name: 'webkit',
62
+ use: {
63
+ ...devices['Desktop Safari']
64
+ }
65
+ }
66
+
67
+ /* Test against mobile viewports. */
68
+ // {
69
+ // name: 'Mobile Chrome',
70
+ // use: {
71
+ // ...devices['Pixel 5'],
72
+ // },
73
+ // },
74
+ // {
75
+ // name: 'Mobile Safari',
76
+ // use: {
77
+ // ...devices['iPhone 12'],
78
+ // },
79
+ // },
80
+
81
+ /* Test against branded browsers. */
82
+ // {
83
+ // name: 'Microsoft Edge',
84
+ // use: {
85
+ // channel: 'msedge',
86
+ // },
87
+ // },
88
+ // {
89
+ // name: 'Google Chrome',
90
+ // use: {
91
+ // channel: 'chrome',
92
+ // },
93
+ // },
94
+ ],
95
+
96
+ /* Folder for test artifacts such as screenshots, videos, traces, etc. */
97
+ // outputDir: 'test-results/',
98
+
99
+ /* Run your local dev server before starting the tests */
100
+ webServer: {
101
+ /**
102
+ * Use the dev server by default for faster feedback loop.
103
+ * Use the preview server on CI for more realistic testing.
104
+ Playwright will re-use the local server if there is already a dev-server running.
105
+ */
106
+ command: process.env.CI ? 'vite preview --port 5173' : 'vite dev',
107
+ port: 5173,
108
+ reuseExistingServer: !process.env.CI
109
+ }
110
+ }
111
+
112
+ export default config
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "dependencies": {
3
- "vue": "^3.2.38",
3
+ "vue": "^3.2.41",
4
4
  "vue-router": "^4.1.5"
5
5
  }
6
6
  }
@@ -11,7 +11,7 @@ else
11
11
  export NODE_PATH="$NODE_PATH:/Users/haoqun/Developer/vuejs/create-vue/node_modules/.pnpm/node_modules"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
- exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/vue-tsc@0.40.6_typescript@4.7.4/node_modules/vue-tsc/bin/vue-tsc.js" "$@"
14
+ exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/vue-tsc@1.0.8_typescript@4.7.4/node_modules/vue-tsc/bin/vue-tsc.js" "$@"
15
15
  else
16
- exec node "$basedir/../../../../../node_modules/.pnpm/vue-tsc@0.40.6_typescript@4.7.4/node_modules/vue-tsc/bin/vue-tsc.js" "$@"
16
+ exec node "$basedir/../../../../../node_modules/.pnpm/vue-tsc@1.0.8_typescript@4.7.4/node_modules/vue-tsc/bin/vue-tsc.js" "$@"
17
17
  fi
@@ -5,9 +5,9 @@
5
5
  "type-check": "vue-tsc --noEmit"
6
6
  },
7
7
  "devDependencies": {
8
- "@types/node": "^16.11.56",
8
+ "@types/node": "^16.11.68",
9
9
  "npm-run-all": "^4.1.5",
10
10
  "typescript": "~4.7.4",
11
- "vue-tsc": "^0.40.6"
11
+ "vue-tsc": "^1.0.8"
12
12
  }
13
13
  }
@@ -11,7 +11,7 @@ else
11
11
  export NODE_PATH="$NODE_PATH:/Users/haoqun/Developer/vuejs/create-vue/node_modules/.pnpm/node_modules"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
- exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/vitest@0.22.1_jsdom@20.0.0/node_modules/vitest/vitest.mjs" "$@"
14
+ exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/vitest@0.24.3_jsdom@20.0.1/node_modules/vitest/vitest.mjs" "$@"
15
15
  else
16
- exec node "$basedir/../../../../../node_modules/.pnpm/vitest@0.22.1_jsdom@20.0.0/node_modules/vitest/vitest.mjs" "$@"
16
+ exec node "$basedir/../../../../../node_modules/.pnpm/vitest@0.24.3_jsdom@20.0.1/node_modules/vitest/vitest.mjs" "$@"
17
17
  fi
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "scripts": {
3
- "test:unit": "vitest --environment jsdom"
3
+ "test:unit": "vitest --environment jsdom --root src/"
4
4
  },
5
5
  "dependencies": {
6
- "vue": "^3.2.38"
6
+ "vue": "^3.2.41"
7
7
  },
8
8
  "devDependencies": {
9
- "@vue/test-utils": "^2.0.2",
10
- "jsdom": "^20.0.0",
11
- "vitest": "^0.22.1"
9
+ "@vue/test-utils": "^2.1.0",
10
+ "jsdom": "^20.0.1",
11
+ "vitest": "^0.24.3"
12
12
  }
13
13
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "extends": "@vue/tsconfig/tsconfig.node.json",
3
- "include": ["vite.config.*", "vitest.config.*", "cypress.config.*"],
3
+ "include": ["vite.config.*", "vitest.config.*", "cypress.config.*", "playwright.config.*"],
4
4
  "compilerOptions": {
5
5
  "composite": true,
6
6
  "types": ["node"]