@modern-js/monorepo-tools 2.0.0-beta.3 → 2.0.0-beta.4

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 (104) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/bin/modern.js +3 -1
  3. package/dist/js/modern/cli/build-watch.js +30 -5
  4. package/dist/js/modern/cli/build.js +31 -5
  5. package/dist/js/modern/cli/clear.js +30 -5
  6. package/dist/js/modern/cli/deploy.js +35 -7
  7. package/dist/js/modern/cli/index.js +1 -1
  8. package/dist/js/modern/cli/install.js +30 -5
  9. package/dist/js/modern/cli/new.js +56 -14
  10. package/dist/js/modern/commands/build-watch.js +32 -18
  11. package/dist/js/modern/commands/build.js +49 -23
  12. package/dist/js/modern/commands/clear.js +31 -15
  13. package/dist/js/modern/commands/deploy.js +38 -24
  14. package/dist/js/modern/commands/index.js +1 -1
  15. package/dist/js/modern/commands/install.js +32 -17
  16. package/dist/js/modern/constants.js +13 -9
  17. package/dist/js/modern/dag/create.js +27 -23
  18. package/dist/js/modern/dag/edge-manager.js +5 -4
  19. package/dist/js/modern/dag/index.js +6 -5
  20. package/dist/js/modern/dag/operator.js +174 -156
  21. package/dist/js/modern/dag/task.js +64 -39
  22. package/dist/js/modern/dag/utils.js +32 -38
  23. package/dist/js/modern/features/build/index.js +47 -28
  24. package/dist/js/modern/features/clear/index.js +16 -15
  25. package/dist/js/modern/features/deploy/index.js +107 -82
  26. package/dist/js/modern/features/dev/cmds.js +4 -3
  27. package/dist/js/modern/features/dev/create-task.js +43 -34
  28. package/dist/js/modern/features/dev/index.js +60 -41
  29. package/dist/js/modern/features/dev/watch-projects-state.js +47 -24
  30. package/dist/js/modern/features/install/index.js +43 -22
  31. package/dist/js/modern/hooks/index.js +6 -3
  32. package/dist/js/modern/index.js +18 -16
  33. package/dist/js/modern/locale/en.js +10 -7
  34. package/dist/js/modern/locale/index.js +6 -6
  35. package/dist/js/modern/locale/zh.js +11 -8
  36. package/dist/js/modern/log/error.js +6 -3
  37. package/dist/js/modern/log/multi-tasks-log.js +25 -34
  38. package/dist/js/modern/log/time.js +26 -11
  39. package/dist/js/modern/log/utils.js +9 -5
  40. package/dist/js/modern/package/index.js +5 -6
  41. package/dist/js/modern/parse-config/index.js +49 -22
  42. package/dist/js/modern/parse-config/monorepo.js +41 -26
  43. package/dist/js/modern/projects/check-project-change.js +59 -30
  44. package/dist/js/modern/projects/clear-memory-files.js +17 -7
  45. package/dist/js/modern/projects/get-projects-by-packages-config.js +89 -52
  46. package/dist/js/modern/projects/get-projects-by-workspace-file.js +68 -32
  47. package/dist/js/modern/projects/get-projects.js +96 -53
  48. package/dist/js/modern/type.js +0 -1
  49. package/dist/js/modern/utils/install.js +36 -19
  50. package/dist/js/modern/utils/language.js +6 -3
  51. package/dist/js/node/cli/build-watch.js +47 -10
  52. package/dist/js/node/cli/build.js +48 -10
  53. package/dist/js/node/cli/clear.js +47 -10
  54. package/dist/js/node/cli/deploy.js +52 -12
  55. package/dist/js/node/cli/index.js +22 -71
  56. package/dist/js/node/cli/install.js +47 -10
  57. package/dist/js/node/cli/new.js +73 -19
  58. package/dist/js/node/commands/build-watch.js +55 -29
  59. package/dist/js/node/commands/build.js +72 -32
  60. package/dist/js/node/commands/clear.js +53 -25
  61. package/dist/js/node/commands/deploy.js +61 -35
  62. package/dist/js/node/commands/index.js +21 -60
  63. package/dist/js/node/commands/install.js +55 -28
  64. package/dist/js/node/constants.js +28 -13
  65. package/dist/js/node/dag/create.js +44 -28
  66. package/dist/js/node/dag/edge-manager.js +21 -8
  67. package/dist/js/node/dag/index.js +26 -13
  68. package/dist/js/node/dag/operator.js +209 -174
  69. package/dist/js/node/dag/task.js +88 -46
  70. package/dist/js/node/dag/utils.js +51 -47
  71. package/dist/js/node/features/build/index.js +79 -47
  72. package/dist/js/node/features/clear/index.js +44 -28
  73. package/dist/js/node/features/deploy/index.js +135 -104
  74. package/dist/js/node/features/dev/cmds.js +22 -9
  75. package/dist/js/node/features/dev/create-task.js +75 -51
  76. package/dist/js/node/features/dev/index.js +94 -58
  77. package/dist/js/node/features/dev/watch-projects-state.js +69 -30
  78. package/dist/js/node/features/install/index.js +78 -41
  79. package/dist/js/node/hooks/index.js +23 -8
  80. package/dist/js/node/index.js +51 -32
  81. package/dist/js/node/locale/en.js +26 -11
  82. package/dist/js/node/locale/index.js +27 -15
  83. package/dist/js/node/locale/zh.js +27 -12
  84. package/dist/js/node/log/error.js +22 -7
  85. package/dist/js/node/log/multi-tasks-log.js +44 -41
  86. package/dist/js/node/log/time.js +43 -18
  87. package/dist/js/node/log/utils.js +26 -10
  88. package/dist/js/node/package/index.js +21 -10
  89. package/dist/js/node/parse-config/index.js +73 -30
  90. package/dist/js/node/parse-config/monorepo.js +71 -44
  91. package/dist/js/node/projects/check-project-change.js +96 -56
  92. package/dist/js/node/projects/clear-memory-files.js +38 -15
  93. package/dist/js/node/projects/get-projects-by-packages-config.js +116 -65
  94. package/dist/js/node/projects/get-projects-by-workspace-file.js +103 -55
  95. package/dist/js/node/projects/get-projects.js +109 -61
  96. package/dist/js/node/type.js +0 -5
  97. package/dist/js/node/utils/install.js +63 -31
  98. package/dist/js/node/utils/language.js +24 -8
  99. package/dist/types/dag/operator.d.ts +3 -0
  100. package/dist/types/dag/utils.d.ts +1 -0
  101. package/dist/types/features/dev/index.d.ts +1 -0
  102. package/dist/types/index.d.ts +2 -0
  103. package/dist/types/projects/get-projects.d.ts +1 -0
  104. package/package.json +12 -19
