@modern-js/monorepo-tools 2.35.0 → 2.36.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.
Files changed (95) hide show
  1. package/dist/cjs/cli/build.js +26 -9
  2. package/dist/cjs/cli/buildWatch.js +26 -9
  3. package/dist/cjs/cli/clear.js +26 -9
  4. package/dist/cjs/cli/deploy.js +26 -9
  5. package/dist/cjs/cli/index.js +30 -9
  6. package/dist/cjs/cli/install.js +26 -9
  7. package/dist/cjs/cli/new.js +29 -12
  8. package/dist/cjs/commands/build.js +33 -16
  9. package/dist/cjs/commands/buildWatch.js +32 -15
  10. package/dist/cjs/commands/clear.js +30 -13
  11. package/dist/cjs/commands/deploy.js +34 -17
  12. package/dist/cjs/commands/index.js +28 -8
  13. package/dist/cjs/commands/install.js +32 -15
  14. package/dist/cjs/constants.js +25 -15
  15. package/dist/cjs/dag/create.js +25 -9
  16. package/dist/cjs/dag/edgeManager.js +26 -9
  17. package/dist/cjs/dag/index.js +28 -11
  18. package/dist/cjs/dag/operator.js +59 -34
  19. package/dist/cjs/dag/task.js +46 -20
  20. package/dist/cjs/dag/utils.js +33 -25
  21. package/dist/cjs/features/build/index.js +51 -32
  22. package/dist/cjs/features/clear/index.js +47 -28
  23. package/dist/cjs/features/deploy/index.js +66 -41
  24. package/dist/cjs/features/dev/cmds.js +24 -7
  25. package/dist/cjs/features/dev/createTask.js +50 -31
  26. package/dist/cjs/features/dev/index.js +47 -21
  27. package/dist/cjs/features/dev/watchProjectsState.js +43 -17
  28. package/dist/cjs/features/install/index.js +55 -29
  29. package/dist/cjs/hooks/index.js +26 -9
  30. package/dist/cjs/index.js +45 -35
  31. package/dist/cjs/locale/en.js +24 -7
  32. package/dist/cjs/locale/index.js +31 -21
  33. package/dist/cjs/locale/zh.js +24 -7
  34. package/dist/cjs/log/error.js +24 -7
  35. package/dist/cjs/log/multiTasksLog.js +33 -16
  36. package/dist/cjs/log/time.js +29 -20
  37. package/dist/cjs/log/utils.js +24 -7
  38. package/dist/cjs/package/index.js +28 -11
  39. package/dist/cjs/parse-config/index.js +39 -13
  40. package/dist/cjs/parse-config/monorepo.js +55 -39
  41. package/dist/cjs/projects/checkProjectChange.js +65 -50
  42. package/dist/cjs/projects/clearMemoryFiles.js +39 -13
  43. package/dist/cjs/projects/getProjects.js +37 -27
  44. package/dist/cjs/projects/getProjectsByPackagesConfig.js +51 -33
  45. package/dist/cjs/projects/getProjectsByWorkspaceFile.js +63 -44
  46. package/dist/cjs/type.js +15 -3
  47. package/dist/cjs/utils/install.js +43 -24
  48. package/dist/cjs/utils/types.js +15 -3
  49. package/dist/esm/cli/build.js +4 -1
  50. package/dist/esm/cli/buildWatch.js +4 -1
  51. package/dist/esm/cli/clear.js +4 -1
  52. package/dist/esm/cli/deploy.js +4 -1
  53. package/dist/esm/cli/install.js +4 -1
  54. package/dist/esm/cli/new.js +4 -1
  55. package/dist/esm/commands/build.js +4 -1
  56. package/dist/esm/commands/buildWatch.js +4 -1
  57. package/dist/esm/commands/clear.js +4 -1
  58. package/dist/esm/commands/deploy.js +4 -1
  59. package/dist/esm/commands/install.js +4 -1
  60. package/dist/esm/constants.js +6 -2
  61. package/dist/esm/dag/create.js +5 -3
  62. package/dist/esm/dag/edgeManager.js +4 -1
  63. package/dist/esm/dag/index.js +4 -1
  64. package/dist/esm/dag/operator.js +5 -3
  65. package/dist/esm/dag/task.js +4 -1
  66. package/dist/esm/dag/utils.js +10 -4
  67. package/dist/esm/features/build/index.js +6 -2
  68. package/dist/esm/features/clear/index.js +6 -2
  69. package/dist/esm/features/deploy/index.js +5 -3
  70. package/dist/esm/features/dev/cmds.js +4 -1
  71. package/dist/esm/features/dev/createTask.js +6 -2
  72. package/dist/esm/features/dev/index.js +4 -1
  73. package/dist/esm/features/dev/watchProjectsState.js +4 -1
  74. package/dist/esm/features/install/index.js +6 -3
  75. package/dist/esm/hooks/index.js +4 -1
  76. package/dist/esm/index.js +6 -2
  77. package/dist/esm/locale/en.js +4 -1
  78. package/dist/esm/locale/index.js +4 -1
  79. package/dist/esm/locale/zh.js +4 -1
  80. package/dist/esm/log/error.js +4 -1
  81. package/dist/esm/log/multiTasksLog.js +4 -1
  82. package/dist/esm/log/time.js +8 -3
  83. package/dist/esm/log/utils.js +4 -1
  84. package/dist/esm/package/index.js +4 -1
  85. package/dist/esm/parse-config/index.js +4 -1
  86. package/dist/esm/parse-config/monorepo.js +12 -5
  87. package/dist/esm/projects/checkProjectChange.js +12 -5
  88. package/dist/esm/projects/clearMemoryFiles.js +4 -1
  89. package/dist/esm/projects/getProjects.js +6 -2
  90. package/dist/esm/projects/getProjectsByPackagesConfig.js +6 -2
  91. package/dist/esm/projects/getProjectsByWorkspaceFile.js +10 -6
  92. package/dist/esm/type.js +0 -1
  93. package/dist/esm/utils/install.js +6 -2
  94. package/dist/esm/utils/types.js +0 -1
  95. package/package.json +11 -11
