create-vue 3.12.2 → 3.13.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.
- package/README.md +3 -1
- package/outfile.cjs +231 -63
- package/package.json +7 -7
- package/template/bare/base/src/App.vue +7 -0
- package/template/bare/cypress-ct/src/__tests__/App.cy.js +8 -0
- package/template/bare/nightwatch-ct/src/__tests__/App.spec.js +14 -0
- package/template/bare/typescript/src/App.vue +7 -0
- package/template/bare/vitest/src/__tests__/App.spec.js +11 -0
- package/template/base/node_modules/.bin/vite +2 -2
- package/template/base/package.json +2 -2
- package/template/code/default/src/components/TheWelcome.vue +16 -12
- package/template/code/router/src/components/TheWelcome.vue +16 -12
- package/template/code/typescript-default/src/components/TheWelcome.vue +16 -12
- package/template/code/typescript-router/src/components/TheWelcome.vue +16 -12
- package/template/config/cypress/node_modules/.bin/cypress +2 -2
- package/template/config/cypress/node_modules/.bin/server-test +2 -2
- package/template/config/cypress/node_modules/.bin/start-server-and-test +2 -2
- package/template/config/cypress/node_modules/.bin/start-test +2 -2
- package/template/config/cypress/package.json +2 -2
- package/template/config/cypress-ct/node_modules/.bin/cypress +2 -2
- package/template/config/cypress-ct/package.json +1 -1
- package/template/config/jsx/node_modules/.bin/vite +2 -2
- package/template/config/jsx/package.json +1 -1
- package/template/config/nightwatch/node_modules/.bin/chromedriver +2 -2
- package/template/config/nightwatch/node_modules/.bin/geckodriver +2 -2
- package/template/config/nightwatch/node_modules/.bin/nightwatch +2 -2
- package/template/config/nightwatch/node_modules/.bin/ts-node +2 -2
- package/template/config/nightwatch/node_modules/.bin/ts-node-cwd +2 -2
- package/template/config/nightwatch/node_modules/.bin/ts-node-esm +2 -2
- package/template/config/nightwatch/node_modules/.bin/ts-node-script +2 -2
- package/template/config/nightwatch/node_modules/.bin/ts-node-transpile-only +2 -2
- package/template/config/nightwatch/node_modules/.bin/ts-script +2 -2
- package/template/config/nightwatch/node_modules/.bin/vite +2 -2
- package/template/config/nightwatch/package.json +2 -2
- package/template/config/pinia/package.json +1 -1
- package/template/config/playwright/node_modules/.bin/playwright +2 -2
- package/template/config/playwright/package.json +1 -1
- package/template/config/router/package.json +1 -1
- package/template/config/typescript/node_modules/.bin/npm-run-all +2 -2
- package/template/config/typescript/node_modules/.bin/npm-run-all2 +2 -2
- package/template/config/typescript/node_modules/.bin/run-p +2 -2
- package/template/config/typescript/node_modules/.bin/run-s +2 -2
- package/template/config/typescript/node_modules/.bin/tsc +2 -2
- package/template/config/typescript/node_modules/.bin/tsserver +2 -2
- package/template/config/typescript/node_modules/.bin/vue-tsc +2 -2
- package/template/config/typescript/package.json +2 -2
- package/template/config/vitest/node_modules/.bin/vitest +2 -2
- package/template/config/vitest/package.json +1 -1
- package/template/eslint/package.json +1 -1
- package/template/tsconfig/base/tsconfig.app.json +0 -1
- package/template/tsconfig/base/tsconfig.node.json +0 -1
- package/template/tsconfig/cypress-ct/tsconfig.cypress-ct.json +0 -1
- package/template/tsconfig/nightwatch/nightwatch/tsconfig.json +0 -1
- package/template/tsconfig/nightwatch-ct/tsconfig.app.json +0 -1
- package/template/tsconfig/vitest/tsconfig.vitest.json +1 -1
- package/template/base/node_modules/.bin/rollup +0 -17
- package/template/base/node_modules/.bin/tsc +0 -17
- package/template/base/node_modules/.bin/tsserver +0 -17
- package/template/base/node_modules/.vue-global-types/vue_3.5_false.d.ts +0 -119
- package/template/config/cypress-ct/node_modules/.bin/tsc +0 -17
- package/template/config/cypress-ct/node_modules/.bin/tsserver +0 -17
- package/template/config/jsx/node_modules/.bin/browserslist +0 -17
- package/template/config/jsx/node_modules/.bin/tsc +0 -17
- package/template/config/jsx/node_modules/.bin/tsserver +0 -17
- package/template/config/nightwatch/node_modules/.bin/tsc +0 -17
- package/template/config/nightwatch/node_modules/.bin/tsserver +0 -17
- package/template/config/nightwatch-ct/node_modules/.bin/tsc +0 -17
- package/template/config/nightwatch-ct/node_modules/.bin/tsserver +0 -17
- package/template/config/pinia/node_modules/.bin/tsc +0 -17
- package/template/config/pinia/node_modules/.bin/tsserver +0 -17
- package/template/config/router/node_modules/.bin/tsc +0 -17
- package/template/config/router/node_modules/.bin/tsserver +0 -17
- package/template/config/vitest/node_modules/.bin/tsc +0 -17
- package/template/config/vitest/node_modules/.bin/tsserver +0 -17
package/README.md
CHANGED
|
@@ -17,7 +17,9 @@ npm create vue@latest
|
|
|
17
17
|
> [!NOTE]
|
|
18
18
|
> (`@latest` or `@legacy`) MUST NOT be omitted, otherwise `npm` may resolve to a cached and outdated version of the package.
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
By default the command will run in interactive mode, but you can also provide feature flags in the CLI arguments to skip the prompts. Run `npm create vue@latest --help` to see all available options.
|
|
21
|
+
|
|
22
|
+
If you need to support IE11, you can create a Vue 2 project with:
|
|
21
23
|
|
|
22
24
|
```sh
|
|
23
25
|
npm create vue@legacy
|
package/outfile.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
/*! create-vue v3.
|
|
2
|
+
/*! create-vue v3.13.0 | MIT */
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -2511,8 +2511,8 @@ var require_package = __commonJS({
|
|
|
2511
2511
|
var require_ejs = __commonJS({
|
|
2512
2512
|
"node_modules/.pnpm/ejs@3.1.10/node_modules/ejs/lib/ejs.js"(exports2) {
|
|
2513
2513
|
"use strict";
|
|
2514
|
-
var
|
|
2515
|
-
var
|
|
2514
|
+
var fs7 = require("fs");
|
|
2515
|
+
var path7 = require("path");
|
|
2516
2516
|
var utils = require_utils();
|
|
2517
2517
|
var scopeOptionWarned = false;
|
|
2518
2518
|
var _VERSION_STRING = require_package().version;
|
|
@@ -2539,14 +2539,14 @@ var require_ejs = __commonJS({
|
|
|
2539
2539
|
var _BOM = /^\uFEFF/;
|
|
2540
2540
|
var _JS_IDENTIFIER = /^[a-zA-Z_$][0-9a-zA-Z_$]*$/;
|
|
2541
2541
|
exports2.cache = utils.cache;
|
|
2542
|
-
exports2.fileLoader =
|
|
2542
|
+
exports2.fileLoader = fs7.readFileSync;
|
|
2543
2543
|
exports2.localsName = _DEFAULT_LOCALS_NAME;
|
|
2544
2544
|
exports2.promiseImpl = new Function("return this;")().Promise;
|
|
2545
2545
|
exports2.resolveInclude = function(name, filename, isDir) {
|
|
2546
|
-
var dirname2 =
|
|
2547
|
-
var extname =
|
|
2548
|
-
var
|
|
2549
|
-
var includePath =
|
|
2546
|
+
var dirname2 = path7.dirname;
|
|
2547
|
+
var extname = path7.extname;
|
|
2548
|
+
var resolve7 = path7.resolve;
|
|
2549
|
+
var includePath = resolve7(isDir ? filename : dirname2(filename), name);
|
|
2550
2550
|
var ext = extname(name);
|
|
2551
2551
|
if (!ext) {
|
|
2552
2552
|
includePath += ".ejs";
|
|
@@ -2557,35 +2557,35 @@ var require_ejs = __commonJS({
|
|
|
2557
2557
|
var filePath;
|
|
2558
2558
|
if (paths.some(function(v) {
|
|
2559
2559
|
filePath = exports2.resolveInclude(name, v, true);
|
|
2560
|
-
return
|
|
2560
|
+
return fs7.existsSync(filePath);
|
|
2561
2561
|
})) {
|
|
2562
2562
|
return filePath;
|
|
2563
2563
|
}
|
|
2564
2564
|
}
|
|
2565
|
-
function getIncludePath(
|
|
2565
|
+
function getIncludePath(path8, options) {
|
|
2566
2566
|
var includePath;
|
|
2567
2567
|
var filePath;
|
|
2568
2568
|
var views = options.views;
|
|
2569
|
-
var match = /^[A-Za-z]+:\\|^\//.exec(
|
|
2569
|
+
var match = /^[A-Za-z]+:\\|^\//.exec(path8);
|
|
2570
2570
|
if (match && match.length) {
|
|
2571
|
-
|
|
2571
|
+
path8 = path8.replace(/^\/*/, "");
|
|
2572
2572
|
if (Array.isArray(options.root)) {
|
|
2573
|
-
includePath = resolvePaths(
|
|
2573
|
+
includePath = resolvePaths(path8, options.root);
|
|
2574
2574
|
} else {
|
|
2575
|
-
includePath = exports2.resolveInclude(
|
|
2575
|
+
includePath = exports2.resolveInclude(path8, options.root || "/", true);
|
|
2576
2576
|
}
|
|
2577
2577
|
} else {
|
|
2578
2578
|
if (options.filename) {
|
|
2579
|
-
filePath = exports2.resolveInclude(
|
|
2580
|
-
if (
|
|
2579
|
+
filePath = exports2.resolveInclude(path8, options.filename);
|
|
2580
|
+
if (fs7.existsSync(filePath)) {
|
|
2581
2581
|
includePath = filePath;
|
|
2582
2582
|
}
|
|
2583
2583
|
}
|
|
2584
2584
|
if (!includePath && Array.isArray(views)) {
|
|
2585
|
-
includePath = resolvePaths(
|
|
2585
|
+
includePath = resolvePaths(path8, views);
|
|
2586
2586
|
}
|
|
2587
2587
|
if (!includePath && typeof options.includer !== "function") {
|
|
2588
|
-
throw new Error('Could not find the include file "' + options.escapeFunction(
|
|
2588
|
+
throw new Error('Could not find the include file "' + options.escapeFunction(path8) + '"');
|
|
2589
2589
|
}
|
|
2590
2590
|
}
|
|
2591
2591
|
return includePath;
|
|
@@ -2621,10 +2621,10 @@ var require_ejs = __commonJS({
|
|
|
2621
2621
|
var result;
|
|
2622
2622
|
if (!cb) {
|
|
2623
2623
|
if (typeof exports2.promiseImpl == "function") {
|
|
2624
|
-
return new exports2.promiseImpl(function(
|
|
2624
|
+
return new exports2.promiseImpl(function(resolve7, reject) {
|
|
2625
2625
|
try {
|
|
2626
2626
|
result = handleCache(options)(data);
|
|
2627
|
-
|
|
2627
|
+
resolve7(result);
|
|
2628
2628
|
} catch (err) {
|
|
2629
2629
|
reject(err);
|
|
2630
2630
|
}
|
|
@@ -2644,11 +2644,11 @@ var require_ejs = __commonJS({
|
|
|
2644
2644
|
function fileLoader(filePath) {
|
|
2645
2645
|
return exports2.fileLoader(filePath);
|
|
2646
2646
|
}
|
|
2647
|
-
function includeFile(
|
|
2647
|
+
function includeFile(path8, options) {
|
|
2648
2648
|
var opts = utils.shallowCopy(utils.createNullProtoObjWherePossible(), options);
|
|
2649
|
-
opts.filename = getIncludePath(
|
|
2649
|
+
opts.filename = getIncludePath(path8, opts);
|
|
2650
2650
|
if (typeof options.includer === "function") {
|
|
2651
|
-
var includerResult = options.includer(
|
|
2651
|
+
var includerResult = options.includer(path8, opts.filename);
|
|
2652
2652
|
if (includerResult) {
|
|
2653
2653
|
if (includerResult.filename) {
|
|
2654
2654
|
opts.filename = includerResult.filename;
|
|
@@ -2883,12 +2883,12 @@ var require_ejs = __commonJS({
|
|
|
2883
2883
|
throw e;
|
|
2884
2884
|
}
|
|
2885
2885
|
var returnedFn = opts.client ? fn : function anonymous(data) {
|
|
2886
|
-
var include = function(
|
|
2886
|
+
var include = function(path8, includeData) {
|
|
2887
2887
|
var d = utils.shallowCopy(utils.createNullProtoObjWherePossible(), data);
|
|
2888
2888
|
if (includeData) {
|
|
2889
2889
|
d = utils.shallowCopy(d, includeData);
|
|
2890
2890
|
}
|
|
2891
|
-
return includeFile(
|
|
2891
|
+
return includeFile(path8, opts)(d);
|
|
2892
2892
|
};
|
|
2893
2893
|
return fn.apply(
|
|
2894
2894
|
opts.context,
|
|
@@ -2897,7 +2897,7 @@ var require_ejs = __commonJS({
|
|
|
2897
2897
|
};
|
|
2898
2898
|
if (opts.filename && typeof Object.defineProperty === "function") {
|
|
2899
2899
|
var filename = opts.filename;
|
|
2900
|
-
var basename3 =
|
|
2900
|
+
var basename3 = path7.basename(filename, path7.extname(filename));
|
|
2901
2901
|
try {
|
|
2902
2902
|
Object.defineProperty(returnedFn, "name", {
|
|
2903
2903
|
value: basename3,
|
|
@@ -3058,8 +3058,8 @@ var require_ejs = __commonJS({
|
|
|
3058
3058
|
});
|
|
3059
3059
|
|
|
3060
3060
|
// index.ts
|
|
3061
|
-
var
|
|
3062
|
-
var
|
|
3061
|
+
var fs6 = __toESM(require("fs"), 1);
|
|
3062
|
+
var path6 = __toESM(require("path"), 1);
|
|
3063
3063
|
var import_node_util = require("util");
|
|
3064
3064
|
var import_prompts = __toESM(require_lib(), 1);
|
|
3065
3065
|
|
|
@@ -3689,7 +3689,7 @@ function deepMerge2(target, obj) {
|
|
|
3689
3689
|
// template/eslint/package.json
|
|
3690
3690
|
var package_default2 = {
|
|
3691
3691
|
devDependencies: {
|
|
3692
|
-
"@vitest/eslint-plugin": "1.1.
|
|
3692
|
+
"@vitest/eslint-plugin": "1.1.20",
|
|
3693
3693
|
"eslint-plugin-cypress": "^4.1.0",
|
|
3694
3694
|
"eslint-plugin-playwright": "^2.1.0"
|
|
3695
3695
|
}
|
|
@@ -3801,6 +3801,104 @@ function getAdditionalConfigs({
|
|
|
3801
3801
|
return additionalConfigs;
|
|
3802
3802
|
}
|
|
3803
3803
|
|
|
3804
|
+
// utils/trimBoilerplate.ts
|
|
3805
|
+
var fs5 = __toESM(require("fs"), 1);
|
|
3806
|
+
var path5 = __toESM(require("path"), 1);
|
|
3807
|
+
function replaceContent(filepath, replacer) {
|
|
3808
|
+
const content = fs5.readFileSync(filepath, "utf8");
|
|
3809
|
+
fs5.writeFileSync(filepath, replacer(content));
|
|
3810
|
+
}
|
|
3811
|
+
function trimBoilerplate(rootDir, features) {
|
|
3812
|
+
const isTs = features.needsTypeScript;
|
|
3813
|
+
const srcDir = path5.resolve(rootDir, "src");
|
|
3814
|
+
for (const filename of fs5.readdirSync(srcDir)) {
|
|
3815
|
+
if (["main.js", "main.ts", "router", "stores"].includes(filename)) {
|
|
3816
|
+
continue;
|
|
3817
|
+
}
|
|
3818
|
+
const fullpath = path5.resolve(srcDir, filename);
|
|
3819
|
+
fs5.rmSync(fullpath, { recursive: true });
|
|
3820
|
+
}
|
|
3821
|
+
const entryPath = path5.resolve(rootDir, isTs ? "src/main.ts" : "src/main.js");
|
|
3822
|
+
replaceContent(entryPath, (content) => content.replace("import './assets/main.css'\n\n", ""));
|
|
3823
|
+
if (features.needsRouter) {
|
|
3824
|
+
const routerEntry = path5.resolve(srcDir, isTs ? "router/index.ts" : "router/index.js");
|
|
3825
|
+
replaceContent(
|
|
3826
|
+
routerEntry,
|
|
3827
|
+
(content) => content.replace(`import HomeView from '../views/HomeView.vue'
|
|
3828
|
+
`, "").replace(/routes:\s*\[[\s\S]*?\],/, "routes: [],")
|
|
3829
|
+
);
|
|
3830
|
+
}
|
|
3831
|
+
}
|
|
3832
|
+
|
|
3833
|
+
// package.json
|
|
3834
|
+
var package_default3 = {
|
|
3835
|
+
name: "create-vue",
|
|
3836
|
+
version: "3.13.0",
|
|
3837
|
+
description: "\u{1F6E0}\uFE0F The recommended way to start a Vite-powered Vue project",
|
|
3838
|
+
type: "module",
|
|
3839
|
+
packageManager: "pnpm@9.15.1",
|
|
3840
|
+
bin: {
|
|
3841
|
+
"create-vue": "outfile.cjs"
|
|
3842
|
+
},
|
|
3843
|
+
files: [
|
|
3844
|
+
"locales",
|
|
3845
|
+
"outfile.cjs",
|
|
3846
|
+
"template"
|
|
3847
|
+
],
|
|
3848
|
+
engines: {
|
|
3849
|
+
node: ">=v18.3.0"
|
|
3850
|
+
},
|
|
3851
|
+
scripts: {
|
|
3852
|
+
prepare: "husky",
|
|
3853
|
+
format: "prettier --write .",
|
|
3854
|
+
build: "zx ./scripts/build.mjs",
|
|
3855
|
+
snapshot: "zx ./scripts/snapshot.mjs",
|
|
3856
|
+
pretest: "pnpm run build && pnpm run snapshot",
|
|
3857
|
+
test: "zx ./scripts/test.mjs",
|
|
3858
|
+
"test:unit": "vitest",
|
|
3859
|
+
postversion: "zx ./scripts/postversion.mjs",
|
|
3860
|
+
prepublishOnly: "pnpm run build"
|
|
3861
|
+
},
|
|
3862
|
+
repository: {
|
|
3863
|
+
type: "git",
|
|
3864
|
+
url: "git+https://github.com/vuejs/create-vue.git"
|
|
3865
|
+
},
|
|
3866
|
+
keywords: [],
|
|
3867
|
+
author: "Haoqun Jiang <npm@haoqun.me>",
|
|
3868
|
+
license: "MIT",
|
|
3869
|
+
bugs: {
|
|
3870
|
+
url: "https://github.com/vuejs/create-vue/issues"
|
|
3871
|
+
},
|
|
3872
|
+
homepage: "https://github.com/vuejs/create-vue#readme",
|
|
3873
|
+
devDependencies: {
|
|
3874
|
+
"@tsconfig/node22": "^22.0.0",
|
|
3875
|
+
"@types/eslint": "^9.6.1",
|
|
3876
|
+
"@types/node": "^22.10.2",
|
|
3877
|
+
"@types/prompts": "^2.4.9",
|
|
3878
|
+
"@vue/create-eslint-config": "^0.6.1",
|
|
3879
|
+
"@vue/tsconfig": "^0.7.0",
|
|
3880
|
+
ejs: "^3.1.10",
|
|
3881
|
+
esbuild: "^0.24.2",
|
|
3882
|
+
"esbuild-plugin-license": "^1.2.3",
|
|
3883
|
+
husky: "^9.1.7",
|
|
3884
|
+
kleur: "^4.1.5",
|
|
3885
|
+
"lint-staged": "^15.2.11",
|
|
3886
|
+
prettier: "^3.4.2",
|
|
3887
|
+
prompts: "^2.4.2",
|
|
3888
|
+
vitest: "^2.1.8",
|
|
3889
|
+
zx: "^8.2.4"
|
|
3890
|
+
},
|
|
3891
|
+
"lint-staged": {
|
|
3892
|
+
"*.{js,ts,vue,json}": [
|
|
3893
|
+
"prettier --write"
|
|
3894
|
+
]
|
|
3895
|
+
},
|
|
3896
|
+
publishConfig: {
|
|
3897
|
+
access: "public",
|
|
3898
|
+
provenance: true
|
|
3899
|
+
}
|
|
3900
|
+
};
|
|
3901
|
+
|
|
3804
3902
|
// index.ts
|
|
3805
3903
|
function isValidPackageName(projectName) {
|
|
3806
3904
|
return /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(projectName);
|
|
@@ -3809,10 +3907,10 @@ function toValidPackageName(projectName) {
|
|
|
3809
3907
|
return projectName.trim().toLowerCase().replace(/\s+/g, "-").replace(/^[._]/, "").replace(/[^a-z0-9-~]+/g, "-");
|
|
3810
3908
|
}
|
|
3811
3909
|
function canSkipEmptying(dir) {
|
|
3812
|
-
if (!
|
|
3910
|
+
if (!fs6.existsSync(dir)) {
|
|
3813
3911
|
return true;
|
|
3814
3912
|
}
|
|
3815
|
-
const files =
|
|
3913
|
+
const files = fs6.readdirSync(dir);
|
|
3816
3914
|
if (files.length === 0) {
|
|
3817
3915
|
return true;
|
|
3818
3916
|
}
|
|
@@ -3822,21 +3920,62 @@ function canSkipEmptying(dir) {
|
|
|
3822
3920
|
return false;
|
|
3823
3921
|
}
|
|
3824
3922
|
function emptyDir(dir) {
|
|
3825
|
-
if (!
|
|
3923
|
+
if (!fs6.existsSync(dir)) {
|
|
3826
3924
|
return;
|
|
3827
3925
|
}
|
|
3828
3926
|
postOrderDirectoryTraverse(
|
|
3829
3927
|
dir,
|
|
3830
|
-
(dir2) =>
|
|
3831
|
-
(file) =>
|
|
3928
|
+
(dir2) => fs6.rmdirSync(dir2),
|
|
3929
|
+
(file) => fs6.unlinkSync(file)
|
|
3832
3930
|
);
|
|
3833
3931
|
}
|
|
3932
|
+
var helpMessage = `Usage: create-vue [FEATURE_FLGAS...] [OPTIONS...] [DIRECTORY]
|
|
3933
|
+
|
|
3934
|
+
Create a new Vue.js project.
|
|
3935
|
+
Start the CLI in interactive mode when no FEATURE_FLAGS is provided, or if the DIRECTORY argument is not a valid package name.
|
|
3936
|
+
|
|
3937
|
+
Options:
|
|
3938
|
+
--force
|
|
3939
|
+
Create the project even if the directory is not empty.
|
|
3940
|
+
--bare
|
|
3941
|
+
Create a barebone project without example code.
|
|
3942
|
+
--help
|
|
3943
|
+
Display this help message.
|
|
3944
|
+
--version
|
|
3945
|
+
Display the version number of this CLI.
|
|
3946
|
+
|
|
3947
|
+
Available feature flags:
|
|
3948
|
+
--default
|
|
3949
|
+
Create a project with the default configuration without any additional features.
|
|
3950
|
+
--ts, --typescript
|
|
3951
|
+
Add TypeScript support.
|
|
3952
|
+
--jsx
|
|
3953
|
+
Add JSX support.
|
|
3954
|
+
--router, --vue-router
|
|
3955
|
+
Add Vue Router for SPA development.
|
|
3956
|
+
--pinia
|
|
3957
|
+
Add Pinia for state management.
|
|
3958
|
+
--vitest
|
|
3959
|
+
Add Vitest for unit testing.
|
|
3960
|
+
--cypress
|
|
3961
|
+
Add Cypress for end-to-end testing.
|
|
3962
|
+
If used without ${cyan("--vitest")}, it will also add Cypress Component Testing.
|
|
3963
|
+
--playwright
|
|
3964
|
+
Add Playwright for end-to-end testing.
|
|
3965
|
+
--nightwatch
|
|
3966
|
+
Add Nightwatch for end-to-end testing.
|
|
3967
|
+
If used without ${cyan("--vitest")}, it will also add Nightwatch Component Testing.
|
|
3968
|
+
--eslint
|
|
3969
|
+
Add ESLint for code quality.
|
|
3970
|
+
--eslint-with-prettier
|
|
3971
|
+
Add Prettier for code formatting in addition to ESLint.
|
|
3972
|
+
|
|
3973
|
+
Unstable feature flags:
|
|
3974
|
+
--tests, --with-tests
|
|
3975
|
+
Add both unit testing and end-to-end testing support.
|
|
3976
|
+
Currently equivalent to ${cyan("--vitest --cypress")}, but may change in the future.
|
|
3977
|
+
`;
|
|
3834
3978
|
async function init2() {
|
|
3835
|
-
console.log();
|
|
3836
|
-
console.log(
|
|
3837
|
-
process.stdout.isTTY && process.stdout.getColorDepth() > 8 ? gradientBanner : defaultBanner
|
|
3838
|
-
);
|
|
3839
|
-
console.log();
|
|
3840
3979
|
const cwd = process.cwd();
|
|
3841
3980
|
const args = process.argv.slice(2);
|
|
3842
3981
|
const options = {
|
|
@@ -3852,12 +3991,25 @@ async function init2() {
|
|
|
3852
3991
|
options,
|
|
3853
3992
|
strict: false
|
|
3854
3993
|
});
|
|
3994
|
+
if (argv.help) {
|
|
3995
|
+
console.log(helpMessage);
|
|
3996
|
+
process.exit(0);
|
|
3997
|
+
}
|
|
3998
|
+
if (argv.version) {
|
|
3999
|
+
console.log(`${package_default3.name} v${package_default3.version}`);
|
|
4000
|
+
process.exit(0);
|
|
4001
|
+
}
|
|
3855
4002
|
const isFeatureFlagsUsed = typeof (argv.default ?? (argv.ts || argv.typescript) ?? argv.jsx ?? (argv.router || argv["vue-router"]) ?? argv.pinia ?? (argv.tests || argv["with-tests"]) ?? argv.vitest ?? argv.cypress ?? argv.nightwatch ?? argv.playwright ?? argv.eslint ?? argv["eslint-with-prettier"]) === "boolean";
|
|
3856
4003
|
let targetDir = positionals[0];
|
|
3857
4004
|
const defaultProjectName = !targetDir ? "vue-project" : targetDir;
|
|
3858
4005
|
const forceOverwrite = argv.force;
|
|
3859
4006
|
const language = getLanguage();
|
|
3860
4007
|
let result = {};
|
|
4008
|
+
console.log();
|
|
4009
|
+
console.log(
|
|
4010
|
+
process.stdout.isTTY && process.stdout.getColorDepth() > 8 ? gradientBanner : defaultBanner
|
|
4011
|
+
);
|
|
4012
|
+
console.log();
|
|
3861
4013
|
try {
|
|
3862
4014
|
result = await (0, import_prompts.default)(
|
|
3863
4015
|
[
|
|
@@ -4025,20 +4177,20 @@ async function init2() {
|
|
|
4025
4177
|
const needsNightwatch = argv.nightwatch || needsE2eTesting === "nightwatch";
|
|
4026
4178
|
const needsNightwatchCT = needsNightwatch && !needsVitest;
|
|
4027
4179
|
const needsPlaywright = argv.playwright || needsE2eTesting === "playwright";
|
|
4028
|
-
const root =
|
|
4029
|
-
if (
|
|
4180
|
+
const root = path6.join(cwd, targetDir);
|
|
4181
|
+
if (fs6.existsSync(root) && shouldOverwrite) {
|
|
4030
4182
|
emptyDir(root);
|
|
4031
|
-
} else if (!
|
|
4032
|
-
|
|
4183
|
+
} else if (!fs6.existsSync(root)) {
|
|
4184
|
+
fs6.mkdirSync(root);
|
|
4033
4185
|
}
|
|
4034
4186
|
console.log(`
|
|
4035
4187
|
${language.infos.scaffolding} ${root}...`);
|
|
4036
4188
|
const pkg = { name: packageName, version: "0.0.0" };
|
|
4037
|
-
|
|
4038
|
-
const templateRoot =
|
|
4189
|
+
fs6.writeFileSync(path6.resolve(root, "package.json"), JSON.stringify(pkg, null, 2));
|
|
4190
|
+
const templateRoot = path6.resolve(__dirname, "template");
|
|
4039
4191
|
const callbacks = [];
|
|
4040
4192
|
const render = function render2(templateName) {
|
|
4041
|
-
const templateDir =
|
|
4193
|
+
const templateDir = path6.resolve(templateRoot, templateName);
|
|
4042
4194
|
renderTemplate_default(templateDir, root, callbacks);
|
|
4043
4195
|
};
|
|
4044
4196
|
render("base");
|
|
@@ -4115,8 +4267,8 @@ ${language.infos.scaffolding} ${root}...`);
|
|
|
4115
4267
|
if (needsNightwatchCT) {
|
|
4116
4268
|
render("tsconfig/nightwatch-ct");
|
|
4117
4269
|
}
|
|
4118
|
-
|
|
4119
|
-
|
|
4270
|
+
fs6.writeFileSync(
|
|
4271
|
+
path6.resolve(root, "tsconfig.json"),
|
|
4120
4272
|
JSON.stringify(rootTsConfig, null, 2) + "\n",
|
|
4121
4273
|
"utf-8"
|
|
4122
4274
|
);
|
|
@@ -4157,11 +4309,11 @@ ${language.infos.scaffolding} ${root}...`);
|
|
|
4157
4309
|
},
|
|
4158
4310
|
(filepath) => {
|
|
4159
4311
|
if (filepath.endsWith(".ejs")) {
|
|
4160
|
-
const template =
|
|
4312
|
+
const template = fs6.readFileSync(filepath, "utf-8");
|
|
4161
4313
|
const dest = filepath.replace(/\.ejs$/, "");
|
|
4162
4314
|
const content = import_ejs2.default.render(template, dataStore[dest]);
|
|
4163
|
-
|
|
4164
|
-
|
|
4315
|
+
fs6.writeFileSync(dest, content);
|
|
4316
|
+
fs6.unlinkSync(filepath);
|
|
4165
4317
|
}
|
|
4166
4318
|
}
|
|
4167
4319
|
);
|
|
@@ -4173,19 +4325,19 @@ ${language.infos.scaffolding} ${root}...`);
|
|
|
4173
4325
|
(filepath) => {
|
|
4174
4326
|
if (filepath.endsWith(".js") && !filepath.endsWith("eslint.config.js")) {
|
|
4175
4327
|
const tsFilePath = filepath.replace(/\.js$/, ".ts");
|
|
4176
|
-
if (
|
|
4177
|
-
|
|
4328
|
+
if (fs6.existsSync(tsFilePath)) {
|
|
4329
|
+
fs6.unlinkSync(filepath);
|
|
4178
4330
|
} else {
|
|
4179
|
-
|
|
4331
|
+
fs6.renameSync(filepath, tsFilePath);
|
|
4180
4332
|
}
|
|
4181
|
-
} else if (
|
|
4182
|
-
|
|
4333
|
+
} else if (path6.basename(filepath) === "jsconfig.json") {
|
|
4334
|
+
fs6.unlinkSync(filepath);
|
|
4183
4335
|
}
|
|
4184
4336
|
}
|
|
4185
4337
|
);
|
|
4186
|
-
const indexHtmlPath =
|
|
4187
|
-
const indexHtmlContent =
|
|
4188
|
-
|
|
4338
|
+
const indexHtmlPath = path6.resolve(root, "index.html");
|
|
4339
|
+
const indexHtmlContent = fs6.readFileSync(indexHtmlPath, "utf8");
|
|
4340
|
+
fs6.writeFileSync(indexHtmlPath, indexHtmlContent.replace("src/main.js", "src/main.ts"));
|
|
4189
4341
|
} else {
|
|
4190
4342
|
preOrderDirectoryTraverse(
|
|
4191
4343
|
root,
|
|
@@ -4193,15 +4345,31 @@ ${language.infos.scaffolding} ${root}...`);
|
|
|
4193
4345
|
},
|
|
4194
4346
|
(filepath) => {
|
|
4195
4347
|
if (filepath.endsWith(".ts")) {
|
|
4196
|
-
|
|
4348
|
+
fs6.unlinkSync(filepath);
|
|
4197
4349
|
}
|
|
4198
4350
|
}
|
|
4199
4351
|
);
|
|
4200
4352
|
}
|
|
4353
|
+
if (argv.bare) {
|
|
4354
|
+
trimBoilerplate(root, { needsTypeScript, needsRouter });
|
|
4355
|
+
render("bare/base");
|
|
4356
|
+
if (needsTypeScript) {
|
|
4357
|
+
render("bare/typescript");
|
|
4358
|
+
}
|
|
4359
|
+
if (needsVitest) {
|
|
4360
|
+
render("bare/vitest");
|
|
4361
|
+
}
|
|
4362
|
+
if (needsCypressCT) {
|
|
4363
|
+
render("bare/cypress-ct");
|
|
4364
|
+
}
|
|
4365
|
+
if (needsNightwatchCT) {
|
|
4366
|
+
render("bare/nightwatch-ct");
|
|
4367
|
+
}
|
|
4368
|
+
}
|
|
4201
4369
|
const userAgent = process.env.npm_config_user_agent ?? "";
|
|
4202
4370
|
const packageManager = /pnpm/.test(userAgent) ? "pnpm" : /yarn/.test(userAgent) ? "yarn" : /bun/.test(userAgent) ? "bun" : "npm";
|
|
4203
|
-
|
|
4204
|
-
|
|
4371
|
+
fs6.writeFileSync(
|
|
4372
|
+
path6.resolve(root, "README.md"),
|
|
4205
4373
|
generateReadme({
|
|
4206
4374
|
projectName: result.projectName ?? result.packageName ?? defaultProjectName,
|
|
4207
4375
|
packageManager,
|
|
@@ -4219,7 +4387,7 @@ ${language.infos.scaffolding} ${root}...`);
|
|
|
4219
4387
|
${language.infos.done}
|
|
4220
4388
|
`);
|
|
4221
4389
|
if (root !== cwd) {
|
|
4222
|
-
const cdProjectName =
|
|
4390
|
+
const cdProjectName = path6.relative(cwd, root);
|
|
4223
4391
|
console.log(
|
|
4224
4392
|
` ${bold(green(`cd ${cdProjectName.includes(" ") ? `"${cdProjectName}"` : cdProjectName}`))}`
|
|
4225
4393
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-vue",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.13.0",
|
|
4
4
|
"description": "🛠️ The recommended way to start a Vite-powered Vue project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -28,20 +28,20 @@
|
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@tsconfig/node22": "^22.0.0",
|
|
30
30
|
"@types/eslint": "^9.6.1",
|
|
31
|
-
"@types/node": "^22.
|
|
31
|
+
"@types/node": "^22.10.2",
|
|
32
32
|
"@types/prompts": "^2.4.9",
|
|
33
33
|
"@vue/create-eslint-config": "^0.6.1",
|
|
34
34
|
"@vue/tsconfig": "^0.7.0",
|
|
35
35
|
"ejs": "^3.1.10",
|
|
36
|
-
"esbuild": "^0.24.
|
|
36
|
+
"esbuild": "^0.24.2",
|
|
37
37
|
"esbuild-plugin-license": "^1.2.3",
|
|
38
38
|
"husky": "^9.1.7",
|
|
39
39
|
"kleur": "^4.1.5",
|
|
40
|
-
"lint-staged": "^15.2.
|
|
41
|
-
"prettier": "^3.
|
|
40
|
+
"lint-staged": "^15.2.11",
|
|
41
|
+
"prettier": "^3.4.2",
|
|
42
42
|
"prompts": "^2.4.2",
|
|
43
|
-
"vitest": "^2.1.
|
|
44
|
-
"zx": "^8.2.
|
|
43
|
+
"vitest": "^2.1.8",
|
|
44
|
+
"zx": "^8.2.4"
|
|
45
45
|
},
|
|
46
46
|
"lint-staged": {
|
|
47
47
|
"*.{js,ts,vue,json}": [
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
describe('App', function () {
|
|
2
|
+
before((browser) => {
|
|
3
|
+
browser.init()
|
|
4
|
+
})
|
|
5
|
+
|
|
6
|
+
it('mounts and renders properly', async function () {
|
|
7
|
+
const appComponent = await browser.mountComponent('/src/App.vue');
|
|
8
|
+
|
|
9
|
+
browser.expect.element(appComponent).to.be.present;
|
|
10
|
+
browser.expect.element('h1').text.to.contain('Hello World');
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
after((browser) => browser.end())
|
|
14
|
+
})
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
|
|
3
|
+
import { mount } from '@vue/test-utils'
|
|
4
|
+
import App from '../App.vue'
|
|
5
|
+
|
|
6
|
+
describe('App', () => {
|
|
7
|
+
it('mounts renders properly', () => {
|
|
8
|
+
const wrapper = mount(App)
|
|
9
|
+
expect(wrapper.text()).toContain('Hello World')
|
|
10
|
+
})
|
|
11
|
+
})
|
|
@@ -6,9 +6,9 @@ case `uname` in
|
|
|
6
6
|
esac
|
|
7
7
|
|
|
8
8
|
if [ -z "$NODE_PATH" ]; then
|
|
9
|
-
export NODE_PATH="/
|
|
9
|
+
export NODE_PATH="/home/runner/work/create-vue/create-vue/node_modules/.pnpm/vite@6.0.5_@types+node@22.10.2_yaml@2.6.1/node_modules/vite/bin/node_modules:/home/runner/work/create-vue/create-vue/node_modules/.pnpm/vite@6.0.5_@types+node@22.10.2_yaml@2.6.1/node_modules/vite/node_modules:/home/runner/work/create-vue/create-vue/node_modules/.pnpm/vite@6.0.5_@types+node@22.10.2_yaml@2.6.1/node_modules:/home/runner/work/create-vue/create-vue/node_modules/.pnpm/node_modules"
|
|
10
10
|
else
|
|
11
|
-
export NODE_PATH="/
|
|
11
|
+
export NODE_PATH="/home/runner/work/create-vue/create-vue/node_modules/.pnpm/vite@6.0.5_@types+node@22.10.2_yaml@2.6.1/node_modules/vite/bin/node_modules:/home/runner/work/create-vue/create-vue/node_modules/.pnpm/vite@6.0.5_@types+node@22.10.2_yaml@2.6.1/node_modules/vite/node_modules:/home/runner/work/create-vue/create-vue/node_modules/.pnpm/vite@6.0.5_@types+node@22.10.2_yaml@2.6.1/node_modules:/home/runner/work/create-vue/create-vue/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
12
12
|
fi
|
|
13
13
|
if [ -x "$basedir/node" ]; then
|
|
14
14
|
exec "$basedir/node" "$basedir/../vite/bin/vite.js" "$@"
|