create-umi 4.1.4 → 4.1.6

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/dist/index.js CHANGED
@@ -169,8 +169,11 @@ var src_default = async ({
169
169
  let pnpmExtraNpmrc = "";
170
170
  const isPnpm = npmClient === "pnpm" /* pnpm */;
171
171
  let pnpmMajorVersion;
172
+ let pnpmVersion;
172
173
  if (isPnpm) {
173
- pnpmMajorVersion = await getPnpmMajorVersion();
174
+ pnpmVersion = await getPnpmVersion();
175
+ pnpmMajorVersion = parseInt(pnpmVersion.split(".")[0], 10);
176
+ import_utils.logger.debug(`pnpm version: ${pnpmVersion}`);
174
177
  if (pnpmMajorVersion === 7) {
175
178
  pnpmExtraNpmrc = `strict-peer-dependencies=false`;
176
179
  }
@@ -213,9 +216,11 @@ var src_default = async ({
213
216
  import_utils.logger.info(`Skip Git init`);
214
217
  }
215
218
  const isPnpm8 = pnpmMajorVersion === 8;
219
+ const pnpmHighestResolutionMinVersion = "8.7.0";
220
+ const isPnpmHighestResolution = isPnpm8 && import_utils.semver.gte(pnpmVersion, pnpmHighestResolutionMinVersion);
216
221
  if (!useDefaultData && args.install !== false) {
217
- if (isPnpm8) {
218
- await installWithPnpm8(target);
222
+ if (isPnpm8 && !isPnpmHighestResolution) {
223
+ await installAndUpdateWithPnpm(target);
219
224
  } else {
220
225
  (0, import_utils.installWithNpmClient)({ npmClient, cwd: target });
221
226
  }
@@ -278,13 +283,13 @@ async function removeHusky(opts) {
278
283
  await import_utils.fsExtra.remove(dir);
279
284
  }
280
285
  }
281
- async function installWithPnpm8(cwd) {
286
+ async function installAndUpdateWithPnpm(cwd) {
282
287
  await import_utils.execa.execa("pnpm", ["up", "-L"], { cwd, stdio: "inherit" });
283
288
  }
284
- async function getPnpmMajorVersion() {
289
+ async function getPnpmVersion() {
285
290
  try {
286
291
  const { stdout } = await import_utils.execa.execa("pnpm", ["--version"]);
287
- return parseInt(stdout.trim().split(".")[0], 10);
292
+ return stdout.trim();
288
293
  } catch (e) {
289
294
  throw new Error("Please install pnpm first", { cause: e });
290
295
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-umi",
3
- "version": "4.1.4",
3
+ "version": "4.1.6",
4
4
  "description": "create-umi",
5
5
  "homepage": "https://github.com/umijs/umi/tree/master/packages/create-umi#readme",
6
6
  "bugs": "https://github.com/umijs/umi/issues",
@@ -19,7 +19,7 @@
19
19
  "templates"
20
20
  ],
21
21
  "dependencies": {
22
- "@umijs/utils": "4.1.4"
22
+ "@umijs/utils": "4.1.6"
23
23
  },
24
24
  "publishConfig": {
25
25
  "access": "public"
@@ -1,4 +1 @@
1
- #!/usr/bin/env sh
2
- . "$(dirname -- "$0")/_/husky.sh"
3
-
4
1
  npx --no-install max verify-commit $1
@@ -1,4 +1 @@
1
- #!/usr/bin/env sh
2
- . "$(dirname -- "$0")/_/husky.sh"
3
-
4
1
  npx --no-install lint-staged --quiet
@@ -5,7 +5,7 @@
5
5
  "dev": "max dev",
6
6
  "build": "max build",
7
7
  "format": "prettier --cache --write .",{{#withHusky}}
8
- "prepare": "husky install",{{/withHusky}}
8
+ "prepare": "husky",{{/withHusky}}
9
9
  "postinstall": "max setup",
10
10
  "setup": "max setup",
11
11
  "start": "npm run dev"
@@ -19,7 +19,7 @@
19
19
  "devDependencies": {
20
20
  "@types/react": "^18.0.33",
21
21
  "@types/react-dom": "^18.0.11",{{#withHusky}}
22
- "husky": "^8.0.3",{{/withHusky}}
22
+ "husky": "^9",{{/withHusky}}
23
23
  "lint-staged": "^13.2.0",
24
24
  "prettier": "^2.8.7",
25
25
  "prettier-plugin-organize-imports": "^3.2.2",
@@ -15,5 +15,6 @@
15
15
  "isolatedModules": false,
16
16
  "noEmit": false,
17
17
  "declaration": true
18
- }
18
+ },
19
+ "include": ["src"]
19
20
  }