@modern-js/monorepo-tools 2.15.0 → 2.17.0
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/CHANGELOG.md +38 -0
- package/dist/cjs/cli/build.js +10 -31
- package/dist/cjs/cli/buildWatch.js +11 -31
- package/dist/cjs/cli/clear.js +11 -31
- package/dist/cjs/cli/deploy.js +14 -36
- package/dist/cjs/cli/index.js +23 -22
- package/dist/cjs/cli/install.js +11 -31
- package/dist/cjs/cli/new.js +17 -37
- package/dist/cjs/commands/build.js +21 -46
- package/dist/cjs/commands/buildWatch.js +19 -36
- package/dist/cjs/commands/clear.js +17 -34
- package/dist/cjs/commands/deploy.js +25 -41
- package/dist/cjs/commands/index.js +22 -21
- package/dist/cjs/commands/install.js +19 -36
- package/dist/cjs/constants.js +13 -26
- package/dist/cjs/dag/create.js +16 -28
- package/dist/cjs/dag/edgeManager.js +24 -28
- package/dist/cjs/dag/index.js +11 -29
- package/dist/cjs/dag/operator.js +106 -123
- package/dist/cjs/dag/task.js +52 -63
- package/dist/cjs/dag/utils.js +52 -49
- package/dist/cjs/features/build/index.js +52 -68
- package/dist/cjs/features/clear/index.js +66 -47
- package/dist/cjs/features/deploy/index.js +126 -96
- package/dist/cjs/features/dev/cmds.js +10 -25
- package/dist/cjs/features/dev/createTask.js +93 -56
- package/dist/cjs/features/dev/index.js +43 -71
- package/dist/cjs/features/dev/watchProjectsState.js +89 -64
- package/dist/cjs/features/install/index.js +74 -63
- package/dist/cjs/hooks/index.js +9 -27
- package/dist/cjs/index.js +36 -53
- package/dist/cjs/locale/en.js +7 -25
- package/dist/cjs/locale/index.js +18 -28
- package/dist/cjs/locale/zh.js +7 -25
- package/dist/cjs/log/error.js +7 -25
- package/dist/cjs/log/multiTasksLog.js +42 -43
- package/dist/cjs/log/time.js +19 -29
- package/dist/cjs/log/utils.js +7 -25
- package/dist/cjs/package/index.js +28 -30
- package/dist/cjs/parse-config/index.js +61 -49
- package/dist/cjs/parse-config/monorepo.js +81 -67
- package/dist/cjs/projects/checkProjectChange.js +95 -73
- package/dist/cjs/projects/clearMemoryFiles.js +52 -44
- package/dist/cjs/projects/getProjects.js +38 -65
- package/dist/cjs/projects/getProjectsByPackagesConfig.js +93 -71
- package/dist/cjs/projects/getProjectsByWorkspaceFile.js +89 -85
- package/dist/cjs/type.js +4 -15
- package/dist/cjs/utils/install.js +69 -44
- package/dist/cjs/utils/types.js +4 -15
- package/dist/esm/cli/build.js +2 -8
- package/dist/esm/cli/buildWatch.js +4 -9
- package/dist/esm/cli/clear.js +4 -9
- package/dist/esm/cli/deploy.js +7 -14
- package/dist/esm/cli/install.js +4 -9
- package/dist/esm/cli/new.js +9 -14
- package/dist/esm/commands/build.js +7 -17
- package/dist/esm/commands/buildWatch.js +6 -8
- package/dist/esm/commands/clear.js +6 -8
- package/dist/esm/commands/deploy.js +10 -11
- package/dist/esm/commands/install.js +6 -8
- package/dist/esm/constants.js +2 -6
- package/dist/esm/dag/create.js +10 -7
- package/dist/esm/dag/edgeManager.js +17 -6
- package/dist/esm/dag/index.js +1 -4
- package/dist/esm/dag/operator.js +77 -74
- package/dist/esm/dag/task.js +39 -30
- package/dist/esm/dag/utils.js +39 -27
- package/dist/esm/features/build/index.js +22 -27
- package/dist/esm/features/clear/index.js +4 -6
- package/dist/esm/features/deploy/index.js +55 -50
- package/dist/esm/features/dev/cmds.js +4 -4
- package/dist/esm/features/dev/createTask.js +31 -15
- package/dist/esm/features/dev/index.js +19 -27
- package/dist/esm/features/dev/watchProjectsState.js +41 -31
- package/dist/esm/features/install/index.js +11 -15
- package/dist/esm/hooks/index.js +1 -4
- package/dist/esm/index.js +12 -11
- package/dist/esm/locale/en.js +1 -4
- package/dist/esm/locale/index.js +5 -5
- package/dist/esm/locale/zh.js +1 -4
- package/dist/esm/log/error.js +1 -4
- package/dist/esm/log/multiTasksLog.js +32 -18
- package/dist/esm/log/time.js +7 -8
- package/dist/esm/log/utils.js +1 -4
- package/dist/esm/package/index.js +21 -8
- package/dist/esm/parse-config/index.js +11 -14
- package/dist/esm/parse-config/monorepo.js +20 -27
- package/dist/esm/projects/checkProjectChange.js +19 -23
- package/dist/esm/projects/clearMemoryFiles.js +3 -13
- package/dist/esm/projects/getProjects.js +21 -45
- package/dist/esm/projects/getProjectsByPackagesConfig.js +29 -33
- package/dist/esm/projects/getProjectsByWorkspaceFile.js +21 -41
- package/dist/esm/type.js +1 -0
- package/dist/esm/utils/install.js +12 -8
- package/dist/esm/utils/types.js +1 -0
- package/package.json +16 -12
|
@@ -1,109 +1,113 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
8
6
|
for (var name in all)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var getProjectsByWorkspaceFile_exports = {};
|
|
29
|
-
__export(getProjectsByWorkspaceFile_exports, {
|
|
7
|
+
Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
30
13
|
getProjectsByWorkspaceFile: () => getProjectsByWorkspaceFile,
|
|
31
14
|
syncGetProjectsByWorkspaceFile: () => syncGetProjectsByWorkspaceFile
|
|
32
15
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
16
|
+
const _path = /* @__PURE__ */ _interop_require_wildcard(require("path"));
|
|
17
|
+
const _nodecorelibrary = require("@rushstack/node-core-library");
|
|
18
|
+
const _utils = require("@modern-js/utils");
|
|
19
|
+
const _monorepo = require("../parse-config/monorepo");
|
|
20
|
+
const _constants = require("../constants");
|
|
21
|
+
const _getProjectsByPackagesConfig = require("./getProjectsByPackagesConfig");
|
|
22
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
23
|
+
if (typeof WeakMap !== "function")
|
|
24
|
+
return null;
|
|
25
|
+
var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
|
|
26
|
+
var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
|
|
27
|
+
return (_getRequireWildcardCache = function(nodeInterop2) {
|
|
28
|
+
return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
|
|
29
|
+
})(nodeInterop);
|
|
30
|
+
}
|
|
31
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
32
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
33
|
+
return obj;
|
|
34
|
+
}
|
|
35
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
36
|
+
return {
|
|
37
|
+
default: obj
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
41
|
+
if (cache && cache.has(obj)) {
|
|
42
|
+
return cache.get(obj);
|
|
43
|
+
}
|
|
44
|
+
var newObj = {};
|
|
45
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
46
|
+
for (var key in obj) {
|
|
47
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
48
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
49
|
+
if (desc && (desc.get || desc.set)) {
|
|
50
|
+
Object.defineProperty(newObj, key, desc);
|
|
51
|
+
} else {
|
|
52
|
+
newObj[key] = obj[key];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
newObj.default = obj;
|
|
57
|
+
if (cache) {
|
|
58
|
+
cache.set(obj, newObj);
|
|
59
|
+
}
|
|
60
|
+
return newObj;
|
|
61
|
+
}
|
|
40
62
|
const getProjectsByWorkspaceFile = async (rootPath, config, ignoreConfigs) => {
|
|
41
|
-
var
|
|
63
|
+
var _config_workspaceFile;
|
|
42
64
|
let { workspaceFile } = config;
|
|
43
|
-
if (!config.enableAutoFinder && (!("workspaceFile" in config) || ((
|
|
44
|
-
throw new Error(
|
|
45
|
-
"Missing workspaceFile Key or workspaceFile is empty string"
|
|
46
|
-
);
|
|
65
|
+
if (!config.enableAutoFinder && (!("workspaceFile" in config) || ((_config_workspaceFile = config.workspaceFile) === null || _config_workspaceFile === void 0 ? void 0 : _config_workspaceFile.length) === 0)) {
|
|
66
|
+
throw new Error("Missing workspaceFile Key or workspaceFile is empty string");
|
|
47
67
|
}
|
|
48
68
|
if (config.enableAutoFinder) {
|
|
49
|
-
workspaceFile = (0,
|
|
69
|
+
workspaceFile = (0, _monorepo.getWorkspaceFile)(rootPath);
|
|
50
70
|
}
|
|
51
71
|
let packagesConfig = [];
|
|
52
|
-
if (workspaceFile ===
|
|
53
|
-
const yamlString = await
|
|
54
|
-
|
|
55
|
-
).then((data) => data.toString());
|
|
56
|
-
const pnpmWorkspace = import_utils.yaml.load(yamlString);
|
|
72
|
+
if (workspaceFile === _constants.WORKSPACE_FILE.PNPM) {
|
|
73
|
+
const yamlString = await _nodecorelibrary.FileSystem.readFileAsync(_path.resolve("/", rootPath, workspaceFile)).then((data) => data.toString());
|
|
74
|
+
const pnpmWorkspace = _utils.yaml.load(yamlString);
|
|
57
75
|
packagesConfig = pnpmWorkspace.packages || [];
|
|
58
|
-
} else if (workspaceFile ===
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
76
|
+
} else if (workspaceFile === _constants.WORKSPACE_FILE.YARN) {
|
|
77
|
+
var _pkgJson_workspaces;
|
|
78
|
+
const pkgJson = _nodecorelibrary.JsonFile.load(_path.resolve(rootPath, workspaceFile));
|
|
79
|
+
packagesConfig = (pkgJson === null || pkgJson === void 0 ? void 0 : (_pkgJson_workspaces = pkgJson.workspaces) === null || _pkgJson_workspaces === void 0 ? void 0 : _pkgJson_workspaces.packages) || [];
|
|
80
|
+
} else if (workspaceFile === _constants.WORKSPACE_FILE.LERNA) {
|
|
81
|
+
const lernaJson = _nodecorelibrary.JsonFile.load(_path.resolve(rootPath, workspaceFile));
|
|
82
|
+
var _lernaJson_packages;
|
|
83
|
+
packagesConfig = (_lernaJson_packages = lernaJson.packages) !== null && _lernaJson_packages !== void 0 ? _lernaJson_packages : [];
|
|
64
84
|
}
|
|
65
|
-
const projects = await (0,
|
|
66
|
-
rootPath,
|
|
67
|
-
packagesConfig,
|
|
68
|
-
ignoreConfigs
|
|
69
|
-
);
|
|
85
|
+
const projects = await (0, _getProjectsByPackagesConfig.getProjectsByPackageConfig)(rootPath, packagesConfig, ignoreConfigs);
|
|
70
86
|
return projects;
|
|
71
87
|
};
|
|
72
88
|
const syncGetProjectsByWorkspaceFile = (rootPath, config, ignoreConfigs) => {
|
|
73
|
-
var
|
|
89
|
+
var _config_workspaceFile;
|
|
74
90
|
let { workspaceFile } = config;
|
|
75
|
-
if (!config.enableAutoFinder && (!("workspaceFile" in config) || ((
|
|
76
|
-
throw new Error(
|
|
77
|
-
"Missing workspaceFile Key or workspaceFile is empty string"
|
|
78
|
-
);
|
|
91
|
+
if (!config.enableAutoFinder && (!("workspaceFile" in config) || ((_config_workspaceFile = config.workspaceFile) === null || _config_workspaceFile === void 0 ? void 0 : _config_workspaceFile.length) === 0)) {
|
|
92
|
+
throw new Error("Missing workspaceFile Key or workspaceFile is empty string");
|
|
79
93
|
}
|
|
80
94
|
if (config.enableAutoFinder) {
|
|
81
|
-
workspaceFile = (0,
|
|
95
|
+
workspaceFile = (0, _monorepo.getWorkspaceFile)(rootPath);
|
|
82
96
|
}
|
|
83
97
|
let packagesConfig = [];
|
|
84
|
-
if (workspaceFile ===
|
|
85
|
-
const yamlString =
|
|
86
|
-
|
|
87
|
-
"utf-8"
|
|
88
|
-
);
|
|
89
|
-
const pnpmWorkspace = import_utils.yaml.load(yamlString);
|
|
98
|
+
if (workspaceFile === _constants.WORKSPACE_FILE.PNPM) {
|
|
99
|
+
const yamlString = _utils.fs.readFileSync(_path.resolve("/", rootPath, workspaceFile), "utf-8");
|
|
100
|
+
const pnpmWorkspace = _utils.yaml.load(yamlString);
|
|
90
101
|
packagesConfig = pnpmWorkspace.packages || [];
|
|
91
|
-
} else if (workspaceFile ===
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
102
|
+
} else if (workspaceFile === _constants.WORKSPACE_FILE.YARN) {
|
|
103
|
+
var _pkgJson_workspaces;
|
|
104
|
+
const pkgJson = _nodecorelibrary.JsonFile.load(_path.resolve(rootPath, workspaceFile));
|
|
105
|
+
packagesConfig = (pkgJson === null || pkgJson === void 0 ? void 0 : (_pkgJson_workspaces = pkgJson.workspaces) === null || _pkgJson_workspaces === void 0 ? void 0 : _pkgJson_workspaces.packages) || [];
|
|
106
|
+
} else if (workspaceFile === _constants.WORKSPACE_FILE.LERNA) {
|
|
107
|
+
const lernaJson = _nodecorelibrary.JsonFile.load(_path.resolve(rootPath, workspaceFile));
|
|
108
|
+
var _lernaJson_packages;
|
|
109
|
+
packagesConfig = (_lernaJson_packages = lernaJson.packages) !== null && _lernaJson_packages !== void 0 ? _lernaJson_packages : [];
|
|
97
110
|
}
|
|
98
|
-
const projects = (0,
|
|
99
|
-
rootPath,
|
|
100
|
-
packagesConfig,
|
|
101
|
-
ignoreConfigs
|
|
102
|
-
);
|
|
111
|
+
const projects = (0, _getProjectsByPackagesConfig.syncGetProjectsByPackageConfig)(rootPath, packagesConfig, ignoreConfigs);
|
|
103
112
|
return projects;
|
|
104
113
|
};
|
|
105
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
106
|
-
0 && (module.exports = {
|
|
107
|
-
getProjectsByWorkspaceFile,
|
|
108
|
-
syncGetProjectsByWorkspaceFile
|
|
109
|
-
});
|
package/dist/cjs/type.js
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var type_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(type_exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
@@ -1,46 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
8
6
|
for (var name in all)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var install_exports = {};
|
|
29
|
-
__export(install_exports, {
|
|
30
|
-
installByPackageManager: () => installByPackageManager,
|
|
31
|
-
removeLockFile: () => removeLockFile
|
|
7
|
+
Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
removeLockFile: () => removeLockFile,
|
|
14
|
+
installByPackageManager: () => installByPackageManager
|
|
32
15
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
16
|
+
const _path = /* @__PURE__ */ _interop_require_wildcard(require("path"));
|
|
17
|
+
const _utils = require("@modern-js/utils");
|
|
18
|
+
const _constants = require("../constants");
|
|
19
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
20
|
+
if (typeof WeakMap !== "function")
|
|
21
|
+
return null;
|
|
22
|
+
var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
|
|
23
|
+
var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
|
|
24
|
+
return (_getRequireWildcardCache = function(nodeInterop2) {
|
|
25
|
+
return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
|
|
26
|
+
})(nodeInterop);
|
|
27
|
+
}
|
|
28
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
29
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
30
|
+
return obj;
|
|
31
|
+
}
|
|
32
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
33
|
+
return {
|
|
34
|
+
default: obj
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
38
|
+
if (cache && cache.has(obj)) {
|
|
39
|
+
return cache.get(obj);
|
|
40
|
+
}
|
|
41
|
+
var newObj = {};
|
|
42
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
43
|
+
for (var key in obj) {
|
|
44
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
45
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
46
|
+
if (desc && (desc.get || desc.set)) {
|
|
47
|
+
Object.defineProperty(newObj, key, desc);
|
|
48
|
+
} else {
|
|
49
|
+
newObj[key] = obj[key];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
newObj.default = obj;
|
|
54
|
+
if (cache) {
|
|
55
|
+
cache.set(obj, newObj);
|
|
56
|
+
}
|
|
57
|
+
return newObj;
|
|
58
|
+
}
|
|
37
59
|
const removeLockFile = (rootPath, packageManager) => {
|
|
38
60
|
if (packageManager === "pnpm") {
|
|
39
|
-
|
|
61
|
+
_utils.fs.removeSync(_path.join(rootPath, _constants.LOCK_FILE.PNPM));
|
|
40
62
|
} else if (packageManager === "yarn") {
|
|
41
|
-
|
|
63
|
+
_utils.fs.removeSync(_path.join(rootPath, _constants.LOCK_FILE.YARN));
|
|
42
64
|
} else if (packageManager === "npm") {
|
|
43
|
-
|
|
65
|
+
_utils.fs.removeSync(_path.join(rootPath, _constants.LOCK_FILE.NPM));
|
|
44
66
|
}
|
|
45
67
|
};
|
|
46
68
|
const installByPackageManager = async (packageManager, { rootPath, removeLock }) => {
|
|
@@ -48,14 +70,17 @@ const installByPackageManager = async (packageManager, { rootPath, removeLock })
|
|
|
48
70
|
removeLockFile(rootPath, packageManager);
|
|
49
71
|
}
|
|
50
72
|
if (packageManager === "pnpm") {
|
|
51
|
-
await (0,
|
|
73
|
+
await (0, _utils.execa)("pnpm", [
|
|
74
|
+
"install"
|
|
75
|
+
], {
|
|
76
|
+
stdio: "inherit"
|
|
77
|
+
});
|
|
52
78
|
}
|
|
53
79
|
if (packageManager === "yarn") {
|
|
54
|
-
await (0,
|
|
80
|
+
await (0, _utils.execa)("yarn", [
|
|
81
|
+
"install"
|
|
82
|
+
], {
|
|
83
|
+
stdio: "inherit"
|
|
84
|
+
});
|
|
55
85
|
}
|
|
56
86
|
};
|
|
57
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
-
0 && (module.exports = {
|
|
59
|
-
installByPackageManager,
|
|
60
|
-
removeLockFile
|
|
61
|
-
});
|
package/dist/cjs/utils/types.js
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var types_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(types_exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
package/dist/esm/cli/build.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { build } from "../commands";
|
|
2
|
-
const buildCli = (program, api) => {
|
|
3
|
-
program.command("build [project]").usage("[options]").option("--no-self", "build without target project").option("-t, --dept", "build target project with project’s dependent").option("--no-deps", "build target project without project’s dependencies").option("--only-self", "build target project with nothing").option(
|
|
4
|
-
"-a, --all",
|
|
5
|
-
"build target project with project’s dependencies and dependent"
|
|
6
|
-
).option("--content-hash", "build target project use content hash cache").option("--git-hash", "build target project use git hash cache").description("build target project").action(async (targetProjectName, option) => {
|
|
2
|
+
export const buildCli = (program, api) => {
|
|
3
|
+
program.command("build [project]").usage("[options]").option("--no-self", "build without target project").option("-t, --dept", "build target project with project’s dependent").option("--no-deps", "build target project without project’s dependencies").option("--only-self", "build target project with nothing").option("-a, --all", "build target project with project’s dependencies and dependent").option("--content-hash", "build target project use content hash cache").option("--git-hash", "build target project use git hash cache").description("build target project").action(async (targetProjectName, option) => {
|
|
7
4
|
await build(targetProjectName, option, api);
|
|
8
5
|
});
|
|
9
6
|
};
|
|
10
|
-
export {
|
|
11
|
-
buildCli
|
|
12
|
-
};
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { buildWatch } from "../commands";
|
|
2
|
-
const buildWatchCli = (program, api) => {
|
|
3
|
-
program.command("build-watch [project]").usage("[options]").option("--only-self", "build target project with nothing").option("-i, --init", "init build beforebuild watch ").description("watch target project and target project’s dependencies").action(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
);
|
|
8
|
-
};
|
|
9
|
-
export {
|
|
10
|
-
buildWatchCli
|
|
2
|
+
export const buildWatchCli = (program, api) => {
|
|
3
|
+
program.command("build-watch [project]").usage("[options]").option("--only-self", "build target project with nothing").option("-i, --init", "init build beforebuild watch ").description("watch target project and target project’s dependencies").action(async (targetProjectName, option) => {
|
|
4
|
+
await buildWatch(targetProjectName, option, api);
|
|
5
|
+
});
|
|
11
6
|
};
|
package/dist/esm/cli/clear.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { clear } from "../commands";
|
|
2
|
-
const clearCli = (program, api) => {
|
|
3
|
-
program.command("clear [projects...]").usage("[options]").option("--remove-dirs [dirs...]", "remove dirs, default is node_modules").description("clear project dirs").action(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
);
|
|
8
|
-
};
|
|
9
|
-
export {
|
|
10
|
-
clearCli
|
|
2
|
+
export const clearCli = (program, api) => {
|
|
3
|
+
program.command("clear [projects...]").usage("[options]").option("--remove-dirs [dirs...]", "remove dirs, default is node_modules").description("clear project dirs").action(async (targetProjectNames, option) => {
|
|
4
|
+
await clear(targetProjectNames, option, api);
|
|
5
|
+
});
|
|
11
6
|
};
|
package/dist/esm/cli/deploy.js
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { deploy } from "../commands";
|
|
2
|
-
const deployCli = (program, api) => {
|
|
3
|
-
program.command("deploy [project...]").usage("[options]").option(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const ignoreMatchs = ["**/output/**"];
|
|
10
|
-
await deploy(api, deployProjectNames, option, ignoreMatchs);
|
|
11
|
-
}
|
|
12
|
-
);
|
|
13
|
-
};
|
|
14
|
-
export {
|
|
15
|
-
deployCli
|
|
2
|
+
export const deployCli = (program, api) => {
|
|
3
|
+
program.command("deploy [project...]").usage("[options]").option("-p, --path [path]", "Specify the path of the product output", "output").description("deploy project").action(async (deployProjectNames, option) => {
|
|
4
|
+
const ignoreMatchs = [
|
|
5
|
+
"**/output/**"
|
|
6
|
+
];
|
|
7
|
+
await deploy(api, deployProjectNames, option, ignoreMatchs);
|
|
8
|
+
});
|
|
16
9
|
};
|
package/dist/esm/cli/install.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { install } from "../commands";
|
|
2
|
-
const installCli = (program, api) => {
|
|
3
|
-
program.command("install [project...]").usage("[options]").description("install deps for some projects").action(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
);
|
|
8
|
-
};
|
|
9
|
-
export {
|
|
10
|
-
installCli
|
|
2
|
+
export const installCli = (program, api) => {
|
|
3
|
+
program.command("install [project...]").usage("[options]").description("install deps for some projects").action(async (installProjectNames, option) => {
|
|
4
|
+
await install(installProjectNames, option, api);
|
|
5
|
+
});
|
|
11
6
|
};
|
package/dist/esm/cli/new.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import { MonorepoNewAction } from "@modern-js/new-action";
|
|
2
2
|
import { i18n, localeKeys } from "../locale";
|
|
3
|
-
const newCli = (program, locale) => {
|
|
4
|
-
program.command("new").usage("[options]").description(i18n.t(localeKeys.command.new.describe)).option("
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
).option("--lang <lang>", i18n.t(localeKeys.command.new.lang)).option("--dist-tag <tag>", i18n.t(localeKeys.command.new.distTag)).option("--registry", i18n.t(localeKeys.command.new.registry)).action(async (options) => {
|
|
13
|
-
await MonorepoNewAction({ ...options, locale: options.lang || locale });
|
|
3
|
+
export const newCli = (program, locale) => {
|
|
4
|
+
program.command("new").usage("[options]").description(i18n.t(localeKeys.command.new.describe)).option("--lang <lang>", i18n.t(localeKeys.command.new.lang)).option("-c, --config <config>", i18n.t(localeKeys.command.new.config)).option("-p, --plugin <plugin>", i18n.t(localeKeys.command.new.plugin), (val, memo) => {
|
|
5
|
+
memo.push(val);
|
|
6
|
+
return memo;
|
|
7
|
+
}, []).option("-d, --debug", i18n.t(localeKeys.command.new.debug), false).option("--dist-tag <tag>", i18n.t(localeKeys.command.new.distTag)).option("--registry", i18n.t(localeKeys.command.new.registry)).action(async (options) => {
|
|
8
|
+
await MonorepoNewAction({
|
|
9
|
+
...options,
|
|
10
|
+
locale: options.lang || locale
|
|
11
|
+
});
|
|
14
12
|
});
|
|
15
13
|
};
|
|
16
|
-
export {
|
|
17
|
-
newCli
|
|
18
|
-
};
|
|
@@ -2,21 +2,14 @@ import { getMonorepoBaseData } from "../parse-config/monorepo";
|
|
|
2
2
|
import { runBuildTask, runAllBuildTask } from "../features/build";
|
|
3
3
|
import { getProjects } from "../projects/getProjects";
|
|
4
4
|
import { initDAG } from "../dag";
|
|
5
|
-
const build = async (targetProjectName, option, api) => {
|
|
5
|
+
export const build = async (targetProjectName, option, api) => {
|
|
6
6
|
const { appDirectory } = api.useAppContext();
|
|
7
|
-
const {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
contentHash = false,
|
|
14
|
-
gitHash = false
|
|
15
|
-
} = option;
|
|
16
|
-
const projects = await getProjects(
|
|
17
|
-
{ packagesMatchs: { enableAutoFinder: true } },
|
|
18
|
-
appDirectory
|
|
19
|
-
);
|
|
7
|
+
const { self = true, dept = false, deps = true, onlySelf = false, all = false, contentHash = false, gitHash = false } = option;
|
|
8
|
+
const projects = await getProjects({
|
|
9
|
+
packagesMatchs: {
|
|
10
|
+
enableAutoFinder: true
|
|
11
|
+
}
|
|
12
|
+
}, appDirectory);
|
|
20
13
|
const operator = initDAG(projects);
|
|
21
14
|
operator.checkCircle();
|
|
22
15
|
const { rootPath, packageManager } = getMonorepoBaseData(appDirectory);
|
|
@@ -51,6 +44,3 @@ const build = async (targetProjectName, option, api) => {
|
|
|
51
44
|
}
|
|
52
45
|
}
|
|
53
46
|
};
|
|
54
|
-
export {
|
|
55
|
-
build
|
|
56
|
-
};
|
|
@@ -2,13 +2,14 @@ import { getMonorepoBaseData } from "../parse-config/monorepo";
|
|
|
2
2
|
import { runBuildWatchTask } from "../features/dev";
|
|
3
3
|
import { getProjects } from "../projects/getProjects";
|
|
4
4
|
import { initDAG } from "../dag";
|
|
5
|
-
const buildWatch = async (targetProjectName, option, api) => {
|
|
5
|
+
export const buildWatch = async (targetProjectName, option, api) => {
|
|
6
6
|
const { appDirectory } = api.useAppContext();
|
|
7
7
|
const { onlySelf = false, init = false } = option;
|
|
8
|
-
const projects = await getProjects(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const projects = await getProjects({
|
|
9
|
+
packagesMatchs: {
|
|
10
|
+
enableAutoFinder: true
|
|
11
|
+
}
|
|
12
|
+
}, appDirectory);
|
|
12
13
|
const operator = initDAG(projects);
|
|
13
14
|
operator.checkCircle();
|
|
14
15
|
const { rootPath, packageManager } = getMonorepoBaseData(process.cwd());
|
|
@@ -19,6 +20,3 @@ const buildWatch = async (targetProjectName, option, api) => {
|
|
|
19
20
|
needInit: init
|
|
20
21
|
});
|
|
21
22
|
};
|
|
22
|
-
export {
|
|
23
|
-
buildWatch
|
|
24
|
-
};
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import { getProjects } from "../projects/getProjects";
|
|
2
2
|
import { getMonorepoBaseData } from "../parse-config/monorepo";
|
|
3
3
|
import { runClearTask } from "../features/clear";
|
|
4
|
-
const clear = async (projectNames, option, api) => {
|
|
4
|
+
export const clear = async (projectNames, option, api) => {
|
|
5
5
|
const { removeDirs } = option;
|
|
6
6
|
const { appDirectory } = api.useAppContext();
|
|
7
|
-
const projects = await getProjects(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
const projects = await getProjects({
|
|
8
|
+
packagesMatchs: {
|
|
9
|
+
enableAutoFinder: true
|
|
10
|
+
}
|
|
11
|
+
}, appDirectory);
|
|
11
12
|
const { rootPath } = getMonorepoBaseData(appDirectory);
|
|
12
13
|
runClearTask(projectNames, projects, {
|
|
13
14
|
rootPath,
|
|
14
15
|
removeDirs
|
|
15
16
|
});
|
|
16
17
|
};
|
|
17
|
-
export {
|
|
18
|
-
clear
|
|
19
|
-
};
|
|
@@ -3,17 +3,16 @@ import { initDAG } from "../dag";
|
|
|
3
3
|
import { getMonorepoBaseData } from "../parse-config/monorepo";
|
|
4
4
|
import { getProjects } from "../projects/getProjects";
|
|
5
5
|
import { deploy as runDeployTask } from "../features/deploy";
|
|
6
|
-
const deploy = async (api, deployProjectNames, option, ignoreMatchs = []) => {
|
|
6
|
+
export const deploy = async (api, deployProjectNames, option, ignoreMatchs = []) => {
|
|
7
7
|
const { deployPath = "output" } = option;
|
|
8
8
|
const { appDirectory } = api.useAppContext();
|
|
9
9
|
logger.info(`start deploy ${deployProjectNames.join(",")}`);
|
|
10
|
-
const projects = await getProjects(
|
|
11
|
-
{
|
|
12
|
-
|
|
13
|
-
packagesIgnoreMatchs: ignoreMatchs
|
|
10
|
+
const projects = await getProjects({
|
|
11
|
+
packagesMatchs: {
|
|
12
|
+
enableAutoFinder: true
|
|
14
13
|
},
|
|
15
|
-
|
|
16
|
-
);
|
|
14
|
+
packagesIgnoreMatchs: ignoreMatchs
|
|
15
|
+
}, appDirectory);
|
|
17
16
|
const { rootPath, packageManager } = getMonorepoBaseData(process.cwd());
|
|
18
17
|
const operator = initDAG(projects);
|
|
19
18
|
await runDeployTask(deployProjectNames, operator, {
|
|
@@ -22,8 +21,8 @@ const deploy = async (api, deployProjectNames, option, ignoreMatchs = []) => {
|
|
|
22
21
|
deployPath
|
|
23
22
|
});
|
|
24
23
|
const runners = api.useHookRunners();
|
|
25
|
-
runners.afterMonorepoDeploy({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
runners.afterMonorepoDeploy({
|
|
25
|
+
operator,
|
|
26
|
+
deployProjectNames
|
|
27
|
+
});
|
|
29
28
|
};
|