create-vue 3.12.1 → 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 +4 -2
- package/outfile.cjs +235 -64
- package/package.json +16 -11
- 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 +4 -4
- 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 +2 -2
- package/template/config/jsx/node_modules/.bin/vite +2 -2
- package/template/config/jsx/package.json +3 -3
- 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 +5 -5
- package/template/config/nightwatch-ct/package.json +1 -1
- package/template/config/pinia/package.json +2 -2
- package/template/config/playwright/node_modules/.bin/playwright +2 -2
- package/template/config/playwright/package.json +1 -1
- package/template/config/router/package.json +2 -2
- 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 +3 -3
- package/template/config/vitest/node_modules/.bin/vitest +2 -2
- package/template/config/vitest/package.json +2 -2
- package/template/eslint/package.json +2 -2
- package/template/tsconfig/base/package.json +1 -1
- package/template/tsconfig/base/tsconfig.app.json +0 -2
- 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 -2
- 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
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
The recommended way to start a Vite-powered Vue project
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
|
-
<img src="https://github.com/vuejs/create-vue/blob/main/media/screenshot-cli.png?raw=true"
|
|
6
|
+
<img width="898" alt="Screenshot from terminal" src="https://github.com/vuejs/create-vue/blob/main/media/screenshot-cli.png?raw=true">
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
9
|
## Usage
|
|
@@ -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
|
|
|
@@ -3257,6 +3257,9 @@ function getCommand(packageManager, scriptName, args) {
|
|
|
3257
3257
|
if (scriptName === "install") {
|
|
3258
3258
|
return packageManager === "yarn" ? "yarn" : `${packageManager} install`;
|
|
3259
3259
|
}
|
|
3260
|
+
if (scriptName === "build") {
|
|
3261
|
+
return packageManager === "npm" || packageManager === "bun" ? `${packageManager} run build` : `${packageManager} build`;
|
|
3262
|
+
}
|
|
3260
3263
|
if (args) {
|
|
3261
3264
|
return packageManager === "npm" ? `npm run ${scriptName} -- ${args}` : `${packageManager} ${scriptName} ${args}`;
|
|
3262
3265
|
} else {
|
|
@@ -3686,9 +3689,9 @@ function deepMerge2(target, obj) {
|
|
|
3686
3689
|
// template/eslint/package.json
|
|
3687
3690
|
var package_default2 = {
|
|
3688
3691
|
devDependencies: {
|
|
3689
|
-
"@vitest/eslint-plugin": "1.1.
|
|
3692
|
+
"@vitest/eslint-plugin": "1.1.20",
|
|
3690
3693
|
"eslint-plugin-cypress": "^4.1.0",
|
|
3691
|
-
"eslint-plugin-playwright": "^2.
|
|
3694
|
+
"eslint-plugin-playwright": "^2.1.0"
|
|
3692
3695
|
}
|
|
3693
3696
|
};
|
|
3694
3697
|
|
|
@@ -3798,6 +3801,104 @@ function getAdditionalConfigs({
|
|
|
3798
3801
|
return additionalConfigs;
|
|
3799
3802
|
}
|
|
3800
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
|
+
|
|
3801
3902
|
// index.ts
|
|
3802
3903
|
function isValidPackageName(projectName) {
|
|
3803
3904
|
return /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(projectName);
|
|
@@ -3806,10 +3907,10 @@ function toValidPackageName(projectName) {
|
|
|
3806
3907
|
return projectName.trim().toLowerCase().replace(/\s+/g, "-").replace(/^[._]/, "").replace(/[^a-z0-9-~]+/g, "-");
|
|
3807
3908
|
}
|
|
3808
3909
|
function canSkipEmptying(dir) {
|
|
3809
|
-
if (!
|
|
3910
|
+
if (!fs6.existsSync(dir)) {
|
|
3810
3911
|
return true;
|
|
3811
3912
|
}
|
|
3812
|
-
const files =
|
|
3913
|
+
const files = fs6.readdirSync(dir);
|
|
3813
3914
|
if (files.length === 0) {
|
|
3814
3915
|
return true;
|
|
3815
3916
|
}
|
|
@@ -3819,21 +3920,62 @@ function canSkipEmptying(dir) {
|
|
|
3819
3920
|
return false;
|
|
3820
3921
|
}
|
|
3821
3922
|
function emptyDir(dir) {
|
|
3822
|
-
if (!
|
|
3923
|
+
if (!fs6.existsSync(dir)) {
|
|
3823
3924
|
return;
|
|
3824
3925
|
}
|
|
3825
3926
|
postOrderDirectoryTraverse(
|
|
3826
3927
|
dir,
|
|
3827
|
-
(dir2) =>
|
|
3828
|
-
(file) =>
|
|
3928
|
+
(dir2) => fs6.rmdirSync(dir2),
|
|
3929
|
+
(file) => fs6.unlinkSync(file)
|
|
3829
3930
|
);
|
|
3830
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
|
+
`;
|
|
3831
3978
|
async function init2() {
|
|
3832
|
-
console.log();
|
|
3833
|
-
console.log(
|
|
3834
|
-
process.stdout.isTTY && process.stdout.getColorDepth() > 8 ? gradientBanner : defaultBanner
|
|
3835
|
-
);
|
|
3836
|
-
console.log();
|
|
3837
3979
|
const cwd = process.cwd();
|
|
3838
3980
|
const args = process.argv.slice(2);
|
|
3839
3981
|
const options = {
|
|
@@ -3849,12 +3991,25 @@ async function init2() {
|
|
|
3849
3991
|
options,
|
|
3850
3992
|
strict: false
|
|
3851
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
|
+
}
|
|
3852
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";
|
|
3853
4003
|
let targetDir = positionals[0];
|
|
3854
4004
|
const defaultProjectName = !targetDir ? "vue-project" : targetDir;
|
|
3855
4005
|
const forceOverwrite = argv.force;
|
|
3856
4006
|
const language = getLanguage();
|
|
3857
4007
|
let result = {};
|
|
4008
|
+
console.log();
|
|
4009
|
+
console.log(
|
|
4010
|
+
process.stdout.isTTY && process.stdout.getColorDepth() > 8 ? gradientBanner : defaultBanner
|
|
4011
|
+
);
|
|
4012
|
+
console.log();
|
|
3858
4013
|
try {
|
|
3859
4014
|
result = await (0, import_prompts.default)(
|
|
3860
4015
|
[
|
|
@@ -4022,20 +4177,20 @@ async function init2() {
|
|
|
4022
4177
|
const needsNightwatch = argv.nightwatch || needsE2eTesting === "nightwatch";
|
|
4023
4178
|
const needsNightwatchCT = needsNightwatch && !needsVitest;
|
|
4024
4179
|
const needsPlaywright = argv.playwright || needsE2eTesting === "playwright";
|
|
4025
|
-
const root =
|
|
4026
|
-
if (
|
|
4180
|
+
const root = path6.join(cwd, targetDir);
|
|
4181
|
+
if (fs6.existsSync(root) && shouldOverwrite) {
|
|
4027
4182
|
emptyDir(root);
|
|
4028
|
-
} else if (!
|
|
4029
|
-
|
|
4183
|
+
} else if (!fs6.existsSync(root)) {
|
|
4184
|
+
fs6.mkdirSync(root);
|
|
4030
4185
|
}
|
|
4031
4186
|
console.log(`
|
|
4032
4187
|
${language.infos.scaffolding} ${root}...`);
|
|
4033
4188
|
const pkg = { name: packageName, version: "0.0.0" };
|
|
4034
|
-
|
|
4035
|
-
const templateRoot =
|
|
4189
|
+
fs6.writeFileSync(path6.resolve(root, "package.json"), JSON.stringify(pkg, null, 2));
|
|
4190
|
+
const templateRoot = path6.resolve(__dirname, "template");
|
|
4036
4191
|
const callbacks = [];
|
|
4037
4192
|
const render = function render2(templateName) {
|
|
4038
|
-
const templateDir =
|
|
4193
|
+
const templateDir = path6.resolve(templateRoot, templateName);
|
|
4039
4194
|
renderTemplate_default(templateDir, root, callbacks);
|
|
4040
4195
|
};
|
|
4041
4196
|
render("base");
|
|
@@ -4112,8 +4267,8 @@ ${language.infos.scaffolding} ${root}...`);
|
|
|
4112
4267
|
if (needsNightwatchCT) {
|
|
4113
4268
|
render("tsconfig/nightwatch-ct");
|
|
4114
4269
|
}
|
|
4115
|
-
|
|
4116
|
-
|
|
4270
|
+
fs6.writeFileSync(
|
|
4271
|
+
path6.resolve(root, "tsconfig.json"),
|
|
4117
4272
|
JSON.stringify(rootTsConfig, null, 2) + "\n",
|
|
4118
4273
|
"utf-8"
|
|
4119
4274
|
);
|
|
@@ -4154,11 +4309,11 @@ ${language.infos.scaffolding} ${root}...`);
|
|
|
4154
4309
|
},
|
|
4155
4310
|
(filepath) => {
|
|
4156
4311
|
if (filepath.endsWith(".ejs")) {
|
|
4157
|
-
const template =
|
|
4312
|
+
const template = fs6.readFileSync(filepath, "utf-8");
|
|
4158
4313
|
const dest = filepath.replace(/\.ejs$/, "");
|
|
4159
4314
|
const content = import_ejs2.default.render(template, dataStore[dest]);
|
|
4160
|
-
|
|
4161
|
-
|
|
4315
|
+
fs6.writeFileSync(dest, content);
|
|
4316
|
+
fs6.unlinkSync(filepath);
|
|
4162
4317
|
}
|
|
4163
4318
|
}
|
|
4164
4319
|
);
|
|
@@ -4170,19 +4325,19 @@ ${language.infos.scaffolding} ${root}...`);
|
|
|
4170
4325
|
(filepath) => {
|
|
4171
4326
|
if (filepath.endsWith(".js") && !filepath.endsWith("eslint.config.js")) {
|
|
4172
4327
|
const tsFilePath = filepath.replace(/\.js$/, ".ts");
|
|
4173
|
-
if (
|
|
4174
|
-
|
|
4328
|
+
if (fs6.existsSync(tsFilePath)) {
|
|
4329
|
+
fs6.unlinkSync(filepath);
|
|
4175
4330
|
} else {
|
|
4176
|
-
|
|
4331
|
+
fs6.renameSync(filepath, tsFilePath);
|
|
4177
4332
|
}
|
|
4178
|
-
} else if (
|
|
4179
|
-
|
|
4333
|
+
} else if (path6.basename(filepath) === "jsconfig.json") {
|
|
4334
|
+
fs6.unlinkSync(filepath);
|
|
4180
4335
|
}
|
|
4181
4336
|
}
|
|
4182
4337
|
);
|
|
4183
|
-
const indexHtmlPath =
|
|
4184
|
-
const indexHtmlContent =
|
|
4185
|
-
|
|
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"));
|
|
4186
4341
|
} else {
|
|
4187
4342
|
preOrderDirectoryTraverse(
|
|
4188
4343
|
root,
|
|
@@ -4190,15 +4345,31 @@ ${language.infos.scaffolding} ${root}...`);
|
|
|
4190
4345
|
},
|
|
4191
4346
|
(filepath) => {
|
|
4192
4347
|
if (filepath.endsWith(".ts")) {
|
|
4193
|
-
|
|
4348
|
+
fs6.unlinkSync(filepath);
|
|
4194
4349
|
}
|
|
4195
4350
|
}
|
|
4196
4351
|
);
|
|
4197
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
|
+
}
|
|
4198
4369
|
const userAgent = process.env.npm_config_user_agent ?? "";
|
|
4199
4370
|
const packageManager = /pnpm/.test(userAgent) ? "pnpm" : /yarn/.test(userAgent) ? "yarn" : /bun/.test(userAgent) ? "bun" : "npm";
|
|
4200
|
-
|
|
4201
|
-
|
|
4371
|
+
fs6.writeFileSync(
|
|
4372
|
+
path6.resolve(root, "README.md"),
|
|
4202
4373
|
generateReadme({
|
|
4203
4374
|
projectName: result.projectName ?? result.packageName ?? defaultProjectName,
|
|
4204
4375
|
packageManager,
|
|
@@ -4216,7 +4387,7 @@ ${language.infos.scaffolding} ${root}...`);
|
|
|
4216
4387
|
${language.infos.done}
|
|
4217
4388
|
`);
|
|
4218
4389
|
if (root !== cwd) {
|
|
4219
|
-
const cdProjectName =
|
|
4390
|
+
const cdProjectName = path6.relative(cwd, root);
|
|
4220
4391
|
console.log(
|
|
4221
4392
|
` ${bold(green(`cd ${cdProjectName.includes(" ") ? `"${cdProjectName}"` : cdProjectName}`))}`
|
|
4222
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": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"url": "git+https://github.com/vuejs/create-vue.git"
|
|
20
20
|
},
|
|
21
21
|
"keywords": [],
|
|
22
|
-
"author": "Haoqun Jiang <
|
|
22
|
+
"author": "Haoqun Jiang <npm@haoqun.me>",
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"bugs": {
|
|
25
25
|
"url": "https://github.com/vuejs/create-vue/issues"
|
|
@@ -28,32 +28,37 @@
|
|
|
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
|
-
"@vue/tsconfig": "^0.
|
|
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
|
-
"husky": "^9.1.
|
|
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}": [
|
|
48
48
|
"prettier --write"
|
|
49
49
|
]
|
|
50
50
|
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public",
|
|
53
|
+
"provenance": true
|
|
54
|
+
},
|
|
51
55
|
"scripts": {
|
|
52
56
|
"format": "prettier --write .",
|
|
53
57
|
"build": "zx ./scripts/build.mjs",
|
|
54
58
|
"snapshot": "zx ./scripts/snapshot.mjs",
|
|
55
59
|
"pretest": "pnpm run build && pnpm run snapshot",
|
|
56
60
|
"test": "zx ./scripts/test.mjs",
|
|
57
|
-
"test:unit": "vitest"
|
|
61
|
+
"test:unit": "vitest",
|
|
62
|
+
"postversion": "zx ./scripts/postversion.mjs"
|
|
58
63
|
}
|
|
59
64
|
}
|
|
@@ -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" "$@"
|