瀏覽代碼

chore(create): Update minimum versions of Node & Yarn

Michael Bromley 1 年之前
父節點
當前提交
6588365d71
共有 3 個文件被更改,包括 9 次插入4 次删除
  1. 2 1
      packages/create/README.md
  2. 1 1
      packages/create/src/constants.ts
  3. 6 2
      packages/create/src/helpers.ts

+ 2 - 1
packages/create/README.md

@@ -39,7 +39,8 @@ It will create a directory called `my-app` inside the current folder.
 
 ### `--use-npm`
 
-By default, Vendure Create will attempt to use Yarn to install all dependencies if it is available. You can override this and force it to use npm with the `--use-npm` flag.
+By default, Vendure Create will detect whether a compatible version of Yarn is installed, and if so will display a prompt to select the preferred package manager.
+You can override this and force it to use npm with the `--use-npm` flag.
 
 ### `--log-level`
 

+ 1 - 1
packages/create/src/constants.ts

@@ -1,4 +1,4 @@
-export const REQUIRED_NODE_VERSION = '>=14.0.0';
+export const REQUIRED_NODE_VERSION = '>=20.0.0';
 export const SERVER_PORT = 3000;
 /**
  * The TypeScript version needs to pinned because minor versions often

+ 6 - 2
packages/create/src/helpers.ts

@@ -104,8 +104,12 @@ export function checkNodeVersion(requiredVersion: string) {
 
 export function yarnIsAvailable() {
     try {
-        execSync('yarnpkg --version', { stdio: 'ignore' });
-        return true;
+        const yarnVersion = execSync('yarnpkg --version');
+        if (semver.major(yarnVersion.toString()) > 1) {
+            return true;
+        } else {
+            return false;
+        }
     } catch (e: any) {
         return false;
     }