package/CHANGELOG.md CHANGED
@@ -1,5 +1,56 @@
1
1
  # @modern-js/monorepo-tools
2
2
 
3
+ ## 2.0.0-beta.4
4
+
5
+ ### Major Changes
6
+
7
+ - dda38c9c3e: chore: v2
8
+
9
+ ### Patch Changes
10
+
11
+ - d4a456659b: chore: rename plugin-jarvis to plugin-lint
12
+
13
+ chore: 重命名 plugin-jarvis 为 plugin-lint
14
+
15
+ - Updated dependencies [7879e8f]
16
+ - Updated dependencies [c9e800d39a]
17
+ - Updated dependencies [6aca875]
18
+ - Updated dependencies [85edee888c]
19
+ - Updated dependencies [2e6031955e]
20
+ - Updated dependencies [7b7d12c]
21
+ - Updated dependencies [92f0eade39]
22
+ - Updated dependencies [edd1cfb1af]
23
+ - Updated dependencies [cc971eabfc]
24
+ - Updated dependencies [5b9049f2e9]
25
+ - Updated dependencies [a3af050486]
26
+ - Updated dependencies [d4a456659b]
27
+ - Updated dependencies [92004d1906]
28
+ - Updated dependencies [b8bbe036c7]
29
+ - Updated dependencies [f680410886]
30
+ - Updated dependencies [d5a31df781]
31
+ - Updated dependencies [dda38c9c3e]
32
+ - Updated dependencies [8b8e1bb571]
33
+ - Updated dependencies [3bbea92b2a]
34
+ - Updated dependencies [b710adb843]
35
+ - Updated dependencies [b7a96c35fc]
36
+ - Updated dependencies [cce8ecee2d]
37
+ - Updated dependencies [f179749375]
38
+ - Updated dependencies [b8494ef]
39
+ - Updated dependencies [ea7cf06]
40
+ - Updated dependencies [bbe4c4a]
41
+ - Updated dependencies [e4558a0]
42
+ - Updated dependencies [abf3421a75]
43
+ - Updated dependencies [543be9558e]
44
+ - Updated dependencies [14b712da84]
45
+ - @modern-js/utils@2.0.0-beta.4
46
+ - @modern-js/core@2.0.0-beta.4
47
+ - @modern-js/plugin-lint@2.0.0-beta.4
48
+ - @modern-js/plugin@2.0.0-beta.4
49
+ - @modern-js/plugin-changeset@2.0.0-beta.4
50
+ - @modern-js/plugin-i18n@2.0.0-beta.4
51
+ - @modern-js/new-action@2.0.0-beta.4
52
+ - @modern-js/upgrade@2.0.0-beta.4
53
+
3
54
  ## 2.0.0-beta.3
