create-vue 3.7.5 → 3.9.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 +1 -1
- package/locales/en-US.json +64 -0
- package/locales/fr-FR.json +64 -0
- package/locales/tr-TR.json +64 -0
- package/locales/zh-CN.json +64 -0
- package/outfile.cjs +172 -121
- package/package.json +11 -8
- package/template/base/_gitignore +2 -0
- package/template/base/jsconfig.json +8 -0
- package/template/base/node_modules/.bin/vite +2 -2
- package/template/base/package.json +4 -3
- package/template/base/src/assets/main.css +1 -1
- package/template/config/cypress/cypress.config.js +2 -2
- 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/cypress.config.js +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/browserslist +4 -4
- package/template/config/jsx/node_modules/.bin/vite +2 -2
- package/template/config/jsx/package.json +3 -3
- package/template/config/nightwatch/nightwatch.conf.js +3 -2
- package/template/config/nightwatch/node_modules/.bin/browserslist +4 -4
- package/template/config/nightwatch/node_modules/.bin/chromedriver +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/tsc +4 -4
- package/template/config/nightwatch/node_modules/.bin/tsserver +4 -4
- package/template/config/nightwatch/node_modules/.bin/vite +4 -4
- package/template/config/nightwatch/package.json +8 -7
- package/template/config/nightwatch/tests/e2e/example.js +1 -4
- package/template/config/nightwatch-ct/package.json +5 -2
- package/template/config/pinia/package.json +2 -2
- package/template/config/playwright/e2e/vue.spec.js +1 -1
- package/template/config/playwright/node_modules/.bin/playwright +2 -2
- package/template/config/playwright/package.json +1 -1
- package/template/config/playwright/playwright.config.js +5 -8
- 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 +17 -0
- 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/vue-tsc +2 -2
- package/template/config/typescript/package.json +4 -4
- package/template/config/vitest/node_modules/.bin/vitest +2 -2
- package/template/config/vitest/package.json +4 -4
- package/template/tsconfig/base/tsconfig.app.json +1 -0
- package/template/tsconfig/base/tsconfig.node.json +1 -0
- package/template/tsconfig/nightwatch/nightwatch/tsconfig.json +3 -1
- package/template/tsconfig/nightwatch-ct/tsconfig.app.json +1 -0
- package/template/tsconfig/vitest/package.json +1 -4
- package/template/config/cypress/cypress.config.ts +0 -8
- package/template/config/cypress-ct/cypress.config.ts +0 -15
- package/template/config/nightwatch/nightwatch/globals.js +0 -23
- package/template/config/nightwatch/node_modules/.bin/wait-on +0 -17
- package/template/config/playwright/playwright.config.ts +0 -112
- package/template/tsconfig/base/tsconfig.json +0 -11
- package/template/tsconfig/cypress-ct/package.json +0 -5
- package/template/tsconfig/cypress-ct/tsconfig.json +0 -14
- package/template/tsconfig/nightwatch/tsconfig.json +0 -17
- package/template/tsconfig/nightwatch-ct/tsconfig.json +0 -14
- package/template/tsconfig/vitest/tsconfig.json +0 -14
package/outfile.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
/*! create-vue v3.
|
|
2
|
+
/*! create-vue v3.9.0 | MIT */
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -2820,8 +2820,8 @@ var require_package = __commonJS({
|
|
|
2820
2820
|
var require_ejs = __commonJS({
|
|
2821
2821
|
"node_modules/.pnpm/ejs@3.1.9/node_modules/ejs/lib/ejs.js"(exports) {
|
|
2822
2822
|
"use strict";
|
|
2823
|
-
var
|
|
2824
|
-
var
|
|
2823
|
+
var fs6 = require("fs");
|
|
2824
|
+
var path6 = require("path");
|
|
2825
2825
|
var utils = require_utils();
|
|
2826
2826
|
var scopeOptionWarned = false;
|
|
2827
2827
|
var _VERSION_STRING = require_package().version;
|
|
@@ -2848,14 +2848,14 @@ var require_ejs = __commonJS({
|
|
|
2848
2848
|
var _BOM = /^\uFEFF/;
|
|
2849
2849
|
var _JS_IDENTIFIER = /^[a-zA-Z_$][0-9a-zA-Z_$]*$/;
|
|
2850
2850
|
exports.cache = utils.cache;
|
|
2851
|
-
exports.fileLoader =
|
|
2851
|
+
exports.fileLoader = fs6.readFileSync;
|
|
2852
2852
|
exports.localsName = _DEFAULT_LOCALS_NAME;
|
|
2853
2853
|
exports.promiseImpl = new Function("return this;")().Promise;
|
|
2854
2854
|
exports.resolveInclude = function(name, filename, isDir) {
|
|
2855
|
-
var dirname2 =
|
|
2856
|
-
var extname =
|
|
2857
|
-
var
|
|
2858
|
-
var includePath =
|
|
2855
|
+
var dirname2 = path6.dirname;
|
|
2856
|
+
var extname = path6.extname;
|
|
2857
|
+
var resolve6 = path6.resolve;
|
|
2858
|
+
var includePath = resolve6(isDir ? filename : dirname2(filename), name);
|
|
2859
2859
|
var ext = extname(name);
|
|
2860
2860
|
if (!ext) {
|
|
2861
2861
|
includePath += ".ejs";
|
|
@@ -2866,35 +2866,35 @@ var require_ejs = __commonJS({
|
|
|
2866
2866
|
var filePath;
|
|
2867
2867
|
if (paths.some(function(v) {
|
|
2868
2868
|
filePath = exports.resolveInclude(name, v, true);
|
|
2869
|
-
return
|
|
2869
|
+
return fs6.existsSync(filePath);
|
|
2870
2870
|
})) {
|
|
2871
2871
|
return filePath;
|
|
2872
2872
|
}
|
|
2873
2873
|
}
|
|
2874
|
-
function getIncludePath(
|
|
2874
|
+
function getIncludePath(path7, options2) {
|
|
2875
2875
|
var includePath;
|
|
2876
2876
|
var filePath;
|
|
2877
2877
|
var views = options2.views;
|
|
2878
|
-
var match = /^[A-Za-z]+:\\|^\//.exec(
|
|
2878
|
+
var match = /^[A-Za-z]+:\\|^\//.exec(path7);
|
|
2879
2879
|
if (match && match.length) {
|
|
2880
|
-
|
|
2880
|
+
path7 = path7.replace(/^\/*/, "");
|
|
2881
2881
|
if (Array.isArray(options2.root)) {
|
|
2882
|
-
includePath = resolvePaths(
|
|
2882
|
+
includePath = resolvePaths(path7, options2.root);
|
|
2883
2883
|
} else {
|
|
2884
|
-
includePath = exports.resolveInclude(
|
|
2884
|
+
includePath = exports.resolveInclude(path7, options2.root || "/", true);
|
|
2885
2885
|
}
|
|
2886
2886
|
} else {
|
|
2887
2887
|
if (options2.filename) {
|
|
2888
|
-
filePath = exports.resolveInclude(
|
|
2889
|
-
if (
|
|
2888
|
+
filePath = exports.resolveInclude(path7, options2.filename);
|
|
2889
|
+
if (fs6.existsSync(filePath)) {
|
|
2890
2890
|
includePath = filePath;
|
|
2891
2891
|
}
|
|
2892
2892
|
}
|
|
2893
2893
|
if (!includePath && Array.isArray(views)) {
|
|
2894
|
-
includePath = resolvePaths(
|
|
2894
|
+
includePath = resolvePaths(path7, views);
|
|
2895
2895
|
}
|
|
2896
2896
|
if (!includePath && typeof options2.includer !== "function") {
|
|
2897
|
-
throw new Error('Could not find the include file "' + options2.escapeFunction(
|
|
2897
|
+
throw new Error('Could not find the include file "' + options2.escapeFunction(path7) + '"');
|
|
2898
2898
|
}
|
|
2899
2899
|
}
|
|
2900
2900
|
return includePath;
|
|
@@ -2930,10 +2930,10 @@ var require_ejs = __commonJS({
|
|
|
2930
2930
|
var result;
|
|
2931
2931
|
if (!cb) {
|
|
2932
2932
|
if (typeof exports.promiseImpl == "function") {
|
|
2933
|
-
return new exports.promiseImpl(function(
|
|
2933
|
+
return new exports.promiseImpl(function(resolve6, reject) {
|
|
2934
2934
|
try {
|
|
2935
2935
|
result = handleCache(options2)(data);
|
|
2936
|
-
|
|
2936
|
+
resolve6(result);
|
|
2937
2937
|
} catch (err) {
|
|
2938
2938
|
reject(err);
|
|
2939
2939
|
}
|
|
@@ -2953,11 +2953,11 @@ var require_ejs = __commonJS({
|
|
|
2953
2953
|
function fileLoader(filePath) {
|
|
2954
2954
|
return exports.fileLoader(filePath);
|
|
2955
2955
|
}
|
|
2956
|
-
function includeFile(
|
|
2956
|
+
function includeFile(path7, options2) {
|
|
2957
2957
|
var opts = utils.shallowCopy(utils.createNullProtoObjWherePossible(), options2);
|
|
2958
|
-
opts.filename = getIncludePath(
|
|
2958
|
+
opts.filename = getIncludePath(path7, opts);
|
|
2959
2959
|
if (typeof options2.includer === "function") {
|
|
2960
|
-
var includerResult = options2.includer(
|
|
2960
|
+
var includerResult = options2.includer(path7, opts.filename);
|
|
2961
2961
|
if (includerResult) {
|
|
2962
2962
|
if (includerResult.filename) {
|
|
2963
2963
|
opts.filename = includerResult.filename;
|
|
@@ -3192,12 +3192,12 @@ var require_ejs = __commonJS({
|
|
|
3192
3192
|
throw e;
|
|
3193
3193
|
}
|
|
3194
3194
|
var returnedFn = opts.client ? fn : function anonymous(data) {
|
|
3195
|
-
var include = function(
|
|
3195
|
+
var include = function(path7, includeData) {
|
|
3196
3196
|
var d = utils.shallowCopy(utils.createNullProtoObjWherePossible(), data);
|
|
3197
3197
|
if (includeData) {
|
|
3198
3198
|
d = utils.shallowCopy(d, includeData);
|
|
3199
3199
|
}
|
|
3200
|
-
return includeFile(
|
|
3200
|
+
return includeFile(path7, opts)(d);
|
|
3201
3201
|
};
|
|
3202
3202
|
return fn.apply(
|
|
3203
3203
|
opts.context,
|
|
@@ -3206,7 +3206,7 @@ var require_ejs = __commonJS({
|
|
|
3206
3206
|
};
|
|
3207
3207
|
if (opts.filename && typeof Object.defineProperty === "function") {
|
|
3208
3208
|
var filename = opts.filename;
|
|
3209
|
-
var basename3 =
|
|
3209
|
+
var basename3 = path6.basename(filename, path6.extname(filename));
|
|
3210
3210
|
try {
|
|
3211
3211
|
Object.defineProperty(returnedFn, "name", {
|
|
3212
3212
|
value: basename3,
|
|
@@ -3396,9 +3396,9 @@ var require_quote = __commonJS({
|
|
|
3396
3396
|
return isValidVariableName(key) ? key : next(key);
|
|
3397
3397
|
}
|
|
3398
3398
|
exports.quoteKey = quoteKey;
|
|
3399
|
-
function stringifyPath(
|
|
3399
|
+
function stringifyPath(path6, next) {
|
|
3400
3400
|
let result = "";
|
|
3401
|
-
for (const key of
|
|
3401
|
+
for (const key of path6) {
|
|
3402
3402
|
if (isValidVariableName(key)) {
|
|
3403
3403
|
result += `.${key}`;
|
|
3404
3404
|
} else {
|
|
@@ -3821,7 +3821,7 @@ var require_dist = __commonJS({
|
|
|
3821
3821
|
var ROOT_SENTINEL = Symbol("root");
|
|
3822
3822
|
function stringify2(value, replacer, indent, options2 = {}) {
|
|
3823
3823
|
const space = typeof indent === "string" ? indent : " ".repeat(indent || 0);
|
|
3824
|
-
const
|
|
3824
|
+
const path6 = [];
|
|
3825
3825
|
const stack = /* @__PURE__ */ new Set();
|
|
3826
3826
|
const tracking = /* @__PURE__ */ new Map();
|
|
3827
3827
|
const unpack = /* @__PURE__ */ new Map();
|
|
@@ -3833,22 +3833,22 @@ var require_dist = __commonJS({
|
|
|
3833
3833
|
return;
|
|
3834
3834
|
if (skipUndefinedProperties && value2 === void 0)
|
|
3835
3835
|
return;
|
|
3836
|
-
if (
|
|
3836
|
+
if (path6.length > maxDepth)
|
|
3837
3837
|
return;
|
|
3838
3838
|
if (key === void 0)
|
|
3839
3839
|
return valueToString(value2, space, onNext, key);
|
|
3840
|
-
|
|
3840
|
+
path6.push(key);
|
|
3841
3841
|
const result2 = builder(value2, key === ROOT_SENTINEL ? void 0 : key);
|
|
3842
|
-
|
|
3842
|
+
path6.pop();
|
|
3843
3843
|
return result2;
|
|
3844
3844
|
};
|
|
3845
3845
|
const builder = references ? (value2, key) => {
|
|
3846
3846
|
if (value2 !== null && (typeof value2 === "object" || typeof value2 === "function" || typeof value2 === "symbol")) {
|
|
3847
3847
|
if (tracking.has(value2)) {
|
|
3848
|
-
unpack.set(
|
|
3848
|
+
unpack.set(path6.slice(1), tracking.get(value2));
|
|
3849
3849
|
return valueToString(void 0, space, onNext, key);
|
|
3850
3850
|
}
|
|
3851
|
-
tracking.set(value2,
|
|
3851
|
+
tracking.set(value2, path6.slice(1));
|
|
3852
3852
|
}
|
|
3853
3853
|
return valueToString(value2, space, onNext, key);
|
|
3854
3854
|
} : (value2, key) => {
|
|
@@ -3951,8 +3951,8 @@ var require_versionMap = __commonJS({
|
|
|
3951
3951
|
});
|
|
3952
3952
|
|
|
3953
3953
|
// index.ts
|
|
3954
|
-
var
|
|
3955
|
-
var
|
|
3954
|
+
var fs5 = __toESM(require("fs"), 1);
|
|
3955
|
+
var path5 = __toESM(require("path"), 1);
|
|
3956
3956
|
var import_minimist = __toESM(require_minimist(), 1);
|
|
3957
3957
|
var import_prompts = __toESM(require_lib(), 1);
|
|
3958
3958
|
|
|
@@ -4354,9 +4354,28 @@ ${commandFor("lint")}
|
|
|
4354
4354
|
return readme;
|
|
4355
4355
|
}
|
|
4356
4356
|
|
|
4357
|
-
// utils/
|
|
4357
|
+
// utils/getLanguage.ts
|
|
4358
4358
|
var fs3 = __toESM(require("fs"), 1);
|
|
4359
4359
|
var path3 = __toESM(require("path"), 1);
|
|
4360
|
+
function getLocale() {
|
|
4361
|
+
const shellLocale = process.env.LC_ALL || // POSIX locale environment variables
|
|
4362
|
+
process.env.LC_MESSAGES || process.env.LANG || Intl.DateTimeFormat().resolvedOptions().locale || // Built-in ECMA-402 support
|
|
4363
|
+
"en-US";
|
|
4364
|
+
const locale = shellLocale.split(".")[0].replace("_", "-");
|
|
4365
|
+
return locale;
|
|
4366
|
+
}
|
|
4367
|
+
function getLanguage() {
|
|
4368
|
+
const locale = getLocale();
|
|
4369
|
+
const localesRoot = path3.resolve(__dirname, "locales");
|
|
4370
|
+
const languageFilePath = path3.resolve(localesRoot, `${locale}.json`);
|
|
4371
|
+
const doesLanguageExist = fs3.existsSync(languageFilePath);
|
|
4372
|
+
const lang = doesLanguageExist ? require(languageFilePath) : require(path3.resolve(localesRoot, "en-US.json"));
|
|
4373
|
+
return lang;
|
|
4374
|
+
}
|
|
4375
|
+
|
|
4376
|
+
// utils/renderEslint.ts
|
|
4377
|
+
var fs4 = __toESM(require("fs"), 1);
|
|
4378
|
+
var path4 = __toESM(require("path"), 1);
|
|
4360
4379
|
|
|
4361
4380
|
// node_modules/.pnpm/@vue+create-eslint-config@0.3.2/node_modules/@vue/create-eslint-config/index.js
|
|
4362
4381
|
var import_javascript_stringify = __toESM(require_dist(), 1);
|
|
@@ -4567,8 +4586,9 @@ function renderEslint(rootDir, { needsTypeScript, needsCypress, needsCypressCT,
|
|
|
4567
4586
|
{
|
|
4568
4587
|
files: needsCypressCT ? [
|
|
4569
4588
|
"**/__tests__/*.{cy,spec}.{js,ts,jsx,tsx}",
|
|
4570
|
-
"cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}"
|
|
4571
|
-
|
|
4589
|
+
"cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}",
|
|
4590
|
+
"cypress/support/**/*.{js,ts,jsx,tsx}"
|
|
4591
|
+
] : ["cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}", "cypress/support/**/*.{js,ts,jsx,tsx}"],
|
|
4572
4592
|
extends: ["plugin:cypress/recommended"]
|
|
4573
4593
|
}
|
|
4574
4594
|
];
|
|
@@ -4590,30 +4610,23 @@ function renderEslint(rootDir, { needsTypeScript, needsCypress, needsCypressCT,
|
|
|
4590
4610
|
if (needsPrettier) {
|
|
4591
4611
|
scripts.format = "prettier --write src/";
|
|
4592
4612
|
}
|
|
4593
|
-
const packageJsonPath =
|
|
4594
|
-
const existingPkg = JSON.parse(
|
|
4613
|
+
const packageJsonPath = path4.resolve(rootDir, "package.json");
|
|
4614
|
+
const existingPkg = JSON.parse(fs4.readFileSync(packageJsonPath, "utf8"));
|
|
4595
4615
|
const updatedPkg = sortDependencies(deepMerge_default(deepMerge_default(existingPkg, pkg), { scripts }));
|
|
4596
|
-
|
|
4616
|
+
fs4.writeFileSync(packageJsonPath, JSON.stringify(updatedPkg, null, 2) + "\n", "utf-8");
|
|
4597
4617
|
for (const [fileName, content] of Object.entries(files)) {
|
|
4598
|
-
const fullPath =
|
|
4599
|
-
|
|
4618
|
+
const fullPath = path4.resolve(rootDir, fileName);
|
|
4619
|
+
fs4.writeFileSync(fullPath, content, "utf-8");
|
|
4600
4620
|
}
|
|
4601
|
-
const extensionsJsonPath =
|
|
4602
|
-
const existingExtensions = JSON.parse(
|
|
4621
|
+
const extensionsJsonPath = path4.resolve(rootDir, ".vscode/extensions.json");
|
|
4622
|
+
const existingExtensions = JSON.parse(fs4.readFileSync(extensionsJsonPath, "utf8"));
|
|
4603
4623
|
existingExtensions.recommendations.push("dbaeumer.vscode-eslint");
|
|
4604
4624
|
if (needsPrettier) {
|
|
4605
4625
|
existingExtensions.recommendations.push("esbenp.prettier-vscode");
|
|
4606
4626
|
}
|
|
4607
|
-
|
|
4627
|
+
fs4.writeFileSync(extensionsJsonPath, JSON.stringify(existingExtensions, null, 2) + "\n", "utf-8");
|
|
4608
4628
|
}
|
|
4609
4629
|
|
|
4610
|
-
// utils/filterList.ts
|
|
4611
|
-
var FILES_TO_FILTER = [
|
|
4612
|
-
"nightwatch.e2e.conf.js",
|
|
4613
|
-
"nightwatch.component.conf.js",
|
|
4614
|
-
"globals.js"
|
|
4615
|
-
];
|
|
4616
|
-
|
|
4617
4630
|
// index.ts
|
|
4618
4631
|
function isValidPackageName(projectName) {
|
|
4619
4632
|
return /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(projectName);
|
|
@@ -4622,10 +4635,10 @@ function toValidPackageName(projectName) {
|
|
|
4622
4635
|
return projectName.trim().toLowerCase().replace(/\s+/g, "-").replace(/^[._]/, "").replace(/[^a-z0-9-~]+/g, "-");
|
|
4623
4636
|
}
|
|
4624
4637
|
function canSkipEmptying(dir) {
|
|
4625
|
-
if (!
|
|
4638
|
+
if (!fs5.existsSync(dir)) {
|
|
4626
4639
|
return true;
|
|
4627
4640
|
}
|
|
4628
|
-
const files =
|
|
4641
|
+
const files = fs5.readdirSync(dir);
|
|
4629
4642
|
if (files.length === 0) {
|
|
4630
4643
|
return true;
|
|
4631
4644
|
}
|
|
@@ -4635,13 +4648,13 @@ function canSkipEmptying(dir) {
|
|
|
4635
4648
|
return false;
|
|
4636
4649
|
}
|
|
4637
4650
|
function emptyDir(dir) {
|
|
4638
|
-
if (!
|
|
4651
|
+
if (!fs5.existsSync(dir)) {
|
|
4639
4652
|
return;
|
|
4640
4653
|
}
|
|
4641
4654
|
postOrderDirectoryTraverse(
|
|
4642
4655
|
dir,
|
|
4643
|
-
(dir2) =>
|
|
4644
|
-
(file) =>
|
|
4656
|
+
(dir2) => fs5.rmdirSync(dir2),
|
|
4657
|
+
(file) => fs5.unlinkSync(file)
|
|
4645
4658
|
);
|
|
4646
4659
|
}
|
|
4647
4660
|
async function init() {
|
|
@@ -4665,6 +4678,7 @@ async function init() {
|
|
|
4665
4678
|
let targetDir = argv._[0];
|
|
4666
4679
|
const defaultProjectName = !targetDir ? "vue-project" : targetDir;
|
|
4667
4680
|
const forceOverwrite = argv.force;
|
|
4681
|
+
const language = getLanguage();
|
|
4668
4682
|
let result = {};
|
|
4669
4683
|
try {
|
|
4670
4684
|
result = await (0, import_prompts.default)(
|
|
@@ -4672,23 +4686,26 @@ async function init() {
|
|
|
4672
4686
|
{
|
|
4673
4687
|
name: "projectName",
|
|
4674
4688
|
type: targetDir ? null : "text",
|
|
4675
|
-
message:
|
|
4689
|
+
message: language.projectName.message,
|
|
4676
4690
|
initial: defaultProjectName,
|
|
4677
4691
|
onState: (state) => targetDir = String(state.value).trim() || defaultProjectName
|
|
4678
4692
|
},
|
|
4679
4693
|
{
|
|
4680
4694
|
name: "shouldOverwrite",
|
|
4681
|
-
type: () => canSkipEmptying(targetDir) || forceOverwrite ? null : "
|
|
4695
|
+
type: () => canSkipEmptying(targetDir) || forceOverwrite ? null : "toggle",
|
|
4682
4696
|
message: () => {
|
|
4683
|
-
const dirForPrompt = targetDir === "." ?
|
|
4684
|
-
return `${dirForPrompt}
|
|
4685
|
-
}
|
|
4697
|
+
const dirForPrompt = targetDir === "." ? language.shouldOverwrite.dirForPrompts.current : `${language.shouldOverwrite.dirForPrompts.target} "${targetDir}"`;
|
|
4698
|
+
return `${dirForPrompt} ${language.shouldOverwrite.message}`;
|
|
4699
|
+
},
|
|
4700
|
+
initial: true,
|
|
4701
|
+
active: language.defaultToggleOptions.active,
|
|
4702
|
+
inactive: language.defaultToggleOptions.inactive
|
|
4686
4703
|
},
|
|
4687
4704
|
{
|
|
4688
4705
|
name: "overwriteChecker",
|
|
4689
4706
|
type: (prev, values) => {
|
|
4690
4707
|
if (values.shouldOverwrite === false) {
|
|
4691
|
-
throw new Error(red("\u2716") +
|
|
4708
|
+
throw new Error(red("\u2716") + ` ${language.errors.operationCancelled}`);
|
|
4692
4709
|
}
|
|
4693
4710
|
return null;
|
|
4694
4711
|
}
|
|
@@ -4696,69 +4713,73 @@ async function init() {
|
|
|
4696
4713
|
{
|
|
4697
4714
|
name: "packageName",
|
|
4698
4715
|
type: () => isValidPackageName(targetDir) ? null : "text",
|
|
4699
|
-
message:
|
|
4716
|
+
message: language.packageName.message,
|
|
4700
4717
|
initial: () => toValidPackageName(targetDir),
|
|
4701
|
-
validate: (dir) => isValidPackageName(dir) ||
|
|
4718
|
+
validate: (dir) => isValidPackageName(dir) || language.packageName.invalidMessage
|
|
4702
4719
|
},
|
|
4703
4720
|
{
|
|
4704
4721
|
name: "needsTypeScript",
|
|
4705
4722
|
type: () => isFeatureFlagsUsed ? null : "toggle",
|
|
4706
|
-
message:
|
|
4723
|
+
message: language.needsTypeScript.message,
|
|
4707
4724
|
initial: false,
|
|
4708
|
-
active:
|
|
4709
|
-
inactive:
|
|
4725
|
+
active: language.defaultToggleOptions.active,
|
|
4726
|
+
inactive: language.defaultToggleOptions.inactive
|
|
4710
4727
|
},
|
|
4711
4728
|
{
|
|
4712
4729
|
name: "needsJsx",
|
|
4713
4730
|
type: () => isFeatureFlagsUsed ? null : "toggle",
|
|
4714
|
-
message:
|
|
4731
|
+
message: language.needsJsx.message,
|
|
4715
4732
|
initial: false,
|
|
4716
|
-
active:
|
|
4717
|
-
inactive:
|
|
4733
|
+
active: language.defaultToggleOptions.active,
|
|
4734
|
+
inactive: language.defaultToggleOptions.inactive
|
|
4718
4735
|
},
|
|
4719
4736
|
{
|
|
4720
4737
|
name: "needsRouter",
|
|
4721
4738
|
type: () => isFeatureFlagsUsed ? null : "toggle",
|
|
4722
|
-
message:
|
|
4739
|
+
message: language.needsRouter.message,
|
|
4723
4740
|
initial: false,
|
|
4724
|
-
active:
|
|
4725
|
-
inactive:
|
|
4741
|
+
active: language.defaultToggleOptions.active,
|
|
4742
|
+
inactive: language.defaultToggleOptions.inactive
|
|
4726
4743
|
},
|
|
4727
4744
|
{
|
|
4728
4745
|
name: "needsPinia",
|
|
4729
4746
|
type: () => isFeatureFlagsUsed ? null : "toggle",
|
|
4730
|
-
message:
|
|
4747
|
+
message: language.needsPinia.message,
|
|
4731
4748
|
initial: false,
|
|
4732
|
-
active:
|
|
4733
|
-
inactive:
|
|
4749
|
+
active: language.defaultToggleOptions.active,
|
|
4750
|
+
inactive: language.defaultToggleOptions.inactive
|
|
4734
4751
|
},
|
|
4735
4752
|
{
|
|
4736
4753
|
name: "needsVitest",
|
|
4737
4754
|
type: () => isFeatureFlagsUsed ? null : "toggle",
|
|
4738
|
-
message:
|
|
4755
|
+
message: language.needsVitest.message,
|
|
4739
4756
|
initial: false,
|
|
4740
|
-
active:
|
|
4741
|
-
inactive:
|
|
4757
|
+
active: language.defaultToggleOptions.active,
|
|
4758
|
+
inactive: language.defaultToggleOptions.inactive
|
|
4742
4759
|
},
|
|
4743
4760
|
{
|
|
4744
4761
|
name: "needsE2eTesting",
|
|
4745
4762
|
type: () => isFeatureFlagsUsed ? null : "select",
|
|
4746
|
-
|
|
4763
|
+
hint: language.needsE2eTesting.hint,
|
|
4764
|
+
message: language.needsE2eTesting.message,
|
|
4747
4765
|
initial: 0,
|
|
4748
4766
|
choices: (prev, answers) => [
|
|
4749
|
-
{ title: "No", value: false },
|
|
4750
4767
|
{
|
|
4751
|
-
title:
|
|
4752
|
-
|
|
4768
|
+
title: language.needsE2eTesting.selectOptions.negative.title,
|
|
4769
|
+
value: false
|
|
4770
|
+
},
|
|
4771
|
+
{
|
|
4772
|
+
title: language.needsE2eTesting.selectOptions.cypress.title,
|
|
4773
|
+
description: answers.needsVitest ? void 0 : language.needsE2eTesting.selectOptions.cypress.desc,
|
|
4753
4774
|
value: "cypress"
|
|
4754
4775
|
},
|
|
4755
4776
|
{
|
|
4756
|
-
title:
|
|
4757
|
-
description: answers.needsVitest ? void 0 :
|
|
4777
|
+
title: language.needsE2eTesting.selectOptions.nightwatch.title,
|
|
4778
|
+
description: answers.needsVitest ? void 0 : language.needsE2eTesting.selectOptions.nightwatch.desc,
|
|
4758
4779
|
value: "nightwatch"
|
|
4759
4780
|
},
|
|
4760
4781
|
{
|
|
4761
|
-
title:
|
|
4782
|
+
title: language.needsE2eTesting.selectOptions.playwright.title,
|
|
4762
4783
|
value: "playwright"
|
|
4763
4784
|
}
|
|
4764
4785
|
]
|
|
@@ -4766,10 +4787,10 @@ async function init() {
|
|
|
4766
4787
|
{
|
|
4767
4788
|
name: "needsEslint",
|
|
4768
4789
|
type: () => isFeatureFlagsUsed ? null : "toggle",
|
|
4769
|
-
message:
|
|
4790
|
+
message: language.needsEslint.message,
|
|
4770
4791
|
initial: false,
|
|
4771
|
-
active:
|
|
4772
|
-
inactive:
|
|
4792
|
+
active: language.defaultToggleOptions.active,
|
|
4793
|
+
inactive: language.defaultToggleOptions.inactive
|
|
4773
4794
|
},
|
|
4774
4795
|
{
|
|
4775
4796
|
name: "needsPrettier",
|
|
@@ -4779,15 +4800,15 @@ async function init() {
|
|
|
4779
4800
|
}
|
|
4780
4801
|
return "toggle";
|
|
4781
4802
|
},
|
|
4782
|
-
message:
|
|
4803
|
+
message: language.needsPrettier.message,
|
|
4783
4804
|
initial: false,
|
|
4784
|
-
active:
|
|
4785
|
-
inactive:
|
|
4805
|
+
active: language.defaultToggleOptions.active,
|
|
4806
|
+
inactive: language.defaultToggleOptions.inactive
|
|
4786
4807
|
}
|
|
4787
4808
|
],
|
|
4788
4809
|
{
|
|
4789
4810
|
onCancel: () => {
|
|
4790
|
-
throw new Error(red("\u2716") +
|
|
4811
|
+
throw new Error(red("\u2716") + ` ${language.errors.operationCancelled}`);
|
|
4791
4812
|
}
|
|
4792
4813
|
}
|
|
4793
4814
|
);
|
|
@@ -4813,20 +4834,20 @@ async function init() {
|
|
|
4813
4834
|
const needsNightwatch = argv.nightwatch || needsE2eTesting === "nightwatch";
|
|
4814
4835
|
const needsNightwatchCT = needsNightwatch && !needsVitest;
|
|
4815
4836
|
const needsPlaywright = argv.playwright || needsE2eTesting === "playwright";
|
|
4816
|
-
const root =
|
|
4817
|
-
if (
|
|
4837
|
+
const root = path5.join(cwd, targetDir);
|
|
4838
|
+
if (fs5.existsSync(root) && shouldOverwrite) {
|
|
4818
4839
|
emptyDir(root);
|
|
4819
|
-
} else if (!
|
|
4820
|
-
|
|
4840
|
+
} else if (!fs5.existsSync(root)) {
|
|
4841
|
+
fs5.mkdirSync(root);
|
|
4821
4842
|
}
|
|
4822
4843
|
console.log(`
|
|
4823
|
-
|
|
4844
|
+
${language.infos.scaffolding} ${root}...`);
|
|
4824
4845
|
const pkg = { name: packageName, version: "0.0.0" };
|
|
4825
|
-
|
|
4826
|
-
const templateRoot =
|
|
4846
|
+
fs5.writeFileSync(path5.resolve(root, "package.json"), JSON.stringify(pkg, null, 2));
|
|
4847
|
+
const templateRoot = path5.resolve(__dirname, "template");
|
|
4827
4848
|
const callbacks = [];
|
|
4828
4849
|
const render = function render2(templateName) {
|
|
4829
|
-
const templateDir =
|
|
4850
|
+
const templateDir = path5.resolve(templateRoot, templateName);
|
|
4830
4851
|
renderTemplate_default(templateDir, root, callbacks);
|
|
4831
4852
|
};
|
|
4832
4853
|
render("base");
|
|
@@ -4860,24 +4881,54 @@ Scaffolding project in ${root}...`);
|
|
|
4860
4881
|
if (needsTypeScript) {
|
|
4861
4882
|
render("config/typescript");
|
|
4862
4883
|
render("tsconfig/base");
|
|
4884
|
+
const rootTsConfig = {
|
|
4885
|
+
// It doesn't target any specific files because they are all configured in the referenced ones.
|
|
4886
|
+
files: [],
|
|
4887
|
+
// All templates contain at least a `.node` and a `.app` tsconfig.
|
|
4888
|
+
references: [
|
|
4889
|
+
{
|
|
4890
|
+
path: "./tsconfig.node.json"
|
|
4891
|
+
},
|
|
4892
|
+
{
|
|
4893
|
+
path: "./tsconfig.app.json"
|
|
4894
|
+
}
|
|
4895
|
+
]
|
|
4896
|
+
};
|
|
4863
4897
|
if (needsCypress) {
|
|
4864
4898
|
render("tsconfig/cypress");
|
|
4899
|
+
rootTsConfig.compilerOptions = {
|
|
4900
|
+
module: "NodeNext"
|
|
4901
|
+
};
|
|
4865
4902
|
}
|
|
4866
4903
|
if (needsCypressCT) {
|
|
4867
4904
|
render("tsconfig/cypress-ct");
|
|
4905
|
+
rootTsConfig.references.push({
|
|
4906
|
+
path: "./tsconfig.cypress-ct.json"
|
|
4907
|
+
});
|
|
4868
4908
|
}
|
|
4869
4909
|
if (needsPlaywright) {
|
|
4870
4910
|
render("tsconfig/playwright");
|
|
4871
4911
|
}
|
|
4872
4912
|
if (needsVitest) {
|
|
4873
4913
|
render("tsconfig/vitest");
|
|
4914
|
+
rootTsConfig.references.push({
|
|
4915
|
+
path: "./tsconfig.vitest.json"
|
|
4916
|
+
});
|
|
4874
4917
|
}
|
|
4875
4918
|
if (needsNightwatch) {
|
|
4876
4919
|
render("tsconfig/nightwatch");
|
|
4920
|
+
rootTsConfig.references.push({
|
|
4921
|
+
path: "./nightwatch/tsconfig.json"
|
|
4922
|
+
});
|
|
4877
4923
|
}
|
|
4878
4924
|
if (needsNightwatchCT) {
|
|
4879
4925
|
render("tsconfig/nightwatch-ct");
|
|
4880
4926
|
}
|
|
4927
|
+
fs5.writeFileSync(
|
|
4928
|
+
path5.resolve(root, "tsconfig.json"),
|
|
4929
|
+
JSON.stringify(rootTsConfig, null, 2) + "\n",
|
|
4930
|
+
"utf-8"
|
|
4931
|
+
);
|
|
4881
4932
|
}
|
|
4882
4933
|
if (needsEslint) {
|
|
4883
4934
|
renderEslint(root, { needsTypeScript, needsCypress, needsCypressCT, needsPrettier });
|
|
@@ -4903,11 +4954,11 @@ Scaffolding project in ${root}...`);
|
|
|
4903
4954
|
},
|
|
4904
4955
|
(filepath) => {
|
|
4905
4956
|
if (filepath.endsWith(".ejs")) {
|
|
4906
|
-
const template =
|
|
4957
|
+
const template = fs5.readFileSync(filepath, "utf-8");
|
|
4907
4958
|
const dest = filepath.replace(/\.ejs$/, "");
|
|
4908
4959
|
const content = import_ejs.default.render(template, dataStore[dest]);
|
|
4909
|
-
|
|
4910
|
-
|
|
4960
|
+
fs5.writeFileSync(dest, content);
|
|
4961
|
+
fs5.unlinkSync(filepath);
|
|
4911
4962
|
}
|
|
4912
4963
|
}
|
|
4913
4964
|
);
|
|
@@ -4917,21 +4968,21 @@ Scaffolding project in ${root}...`);
|
|
|
4917
4968
|
() => {
|
|
4918
4969
|
},
|
|
4919
4970
|
(filepath) => {
|
|
4920
|
-
if (filepath.endsWith(".js")
|
|
4971
|
+
if (filepath.endsWith(".js")) {
|
|
4921
4972
|
const tsFilePath = filepath.replace(/\.js$/, ".ts");
|
|
4922
|
-
if (
|
|
4923
|
-
|
|
4973
|
+
if (fs5.existsSync(tsFilePath)) {
|
|
4974
|
+
fs5.unlinkSync(filepath);
|
|
4924
4975
|
} else {
|
|
4925
|
-
|
|
4976
|
+
fs5.renameSync(filepath, tsFilePath);
|
|
4926
4977
|
}
|
|
4927
|
-
} else if (
|
|
4928
|
-
|
|
4978
|
+
} else if (path5.basename(filepath) === "jsconfig.json") {
|
|
4979
|
+
fs5.unlinkSync(filepath);
|
|
4929
4980
|
}
|
|
4930
4981
|
}
|
|
4931
4982
|
);
|
|
4932
|
-
const indexHtmlPath =
|
|
4933
|
-
const indexHtmlContent =
|
|
4934
|
-
|
|
4983
|
+
const indexHtmlPath = path5.resolve(root, "index.html");
|
|
4984
|
+
const indexHtmlContent = fs5.readFileSync(indexHtmlPath, "utf8");
|
|
4985
|
+
fs5.writeFileSync(indexHtmlPath, indexHtmlContent.replace("src/main.js", "src/main.ts"));
|
|
4935
4986
|
} else {
|
|
4936
4987
|
preOrderDirectoryTraverse(
|
|
4937
4988
|
root,
|
|
@@ -4939,15 +4990,15 @@ Scaffolding project in ${root}...`);
|
|
|
4939
4990
|
},
|
|
4940
4991
|
(filepath) => {
|
|
4941
4992
|
if (filepath.endsWith(".ts")) {
|
|
4942
|
-
|
|
4993
|
+
fs5.unlinkSync(filepath);
|
|
4943
4994
|
}
|
|
4944
4995
|
}
|
|
4945
4996
|
);
|
|
4946
4997
|
}
|
|
4947
4998
|
const userAgent = process.env.npm_config_user_agent ?? "";
|
|
4948
4999
|
const packageManager = /pnpm/.test(userAgent) ? "pnpm" : /yarn/.test(userAgent) ? "yarn" : "npm";
|
|
4949
|
-
|
|
4950
|
-
|
|
5000
|
+
fs5.writeFileSync(
|
|
5001
|
+
path5.resolve(root, "README.md"),
|
|
4951
5002
|
generateReadme({
|
|
4952
5003
|
projectName: result.projectName ?? result.packageName ?? defaultProjectName,
|
|
4953
5004
|
packageManager,
|
|
@@ -4962,10 +5013,10 @@ Scaffolding project in ${root}...`);
|
|
|
4962
5013
|
})
|
|
4963
5014
|
);
|
|
4964
5015
|
console.log(`
|
|
4965
|
-
|
|
5016
|
+
${language.infos.done}
|
|
4966
5017
|
`);
|
|
4967
5018
|
if (root !== cwd) {
|
|
4968
|
-
const cdProjectName =
|
|
5019
|
+
const cdProjectName = path5.relative(cwd, root);
|
|
4969
5020
|
console.log(
|
|
4970
5021
|
` ${bold(green(`cd ${cdProjectName.includes(" ") ? `"${cdProjectName}"` : cdProjectName}`))}`
|
|
4971
5022
|
);
|