@modern-js/monorepo-tools 2.4.0 → 2.5.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 (118) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/cli.js +1 -1
  3. package/dist/{js/node → cjs}/cli/build-watch.js +3 -23
  4. package/dist/{js/node → cjs}/cli/build.js +3 -23
  5. package/dist/{js/node → cjs}/cli/clear.js +3 -23
  6. package/dist/{js/node → cjs}/cli/deploy.js +3 -23
  7. package/dist/{js/node → cjs}/cli/index.js +0 -0
  8. package/dist/cjs/cli/install.js +34 -0
  9. package/dist/{js/node → cjs}/cli/new.js +3 -40
  10. package/dist/{js/node → cjs}/commands/build-watch.js +4 -24
  11. package/dist/{js/node → cjs}/commands/build.js +8 -41
  12. package/dist/{js/node → cjs}/commands/clear.js +3 -23
  13. package/dist/{js/node → cjs}/commands/deploy.js +4 -24
  14. package/dist/{js/node → cjs}/commands/index.js +0 -0
  15. package/dist/{js/node → cjs}/commands/install.js +4 -24
  16. package/dist/{js/node → cjs}/constants.js +0 -0
  17. package/dist/{js/node → cjs}/dag/create.js +5 -15
  18. package/dist/{js/node → cjs}/dag/edge-manager.js +0 -0
  19. package/dist/{js/node → cjs}/dag/index.js +0 -0
  20. package/dist/cjs/dag/operator.js +232 -0
  21. package/dist/{js/node → cjs}/dag/task.js +29 -53
  22. package/dist/{js/node → cjs}/dag/utils.js +0 -0
  23. package/dist/{js/node → cjs}/features/build/index.js +13 -33
  24. package/dist/{js/node → cjs}/features/clear/index.js +0 -0
  25. package/dist/{js/node → cjs}/features/deploy/index.js +10 -30
  26. package/dist/{js/node → cjs}/features/dev/cmds.js +0 -0
  27. package/dist/{js/node → cjs}/features/dev/create-task.js +6 -26
  28. package/dist/{js/node → cjs}/features/dev/index.js +14 -34
  29. package/dist/{js/node → cjs}/features/dev/watch-projects-state.js +3 -19
  30. package/dist/{js/node → cjs}/features/install/index.js +3 -23
  31. package/dist/{js/node → cjs}/hooks/index.js +0 -0
  32. package/dist/{js/node → cjs}/index.js +0 -0
  33. package/dist/{js/node → cjs}/locale/en.js +0 -0
  34. package/dist/{js/node → cjs}/locale/index.js +0 -0
  35. package/dist/{js/node → cjs}/locale/zh.js +0 -0
  36. package/dist/{js/node → cjs}/log/error.js +0 -0
  37. package/dist/{js/node → cjs}/log/multi-tasks-log.js +0 -0
  38. package/dist/{js/node → cjs}/log/time.js +1 -15
  39. package/dist/{js/node → cjs}/log/utils.js +0 -0
  40. package/dist/{js/node → cjs}/package/index.js +0 -0
  41. package/dist/{js/node → cjs}/parse-config/index.js +4 -38
  42. package/dist/{js/node → cjs}/parse-config/monorepo.js +0 -0
  43. package/dist/{js/node → cjs}/projects/check-project-change.js +12 -32
  44. package/dist/{js/node → cjs}/projects/clear-memory-files.js +0 -0
  45. package/dist/{js/node → cjs}/projects/get-projects-by-packages-config.js +11 -45
  46. package/dist/{js/node → cjs}/projects/get-projects-by-workspace-file.js +4 -24
  47. package/dist/{js/node → cjs}/projects/get-projects.js +15 -47
  48. package/dist/{js/node → cjs}/type.js +0 -0
  49. package/dist/{js/node → cjs}/utils/install.js +4 -24
  50. package/dist/{js/node → cjs}/utils/language.js +0 -0
  51. package/dist/{js/node → cjs}/utils/types.js +0 -0
  52. package/dist/esm/cli/build-watch.js +11 -0
  53. package/dist/esm/cli/build.js +12 -0
  54. package/dist/esm/cli/clear.js +11 -0
  55. package/dist/esm/cli/deploy.js +16 -0
  56. package/dist/{js/modern → esm}/cli/index.js +0 -0
  57. package/dist/esm/cli/install.js +11 -0
  58. package/dist/esm/cli/new.js +18 -0
  59. package/dist/esm/commands/build-watch.js +24 -0
  60. package/dist/esm/commands/build.js +55 -0
  61. package/dist/esm/commands/clear.js +19 -0
  62. package/dist/{js/modern → esm}/commands/deploy.js +4 -24
  63. package/dist/{js/modern → esm}/commands/index.js +0 -0
  64. package/dist/esm/commands/install.js +23 -0
  65. package/dist/{js/modern → esm}/constants.js +0 -0
  66. package/dist/{js/modern → esm}/dag/create.js +5 -17
  67. package/dist/{js/modern → esm}/dag/edge-manager.js +0 -0
  68. package/dist/{js/modern → esm}/dag/index.js +0 -0
  69. package/dist/esm/dag/operator.js +203 -0
  70. package/dist/esm/dag/task.js +55 -0
  71. package/dist/{js/modern → esm}/dag/utils.js +0 -0
  72. package/dist/{js/modern → esm}/features/build/index.js +13 -33
  73. package/dist/{js/modern → esm}/features/clear/index.js +0 -0
  74. package/dist/{js/modern → esm}/features/deploy/index.js +10 -30
  75. package/dist/{js/modern → esm}/features/dev/cmds.js +0 -0
  76. package/dist/{js/modern → esm}/features/dev/create-task.js +6 -26
  77. package/dist/{js/modern → esm}/features/dev/index.js +14 -34
  78. package/dist/{js/modern → esm}/features/dev/watch-projects-state.js +3 -21
  79. package/dist/{js/modern → esm}/features/install/index.js +3 -23
  80. package/dist/{js/modern → esm}/hooks/index.js +0 -0
  81. package/dist/{js/modern → esm}/index.js +0 -0
  82. package/dist/{js/modern → esm}/locale/en.js +0 -0
  83. package/dist/{js/modern → esm}/locale/index.js +0 -0
  84. package/dist/{js/modern → esm}/locale/zh.js +0 -0
  85. package/dist/{js/modern → esm}/log/error.js +0 -0
  86. package/dist/{js/modern → esm}/log/multi-tasks-log.js +0 -0
  87. package/dist/esm/log/time.js +13 -0
  88. package/dist/{js/modern → esm}/log/utils.js +0 -0
  89. package/dist/{js/modern → esm}/package/index.js +0 -0
  90. package/dist/esm/parse-config/index.js +15 -0
  91. package/dist/{js/modern → esm}/parse-config/monorepo.js +0 -0
  92. package/dist/{js/modern → esm}/projects/check-project-change.js +12 -32
  93. package/dist/{js/modern → esm}/projects/clear-memory-files.js +0 -0
  94. package/dist/{js/modern → esm}/projects/get-projects-by-packages-config.js +11 -47
  95. package/dist/{js/modern → esm}/projects/get-projects-by-workspace-file.js +4 -24
  96. package/dist/{js/modern → esm}/projects/get-projects.js +15 -49
  97. package/dist/{js/modern → esm}/type.js +0 -0
  98. package/dist/esm/utils/install.js +27 -0
  99. package/dist/{js/modern → esm}/utils/language.js +0 -0
  100. package/dist/{js/modern → esm}/utils/types.js +0 -0
  101. package/package.json +16 -16
  102. package/dist/js/modern/cli/build-watch.js +0 -31
  103. package/dist/js/modern/cli/build.js +0 -32
  104. package/dist/js/modern/cli/clear.js +0 -31
  105. package/dist/js/modern/cli/deploy.js +0 -36
  106. package/dist/js/modern/cli/install.js +0 -31
  107. package/dist/js/modern/cli/new.js +0 -57
  108. package/dist/js/modern/commands/build-watch.js +0 -44
  109. package/dist/js/modern/commands/build.js +0 -90
  110. package/dist/js/modern/commands/clear.js +0 -39
  111. package/dist/js/modern/commands/install.js +0 -43
  112. package/dist/js/modern/dag/operator.js +0 -251
  113. package/dist/js/modern/dag/task.js +0 -79
  114. package/dist/js/modern/log/time.js +0 -29
  115. package/dist/js/modern/parse-config/index.js +0 -51
  116. package/dist/js/modern/utils/install.js +0 -47
  117. package/dist/js/node/cli/install.js +0 -54
  118. package/dist/js/node/dag/operator.js +0 -278
