@umijs/utils 4.0.0-rc.12 → 4.0.0-rc.13
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/npmClient.d.ts +3 -1
- package/dist/npmClient.js +17 -11
- package/package.json +2 -2
package/dist/npmClient.d.ts
CHANGED
|
@@ -7,7 +7,9 @@ export declare enum NpmClientEnum {
|
|
|
7
7
|
yarn = "yarn",
|
|
8
8
|
npm = "npm"
|
|
9
9
|
}
|
|
10
|
-
export declare const getNpmClient: (
|
|
10
|
+
export declare const getNpmClient: (opts: {
|
|
11
|
+
cwd: string;
|
|
12
|
+
}) => NpmClient;
|
|
11
13
|
export declare const installWithNpmClient: ({ npmClient, cwd, }: {
|
|
12
14
|
npmClient: NpmClient;
|
|
13
15
|
cwd?: string | undefined;
|
package/dist/npmClient.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.installWithNpmClient = exports.getNpmClient = exports.NpmClientEnum = exports.npmClients = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const path_1 = require("path");
|
|
4
6
|
exports.npmClients = ['pnpm', 'tnpm', 'cnpm', 'yarn', 'npm'];
|
|
5
7
|
var NpmClientEnum;
|
|
6
8
|
(function (NpmClientEnum) {
|
|
@@ -10,17 +12,21 @@ var NpmClientEnum;
|
|
|
10
12
|
NpmClientEnum["yarn"] = "yarn";
|
|
11
13
|
NpmClientEnum["npm"] = "npm";
|
|
12
14
|
})(NpmClientEnum = exports.NpmClientEnum || (exports.NpmClientEnum = {}));
|
|
13
|
-
const getNpmClient = () => {
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
const getNpmClient = (opts) => {
|
|
16
|
+
const chokidarPkg = require('chokidar/package.json');
|
|
17
|
+
if (chokidarPkg.__npminstall_done) {
|
|
18
|
+
return chokidarPkg._resolved.includes('registry.npm.alibaba-inc.com')
|
|
19
|
+
? 'tnpm'
|
|
20
|
+
: 'cnpm';
|
|
21
|
+
}
|
|
22
|
+
const chokidarPath = require.resolve('chokidar');
|
|
23
|
+
if (chokidarPath.includes('.pnpm') ||
|
|
24
|
+
(0, fs_1.existsSync)((0, path_1.join)(opts.cwd, 'node_modules', '.pnpm'))) {
|
|
25
|
+
return 'pnpm';
|
|
26
|
+
}
|
|
27
|
+
if ((0, fs_1.existsSync)((0, path_1.join)(opts.cwd, 'yarn.lock')) ||
|
|
28
|
+
(0, fs_1.existsSync)((0, path_1.join)(opts.cwd, 'node_modules', '.yarn-integrity'))) {
|
|
29
|
+
return 'yarn';
|
|
24
30
|
}
|
|
25
31
|
return 'npm';
|
|
26
32
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/utils",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.13",
|
|
4
4
|
"homepage": "https://github.com/umijs/umi-next/tree/master/packages/utils#readme",
|
|
5
5
|
"bugs": "https://github.com/umijs/umi-next/issues",
|
|
6
6
|
"repository": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@types/color": "3.0.3",
|
|
28
28
|
"@types/cross-spawn": "6.0.2",
|
|
29
29
|
"@types/debug": "4.1.7",
|
|
30
|
-
"@types/lodash": "4.14.
|
|
30
|
+
"@types/lodash": "4.14.182",
|
|
31
31
|
"@types/mustache": "4.1.2",
|
|
32
32
|
"@types/prompts": "^2.0.14",
|
|
33
33
|
"@types/rimraf": "3.0.2",
|