@@ -1,41 +1,55 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
6
9
  for (var name in all)
7
- Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- runBuildTask: function() {
14
- return runBuildTask;
15
- },
16
- runAllBuildTask: function() {
17
- return runAllBuildTask;
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
17
  }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var build_exports = {};
30
+ __export(build_exports, {
31
+ runAllBuildTask: () => runAllBuildTask,
32
+ runBuildTask: () => runBuildTask
19
33
  });
20
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
21
- const _os = /* @__PURE__ */ _interop_require_default._(require("os"));
22
- const _utils = require("@modern-js/utils");
23
- const _checkProjectChange = require("../../projects/checkProjectChange");
24
- const _error = require("../../log/error");
25
- const _multiTasksLog = require("../../log/multiTasksLog");
34
+ module.exports = __toCommonJS(build_exports);
35
+ var import_os = __toESM(require("os"));
36
+ var import_utils = require("@modern-js/utils");
37
+ var import_checkProjectChange = require("../../projects/checkProjectChange");
38
+ var import_error = require("../../log/error");
39
+ var import_multiTasksLog = require("../../log/multiTasksLog");
26
40
  const createTask = (config, taskCmds = defaultBuildCmds, taskLogger) => {
27
41
  const { rootPath, packageManager, disableContentHash = false, enableGitHash = false } = config;
28
42
  const task = async (project) => {
29
43
  console.info("run ", project.name);
30
44
  if (!disableContentHash) {
31
- const changed = await (0, _checkProjectChange.checkProjectChangeByContent)(project);
45
+ const changed = await (0, import_checkProjectChange.checkProjectChangeByContent)(project);
32
46
  if (!changed) {
33
47
  console.info(`${project.name} content not change, skip`);
34
48
  return;
35
49
  }
36
50
  }
37
51
  if (enableGitHash) {
38
- const changed = await (0, _checkProjectChange.checkProjectChangeByGit)(project, rootPath);
52
+ const changed = await (0, import_checkProjectChange.checkProjectChangeByGit)(project, rootPath);
39
53
  if (!changed) {
40
54
  console.info(`${project.name} not change, skip`);
41
55
  return;
@@ -46,9 +60,9 @@ const createTask = (config, taskCmds = defaultBuildCmds, taskLogger) => {
46
60
  for (const taskCmd of taskCmds) {
47
61
  if (cmd[taskCmd]) {
48
62
  const prefix = `run ${project.name} ${taskCmd} script`;
49
- _utils.signale.time(prefix);
63
+ import_utils.signale.time(prefix);
50
64
  try {
51
- const childProcess = (0, _utils.execa)(packageManager, [
65
+ const childProcess = (0, import_utils.execa)(packageManager, [
52
66
  taskCmd
53
67
  ], {
54
68
  cwd: project.extra.path,
@@ -66,9 +80,9 @@ const createTask = (config, taskCmds = defaultBuildCmds, taskLogger) => {
66
80
  }
67
81
  });
68
82
  await childProcess;
69
- _utils.signale.timeEnd(prefix);
83
+ import_utils.signale.timeEnd(prefix);
70
84
  } catch (e) {
71
- (0, _error.errorLog)(project.name, e.message);
85
+ (0, import_error.errorLog)(project.name, e.message);
72
86
  }
73
87
  } else {
74
88
  console.info(`${project.name} not have ${taskCmd}, skip it.`);
@@ -82,7 +96,7 @@ const defaultBuildCmds = [
82
96
  ];
83
97
  const runBuildTask = async (projectName, operator, config, taskCmds = defaultBuildCmds) => {
84
98
  const { withSelf = true, onlySelf = false, disableWithDeps = false, withDept = false } = config;
85
- const taskLogger = new _multiTasksLog.MultitasksLogger();
99
+ const taskLogger = new import_multiTasksLog.MultitasksLogger();
86
100
  const task = createTask(config, taskCmds, taskLogger);
87
101
  if (onlySelf) {
88
102
  await task(operator.getNodeData(projectName, {
@@ -91,22 +105,27 @@ const runBuildTask = async (projectName, operator, config, taskCmds = defaultBui
91
105
  } else if (!disableWithDeps && withDept) {
92
106
  await operator.traverseDependenciesToProjectToDependent(projectName, task, {
93
107
  withSelf,
94
- runTaskConcurrency: _os.default.cpus().length
108
+ runTaskConcurrency: import_os.default.cpus().length
95
109
  });
96
110
  } else if (disableWithDeps && withDept) {
97
111
  await operator.traverseProjectToDependent(projectName, task, {
98
112
  withSelf,
99
- runTaskConcurrency: _os.default.cpus().length
113
+ runTaskConcurrency: import_os.default.cpus().length
100
114
  });
101
115
  } else {
102
116
  operator.traverseDependenciesToProject(projectName, task, {
103
117
  withSelf,
104
- runTaskConcurrency: _os.default.cpus().length
118
+ runTaskConcurrency: import_os.default.cpus().length
105
119
  });
106
120
  }
107
121
  };
108
122
  const runAllBuildTask = async (operator, config, taskCmds = defaultBuildCmds) => {
109
- const taskLogger = new _multiTasksLog.MultitasksLogger();
123
+ const taskLogger = new import_multiTasksLog.MultitasksLogger();
110
124
  const task = createTask(config, taskCmds, taskLogger);
111
125
  await operator.traverseAllNodes(task);
112
126
  };
127
+ // Annotate the CommonJS export names for ESM import in node:
128
+ 0 && (module.exports = {
129
+ runAllBuildTask,
130
+ runBuildTask
131
+ });
@@ -1,26 +1,40 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
6
9
  for (var name in all)
7
- Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- defaultRemoveDirs: function() {
14
- return defaultRemoveDirs;
15
- },
16
- runClearTask: function() {
17
- return runClearTask;
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
17
  }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var clear_exports = {};
30
+ __export(clear_exports, {
31
+ defaultRemoveDirs: () => defaultRemoveDirs,
32
+ runClearTask: () => runClearTask
19
33
  });
20
- const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
21
- const _path = /* @__PURE__ */ _interop_require_wildcard._(require("path"));
22
- const _utils = require("@modern-js/utils");
23
- const _nodecorelibrary = require("@rushstack/node-core-library");
34
+ module.exports = __toCommonJS(clear_exports);
35
+ var path = __toESM(require("path"));
36
+ var import_utils = require("@modern-js/utils");
37
+ var import_node_core_library = require("@rushstack/node-core-library");
24
38
  const defaultRemoveDirs = [
25
39
  "node_modules"
26
40
  ];
@@ -30,24 +44,29 @@ const runClearTask = (projectNames, projects, config) => {
30
44
  projects.forEach((project) => {
31
45
  if (projectNames.includes(project.name)) {
32
46
  removeDirs.forEach((dir) => {
33
- const removePath = _path.join(`${project.extra.path}`, dir);
34
- _utils.logger.info(`remove ${removePath}`);
35
- _nodecorelibrary.FileSystem.deleteFolder(removePath);
47
+ const removePath = path.join(`${project.extra.path}`, dir);
48
+ import_utils.logger.info(`remove ${removePath}`);
49
+ import_node_core_library.FileSystem.deleteFolder(removePath);
36
50
  });
37
51
  }
38
52
  });
39
53
  } else {
40
54
  removeDirs.forEach((dir) => {
41
- const removePath = _path.join(`${rootPath}`, dir);
42
- _utils.logger.info(`remove ${removePath}`);
43
- _nodecorelibrary.FileSystem.deleteFolder(removePath);
55
+ const removePath = path.join(`${rootPath}`, dir);
56
+ import_utils.logger.info(`remove ${removePath}`);
57
+ import_node_core_library.FileSystem.deleteFolder(removePath);
44
58
  });
45
59
  projects.forEach((project) => {
46
60
  removeDirs.forEach((dir) => {
47
- const removePath = _path.join(`${project.extra.path}`, dir);
48
- _utils.logger.info(`remove ${removePath}`);
49
- _nodecorelibrary.FileSystem.deleteFolder(removePath);
61
+ const removePath = path.join(`${project.extra.path}`, dir);
62
+ import_utils.logger.info(`remove ${removePath}`);
63
+ import_node_core_library.FileSystem.deleteFolder(removePath);
50
64
  });
51
65
  });
52
66
  }
53
67
  };
68
+ // Annotate the CommonJS export names for ESM import in node:
69
+ 0 && (module.exports = {
70
+ defaultRemoveDirs,
71
+ runClearTask
72
+ });
@@ -1,34 +1,56 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "deploy", {
6
- enumerable: true,
7
- get: function() {
8
- return deploy;
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
17
  }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var deploy_exports = {};
30
+ __export(deploy_exports, {
31
+ deploy: () => deploy
10
32
  });
11
- const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
- const _path = /* @__PURE__ */ _interop_require_wildcard._(require("path"));
13
- const _nodecorelibrary = require("@rushstack/node-core-library");
14
- const _utils = require("@modern-js/utils");
15
- const _constants = require("../../constants");
33
+ module.exports = __toCommonJS(deploy_exports);
34
+ var path = __toESM(require("path"));
35
+ var import_node_core_library = require("@rushstack/node-core-library");
36
+ var import_utils = require("@modern-js/utils");
37
+ var import_constants = require("../../constants");
16
38
  const createCopyMap = (rootPath, targetProject, copyProjects, deployDir) => {
17
39
  const map = /* @__PURE__ */ new Map();
18
40
  for (const project of copyProjects) {
19
- const relativePath = _path.relative(rootPath, project.extra.path);
20
- const targetPath = _path.join(deployDir, relativePath);
41
+ const relativePath = path.relative(rootPath, project.extra.path);
42
+ const targetPath = path.join(deployDir, relativePath);
21
43
  map.set(project.extra.path, targetPath);
22
44
  }
23
- const targetProjectDeployPath = _path.join(deployDir, "apps/app");
45
+ const targetProjectDeployPath = path.join(deployDir, "apps/app");
24
46
  map.set(targetProject.extra.path, targetProjectDeployPath);
25
47
  return map;
26
48
  };
27
49
  const createCopyFromMonorepoToDeployDirFn = (monorepoDir, deployDir) => (filename) => {
28
- const sourcePath = _path.join(monorepoDir, filename);
29
- const destinationPath = _path.join(deployDir, filename);
30
- if (_nodecorelibrary.FileSystem.exists(sourcePath)) {
31
- _nodecorelibrary.FileSystem.copyFile({
50
+ const sourcePath = path.join(monorepoDir, filename);
51
+ const destinationPath = path.join(deployDir, filename);
52
+ if (import_node_core_library.FileSystem.exists(sourcePath)) {
53
+ import_node_core_library.FileSystem.copyFile({
32
54
  sourcePath,
33
55
  destinationPath
34
56
  });
@@ -36,16 +58,16 @@ const createCopyFromMonorepoToDeployDirFn = (monorepoDir, deployDir) => (filenam
36
58
  };
37
59
  const checkAndUpdatePMWorkspaces = (deployDir) => {
38
60
  var _pkg_workspaces;
39
- const pnpmWp = _path.join(deployDir, _constants.WORKSPACE_FILE.PNPM);
40
- if (_utils.fs.existsSync(pnpmWp)) {
41
- const pnpmWorkspace = _utils.yaml.load(_utils.fs.readFileSync(pnpmWp, "utf-8"));
61
+ const pnpmWp = path.join(deployDir, import_constants.WORKSPACE_FILE.PNPM);
62
+ if (import_utils.fs.existsSync(pnpmWp)) {
63
+ const pnpmWorkspace = import_utils.yaml.load(import_utils.fs.readFileSync(pnpmWp, "utf-8"));
42
64
  if (pnpmWorkspace.packages && Array.isArray(pnpmWorkspace.packages)) {
43
65
  pnpmWorkspace.packages.push("apps/**");
44
66
  }
45
- _utils.fs.writeFileSync(pnpmWp, _utils.yaml.dump(pnpmWorkspace));
67
+ import_utils.fs.writeFileSync(pnpmWp, import_utils.yaml.dump(pnpmWorkspace));
46
68
  }
47
- const pkgPath = _path.join(deployDir, _constants.WORKSPACE_FILE.YARN);
48
- const pkg = _nodecorelibrary.JsonFile.load(pkgPath);
69
+ const pkgPath = path.join(deployDir, import_constants.WORKSPACE_FILE.YARN);
70
+ const pkg = import_node_core_library.JsonFile.load(pkgPath);
49
71
  if (((_pkg_workspaces = pkg.workspaces) === null || _pkg_workspaces === void 0 ? void 0 : _pkg_workspaces.packages) && Array.isArray(pkg.workspaces.packages)) {
50
72
  pkg.workspaces.packages.push("app/**");
51
73
  }
@@ -69,13 +91,13 @@ const checkAndRunDeployCommand = async (monorepoPath, targetProject, packageMana
69
91
  const scripts = ((_targetProject_extra = targetProject.extra) === null || _targetProject_extra === void 0 ? void 0 : _targetProject_extra.scripts) || {};
70
92
  if (scripts.deploy) {
71
93
  var _childProcess_stdout, _childProcess_stderr;
72
- _utils.logger.info(`The 'deploy' command for the ${targetProject.name} is detected, so 'deploy' will be executed`);
94
+ import_utils.logger.info(`The 'deploy' command for the ${targetProject.name} is detected, so 'deploy' will be executed`);
73
95
  let runDeployCommands = [
74
96
  "run",
75
97
  "deploy"
76
98
  ];
77
99
  if (packageManager === "pnpm") {
78
- const pnpmVersion = await (0, _utils.getPnpmVersion)();
100
+ const pnpmVersion = await (0, import_utils.getPnpmVersion)();
79
101
  if (pnpmVersion.startsWith("6")) {
80
102
  runDeployCommands = [
81
103
  "run",
@@ -100,7 +122,7 @@ const checkAndRunDeployCommand = async (monorepoPath, targetProject, packageMana
100
122
  ];
101
123
  }
102
124
  const cwd = packageManager === "npm" ? targetProject.extra.path : monorepoPath;
103
- const childProcess = (0, _utils.execa)(packageManager, runDeployCommands, {
125
+ const childProcess = (0, import_utils.execa)(packageManager, runDeployCommands, {
104
126
  cwd,
105
127
  stdio: [
106
128
  "pipe"
@@ -112,25 +134,24 @@ const checkAndRunDeployCommand = async (monorepoPath, targetProject, packageMana
112
134
  }
113
135
  };
114
136
  const installDependency = async (deployDir, packageManager) => {
115
- var _packageJson;
116
- const packageJsonPath = _path.join(deployDir, "package.json");
117
- const packageJson = _nodecorelibrary.JsonFile.load(packageJsonPath);
118
- const scripts = ((_packageJson = packageJson) === null || _packageJson === void 0 ? void 0 : _packageJson.scripts) || {};
137
+ const packageJsonPath = path.join(deployDir, "package.json");
138
+ const packageJson = import_node_core_library.JsonFile.load(packageJsonPath);
139
+ const scripts = (packageJson === null || packageJson === void 0 ? void 0 : packageJson.scripts) || {};
119
140
  let commands = [];
120
141
  if (scripts.setup) {
121
- _utils.logger.info(`The 'setup' command is detected, execute '${packageManager} run setup' to start installing the dependencies`);
142
+ import_utils.logger.info(`The 'setup' command is detected, execute '${packageManager} run setup' to start installing the dependencies`);
122
143
  commands = [
123
144
  "run",
124
145
  "setup"
125
146
  ];
126
147
  } else {
127
- _utils.logger.info(`No 'setup' command detected, execute '${packageManager} install' to start installing dependencies`);
148
+ import_utils.logger.info(`No 'setup' command detected, execute '${packageManager} install' to start installing dependencies`);
128
149
  commands = [
129
150
  "install"
130
151
  ];
131
152
  }
132
- _utils.logger.log(_utils.chalk.rgb(218, 152, 92)("Install Log:\n"));
133
- const childProcess = (0, _utils.execa)(packageManager, commands, {
153
+ import_utils.logger.log(import_utils.chalk.rgb(218, 152, 92)("Install Log:\n"));
154
+ const childProcess = (0, import_utils.execa)(packageManager, commands, {
134
155
  stdio: "inherit",
135
156
  cwd: deployDir,
136
157
  env: {
@@ -143,8 +164,8 @@ const excludeDirs = (filePath, dirs) => dirs.some((dir) => filePath.includes(dir
143
164
  const defaultDeployPath = "output";
144
165
  const deploy = async (deployProjectNames, operator, config) => {
145
166
  const { rootPath, packageManager, deployPath = defaultDeployPath } = config;
146
- const realDeployPath = _path.isAbsolute(deployPath) ? deployPath : _path.join(rootPath, deployPath);
147
- _nodecorelibrary.FileSystem.deleteFolder(realDeployPath);
167
+ const realDeployPath = path.isAbsolute(deployPath) ? deployPath : path.join(rootPath, deployPath);
168
+ import_node_core_library.FileSystem.deleteFolder(realDeployPath);
148
169
  for (const deployProjectName of deployProjectNames) {
149
170
  const currentProject = operator.getNodeData(deployProjectName, {
150
171
  checkExist: true
@@ -152,9 +173,9 @@ const deploy = async (deployProjectNames, operator, config) => {
152
173
  const alldeps = operator.getNodeAllDependencyData(deployProjectName);
153
174
  const copyMap = createCopyMap(rootPath, currentProject, alldeps, realDeployPath);
154
175
  await checkAndRunDeployCommand(rootPath, currentProject, packageManager);
155
- _nodecorelibrary.FileSystem.ensureFolder(realDeployPath);
176
+ import_node_core_library.FileSystem.ensureFolder(realDeployPath);
156
177
  for (const [from, to] of copyMap) {
157
- _nodecorelibrary.FileSystem.copyFiles({
178
+ import_node_core_library.FileSystem.copyFiles({
158
179
  sourcePath: from,
159
180
  destinationPath: to,
160
181
  // If true, then when copying symlinks, copy the target object instead of copying the link.
@@ -172,5 +193,9 @@ const deploy = async (deployProjectNames, operator, config) => {
172
193
  }
173
194
  }
174
195
  generatorAndCopyRequiredFiles(rootPath, realDeployPath);
175
- _utils.logger.success(`Deploy success. The deploy dir is in '${rootPath}/output'`);
196
+ import_utils.logger.success(`Deploy success. The deploy dir is in '${rootPath}/output'`);
176
197
  };
198
+ // Annotate the CommonJS export names for ESM import in node:
199
+ 0 && (module.exports = {
200
+ deploy
201
+ });
@@ -1,14 +1,31 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "defaultBuildWatchCmds", {
6
- enumerable: true,
7
- get: function() {
8
- return defaultBuildWatchCmds;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
15
  }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var cmds_exports = {};
20
+ __export(cmds_exports, {
21
+ defaultBuildWatchCmds: () => defaultBuildWatchCmds
10
22
  });
23
+ module.exports = __toCommonJS(cmds_exports);
11
24
  const defaultBuildWatchCmds = [
12
25
  "dev",
13
26
  "build"
14
27
  ];
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ defaultBuildWatchCmds
31
+ });
@@ -1,27 +1,41 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
6
9
  for (var name in all)
7
- Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- createDependenciesTask: function() {
14
- return createDependenciesTask;
15
- },
16
- createDevTask: function() {
17
- return createDevTask;
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
17
  }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var createTask_exports = {};
30
+ __export(createTask_exports, {
31
+ createDependenciesTask: () => createDependenciesTask,
32
+ createDevTask: () => createDevTask
19
33
  });
20
- const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
21
- const _utils = require("@modern-js/utils");
22
- const _error = require("../../log/error");
23
- const _time = /* @__PURE__ */ _interop_require_wildcard._(require("../../log/time"));
24
- const _cmds = require("./cmds");
34
+ module.exports = __toCommonJS(createTask_exports);
35
+ var import_utils = require("@modern-js/utils");
36
+ var import_error = require("../../log/error");
37
+ var timeLog = __toESM(require("../../log/time"));
38
+ var import_cmds = require("./cmds");
25
39
  const getFinalTaskCmds = (taskCmds, project) => {
26
40
  let finalTaskCmds = [];
27
41
  if (taskCmds.length === 1) {
@@ -41,18 +55,18 @@ const getFinalTaskCmds = (taskCmds, project) => {
41
55
  }
42
56
  return finalTaskCmds;
43
57
  };
44
- const createDependenciesTask = (config, taskCmds = _cmds.defaultBuildWatchCmds, taskLogger) => {
58
+ const createDependenciesTask = (config, taskCmds = import_cmds.defaultBuildWatchCmds, taskLogger) => {
45
59
  const { packageManager } = config;
46
- const timelogInstance = _time.initTimeLog();
60
+ const timelogInstance = timeLog.initTimeLog();
47
61
  const task = async (project) => {
48
62
  const finalTaskCmds = getFinalTaskCmds(taskCmds, project);
49
63
  const cmd = project.extra.scripts || {};
50
64
  for (const taskCmd of finalTaskCmds) {
51
65
  if (cmd[taskCmd]) {
52
66
  const prefix = `run ${project.name} ${taskCmd} script`;
53
- _time.startTime(timelogInstance, prefix);
67
+ timeLog.startTime(timelogInstance, prefix);
54
68
  try {
55
- const childProcess = (0, _utils.execa)(packageManager, [
69
+ const childProcess = (0, import_utils.execa)(packageManager, [
56
70
  taskCmd
57
71
  ], {
58
72
  cwd: project.extra.path,
@@ -71,17 +85,17 @@ const createDependenciesTask = (config, taskCmds = _cmds.defaultBuildWatchCmds,
71
85
  });
72
86
  await childProcess;
73
87
  } catch (e) {
74
- (0, _error.errorLog)(project.name, e);
88
+ (0, import_error.errorLog)(project.name, e);
75
89
  }
76
- _time.endTime(timelogInstance, prefix);
90
+ timeLog.endTime(timelogInstance, prefix);
77
91
  } else {
78
- _utils.logger.info(`${project.name} not have ${taskCmd}, skip it.`);
92
+ import_utils.logger.info(`${project.name} not have ${taskCmd}, skip it.`);
79
93
  }
80
94
  }
81
95
  };
82
96
  return task;
83
97
  };
84
- const createDevTask = (config, taskCmds = _cmds.defaultBuildWatchCmds, taskLogger) => {
98
+ const createDevTask = (config, taskCmds = import_cmds.defaultBuildWatchCmds, taskLogger) => {
85
99
  const { packageManager } = config;
86
100
  const task = async (project) => {
87
101
  const devCmds = [
@@ -91,7 +105,7 @@ const createDevTask = (config, taskCmds = _cmds.defaultBuildWatchCmds, taskLogge
91
105
  for (const taskCmd of devCmds) {
92
106
  if (cmd[taskCmd]) {
93
107
  try {
94
- const childProcess = (0, _utils.execa)(packageManager, [
108
+ const childProcess = (0, import_utils.execa)(packageManager, [
95
109
  taskCmd
96
110
  ], {
97
111
  cwd: project.extra.path,
@@ -108,12 +122,17 @@ const createDevTask = (config, taskCmds = _cmds.defaultBuildWatchCmds, taskLogge
108
122
  const ret = await childProcess;
109
123
  console.info(ret);
110
124
  } catch (e) {
111
- (0, _error.errorLog)(project.name, e);
125
+ (0, import_error.errorLog)(project.name, e);
112
126
  }
113
127
  } else {
114
- _utils.logger.info(`${project.name} not have ${taskCmd}, skip it.`);
128
+ import_utils.logger.info(`${project.name} not have ${taskCmd}, skip it.`);
115
129
  }
116
130
  }
117
131
  };
118
132
  return task;
119
133
  };
134
+ // Annotate the CommonJS export names for ESM import in node:
135
+ 0 && (module.exports = {
136
+ createDependenciesTask,
137
+ createDevTask
138
+ });