]> git.ipfire.org Git - thirdparty/vuejs/create-vue.git/commitdiff
feat: use `??` instead of `||` (#78)
authorzhhbstudio <zhhbstudio@gmail.com>
Fri, 11 Mar 2022 08:02:20 +0000 (16:02 +0800)
committerGitHub <noreply@github.com>
Fri, 11 Mar 2022 08:02:20 +0000 (16:02 +0800)
Co-authored-by: zhaohebin <zhaohebin@360.cn>
index.js

index a06e9a16d4cce812c5b28fcb4465a84cb7fadc4f..55eb46381234a261e494e27caa9a4bba790a3d11 100755 (executable)
--- a/index.js
+++ b/index.js
@@ -71,17 +71,16 @@ async function init() {
   })
 
   // if any of the feature flags is set, we would skip the feature prompts
-  // use `??` instead of `||` once we drop Node.js 12 support
   const isFeatureFlagsUsed =
     typeof (
-      argv.default ||
-      argv.ts ||
-      argv.jsx ||
-      argv.router ||
-      argv.pinia ||
-      argv.tests ||
-      argv.vitest ||
-      argv.cypress ||
+      argv.default ??
+      argv.ts ??
+      argv.jsx ??
+      argv.router ??
+      argv.pinia ??
+      argv.tests ??
+      argv.vitest ??
+      argv.cypress ??
       argv.eslint
     ) === 'boolean'
 
@@ -227,7 +226,7 @@ async function init() {
   // so we still have to assign the default values here
   const {
     projectName,
-    packageName = projectName || defaultProjectName,
+    packageName = projectName ?? defaultProjectName,
     shouldOverwrite = argv.force,
     needsJsx = argv.jsx,
     needsTypeScript = argv.typescript,
@@ -380,7 +379,7 @@ async function init() {
   fs.writeFileSync(
     path.resolve(root, 'README.md'),
     generateReadme({
-      projectName: result.projectName || defaultProjectName,
+      projectName: result.projectName ?? defaultProjectName,
       packageManager,
       needsTypeScript,
       needsVitest,