@modern-js/monorepo-tools 2.0.0-beta.3 → 2.0.0-beta.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/CHANGELOG.md +103 -0
- package/bin/modern.js +3 -1
- package/dist/js/modern/cli/build-watch.js +30 -5
- package/dist/js/modern/cli/build.js +31 -5
- package/dist/js/modern/cli/clear.js +30 -5
- package/dist/js/modern/cli/deploy.js +35 -7
- package/dist/js/modern/cli/index.js +1 -1
- package/dist/js/modern/cli/install.js +30 -5
- package/dist/js/modern/cli/new.js +56 -14
- package/dist/js/modern/commands/build-watch.js +32 -18
- package/dist/js/modern/commands/build.js +49 -23
- package/dist/js/modern/commands/clear.js +31 -15
- package/dist/js/modern/commands/deploy.js +38 -24
- package/dist/js/modern/commands/index.js +1 -1
- package/dist/js/modern/commands/install.js +32 -17
- package/dist/js/modern/constants.js +13 -9
- package/dist/js/modern/dag/create.js +27 -23
- package/dist/js/modern/dag/edge-manager.js +5 -4
- package/dist/js/modern/dag/index.js +6 -5
- package/dist/js/modern/dag/operator.js +174 -156
- package/dist/js/modern/dag/task.js +64 -39
- package/dist/js/modern/dag/utils.js +32 -38
- package/dist/js/modern/features/build/index.js +47 -28
- package/dist/js/modern/features/clear/index.js +16 -15
- package/dist/js/modern/features/deploy/index.js +107 -82
- package/dist/js/modern/features/dev/cmds.js +4 -3
- package/dist/js/modern/features/dev/create-task.js +43 -34
- package/dist/js/modern/features/dev/index.js +60 -41
- package/dist/js/modern/features/dev/watch-projects-state.js +47 -24
- package/dist/js/modern/features/install/index.js +43 -22
- package/dist/js/modern/hooks/index.js +6 -3
- package/dist/js/modern/index.js +18 -16
- package/dist/js/modern/locale/en.js +10 -7
- package/dist/js/modern/locale/index.js +6 -6
- package/dist/js/modern/locale/zh.js +11 -8
- package/dist/js/modern/log/error.js +6 -3
- package/dist/js/modern/log/multi-tasks-log.js +25 -34
- package/dist/js/modern/log/time.js +26 -11
- package/dist/js/modern/log/utils.js +9 -5
- package/dist/js/modern/package/index.js +5 -6
- package/dist/js/modern/parse-config/index.js +49 -22
- package/dist/js/modern/parse-config/monorepo.js +41 -26
- package/dist/js/modern/projects/check-project-change.js +59 -30
- package/dist/js/modern/projects/clear-memory-files.js +17 -7
- package/dist/js/modern/projects/get-projects-by-packages-config.js +89 -52
- package/dist/js/modern/projects/get-projects-by-workspace-file.js +68 -32
- package/dist/js/modern/projects/get-projects.js +96 -53
- package/dist/js/modern/type.js +0 -1
- package/dist/js/modern/utils/install.js +36 -19
- package/dist/js/modern/utils/language.js +6 -3
- package/dist/js/node/cli/build-watch.js +51 -10
- package/dist/js/node/cli/build.js +52 -10
- package/dist/js/node/cli/clear.js +51 -10
- package/dist/js/node/cli/deploy.js +56 -12
- package/dist/js/node/cli/index.js +22 -71
- package/dist/js/node/cli/install.js +51 -10
- package/dist/js/node/cli/new.js +75 -19
- package/dist/js/node/commands/build-watch.js +59 -29
- package/dist/js/node/commands/build.js +74 -32
- package/dist/js/node/commands/clear.js +57 -25
- package/dist/js/node/commands/deploy.js +65 -35
- package/dist/js/node/commands/index.js +21 -60
- package/dist/js/node/commands/install.js +59 -28
- package/dist/js/node/constants.js +33 -13
- package/dist/js/node/dag/create.js +46 -28
- package/dist/js/node/dag/edge-manager.js +25 -8
- package/dist/js/node/dag/index.js +30 -13
- package/dist/js/node/dag/operator.js +211 -174
- package/dist/js/node/dag/task.js +92 -46
- package/dist/js/node/dag/utils.js +58 -47
- package/dist/js/node/features/build/index.js +84 -47
- package/dist/js/node/features/clear/index.js +49 -28
- package/dist/js/node/features/deploy/index.js +139 -104
- package/dist/js/node/features/dev/cmds.js +26 -9
- package/dist/js/node/features/dev/create-task.js +80 -51
- package/dist/js/node/features/dev/index.js +98 -58
- package/dist/js/node/features/dev/watch-projects-state.js +71 -30
- package/dist/js/node/features/install/index.js +82 -41
- package/dist/js/node/hooks/index.js +27 -8
- package/dist/js/node/index.js +53 -32
- package/dist/js/node/locale/en.js +30 -11
- package/dist/js/node/locale/index.js +31 -14
- package/dist/js/node/locale/zh.js +31 -12
- package/dist/js/node/log/error.js +26 -7
- package/dist/js/node/log/multi-tasks-log.js +48 -41
- package/dist/js/node/log/time.js +47 -18
- package/dist/js/node/log/utils.js +30 -10
- package/dist/js/node/package/index.js +25 -10
- package/dist/js/node/parse-config/index.js +76 -31
- package/dist/js/node/parse-config/monorepo.js +79 -44
- package/dist/js/node/projects/check-project-change.js +104 -56
- package/dist/js/node/projects/clear-memory-files.js +42 -15
- package/dist/js/node/projects/get-projects-by-packages-config.js +119 -65
- package/dist/js/node/projects/get-projects-by-workspace-file.js +108 -55
- package/dist/js/node/projects/get-projects.js +112 -61
- package/dist/js/node/type.js +15 -5
- package/dist/js/node/utils/install.js +68 -31
- package/dist/js/node/utils/language.js +28 -8
- package/dist/js/node/utils/types.js +15 -0
- package/dist/types/dag/operator.d.ts +3 -0
- package/dist/types/dag/utils.d.ts +1 -0
- package/dist/types/features/dev/index.d.ts +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/projects/get-projects.d.ts +1 -0
- package/package.json +12 -19
|
@@ -1,47 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var utils_exports = {};
|
|
19
|
+
__export(utils_exports, {
|
|
20
|
+
calculateCriticalPaths: () => calculateCriticalPaths,
|
|
21
|
+
findCircle: () => findCircle,
|
|
22
|
+
recursiveGetDependency: () => recursiveGetDependency,
|
|
23
|
+
sortProjects: () => sortProjects
|
|
5
24
|
});
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*/
|
|
13
|
-
const calculateCriticalPaths = project => {
|
|
14
|
-
var _project$dependent;
|
|
15
|
-
// Return the memoized value
|
|
16
|
-
if (project.criticalPathLength !== undefined) {
|
|
25
|
+
module.exports = __toCommonJS(utils_exports);
|
|
26
|
+
var import_error = require("../log/error");
|
|
27
|
+
var import_edge_manager = require("./edge-manager");
|
|
28
|
+
const calculateCriticalPaths = (project) => {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
if (project.criticalPathLength !== void 0) {
|
|
17
31
|
return project.criticalPathLength;
|
|
18
32
|
}
|
|
19
|
-
|
|
20
|
-
// If no dependents, we are in a "root"
|
|
21
|
-
if (((_project$dependent = project.dependent) === null || _project$dependent === void 0 ? void 0 : _project$dependent.length) === 0) {
|
|
33
|
+
if (((_a = project.dependent) == null ? void 0 : _a.length) === 0) {
|
|
22
34
|
project.criticalPathLength = 0;
|
|
23
35
|
return project.criticalPathLength;
|
|
24
36
|
} else {
|
|
25
|
-
var _project$dependent2;
|
|
26
|
-
// Otherwise we are as long as the longest package + 1
|
|
27
37
|
const depsLengths = [];
|
|
28
|
-
(
|
|
38
|
+
(_b = project.dependent) == null ? void 0 : _b.forEach(
|
|
39
|
+
(dependentProject) => depsLengths.push(calculateCriticalPaths(dependentProject))
|
|
40
|
+
);
|
|
29
41
|
project.criticalPathLength = Math.max(...depsLengths) + 1;
|
|
30
42
|
return project.criticalPathLength;
|
|
31
43
|
}
|
|
32
44
|
};
|
|
33
|
-
|
|
34
|
-
const _recursiveGetDependencySkipCircleDeps = node => {
|
|
45
|
+
const _recursiveGetDependencySkipCircleDeps = (node) => {
|
|
35
46
|
let allDeps = [];
|
|
36
|
-
const foundDepsNameSet = new Set([node.name]);
|
|
47
|
+
const foundDepsNameSet = /* @__PURE__ */ new Set([node.name]);
|
|
37
48
|
let queue = [node];
|
|
38
49
|
while (queue.length > 0) {
|
|
39
50
|
const checkNode = queue.pop();
|
|
40
51
|
const checkNodeDeps = checkNode.dependency || [];
|
|
41
52
|
if (checkNodeDeps.length > 0) {
|
|
42
|
-
const willIntoQueue = checkNodeDeps.filter(
|
|
53
|
+
const willIntoQueue = checkNodeDeps.filter(
|
|
54
|
+
(dep) => !foundDepsNameSet.has(dep.name)
|
|
55
|
+
);
|
|
43
56
|
allDeps = [...allDeps, ...willIntoQueue];
|
|
44
|
-
willIntoQueue.forEach(dep => foundDepsNameSet.add(dep.name));
|
|
57
|
+
willIntoQueue.forEach((dep) => foundDepsNameSet.add(dep.name));
|
|
45
58
|
queue = [...queue, ...willIntoQueue];
|
|
46
59
|
}
|
|
47
60
|
}
|
|
@@ -54,32 +67,26 @@ const recursiveGetDependency = (project, skipCircleProjects = false) => {
|
|
|
54
67
|
const dependency = project.dependency || [];
|
|
55
68
|
let allDependency = [...dependency];
|
|
56
69
|
for (const dependencyProject of dependency) {
|
|
57
|
-
allDependency = [
|
|
70
|
+
allDependency = [
|
|
71
|
+
...allDependency,
|
|
72
|
+
...recursiveGetDependency(dependencyProject)
|
|
73
|
+
];
|
|
58
74
|
}
|
|
59
75
|
return allDependency;
|
|
60
76
|
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
let readyIntoSortedQueue = []; // 用来准备放入 sortedQueue的数组
|
|
67
|
-
let queue = []; // 用来存放入度为0的节点
|
|
68
|
-
const edgeManager = new _edgeManager.EdgeManager();
|
|
69
|
-
// 初始化队列queue
|
|
77
|
+
const sortProjects = (projects) => {
|
|
78
|
+
const sortedQueue = [];
|
|
79
|
+
let readyIntoSortedQueue = [];
|
|
80
|
+
let queue = [];
|
|
81
|
+
const edgeManager = new import_edge_manager.EdgeManager();
|
|
70
82
|
for (const project of projects) {
|
|
71
83
|
edgeManager.setEdge(project);
|
|
72
|
-
// 入度为0进队列
|
|
73
|
-
// TODO 可能存在多个 dagNodeFrom === 0 的节点
|
|
74
84
|
if (edgeManager.getEdge(project) === 0) {
|
|
75
85
|
queue.push(project);
|
|
76
86
|
}
|
|
77
87
|
}
|
|
78
|
-
|
|
79
|
-
// 加入最初入度为0的节点
|
|
80
88
|
sortedQueue.push([...queue]);
|
|
81
|
-
let shiftNodesCount = 0;
|
|
82
|
-
|
|
89
|
+
let shiftNodesCount = 0;
|
|
83
90
|
while (queue.length > 0) {
|
|
84
91
|
const checkNode = queue.shift();
|
|
85
92
|
shiftNodesCount++;
|
|
@@ -96,14 +103,12 @@ const sortProjects = projects => {
|
|
|
96
103
|
}
|
|
97
104
|
}
|
|
98
105
|
if (shiftNodesCount < projects.length) {
|
|
99
|
-
(0,
|
|
106
|
+
(0, import_error.errorLog)("Items with a dependency loop");
|
|
100
107
|
} else {
|
|
101
|
-
// console.info('No dependency loop');
|
|
102
108
|
}
|
|
103
109
|
return sortedQueue;
|
|
104
110
|
};
|
|
105
|
-
|
|
106
|
-
const findCircle = projects => {
|
|
111
|
+
const findCircle = (projects) => {
|
|
107
112
|
let result = projects.reduce((circleNodes, project) => {
|
|
108
113
|
if (project.dependencyEdge > 0) {
|
|
109
114
|
return [...circleNodes, project];
|
|
@@ -116,4 +121,10 @@ const findCircle = projects => {
|
|
|
116
121
|
checkNode.dependencyEdge--;
|
|
117
122
|
}
|
|
118
123
|
};
|
|
119
|
-
|
|
124
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
125
|
+
0 && (module.exports = {
|
|
126
|
+
calculateCriticalPaths,
|
|
127
|
+
findCircle,
|
|
128
|
+
recursiveGetDependency,
|
|
129
|
+
sortProjects
|
|
130
|
+
});
|
|
@@ -1,15 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
var __async = (__this, __arguments, generator) => {
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
var fulfilled = (value) => {
|
|
27
|
+
try {
|
|
28
|
+
step(generator.next(value));
|
|
29
|
+
} catch (e) {
|
|
30
|
+
reject(e);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
var rejected = (value) => {
|
|
34
|
+
try {
|
|
35
|
+
step(generator.throw(value));
|
|
36
|
+
} catch (e) {
|
|
37
|
+
reject(e);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
41
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var build_exports = {};
|
|
45
|
+
__export(build_exports, {
|
|
46
|
+
runAllBuildTask: () => runAllBuildTask,
|
|
47
|
+
runBuildTask: () => runBuildTask
|
|
5
48
|
});
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
49
|
+
module.exports = __toCommonJS(build_exports);
|
|
50
|
+
var import_os = __toESM(require("os"));
|
|
51
|
+
var import_utils = require("@modern-js/utils");
|
|
52
|
+
var import_check_project_change = require("../../projects/check-project-change");
|
|
53
|
+
var import_error = require("../../log/error");
|
|
54
|
+
var import_multi_tasks_log = require("../../log/multi-tasks-log");
|
|
13
55
|
const createTask = (config, taskCmds = defaultBuildCmds, taskLogger) => {
|
|
14
56
|
const {
|
|
15
57
|
rootPath,
|
|
@@ -17,18 +59,17 @@ const createTask = (config, taskCmds = defaultBuildCmds, taskLogger) => {
|
|
|
17
59
|
disableContentHash = false,
|
|
18
60
|
enableGitHash = false
|
|
19
61
|
} = config;
|
|
20
|
-
const task =
|
|
21
|
-
console.info(
|
|
22
|
-
// const taskTimeLog = timeLog.initTimeLog({ scope: '' });
|
|
62
|
+
const task = (project) => __async(void 0, null, function* () {
|
|
63
|
+
console.info("run ", project.name);
|
|
23
64
|
if (!disableContentHash) {
|
|
24
|
-
const changed =
|
|
65
|
+
const changed = yield (0, import_check_project_change.checkProjectChangeByContent)(project);
|
|
25
66
|
if (!changed) {
|
|
26
67
|
console.info(`${project.name} content not change, skip`);
|
|
27
68
|
return;
|
|
28
69
|
}
|
|
29
70
|
}
|
|
30
71
|
if (enableGitHash) {
|
|
31
|
-
const changed =
|
|
72
|
+
const changed = yield (0, import_check_project_change.checkProjectChangeByGit)(project, rootPath);
|
|
32
73
|
if (!changed) {
|
|
33
74
|
console.info(`${project.name} not change, skip`);
|
|
34
75
|
return;
|
|
@@ -39,69 +80,65 @@ const createTask = (config, taskCmds = defaultBuildCmds, taskLogger) => {
|
|
|
39
80
|
for (const taskCmd of taskCmds) {
|
|
40
81
|
if (cmd[taskCmd]) {
|
|
41
82
|
const prefix = `run ${project.name} ${taskCmd} script`;
|
|
42
|
-
|
|
43
|
-
_utils.signale.time(prefix);
|
|
83
|
+
import_utils.signale.time(prefix);
|
|
44
84
|
try {
|
|
45
|
-
const childProcess = (0,
|
|
85
|
+
const childProcess = (0, import_utils.execa)(packageManager, [taskCmd], {
|
|
46
86
|
cwd: project.extra.path,
|
|
47
|
-
stdio: [
|
|
87
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
48
88
|
});
|
|
49
89
|
taskLogger.addLogProvider(project.name, {
|
|
50
90
|
stdout: childProcess.stdout,
|
|
51
91
|
stderr: childProcess.stderr,
|
|
52
|
-
logConfig: {
|
|
53
|
-
label: 'BUILD: '
|
|
54
|
-
}
|
|
92
|
+
logConfig: { label: "BUILD: " }
|
|
55
93
|
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
_utils.signale.timeEnd(prefix);
|
|
94
|
+
yield childProcess;
|
|
95
|
+
import_utils.signale.timeEnd(prefix);
|
|
59
96
|
} catch (e) {
|
|
60
|
-
(0,
|
|
97
|
+
(0, import_error.errorLog)(project.name, e.message);
|
|
61
98
|
}
|
|
62
99
|
} else {
|
|
63
100
|
console.info(`${project.name} not have ${taskCmd}, skip it.`);
|
|
64
101
|
}
|
|
65
102
|
}
|
|
66
|
-
};
|
|
103
|
+
});
|
|
67
104
|
return task;
|
|
68
105
|
};
|
|
69
|
-
const defaultBuildCmds = [
|
|
70
|
-
const runBuildTask =
|
|
106
|
+
const defaultBuildCmds = ["build"];
|
|
107
|
+
const runBuildTask = (_0, _1, _2, ..._3) => __async(void 0, [_0, _1, _2, ..._3], function* (projectName, operator, config, taskCmds = defaultBuildCmds) {
|
|
71
108
|
const {
|
|
72
109
|
withSelf = true,
|
|
73
110
|
onlySelf = false,
|
|
74
111
|
disableWithDeps = false,
|
|
75
112
|
withDept = false
|
|
76
113
|
} = config;
|
|
77
|
-
const taskLogger = new
|
|
114
|
+
const taskLogger = new import_multi_tasks_log.MultitasksLogger();
|
|
78
115
|
const task = createTask(config, taskCmds, taskLogger);
|
|
79
|
-
// 优先级 onlySelf > withDept、disableWithDeps
|
|
80
116
|
if (onlySelf) {
|
|
81
|
-
|
|
82
|
-
checkExist: true
|
|
83
|
-
}));
|
|
117
|
+
yield task(operator.getNodeData(projectName, { checkExist: true }));
|
|
84
118
|
} else if (!disableWithDeps && withDept) {
|
|
85
|
-
|
|
119
|
+
yield operator.traverseDependenciesToProjectToDependent(projectName, task, {
|
|
86
120
|
withSelf,
|
|
87
|
-
runTaskConcurrency:
|
|
121
|
+
runTaskConcurrency: import_os.default.cpus().length
|
|
88
122
|
});
|
|
89
123
|
} else if (disableWithDeps && withDept) {
|
|
90
|
-
|
|
124
|
+
yield operator.traverseProjectToDependent(projectName, task, {
|
|
91
125
|
withSelf,
|
|
92
|
-
runTaskConcurrency:
|
|
126
|
+
runTaskConcurrency: import_os.default.cpus().length
|
|
93
127
|
});
|
|
94
128
|
} else {
|
|
95
129
|
operator.traverseDependenciesToProject(projectName, task, {
|
|
96
130
|
withSelf,
|
|
97
|
-
runTaskConcurrency:
|
|
131
|
+
runTaskConcurrency: import_os.default.cpus().length
|
|
98
132
|
});
|
|
99
133
|
}
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
const taskLogger = new _multiTasksLog.MultitasksLogger();
|
|
134
|
+
});
|
|
135
|
+
const runAllBuildTask = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (operator, config, taskCmds = defaultBuildCmds) {
|
|
136
|
+
const taskLogger = new import_multi_tasks_log.MultitasksLogger();
|
|
104
137
|
const task = createTask(config, taskCmds, taskLogger);
|
|
105
|
-
|
|
106
|
-
};
|
|
107
|
-
|
|
138
|
+
yield operator.traverseAllNodes(task);
|
|
139
|
+
});
|
|
140
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
141
|
+
0 && (module.exports = {
|
|
142
|
+
runAllBuildTask,
|
|
143
|
+
runBuildTask
|
|
144
|
+
});
|
|
@@ -1,44 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
var clear_exports = {};
|
|
25
|
+
__export(clear_exports, {
|
|
26
|
+
defaultRemoveDirs: () => defaultRemoveDirs,
|
|
27
|
+
runClearTask: () => runClearTask
|
|
5
28
|
});
|
|
6
|
-
|
|
7
|
-
var path =
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
|
-
const defaultRemoveDirs = ['node_modules'];
|
|
13
|
-
exports.defaultRemoveDirs = defaultRemoveDirs;
|
|
29
|
+
module.exports = __toCommonJS(clear_exports);
|
|
30
|
+
var path = __toESM(require("path"));
|
|
31
|
+
var import_utils = require("@modern-js/utils");
|
|
32
|
+
var import_node_core_library = require("@rushstack/node-core-library");
|
|
33
|
+
const defaultRemoveDirs = ["node_modules"];
|
|
14
34
|
const runClearTask = (projectNames, projects, config) => {
|
|
15
|
-
const {
|
|
16
|
-
removeDirs = defaultRemoveDirs,
|
|
17
|
-
rootPath
|
|
18
|
-
} = config;
|
|
35
|
+
const { removeDirs = defaultRemoveDirs, rootPath } = config;
|
|
19
36
|
if (projectNames.length > 0) {
|
|
20
|
-
projects.forEach(project => {
|
|
37
|
+
projects.forEach((project) => {
|
|
21
38
|
if (projectNames.includes(project.name)) {
|
|
22
|
-
removeDirs.forEach(dir => {
|
|
39
|
+
removeDirs.forEach((dir) => {
|
|
23
40
|
const removePath = path.join(`${project.extra.path}`, dir);
|
|
24
|
-
|
|
25
|
-
|
|
41
|
+
import_utils.logger.info(`remove ${removePath}`);
|
|
42
|
+
import_node_core_library.FileSystem.deleteFolder(removePath);
|
|
26
43
|
});
|
|
27
44
|
}
|
|
28
45
|
});
|
|
29
46
|
} else {
|
|
30
|
-
removeDirs.forEach(dir => {
|
|
47
|
+
removeDirs.forEach((dir) => {
|
|
31
48
|
const removePath = path.join(`${rootPath}`, dir);
|
|
32
|
-
|
|
33
|
-
|
|
49
|
+
import_utils.logger.info(`remove ${removePath}`);
|
|
50
|
+
import_node_core_library.FileSystem.deleteFolder(removePath);
|
|
34
51
|
});
|
|
35
|
-
projects.forEach(project => {
|
|
36
|
-
removeDirs.forEach(dir => {
|
|
52
|
+
projects.forEach((project) => {
|
|
53
|
+
removeDirs.forEach((dir) => {
|
|
37
54
|
const removePath = path.join(`${project.extra.path}`, dir);
|
|
38
|
-
|
|
39
|
-
|
|
55
|
+
import_utils.logger.info(`remove ${removePath}`);
|
|
56
|
+
import_node_core_library.FileSystem.deleteFolder(removePath);
|
|
40
57
|
});
|
|
41
58
|
});
|
|
42
59
|
}
|
|
43
60
|
};
|
|
44
|
-
|
|
61
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
62
|
+
0 && (module.exports = {
|
|
63
|
+
defaultRemoveDirs,
|
|
64
|
+
runClearTask
|
|
65
|
+
});
|