4
55
 
5
56
  ### Major Changes
package/bin/modern.js CHANGED
@@ -1,3 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- require('@modern-js/core/bin');
3
+ require('@modern-js/core/runBin').run({
4
+ toolsType: 'monorepo-tools',
5
+ });
@@ -1,6 +1,31 @@
1
- import { buildWatch } from "../commands";
2
- export const buildWatchCli = (program, api) => {
3
- program.command('build-watch [project]').usage('[options]').option('--only-self', 'build target project with nothing').option('-i, --init', 'init build beforebuild watch ').description('watch target project and target project’s dependencies').action(async (targetProjectName, option) => {
4
- await buildWatch(targetProjectName, option, api);
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());
5
19
  });
6
- };
20
+ };
21
+ import { buildWatch } from "../commands";
22
+ const buildWatchCli = (program, api) => {
23
+ 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(
24
+ (targetProjectName, option) => __async(void 0, null, function* () {
25
+ yield buildWatch(targetProjectName, option, api);
26
+ })
27
+ );
28
+ };
29
+ export {
30
+ buildWatchCli
31
+ };
@@ -1,6 +1,32 @@
1
- import { build } from "../commands";
2
- export const buildCli = (program, api) => {
3
- program.command('build [project]').usage('[options]').option('--no-self', 'build without target project').option('-t, --dept', 'build target project with project’s dependent').option('--no-deps', 'build target project without project’s dependencies').option('--only-self', 'build target project with nothing').option('-a, --all', 'build target project with project’s dependencies and dependent').option('--content-hash', 'build target project use content hash cache').option('--git-hash', 'build target project use git hash cache').description('build target project').action(async (targetProjectName, option) => {
4
- await build(targetProjectName, option, api);
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());
5
19
  });
6
- };
20
+ };
21
+ import { build } from "../commands";
22
+ const buildCli = (program, api) => {
23
+ 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(
24
+ "-a, --all",
25
+ "build target project with project’s dependencies and dependent"
26
+ ).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((targetProjectName, option) => __async(void 0, null, function* () {
27
+ yield build(targetProjectName, option, api);
28
+ }));
29
+ };
30
+ export {
31
+ buildCli
32
+ };
@@ -1,6 +1,31 @@
1
- import { clear } from "../commands";
2
- export const clearCli = (program, api) => {
3
- program.command('clear [projects...]').usage('[options]').option('--remove-dirs [dirs...]', 'remove dirs, default is node_modules').description('clear project dirs').action(async (targetProjectNames, option) => {
4
- await clear(targetProjectNames, option, api);
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());
5
19
  });
6
- };
20
+ };
21
+ import { clear } from "../commands";
22
+ const clearCli = (program, api) => {
23
+ program.command("clear [projects...]").usage("[options]").option("--remove-dirs [dirs...]", "remove dirs, default is node_modules").description("clear project dirs").action(
24
+ (targetProjectNames, option) => __async(void 0, null, function* () {
25
+ yield clear(targetProjectNames, option, api);
26
+ })
27
+ );
28
+ };
29
+ export {
30
+ clearCli
31
+ };
@@ -1,8 +1,36 @@
1
- import { deploy } from "../commands";
2
- export const deployCli = (program, api) => {
3
- program.command('deploy [project...]').usage('[options]').option('-p, --path [path]', 'Specify the path of the product output', 'output').description('deploy project').action(async (deployProjectNames, option) => {
4
- // 在查找 workspace 下项目时,默认忽略 output 下面的项目
5
- const ignoreMatchs = ['**/output/**'];
6
- await deploy(api, deployProjectNames, option, ignoreMatchs);
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());
7
19
  });
