From: zhhbstudio Date: Fri, 11 Mar 2022 08:02:20 +0000 (+0800) Subject: feat: use `??` instead of `||` (#78) X-Git-Tag: v3.1.8~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b2b1e4322e03f7e22312e361c6afb1fc402e742;p=thirdparty%2Fvuejs%2Fcreate-vue.git feat: use `??` instead of `||` (#78) Co-authored-by: zhaohebin --- diff --git a/index.js b/index.js index a06e9a16..55eb4638 100755 --- 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,