@modern-js/monorepo-tools 2.5.0 → 2.7.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 +44 -0
- package/dist/cjs/cli/{build-watch.js → buildWatch.js} +3 -3
- package/dist/cjs/cli/index.js +1 -1
- package/dist/cjs/commands/build.js +3 -2
- package/dist/cjs/commands/{build-watch.js → buildWatch.js} +5 -5
- package/dist/cjs/commands/clear.js +2 -2
- package/dist/cjs/commands/deploy.js +2 -2
- package/dist/cjs/commands/index.js +1 -1
- package/dist/cjs/commands/install.js +2 -2
- package/dist/cjs/dag/create.js +4 -1
- package/dist/cjs/dag/{edge-manager.js → edgeManager.js} +3 -3
- package/dist/cjs/dag/operator.js +40 -3
- package/dist/cjs/dag/task.js +4 -0
- package/dist/cjs/dag/utils.js +2 -2
- package/dist/cjs/features/build/index.js +10 -6
- package/dist/cjs/features/clear/index.js +4 -0
- package/dist/cjs/features/deploy/index.js +5 -0
- package/dist/cjs/features/dev/{create-task.js → createTask.js} +7 -3
- package/dist/cjs/features/dev/index.js +11 -7
- package/dist/cjs/features/dev/{watch-projects-state.js → watchProjectsState.js} +7 -3
- package/dist/cjs/features/install/index.js +4 -0
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/log/{multi-tasks-log.js → multiTasksLog.js} +3 -3
- package/dist/cjs/parse-config/index.js +9 -1
- package/dist/cjs/parse-config/monorepo.js +4 -0
- package/dist/cjs/projects/{check-project-change.js → checkProjectChange.js} +7 -3
- package/dist/cjs/projects/{clear-memory-files.js → clearMemoryFiles.js} +10 -6
- package/dist/cjs/projects/{get-projects.js → getProjects.js} +12 -9
- package/dist/cjs/projects/{get-projects-by-packages-config.js → getProjectsByPackagesConfig.js} +9 -3
- package/dist/cjs/projects/{get-projects-by-workspace-file.js → getProjectsByWorkspaceFile.js} +10 -6
- package/dist/cjs/utils/install.js +4 -0
- package/dist/esm/cli/index.js +1 -1
- package/dist/esm/commands/build.js +2 -1
- package/dist/esm/commands/{build-watch.js → buildWatch.js} +1 -1
- package/dist/esm/commands/clear.js +1 -1
- package/dist/esm/commands/deploy.js +1 -1
- package/dist/esm/commands/index.js +1 -1
- package/dist/esm/commands/install.js +1 -1
- package/dist/esm/dag/create.js +4 -1
- package/dist/esm/dag/operator.js +34 -1
- package/dist/esm/dag/utils.js +1 -1
- package/dist/esm/features/build/index.js +2 -2
- package/dist/esm/features/deploy/index.js +1 -0
- package/dist/esm/features/dev/index.js +3 -3
- package/dist/esm/parse-config/index.js +5 -1
- package/dist/esm/projects/{clear-memory-files.js → clearMemoryFiles.js} +1 -1
- package/dist/esm/projects/{get-projects.js → getProjects.js} +5 -2
- package/dist/esm/projects/{get-projects-by-packages-config.js → getProjectsByPackagesConfig.js} +2 -0
- package/dist/esm/projects/{get-projects-by-workspace-file.js → getProjectsByWorkspaceFile.js} +1 -1
- package/dist/types/cli/index.d.ts +1 -1
- package/dist/types/commands/index.d.ts +1 -1
- package/dist/types/dag/create.d.ts +1 -1
- package/dist/types/dag/{edge-manager.d.ts → edgeManager.d.ts} +1 -1
- package/dist/types/dag/index.d.ts +1 -1
- package/dist/types/dag/operator.d.ts +1 -1
- package/dist/types/dag/utils.d.ts +1 -1
- package/dist/types/features/clear/index.d.ts +1 -1
- package/dist/types/features/dev/cmds.d.ts +1 -1
- package/dist/types/features/dev/{create-task.d.ts → createTask.d.ts} +2 -2
- package/dist/types/features/dev/index.d.ts +1 -1
- package/dist/types/features/dev/{watch-projects-state.d.ts → watchProjectsState.d.ts} +1 -1
- package/dist/types/package/index.d.ts +1 -1
- package/dist/types/projects/{check-project-change.d.ts → checkProjectChange.d.ts} +1 -1
- package/dist/types/projects/{clear-memory-files.d.ts → clearMemoryFiles.d.ts} +1 -1
- package/package.json +11 -11
- /package/dist/esm/cli/{build-watch.js → buildWatch.js} +0 -0
- /package/dist/esm/dag/{edge-manager.js → edgeManager.js} +0 -0
- /package/dist/esm/features/dev/{create-task.js → createTask.js} +0 -0
- /package/dist/esm/features/dev/{watch-projects-state.js → watchProjectsState.js} +0 -0
- /package/dist/esm/log/{multi-tasks-log.js → multiTasksLog.js} +0 -0
- /package/dist/esm/projects/{check-project-change.js → checkProjectChange.js} +0 -0
- /package/dist/types/cli/{build-watch.d.ts → buildWatch.d.ts} +0 -0
- /package/dist/types/commands/{build-watch.d.ts → buildWatch.d.ts} +0 -0
- /package/dist/types/log/{multi-tasks-log.d.ts → multiTasksLog.d.ts} +0 -0
- /package/dist/types/projects/{get-projects.d.ts → getProjects.d.ts} +0 -0
- /package/dist/types/projects/{get-projects-by-packages-config.d.ts → getProjectsByPackagesConfig.d.ts} +0 -0
- /package/dist/types/projects/{get-projects-by-workspace-file.d.ts → getProjectsByWorkspaceFile.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
# @modern-js/monorepo-tools
|
|
2
2
|
|
|
3
|
+
## 2.7.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7fff9020e1: chore: make file naming consistent
|
|
8
|
+
|
|
9
|
+
chore: 统一文件命名为小驼峰格式
|
|
10
|
+
|
|
11
|
+
- 1eea234fdd: chore: make test files naming consistent
|
|
12
|
+
|
|
13
|
+
chore: 统一测试文件命名为小驼峰格式
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [206c806efa]
|
|
16
|
+
- Updated dependencies [0f15fc597c]
|
|
17
|
+
- Updated dependencies [dcad887024]
|
|
18
|
+
- Updated dependencies [a4672f7c16]
|
|
19
|
+
- Updated dependencies [7fff9020e1]
|
|
20
|
+
- Updated dependencies [1eea234fdd]
|
|
21
|
+
- Updated dependencies [84bfb439b8]
|
|
22
|
+
- @modern-js/core@2.7.0
|
|
23
|
+
- @modern-js/utils@2.7.0
|
|
24
|
+
- @modern-js/plugin-changeset@2.7.0
|
|
25
|
+
- @modern-js/plugin-i18n@2.7.0
|
|
26
|
+
- @modern-js/plugin-lint@2.7.0
|
|
27
|
+
- @modern-js/new-action@2.7.0
|
|
28
|
+
- @modern-js/upgrade@2.7.0
|
|
29
|
+
- @modern-js/plugin@2.7.0
|
|
30
|
+
|
|
31
|
+
## 2.6.0
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies [e1f799e]
|
|
36
|
+
- Updated dependencies [7915ab3]
|
|
37
|
+
- Updated dependencies [0fe658a]
|
|
38
|
+
- @modern-js/utils@2.6.0
|
|
39
|
+
- @modern-js/core@2.6.0
|
|
40
|
+
- @modern-js/plugin-changeset@2.6.0
|
|
41
|
+
- @modern-js/plugin-i18n@2.6.0
|
|
42
|
+
- @modern-js/plugin-lint@2.6.0
|
|
43
|
+
- @modern-js/new-action@2.6.0
|
|
44
|
+
- @modern-js/upgrade@2.6.0
|
|
45
|
+
- @modern-js/plugin@2.6.0
|
|
46
|
+
|
|
3
47
|
## 2.5.0
|
|
4
48
|
|
|
5
49
|
### Patch Changes
|
|
@@ -15,11 +15,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var
|
|
19
|
-
__export(
|
|
18
|
+
var buildWatch_exports = {};
|
|
19
|
+
__export(buildWatch_exports, {
|
|
20
20
|
buildWatchCli: () => buildWatchCli
|
|
21
21
|
});
|
|
22
|
-
module.exports = __toCommonJS(
|
|
22
|
+
module.exports = __toCommonJS(buildWatch_exports);
|
|
23
23
|
var import_commands = require("../commands");
|
|
24
24
|
const buildWatchCli = (program, api) => {
|
|
25
25
|
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(
|
package/dist/cjs/cli/index.js
CHANGED
|
@@ -17,6 +17,6 @@ module.exports = __toCommonJS(cli_exports);
|
|
|
17
17
|
__reExport(cli_exports, require("./new"), module.exports);
|
|
18
18
|
__reExport(cli_exports, require("./deploy"), module.exports);
|
|
19
19
|
__reExport(cli_exports, require("./build"), module.exports);
|
|
20
|
-
__reExport(cli_exports, require("./
|
|
20
|
+
__reExport(cli_exports, require("./buildWatch"), module.exports);
|
|
21
21
|
__reExport(cli_exports, require("./clear"), module.exports);
|
|
22
22
|
__reExport(cli_exports, require("./install"), module.exports);
|
|
@@ -22,7 +22,7 @@ __export(build_exports, {
|
|
|
22
22
|
module.exports = __toCommonJS(build_exports);
|
|
23
23
|
var import_monorepo = require("../parse-config/monorepo");
|
|
24
24
|
var import_build = require("../features/build");
|
|
25
|
-
var
|
|
25
|
+
var import_getProjects = require("../projects/getProjects");
|
|
26
26
|
var import_dag = require("../dag");
|
|
27
27
|
const build = async (targetProjectName, option, api) => {
|
|
28
28
|
const { appDirectory } = api.useAppContext();
|
|
@@ -35,7 +35,7 @@ const build = async (targetProjectName, option, api) => {
|
|
|
35
35
|
contentHash = false,
|
|
36
36
|
gitHash = false
|
|
37
37
|
} = option;
|
|
38
|
-
const projects = await (0,
|
|
38
|
+
const projects = await (0, import_getProjects.getProjects)(
|
|
39
39
|
{ packagesMatchs: { enableAutoFinder: true } },
|
|
40
40
|
appDirectory
|
|
41
41
|
);
|
|
@@ -56,6 +56,7 @@ const build = async (targetProjectName, option, api) => {
|
|
|
56
56
|
withDept: dept,
|
|
57
57
|
onlySelf,
|
|
58
58
|
disableWithDeps: !deps,
|
|
59
|
+
// The CI/CD phase is recommended to be switched on
|
|
59
60
|
disableContentHash: !contentHash,
|
|
60
61
|
enableGitHash: gitHash,
|
|
61
62
|
...overrideConfig
|
|
@@ -15,19 +15,19 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var
|
|
19
|
-
__export(
|
|
18
|
+
var buildWatch_exports = {};
|
|
19
|
+
__export(buildWatch_exports, {
|
|
20
20
|
buildWatch: () => buildWatch
|
|
21
21
|
});
|
|
22
|
-
module.exports = __toCommonJS(
|
|
22
|
+
module.exports = __toCommonJS(buildWatch_exports);
|
|
23
23
|
var import_monorepo = require("../parse-config/monorepo");
|
|
24
24
|
var import_dev = require("../features/dev");
|
|
25
|
-
var
|
|
25
|
+
var import_getProjects = require("../projects/getProjects");
|
|
26
26
|
var import_dag = require("../dag");
|
|
27
27
|
const buildWatch = async (targetProjectName, option, api) => {
|
|
28
28
|
const { appDirectory } = api.useAppContext();
|
|
29
29
|
const { onlySelf = false, init = false } = option;
|
|
30
|
-
const projects = await (0,
|
|
30
|
+
const projects = await (0, import_getProjects.getProjects)(
|
|
31
31
|
{ packagesMatchs: { enableAutoFinder: true } },
|
|
32
32
|
appDirectory
|
|
33
33
|
);
|
|
@@ -20,13 +20,13 @@ __export(clear_exports, {
|
|
|
20
20
|
clear: () => clear
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(clear_exports);
|
|
23
|
-
var
|
|
23
|
+
var import_getProjects = require("../projects/getProjects");
|
|
24
24
|
var import_monorepo = require("../parse-config/monorepo");
|
|
25
25
|
var import_clear = require("../features/clear");
|
|
26
26
|
const clear = async (projectNames, option, api) => {
|
|
27
27
|
const { removeDirs } = option;
|
|
28
28
|
const { appDirectory } = api.useAppContext();
|
|
29
|
-
const projects = await (0,
|
|
29
|
+
const projects = await (0, import_getProjects.getProjects)(
|
|
30
30
|
{ packagesMatchs: { enableAutoFinder: true } },
|
|
31
31
|
appDirectory
|
|
32
32
|
);
|
|
@@ -23,13 +23,13 @@ module.exports = __toCommonJS(deploy_exports);
|
|
|
23
23
|
var import_utils = require("@modern-js/utils");
|
|
24
24
|
var import_dag = require("../dag");
|
|
25
25
|
var import_monorepo = require("../parse-config/monorepo");
|
|
26
|
-
var
|
|
26
|
+
var import_getProjects = require("../projects/getProjects");
|
|
27
27
|
var import_deploy = require("../features/deploy");
|
|
28
28
|
const deploy = async (api, deployProjectNames, option, ignoreMatchs = []) => {
|
|
29
29
|
const { deployPath = "output" } = option;
|
|
30
30
|
const { appDirectory } = api.useAppContext();
|
|
31
31
|
import_utils.logger.info(`start deploy ${deployProjectNames.join(",")}`);
|
|
32
|
-
const projects = await (0,
|
|
32
|
+
const projects = await (0, import_getProjects.getProjects)(
|
|
33
33
|
{
|
|
34
34
|
packagesMatchs: { enableAutoFinder: true },
|
|
35
35
|
packagesIgnoreMatchs: ignoreMatchs
|
|
@@ -16,6 +16,6 @@ var commands_exports = {};
|
|
|
16
16
|
module.exports = __toCommonJS(commands_exports);
|
|
17
17
|
__reExport(commands_exports, require("./deploy"), module.exports);
|
|
18
18
|
__reExport(commands_exports, require("./build"), module.exports);
|
|
19
|
-
__reExport(commands_exports, require("./
|
|
19
|
+
__reExport(commands_exports, require("./buildWatch"), module.exports);
|
|
20
20
|
__reExport(commands_exports, require("./clear"), module.exports);
|
|
21
21
|
__reExport(commands_exports, require("./install"), module.exports);
|
|
@@ -22,12 +22,12 @@ __export(install_exports, {
|
|
|
22
22
|
module.exports = __toCommonJS(install_exports);
|
|
23
23
|
var import_install = require("../features/install");
|
|
24
24
|
var import_monorepo = require("../parse-config/monorepo");
|
|
25
|
-
var
|
|
25
|
+
var import_getProjects = require("../projects/getProjects");
|
|
26
26
|
var import_dag = require("../dag");
|
|
27
27
|
const install = async (projectNames = [], option, api) => {
|
|
28
28
|
const { appDirectory } = api.useAppContext();
|
|
29
29
|
const { auto } = option;
|
|
30
|
-
const projects = await (0,
|
|
30
|
+
const projects = await (0, import_getProjects.getProjects)(
|
|
31
31
|
{ packagesMatchs: { enableAutoFinder: true } },
|
|
32
32
|
appDirectory
|
|
33
33
|
);
|
package/dist/cjs/dag/create.js
CHANGED
|
@@ -33,7 +33,10 @@ const initProjectDependencyAndDependent = (project, projectsName, projectsMap) =
|
|
|
33
33
|
project.dependency = DependencyProjectsName.map((projectName) => {
|
|
34
34
|
const dependencyProject = projectsMap.get(projectName);
|
|
35
35
|
const dependent = (dependencyProject == null ? void 0 : dependencyProject.dependent) || [];
|
|
36
|
-
if (
|
|
36
|
+
if (
|
|
37
|
+
// 消除重复添加的情况
|
|
38
|
+
!dependent.some((p) => p.name === project.name)
|
|
39
|
+
) {
|
|
37
40
|
dependencyProject.dependent = [...dependent, project];
|
|
38
41
|
dependencyProject.dependentEdge = dependencyProject.dependent.length;
|
|
39
42
|
}
|
|
@@ -15,11 +15,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var
|
|
19
|
-
__export(
|
|
18
|
+
var edgeManager_exports = {};
|
|
19
|
+
__export(edgeManager_exports, {
|
|
20
20
|
EdgeManager: () => EdgeManager
|
|
21
21
|
});
|
|
22
|
-
module.exports = __toCommonJS(
|
|
22
|
+
module.exports = __toCommonJS(edgeManager_exports);
|
|
23
23
|
class EdgeManager {
|
|
24
24
|
constructor() {
|
|
25
25
|
this._dependencyEdgeHash = {};
|
package/dist/cjs/dag/operator.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -29,7 +33,7 @@ module.exports = __toCommonJS(operator_exports);
|
|
|
29
33
|
var import_p_map = __toESM(require("p-map"));
|
|
30
34
|
var import_error = require("../log/error");
|
|
31
35
|
var import_task = require("./task");
|
|
32
|
-
var
|
|
36
|
+
var import_edgeManager = require("./edgeManager");
|
|
33
37
|
var import_utils = require("./utils");
|
|
34
38
|
class DagOperator {
|
|
35
39
|
constructor(projects, projectsMap) {
|
|
@@ -91,6 +95,7 @@ class DagOperator {
|
|
|
91
95
|
}
|
|
92
96
|
await (0, import_p_map.default)(
|
|
93
97
|
projects,
|
|
98
|
+
// eslint-disable-next-line @typescript-eslint/no-loop-func
|
|
94
99
|
async (project) => {
|
|
95
100
|
if (!finishTaskHash[project.name]) {
|
|
96
101
|
finishTaskHash[project.name] = true;
|
|
@@ -116,6 +121,14 @@ class DagOperator {
|
|
|
116
121
|
withSelf: false
|
|
117
122
|
});
|
|
118
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* 1. 把目标节点当做叶子节点集合 A 中的元素
|
|
126
|
+
* 2. 当叶子节点集合中某个 a 元素结束任务的时候进行如下操作:
|
|
127
|
+
* 2.1 剪(去额外的)枝:获取 a 元素的 dependent集合,将该集合中元素的依赖列表进行过滤,过滤条件为:排除 a 以及 a 元素的 dependent集合以外的元素。
|
|
128
|
+
* 2.2 入度减一:对 a 元素的 dependent 集合元素的 dependencyEdge 减一
|
|
129
|
+
* 3. 检查是否存在 dependencyEdge === 0 的节点,加入叶子节点集合 A中。
|
|
130
|
+
* 4. 根据情况(是否存在空闲的进程)选择是否执行新加入的节点对应的任务。
|
|
131
|
+
*/
|
|
119
132
|
async traverseProjectToDependent(name, task, { withSelf = false, runTaskConcurrency } = {}) {
|
|
120
133
|
if (!this._projectsMap.has(name)) {
|
|
121
134
|
(0, import_error.errorLog)(`No '${name}' project exist`);
|
|
@@ -127,7 +140,7 @@ class DagOperator {
|
|
|
127
140
|
const taskRunner = new import_task.TaskRunner(leafNodeTasks, {
|
|
128
141
|
concurrency: runTaskConcurrency
|
|
129
142
|
});
|
|
130
|
-
const edgeManager = new
|
|
143
|
+
const edgeManager = new import_edgeManager.EdgeManager();
|
|
131
144
|
taskRunner.on(import_task.TaskRunner.TASK_FINISH, (projectName) => {
|
|
132
145
|
const projectNode = this.getNodeData(projectName);
|
|
133
146
|
const dependent = projectNode.dependent || [];
|
|
@@ -146,6 +159,14 @@ class DagOperator {
|
|
|
146
159
|
});
|
|
147
160
|
await taskRunner.run();
|
|
148
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* 1. 找到叶子节点集合 A
|
|
164
|
+
* 2. 找到直接连接叶子节点的节点集合 B
|
|
165
|
+
* 3. 当有某个叶子节点结束任务,则对该节点的直接连接的节点(或者理解成dependent)的枝数(或者叫入度)减一。
|
|
166
|
+
* 4. 检查 B 集合中是否存在入度为0的节点,则此节点为叶子节点,并加入叶子节点集合 A
|
|
167
|
+
* 5. 根据情况(是否存在空闲的进程)选择是否执行新加入的节点对应的任务。
|
|
168
|
+
*/
|
|
169
|
+
// TODO: 执行顺序还需要再确定一下
|
|
149
170
|
async traverseDependenciesToProject(name, task, { withSelf = false, runTaskConcurrency } = {}) {
|
|
150
171
|
if (!this._projectsMap.has(name)) {
|
|
151
172
|
(0, import_error.errorLog)(`No '${name}' project exist`);
|
|
@@ -162,7 +183,7 @@ class DagOperator {
|
|
|
162
183
|
const taskRunner = new import_task.TaskRunner(leafNodeTasks, {
|
|
163
184
|
concurrency: runTaskConcurrency
|
|
164
185
|
});
|
|
165
|
-
const edgeManager = new
|
|
186
|
+
const edgeManager = new import_edgeManager.EdgeManager();
|
|
166
187
|
taskRunner.on(import_task.TaskRunner.TASK_FINISH, (projectName) => {
|
|
167
188
|
const projectNode = this.getNodeData(projectName);
|
|
168
189
|
const dependent = projectNode.dependent || [];
|
|
@@ -183,6 +204,16 @@ class DagOperator {
|
|
|
183
204
|
});
|
|
184
205
|
await taskRunner.run();
|
|
185
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
209
|
+
*
|
|
210
|
+
* This source code is licensed under the MIT license found in the
|
|
211
|
+
* LICENSE file at
|
|
212
|
+
* https://github.com/microsoft/rushstack/blob/master/apps/rush-lib/LICENSE
|
|
213
|
+
*
|
|
214
|
+
/**
|
|
215
|
+
* Checks for projects that indirectly depend on themselves.
|
|
216
|
+
*/
|
|
186
217
|
_checkForCyclicDependencies(projects, dependencyChain, alreadyCheckedProjects) {
|
|
187
218
|
for (const project of projects) {
|
|
188
219
|
if (dependencyChain.includes(project.name)) {
|
|
@@ -225,6 +256,12 @@ class DagOperator {
|
|
|
225
256
|
(p) => preNodes.map((preP) => preP.name).includes(p.name)
|
|
226
257
|
);
|
|
227
258
|
}
|
|
259
|
+
// public async getOrderTasks() {
|
|
260
|
+
// // Precalculate the number of dependent packages
|
|
261
|
+
// for (const project of this._projects) {
|
|
262
|
+
// calculateCriticalPaths(project);
|
|
263
|
+
// }
|
|
264
|
+
// }
|
|
228
265
|
}
|
|
229
266
|
// Annotate the CommonJS export names for ESM import in node:
|
|
230
267
|
0 && (module.exports = {
|
package/dist/cjs/dag/task.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
package/dist/cjs/dag/utils.js
CHANGED
|
@@ -24,7 +24,7 @@ __export(utils_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(utils_exports);
|
|
26
26
|
var import_error = require("../log/error");
|
|
27
|
-
var
|
|
27
|
+
var import_edgeManager = require("./edgeManager");
|
|
28
28
|
const calculateCriticalPaths = (project) => {
|
|
29
29
|
var _a, _b;
|
|
30
30
|
if (project.criticalPathLength !== void 0) {
|
|
@@ -78,7 +78,7 @@ const sortProjects = (projects) => {
|
|
|
78
78
|
const sortedQueue = [];
|
|
79
79
|
let readyIntoSortedQueue = [];
|
|
80
80
|
let queue = [];
|
|
81
|
-
const edgeManager = new
|
|
81
|
+
const edgeManager = new import_edgeManager.EdgeManager();
|
|
82
82
|
for (const project of projects) {
|
|
83
83
|
edgeManager.setEdge(project);
|
|
84
84
|
if (edgeManager.getEdge(project) === 0) {
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -29,9 +33,9 @@ __export(build_exports, {
|
|
|
29
33
|
module.exports = __toCommonJS(build_exports);
|
|
30
34
|
var import_os = __toESM(require("os"));
|
|
31
35
|
var import_utils = require("@modern-js/utils");
|
|
32
|
-
var
|
|
36
|
+
var import_checkProjectChange = require("../../projects/checkProjectChange");
|
|
33
37
|
var import_error = require("../../log/error");
|
|
34
|
-
var
|
|
38
|
+
var import_multiTasksLog = require("../../log/multiTasksLog");
|
|
35
39
|
const createTask = (config, taskCmds = defaultBuildCmds, taskLogger) => {
|
|
36
40
|
const {
|
|
37
41
|
rootPath,
|
|
@@ -42,14 +46,14 @@ const createTask = (config, taskCmds = defaultBuildCmds, taskLogger) => {
|
|
|
42
46
|
const task = async (project) => {
|
|
43
47
|
console.info("run ", project.name);
|
|
44
48
|
if (!disableContentHash) {
|
|
45
|
-
const changed = await (0,
|
|
49
|
+
const changed = await (0, import_checkProjectChange.checkProjectChangeByContent)(project);
|
|
46
50
|
if (!changed) {
|
|
47
51
|
console.info(`${project.name} content not change, skip`);
|
|
48
52
|
return;
|
|
49
53
|
}
|
|
50
54
|
}
|
|
51
55
|
if (enableGitHash) {
|
|
52
|
-
const changed = await (0,
|
|
56
|
+
const changed = await (0, import_checkProjectChange.checkProjectChangeByGit)(project, rootPath);
|
|
53
57
|
if (!changed) {
|
|
54
58
|
console.info(`${project.name} not change, skip`);
|
|
55
59
|
return;
|
|
@@ -91,7 +95,7 @@ const runBuildTask = async (projectName, operator, config, taskCmds = defaultBui
|
|
|
91
95
|
disableWithDeps = false,
|
|
92
96
|
withDept = false
|
|
93
97
|
} = config;
|
|
94
|
-
const taskLogger = new
|
|
98
|
+
const taskLogger = new import_multiTasksLog.MultitasksLogger();
|
|
95
99
|
const task = createTask(config, taskCmds, taskLogger);
|
|
96
100
|
if (onlySelf) {
|
|
97
101
|
await task(operator.getNodeData(projectName, { checkExist: true }));
|
|
@@ -113,7 +117,7 @@ const runBuildTask = async (projectName, operator, config, taskCmds = defaultBui
|
|
|
113
117
|
}
|
|
114
118
|
};
|
|
115
119
|
const runAllBuildTask = async (operator, config, taskCmds = defaultBuildCmds) => {
|
|
116
|
-
const taskLogger = new
|
|
120
|
+
const taskLogger = new import_multiTasksLog.MultitasksLogger();
|
|
117
121
|
const task = createTask(config, taskCmds, taskLogger);
|
|
118
122
|
await operator.traverseAllNodes(task);
|
|
119
123
|
};
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -158,6 +162,7 @@ const deploy = async (deployProjectNames, operator, config) => {
|
|
|
158
162
|
import_node_core_library.FileSystem.copyFiles({
|
|
159
163
|
sourcePath: from,
|
|
160
164
|
destinationPath: to,
|
|
165
|
+
// If true, then when copying symlinks, copy the target object instead of copying the link.
|
|
161
166
|
dereferenceSymlinks: false,
|
|
162
167
|
filter(filePath) {
|
|
163
168
|
if (excludeDirs(filePath, ["node_modules", "dist"])) {
|
|
@@ -17,16 +17,20 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
23
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
-
var
|
|
25
|
-
__export(
|
|
28
|
+
var createTask_exports = {};
|
|
29
|
+
__export(createTask_exports, {
|
|
26
30
|
createDependenciesTask: () => createDependenciesTask,
|
|
27
31
|
createDevTask: () => createDevTask
|
|
28
32
|
});
|
|
29
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(createTask_exports);
|
|
30
34
|
var import_utils = require("@modern-js/utils");
|
|
31
35
|
var import_error = require("../../log/error");
|
|
32
36
|
var timeLog = __toESM(require("../../log/time"));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -28,10 +32,10 @@ __export(dev_exports, {
|
|
|
28
32
|
module.exports = __toCommonJS(dev_exports);
|
|
29
33
|
var import_anymatch = __toESM(require("anymatch"));
|
|
30
34
|
var import_utils = require("@modern-js/utils");
|
|
31
|
-
var
|
|
32
|
-
var
|
|
35
|
+
var import_multiTasksLog = require("../../log/multiTasksLog");
|
|
36
|
+
var import_watchProjectsState = require("./watchProjectsState");
|
|
33
37
|
var import_cmds = require("./cmds");
|
|
34
|
-
var
|
|
38
|
+
var import_createTask = require("./createTask");
|
|
35
39
|
const getIgnored = (config) => (watchFilePath) => {
|
|
36
40
|
const nodeModulesPattern = /(?:^|[\\/])node_modules/g;
|
|
37
41
|
if (nodeModulesPattern.test(watchFilePath) || watchFilePath.includes("dist")) {
|
|
@@ -44,11 +48,11 @@ const getIgnored = (config) => (watchFilePath) => {
|
|
|
44
48
|
};
|
|
45
49
|
const runBuildWatchTask = async (projectName, operator, config, taskCmds = import_cmds.defaultBuildWatchCmds) => {
|
|
46
50
|
const { needInit = true } = config;
|
|
47
|
-
const taskLogger = new
|
|
48
|
-
const dependenciesTask = (0,
|
|
49
|
-
const devTask = (0,
|
|
51
|
+
const taskLogger = new import_multiTasksLog.MultitasksLogger();
|
|
52
|
+
const dependenciesTask = (0, import_createTask.createDependenciesTask)(config, taskCmds, taskLogger);
|
|
53
|
+
const devTask = (0, import_createTask.createDevTask)(config, taskCmds, taskLogger);
|
|
50
54
|
const fromNodes = operator.getNodeAllDependencyData(projectName);
|
|
51
|
-
const watchedProjectState = new
|
|
55
|
+
const watchedProjectState = new import_watchProjectsState.WatchedProjectsState(fromNodes, config);
|
|
52
56
|
const watcher = new import_utils.chokidar.FSWatcher({
|
|
53
57
|
persistent: true,
|
|
54
58
|
cwd: config.rootPath,
|
|
@@ -17,15 +17,19 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
23
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
-
var
|
|
25
|
-
__export(
|
|
28
|
+
var watchProjectsState_exports = {};
|
|
29
|
+
__export(watchProjectsState_exports, {
|
|
26
30
|
WatchedProjectsState: () => WatchedProjectsState
|
|
27
31
|
});
|
|
28
|
-
module.exports = __toCommonJS(
|
|
32
|
+
module.exports = __toCommonJS(watchProjectsState_exports);
|
|
29
33
|
var path = __toESM(require("path"));
|
|
30
34
|
var import_utils = require("@modern-js/utils");
|
|
31
35
|
class WatchedProjectsState {
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
package/dist/cjs/index.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -15,11 +15,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var
|
|
19
|
-
__export(
|
|
18
|
+
var multiTasksLog_exports = {};
|
|
19
|
+
__export(multiTasksLog_exports, {
|
|
20
20
|
MultitasksLogger: () => MultitasksLogger
|
|
21
21
|
});
|
|
22
|
-
module.exports = __toCommonJS(
|
|
22
|
+
module.exports = __toCommonJS(multiTasksLog_exports);
|
|
23
23
|
var import_utils = require("@modern-js/utils");
|
|
24
24
|
var import_utils2 = require("./utils");
|
|
25
25
|
const createLogger = (name, config) => {
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -29,7 +33,11 @@ module.exports = __toCommonJS(parse_config_exports);
|
|
|
29
33
|
var path = __toESM(require("path"));
|
|
30
34
|
var import_node_core_library = require("@rushstack/node-core-library");
|
|
31
35
|
var import_monorepo = require("./monorepo");
|
|
32
|
-
const defaultConfig = {
|
|
36
|
+
const defaultConfig = {
|
|
37
|
+
// packagesMatchs: {
|
|
38
|
+
// workspaceFile: 'pnpm-lock.yaml',
|
|
39
|
+
// },
|
|
40
|
+
};
|
|
33
41
|
const getFinalConfig = async (currentPath = process.cwd()) => {
|
|
34
42
|
const monorepo = (0, import_monorepo.getMonorepoBaseData)(currentPath);
|
|
35
43
|
const userConfig = await import_node_core_library.JsonFile.loadAsync(
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,19 +17,23 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
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.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
23
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
-
var
|
|
25
|
-
__export(
|
|
28
|
+
var checkProjectChange_exports = {};
|
|
29
|
+
__export(checkProjectChange_exports, {
|
|
26
30
|
MONOREPO_GIT_FILE_NAME: () => MONOREPO_GIT_FILE_NAME,
|
|
27
31
|
PROJECT_CONTENT_FILE_NAME: () => PROJECT_CONTENT_FILE_NAME,
|
|
28
32
|
PROJECT_MEMORY_PATH: () => PROJECT_MEMORY_PATH,
|
|
29
33
|
checkProjectChangeByContent: () => checkProjectChangeByContent,
|
|
30
34
|
checkProjectChangeByGit: () => checkProjectChangeByGit
|
|
31
35
|
});
|
|
32
|
-
module.exports = __toCommonJS(
|
|
36
|
+
module.exports = __toCommonJS(checkProjectChange_exports);
|
|
33
37
|
var path = __toESM(require("path"));
|
|
34
38
|
var import_node_core_library = require("@rushstack/node-core-library");
|
|
35
39
|
var import_package_deps_hash = require("@rushstack/package-deps-hash");
|