@@ -1,21 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
5
  var __export = (target, all) => {
20
6
  for (var name in all)
21
7
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -29,26 +15,6 @@ var __copyProps = (to, from, except, desc) => {
29
15
  return to;
30
16
  };
31
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
- var __async = (__this, __arguments, generator) => {
33
- return new Promise((resolve, reject) => {
34
- var fulfilled = (value) => {
35
- try {
36
- step(generator.next(value));
37
- } catch (e) {
38
- reject(e);
39
- }
40
- };
41
- var rejected = (value) => {
42
- try {
43
- step(generator.throw(value));
44
- } catch (e) {
45
- reject(e);
46
- }
47
- };
48
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
49
- step((generator = generator.apply(__this, __arguments)).next());
50
- });
51
- };
52
18
  var get_projects_exports = {};
53
19
  __export(get_projects_exports, {
54
20
  getProjects: () => getProjects,
@@ -78,12 +44,12 @@ const getProjectsByProjectsConfig = (rootPath, configs = []) => {
78
44
  }
79
45
  return subProjects;
80
46
  };
81
- const getProjectsByPackagesMatch = (rootPath, match, ignore) => __async(void 0, null, function* () {
47
+ const getProjectsByPackagesMatch = async (rootPath, match, ignore) => {
82
48
  let projects = [];
83
49
  if (Array.isArray(match)) {
84
- projects = yield (0, import_get_projects_by_packages_config.getProjectsByPackageConfig)(rootPath, match, ignore);
50
+ projects = await (0, import_get_projects_by_packages_config.getProjectsByPackageConfig)(rootPath, match, ignore);
85
51
  } else {
86
- projects = yield (0, import_get_projects_by_workspace_file.getProjectsByWorkspaceFile)(
52
+ projects = await (0, import_get_projects_by_workspace_file.getProjectsByWorkspaceFile)(
87
53
  rootPath,
88
54
  match,
89
55
  ignore
@@ -93,9 +59,10 @@ const getProjectsByPackagesMatch = (rootPath, match, ignore) => __async(void 0,
93
59
  for (const project of projects) {
94
60
  subProjects.push({
95
61
  name: project.name,
96
- extra: __spreadValues({
97
- path: project.path
98
- }, project.json),
62
+ extra: {
63
+ path: project.path,
64
+ ...project.json
65
+ },
99
66
  dependencyEdge: 0,
100
67
  dependentEdge: 0,
101
68
  checkedCircle: false,
@@ -103,7 +70,7 @@ const getProjectsByPackagesMatch = (rootPath, match, ignore) => __async(void 0,
103
70
  });
104
71
  }
105
72
  return subProjects;
106
- });
73
+ };
107
74
  const syncGetProjectsByPackagesMatch = (rootPath, match, ignore) => {
108
75
  let projects = [];
109
76
  if (Array.isArray(match)) {
@@ -119,9 +86,10 @@ const syncGetProjectsByPackagesMatch = (rootPath, match, ignore) => {
119
86
  for (const project of projects) {
120
87
  subProjects.push({
121
88
  name: project.name,
122
- extra: __spreadValues({
123
- path: project.path
124
- }, project.json),
89
+ extra: {
90
+ path: project.path,
91
+ ...project.json
92
+ },
125
93
  dependencyEdge: 0,
126
94
  dependentEdge: 0,
127
95
  checkedCircle: false,
@@ -145,12 +113,12 @@ const checkFindProjectsMode = (config) => {
145
113
  }
146
114
  (0, import_error.errorLog)("No `packagesMatchs` and `projectsConfig` configurations found");
147
115
  };
148
- const getProjects = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (config, currentDir = process.cwd()) {
116
+ const getProjects = async (config, currentDir = process.cwd()) => {
149
117
  const { rootPath } = (0, import_monorepo.getMonorepoBaseData)(currentDir);
150
118
  const mode = checkFindProjectsMode(config);
151
119
  let projects = [];
152
120
  if (mode === 0 /* Rough */) {
153
- projects = yield getProjectsByPackagesMatch(
121
+ projects = await getProjectsByPackagesMatch(
154
122
  rootPath,
155
123
  config.packagesMatchs,
156
124
  config.packagesIgnoreMatchs || []
@@ -159,7 +127,7 @@ const getProjects = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (confi
159
127
  projects = getProjectsByProjectsConfig(rootPath, config.projectsConfig);
160
128
  }
161
129
  return projects;
162
- });
130
+ };
163
131
  const syncGetProjects = (config, currentDir = process.cwd()) => {
164
132
  const { rootPath } = (0, import_monorepo.getMonorepoBaseData)(currentDir);
165
133
  const mode = checkFindProjectsMode(config);
File without changes
@@ -21,26 +21,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  mod
22
22
  ));
23
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
24
  var install_exports = {};
45
25
  __export(install_exports, {
46
26
  installByPackageManager: () => installByPackageManager,
@@ -59,17 +39,17 @@ const removeLockFile = (rootPath, packageManager) => {
59
39
  import_utils.fs.removeSync(path.join(rootPath, import_constants.LOCK_FILE.NPM));
60
40
  }
61
41
  };
62
- const installByPackageManager = (_0, _1) => __async(void 0, [_0, _1], function* (packageManager, { rootPath, removeLock }) {
42
+ const installByPackageManager = async (packageManager, { rootPath, removeLock }) => {
63
43
  if (removeLock) {
64
44
  removeLockFile(rootPath, packageManager);
65
45
  }
66
46
  if (packageManager === "pnpm") {
67
- yield (0, import_utils.execa)("pnpm", ["install"], { stdio: "inherit" });
47
+ await (0, import_utils.execa)("pnpm", ["install"], { stdio: "inherit" });
68
48
  }
69
49
  if (packageManager === "yarn") {
70
- yield (0, import_utils.execa)("yarn", ["install"], { stdio: "inherit" });
50
+ await (0, import_utils.execa)("yarn", ["install"], { stdio: "inherit" });
71
51
  }
72
- });
52
+ };
73
53
  // Annotate the CommonJS export names for ESM import in node:
74
54
  0 && (module.exports = {
75
55
  installByPackageManager,
File without changes
File without changes
@@ -0,0 +1,11 @@
1
+ import { buildWatch } from "../commands";
2
+ const buildWatchCli = (program, api) => {
3
+ program.command("build-watch [project]").usage("[options]").option("--only-self", "build target project with nothing").option("-i, --init", "init build beforebuild watch ").description("watch target project and target project’s dependencies").action(
4
+ async (targetProjectName, option) => {
5
+ await buildWatch(targetProjectName, option, api);
6
+ }
7
+ );
8
+ };
9
+ export {
10
+ buildWatchCli
11
+ };
@@ -0,0 +1,12 @@
1
+ import { build } from "../commands";
2
+ const buildCli = (program, api) => {
3
+ program.command("build [project]").usage("[options]").option("--no-self", "build without target project").option("-t, --dept", "build target project with project’s dependent").option("--no-deps", "build target project without project’s dependencies").option("--only-self", "build target project with nothing").option(
4
+ "-a, --all",
5
+ "build target project with project’s dependencies and dependent"
6
+ ).option("--content-hash", "build target project use content hash cache").option("--git-hash", "build target project use git hash cache").description("build target project").action(async (targetProjectName, option) => {
7
+ await build(targetProjectName, option, api);
8
+ });
9
+ };
10
+ export {
11
+ buildCli
12
+ };
@@ -0,0 +1,11 @@
1
+ import { clear } from "../commands";
2
+ const clearCli = (program, api) => {
3
+ program.command("clear [projects...]").usage("[options]").option("--remove-dirs [dirs...]", "remove dirs, default is node_modules").description("clear project dirs").action(
4
+ async (targetProjectNames, option) => {
5
+ await clear(targetProjectNames, option, api);
6
+ }
7
+ );
8
+ };
9
+ export {
10
+ clearCli
11
+ };
@@ -0,0 +1,16 @@
1
+ import { deploy } from "../commands";
2
+ const deployCli = (program, api) => {
3
+ program.command("deploy [project...]").usage("[options]").option(
4
+ "-p, --path [path]",
5
+ "Specify the path of the product output",
6
+ "output"
7
+ ).description("deploy project").action(
8
+ async (deployProjectNames, option) => {
9
+ const ignoreMatchs = ["**/output/**"];
10
+ await deploy(api, deployProjectNames, option, ignoreMatchs);
11
+ }
12
+ );
13
+ };
14
+ export {
15
+ deployCli
16
+ };
File without changes
@@ -0,0 +1,11 @@
1
+ import { install } from "../commands";
2
+ const installCli = (program, api) => {
3
+ program.command("install [project...]").usage("[options]").description("install deps for some projects").action(
4
+ async (installProjectNames, option) => {
5
+ await install(installProjectNames, option, api);
6
+ }
7
+ );
8
+ };
9
+ export {
10
+ installCli
11
+ };
@@ -0,0 +1,18 @@
1
+ import { MonorepoNewAction } from "@modern-js/new-action";
2
+ import { i18n, localeKeys } from "../locale";
3
+ const newCli = (program, locale) => {
4
+ program.command("new").usage("[options]").description(i18n.t(localeKeys.command.new.describe)).option("-d, --debug", i18n.t(localeKeys.command.new.debug), false).option("-c, --config <config>", i18n.t(localeKeys.command.new.config)).option(
5
+ "-p, --plugin <plugin>",
6
+ i18n.t(localeKeys.command.new.plugin),
7
+ (val, memo) => {
8
+ memo.push(val);
9
+ return memo;
10
+ },
11
+ []
12
+ ).option("--lang <lang>", i18n.t(localeKeys.command.new.lang)).option("--dist-tag <tag>", i18n.t(localeKeys.command.new.distTag)).option("--registry", i18n.t(localeKeys.command.new.registry)).action(async (options) => {
13
+ await MonorepoNewAction({ ...options, locale: options.lang || locale });
14
+ });
15
+ };
16
+ export {
17
+ newCli
18
+ };
@@ -0,0 +1,24 @@
1
+ import { getMonorepoBaseData } from "../parse-config/monorepo";
2
+ import { runBuildWatchTask } from "../features/dev";
3
+ import { getProjects } from "../projects/get-projects";
4
+ import { initDAG } from "../dag";
5
+ const buildWatch = async (targetProjectName, option, api) => {
6
+ const { appDirectory } = api.useAppContext();
7
+ const { onlySelf = false, init = false } = option;
8
+ const projects = await getProjects(
9
+ { packagesMatchs: { enableAutoFinder: true } },
10
+ appDirectory
11
+ );
12
+ const operator = initDAG(projects);
13
+ operator.checkCircle();
14
+ const { rootPath, packageManager } = getMonorepoBaseData(process.cwd());
15
+ await runBuildWatchTask(targetProjectName, operator, {
16
+ rootPath,
17
+ packageManager,
18
+ onlySelf,
19
+ needInit: init
20
+ });
21
+ };
22
+ export {
23
+ buildWatch
24
+ };
@@ -0,0 +1,55 @@
1
+ import { getMonorepoBaseData } from "../parse-config/monorepo";
2
+ import { runBuildTask, runAllBuildTask } from "../features/build";
3
+ import { getProjects } from "../projects/get-projects";
4
+ import { initDAG } from "../dag";
5
+ const build = async (targetProjectName, option, api) => {
6
+ const { appDirectory } = api.useAppContext();
7
+ const {
8
+ self = true,
9
+ dept = false,
10
+ deps = true,
11
+ onlySelf = false,
12
+ all = false,
13
+ contentHash = false,
14
+ gitHash = false
15
+ } = option;
16
+ const projects = await getProjects(
17
+ { packagesMatchs: { enableAutoFinder: true } },
18
+ appDirectory
19
+ );
20
+ const operator = initDAG(projects);
21
+ operator.checkCircle();
22
+ const { rootPath, packageManager } = getMonorepoBaseData(appDirectory);
23
+ const overrideConfig = {};
24
+ if (all) {
25
+ overrideConfig.disableWithDeps = false;
26
+ overrideConfig.withSelf = true;
27
+ overrideConfig.withDept = true;
28
+ }
29
+ if (targetProjectName) {
30
+ runBuildTask(targetProjectName, operator, {
31
+ rootPath,
32
+ packageManager,
33
+ withSelf: self,
34
+ withDept: dept,
35
+ onlySelf,
36
+ disableWithDeps: !deps,
37
+ disableContentHash: !contentHash,
38
+ enableGitHash: gitHash,
39
+ ...overrideConfig
40
+ });
41
+ } else {
42
+ const currentDir = process.cwd();
43
+ if (currentDir === appDirectory) {
44
+ await runAllBuildTask(operator, {
45
+ rootPath: currentDir,
46
+ packageManager,
47
+ disableContentHash: !contentHash,
48
+ enableGitHash: gitHash
49
+ });
50
+ }
51
+ }
52
+ };
53
+ export {
54
+ build
55
+ };
@@ -0,0 +1,19 @@
1
+ import { getProjects } from "../projects/get-projects";
2
+ import { getMonorepoBaseData } from "../parse-config/monorepo";
3
+ import { runClearTask } from "../features/clear";
4
+ const clear = async (projectNames, option, api) => {
5
+ const { removeDirs } = option;
6
+ const { appDirectory } = api.useAppContext();
7
+ const projects = await getProjects(
8
+ { packagesMatchs: { enableAutoFinder: true } },
9
+ appDirectory
10
+ );
11
+ const { rootPath } = getMonorepoBaseData(appDirectory);
12
+ runClearTask(projectNames, projects, {
13
+ rootPath,
14
+ removeDirs
15
+ });
16
+ };
17
+ export {
18
+ clear
19
+ };
@@ -1,33 +1,13 @@
1
- var __async = (__this, __arguments, generator) => {
2
- return new Promise((resolve, reject) => {
3
- var fulfilled = (value) => {
4
- try {
5
- step(generator.next(value));
6
- } catch (e) {
7
- reject(e);
8
- }
9
- };
10
- var rejected = (value) => {
11
- try {
12
- step(generator.throw(value));
13
- } catch (e) {
14
- reject(e);
15
- }
16
- };
17
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
- step((generator = generator.apply(__this, __arguments)).next());
19
- });
20
- };
21
1
  import { logger } from "@modern-js/utils";
22
2
  import { initDAG } from "../dag";
23
3
  import { getMonorepoBaseData } from "../parse-config/monorepo";
24
4
  import { getProjects } from "../projects/get-projects";
25
5
  import { deploy as runDeployTask } from "../features/deploy";
26
- const deploy = (_0, _1, _2, ..._3) => __async(void 0, [_0, _1, _2, ..._3], function* (api, deployProjectNames, option, ignoreMatchs = []) {
6
+ const deploy = async (api, deployProjectNames, option, ignoreMatchs = []) => {
27
7
  const { deployPath = "output" } = option;
28
8
  const { appDirectory } = api.useAppContext();
29
9
  logger.info(`start deploy ${deployProjectNames.join(",")}`);
30
- const projects = yield getProjects(
10
+ const projects = await getProjects(
31
11
  {
32
12
  packagesMatchs: { enableAutoFinder: true },
33
13
  packagesIgnoreMatchs: ignoreMatchs
@@ -36,14 +16,14 @@ const deploy = (_0, _1, _2, ..._3) => __async(void 0, [_0, _1, _2, ..._3], funct
36
16
  );
37
17
  const { rootPath, packageManager } = getMonorepoBaseData(process.cwd());
38
18
  const operator = initDAG(projects);
39
- yield runDeployTask(deployProjectNames, operator, {
19
+ await runDeployTask(deployProjectNames, operator, {
40
20
  rootPath,
41
21
  packageManager,
42
22
  deployPath
43
23
  });
44
24
  const runners = api.useHookRunners();
45
25
  runners.afterMonorepoDeploy({ operator, deployProjectNames });
46
- });
26
+ };
47
27
  export {
48
28
  deploy
49
29
  };
File without changes
@@ -0,0 +1,23 @@
1
+ import { runInstallTask } from "../features/install";
2
+ import { getMonorepoBaseData } from "../parse-config/monorepo";
3
+ import { getProjects } from "../projects/get-projects";
4
+ import { initDAG } from "../dag";
5
+ const install = async (projectNames = [], option, api) => {
6
+ const { appDirectory } = api.useAppContext();
7
+ const { auto } = option;
8
+ const projects = await getProjects(
9
+ { packagesMatchs: { enableAutoFinder: true } },
10
+ appDirectory
11
+ );
12
+ const operator = initDAG(projects);
13
+ operator.checkCircle();
14
+ const { rootPath, packageManager } = getMonorepoBaseData(appDirectory);
15
+ await runInstallTask(projectNames, operator, {
16
+ packageManager,
17
+ rootPath,
18
+ auto
19
+ });
20
+ };
21
+ export {
22
+ install
23
+ };
File without changes
@@ -1,24 +1,12 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
- var __hasOwnProp = Object.prototype.hasOwnProperty;
4
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __spreadValues = (a, b) => {
7
- for (var prop in b || (b = {}))
8
- if (__hasOwnProp.call(b, prop))
9
- __defNormalProp(a, prop, b[prop]);
10
- if (__getOwnPropSymbols)
11
- for (var prop of __getOwnPropSymbols(b)) {
12
- if (__propIsEnum.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- }
15
- return a;
16
- };
17
1
  const initProjectDependencyAndDependent = (project, projectsName, projectsMap) => {
18
2
  const dependencies = project.extra.dependencies || {};
19
3
  const devDependencies = project.extra.devDependencies || {};
20
4
  const optionalDependencies = project.extra.optionalDependencies || {};
21
- const DependencyProjectsName = Object.keys(__spreadValues(__spreadValues(__spreadValues({}, dependencies), devDependencies), optionalDependencies)).filter((depName) => projectsName.includes(depName));
5
+ const DependencyProjectsName = Object.keys({
6
+ ...dependencies,
7
+ ...devDependencies,
8
+ ...optionalDependencies
9
+ }).filter((depName) => projectsName.includes(depName));
22
10
  project.dependent = project.dependent || [];
23
11
  project.dependency = DependencyProjectsName.map((projectName) => {
24
12
  const dependencyProject = projectsMap.get(projectName);
File without changes
File without changes