8
- };
20
+ };
21
+ import { deploy } from "../commands";
22
+ const deployCli = (program, api) => {
23
+ program.command("deploy [project...]").usage("[options]").option(
24
+ "-p, --path [path]",
25
+ "Specify the path of the product output",
26
+ "output"
27
+ ).description("deploy project").action(
28
+ (deployProjectNames, option) => __async(void 0, null, function* () {
29
+ const ignoreMatchs = ["**/output/**"];
30
+ yield deploy(api, deployProjectNames, option, ignoreMatchs);
31
+ })
32
+ );
33
+ };
34
+ export {
35
+ deployCli
36
+ };
@@ -3,4 +3,4 @@ export * from "./deploy";
3
3
  export * from "./build";
4
4
  export * from "./build-watch";
5
5
  export * from "./clear";
6
- export * from "./install";
6
+ export * from "./install";
@@ -1,6 +1,31 @@
1
- import { install } from "../commands";
2
- export const installCli = (program, api) => {
3
- program.command('install [project...]').usage('[options]').description('install deps for some projects').action(async (installProjectNames, option) => {
4
- await install(installProjectNames, option, api);
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());
5
19
  });
6
- };
20
+ };
21
+ import { install } from "../commands";
22
+ const installCli = (program, api) => {
23
+ program.command("install [project...]").usage("[options]").description("install deps for some projects").action(
24
+ (installProjectNames, option) => __async(void 0, null, function* () {
25
+ yield install(installProjectNames, option, api);
26
+ })
27
+ );
28
+ };
29
+ export {
30
+ installCli
31
+ };
@@ -1,15 +1,57 @@
1
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
- import { MonorepoNewAction } from '@modern-js/new-action';
5
- import { i18n, localeKeys } from "../locale";
6
- export const newCli = (program, locale) => {
7
- 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('-p, --plugin <plugin>', i18n.t(localeKeys.command.new.plugin), (val, memo) => {
8
- memo.push(val);
9
- return memo;
10
- }, []).option('--dist-tag <tag>', i18n.t(localeKeys.command.new.distTag)).option('--registry', i18n.t(localeKeys.command.new.registry)).action(async options => {
11
- await MonorepoNewAction(_objectSpread(_objectSpread({}, options), {}, {
12
- locale
13
- }));
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ 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
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __async = (__this, __arguments, generator) => {
21
+ return new Promise((resolve, reject) => {
22
+ var fulfilled = (value) => {
23
+ try {
24
+ step(generator.next(value));
25
+ } catch (e) {
26
+ reject(e);
27
+ }
28
+ };
29
+ var rejected = (value) => {
30
+ try {
31
+ step(generator.throw(value));
32
+ } catch (e) {
33
+ reject(e);
34
+ }
35
+ };
36
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
37
+ step((generator = generator.apply(__this, __arguments)).next());
14
38
  });
15
- };
39
+ };
40
+ import { MonorepoNewAction } from "@modern-js/new-action";
41
+ import { i18n, localeKeys } from "../locale";
42
+ const newCli = (program, locale) => {
43
+ 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(
44
+ "-p, --plugin <plugin>",
45
+ i18n.t(localeKeys.command.new.plugin),
46
+ (val, memo) => {
47
+ memo.push(val);
48
+ return memo;
49
+ },
50
+ []
51
+ ).option("--dist-tag <tag>", i18n.t(localeKeys.command.new.distTag)).option("--registry", i18n.t(localeKeys.command.new.registry)).action((options) => __async(void 0, null, function* () {
52
+ yield MonorepoNewAction(__spreadProps(__spreadValues({}, options), { locale }));
53
+ }));
54
+ };
55
+ export {
56
+ newCli
57
+ };
@@ -1,30 +1,44 @@
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
+ };
1
21
  import { getMonorepoBaseData } from "../parse-config/monorepo";
2
22
  import { runBuildWatchTask } from "../features/dev";
3
23
  import { getProjects } from "../projects/get-projects";
4
24
  import { initDAG } from "../dag";
5
- export const buildWatch = async (targetProjectName, option, api) => {
6
- const {
25
+ const buildWatch = (targetProjectName, option, api) => __async(void 0, null, function* () {
26
+ const { appDirectory } = api.useAppContext();
27
+ const { onlySelf = false, init = false } = option;
28
+ const projects = yield getProjects(
29
+ { packagesMatchs: { enableAutoFinder: true } },
7
30
  appDirectory
8
- } = api.useAppContext();
9
- const {
10
- onlySelf = false,
11
- init = false
12
- } = option;
13
- const projects = await getProjects({
14
- packagesMatchs: {
15
- enableAutoFinder: true
16
- }
17
- }, appDirectory);
31
+ );
18
32
  const operator = initDAG(projects);
19
33
  operator.checkCircle();
20
- const {
21
- rootPath,
22
- packageManager
23
- } = getMonorepoBaseData(process.cwd());
24
- await runBuildWatchTask(targetProjectName, operator, {
34
+ const { rootPath, packageManager } = getMonorepoBaseData(process.cwd());
35
+ yield runBuildWatchTask(targetProjectName, operator, {
25
36
  rootPath,
26
37
  packageManager,
27
38
  onlySelf,
28
39
  needInit: init
29
40
  });
30
- };
41
+ });
42
+ export {
43
+ buildWatch
44
+ };
@@ -1,16 +1,45 @@
1
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
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
+ var __async = (__this, __arguments, generator) => {
18
+ return new Promise((resolve, reject) => {
19
+ var fulfilled = (value) => {
20
+ try {
21
+ step(generator.next(value));
22
+ } catch (e) {
23
+ reject(e);
24
+ }
25
+ };
26
+ var rejected = (value) => {
27
+ try {
28
+ step(generator.throw(value));
29
+ } catch (e) {
30
+ reject(e);
31
+ }
32
+ };
33
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
34
+ step((generator = generator.apply(__this, __arguments)).next());
35
+ });
36
+ };
4
37
  import { getMonorepoBaseData } from "../parse-config/monorepo";
5
38
  import { runBuildTask, runAllBuildTask } from "../features/build";
6
39
  import { getProjects } from "../projects/get-projects";
7
40
  import { initDAG } from "../dag";
8
- // import { clearProjectsMemoryFile } from './projects/clear-memory-files';
9
-
10
- export const build = async (targetProjectName, option, api) => {
11
- const {
12
- appDirectory
13
- } = api.useAppContext();
41
+ const build = (targetProjectName, option, api) => __async(void 0, null, function* () {
42
+ const { appDirectory } = api.useAppContext();
14
43
  const {
15
44
  self = true,
16
45
  dept = false,
@@ -20,17 +49,13 @@ export const build = async (targetProjectName, option, api) => {
20
49
  contentHash = false,
21
50
  gitHash = false
22
51
  } = option;
23
- const projects = await getProjects({
24
- packagesMatchs: {
25
- enableAutoFinder: true
26
- }
27
- }, appDirectory);
52
+ const projects = yield getProjects(
53
+ { packagesMatchs: { enableAutoFinder: true } },
54
+ appDirectory
55
+ );
28
56
  const operator = initDAG(projects);
29
57
  operator.checkCircle();
30
- const {
31
- rootPath,
32
- packageManager
33
- } = getMonorepoBaseData(appDirectory);
58
+ const { rootPath, packageManager } = getMonorepoBaseData(appDirectory);
34
59
  const overrideConfig = {};
35
60
  if (all) {
36
61
  overrideConfig.disableWithDeps = false;
@@ -38,27 +63,28 @@ export const build = async (targetProjectName, option, api) => {
38
63
  overrideConfig.withDept = true;
39
64
  }
40
65
  if (targetProjectName) {
41
- runBuildTask(targetProjectName, operator, _objectSpread({
66
+ runBuildTask(targetProjectName, operator, __spreadValues({
42
67
  rootPath,
43
68
  packageManager,
44
69
  withSelf: self,
45
70
  withDept: dept,
46
71
  onlySelf,
47
72
  disableWithDeps: !deps,
48
- // The CI/CD phase is recommended to be switched on
49
73
  disableContentHash: !contentHash,
50
74
  enableGitHash: gitHash
51
75
  }, overrideConfig));
52
76
  } else {
53
77
  const currentDir = process.cwd();
54
78
  if (currentDir === appDirectory) {
55
- await runAllBuildTask(operator, {
79
+ yield runAllBuildTask(operator, {
56
80
  rootPath: currentDir,
57
81
  packageManager,
58
82
  disableContentHash: !contentHash,
59
83
  enableGitHash: gitHash
60
84
  });
61
85
  }
62
- // TODO: 没有指定项目名称的构建任务如何处理
63
86
  }
64
- };
87
+ });
88
+ export {
89
+ build
90
+ };
@@ -1,23 +1,39 @@
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
+ };
1
21
  import { getProjects } from "../projects/get-projects";
2
22
  import { getMonorepoBaseData } from "../parse-config/monorepo";
3
23
  import { runClearTask } from "../features/clear";
4
- export const clear = async (projectNames, option, api) => {
5
- const {
6
- removeDirs
7
- } = option;
8
- const {
24
+ const clear = (projectNames, option, api) => __async(void 0, null, function* () {
25
+ const { removeDirs } = option;
26
+ const { appDirectory } = api.useAppContext();
27
+ const projects = yield getProjects(
28
+ { packagesMatchs: { enableAutoFinder: true } },
9
29
  appDirectory
10
- } = api.useAppContext();
11
- const projects = await getProjects({
12
- packagesMatchs: {
13
- enableAutoFinder: true
14
- }
15
- }, appDirectory);
16
- const {
17
- rootPath
18
- } = getMonorepoBaseData(appDirectory);
30
+ );
31
+ const { rootPath } = getMonorepoBaseData(appDirectory);
19
32
  runClearTask(projectNames, projects, {
20
33
  rootPath,
21
34
  removeDirs
22
35
  });
23
- };
36
+ });
37
+ export {
38
+ clear
39
+ };
@@ -1,35 +1,49 @@
1
- import { logger } from '@modern-js/utils';
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
+ import { logger } from "@modern-js/utils";
2
22
  import { initDAG } from "../dag";
3
23
  import { getMonorepoBaseData } from "../parse-config/monorepo";
4
24
  import { getProjects } from "../projects/get-projects";
5
25
  import { deploy as runDeployTask } from "../features/deploy";
6
- export const deploy = async (api, deployProjectNames, option, ignoreMatchs = []) => {
7
- const {
8
- deployPath = 'output'
9
- } = option;
10
- const {
11
- appDirectory
12
- } = api.useAppContext();
13
- logger.info(`start deploy ${deployProjectNames.join(',')}`);
14
- const projects = await getProjects({
15
- packagesMatchs: {
16
- enableAutoFinder: true
26
+ const deploy = (_0, _1, _2, ..._3) => __async(void 0, [_0, _1, _2, ..._3], function* (api, deployProjectNames, option, ignoreMatchs = []) {
27
+ const { deployPath = "output" } = option;
28
+ const { appDirectory } = api.useAppContext();
29
+ logger.info(`start deploy ${deployProjectNames.join(",")}`);
30
+ const projects = yield getProjects(
31
+ {
32
+ packagesMatchs: { enableAutoFinder: true },
33
+ packagesIgnoreMatchs: ignoreMatchs
17
34
  },
18
- packagesIgnoreMatchs: ignoreMatchs
19
- }, appDirectory);
20
- const {
21
- rootPath,
22
- packageManager
23
- } = getMonorepoBaseData(process.cwd());
35
+ appDirectory
36
+ );
37
+ const { rootPath, packageManager } = getMonorepoBaseData(process.cwd());
24
38
  const operator = initDAG(projects);
25
- await runDeployTask(deployProjectNames, operator, {
39
+ yield runDeployTask(deployProjectNames, operator, {
26
40
  rootPath,
27
41
  packageManager,
28
42
  deployPath
29
43
  });
30
44
  const runners = api.useHookRunners();
31
- runners.afterMonorepoDeploy({
32
- operator,
33
- deployProjectNames
34
- });
35
- };
45
+ runners.afterMonorepoDeploy({ operator, deployProjectNames });
46
+ });
47
+ export {
48
+ deploy
49
+ };
@@ -2,4 +2,4 @@ export * from "./deploy";
2
2
  export * from "./build";
3
3
  export * from "./build-watch";
4
4
  export * from "./clear";
5
- export * from "./install";
5
+ export * from "./install";