@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
@@ -1,54 +1,79 @@
1
- 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; }
2
- import { EventEmitter } from 'events';
3
- import pMap from 'p-map';
4
- export class TaskRunner extends EventEmitter {
5
- constructor(tasks, {
6
- concurrency
7
- }) {
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 { EventEmitter } from "events";
22
+ import pMap from "p-map";
23
+ const _TaskRunner = class extends EventEmitter {
24
+ constructor(tasks, { concurrency }) {
8
25
  super();
9
- _defineProperty(this, "_tasks", void 0);
10
- _defineProperty(this, "_concurrency", void 0);
11
- _defineProperty(this, "_usableConcurrency", void 0);
12
- _defineProperty(this, "_stopFlag", void 0);
13
26
  this._tasks = tasks;
14
- this._concurrency = concurrency || TaskRunner.DefaultConcurrency;
27
+ this._concurrency = concurrency || _TaskRunner.DefaultConcurrency;
15
28
  this._usableConcurrency = this._concurrency;
16
29
  this._stopFlag = false;
17
30
  }
18
- async run() {
19
- const tasks = this._tasks.splice(0, this._concurrency);
20
- this._usableConcurrency = this._concurrency - tasks.length;
21
- await pMap(tasks, async task => {
22
- await this._runTask(task);
23
- }, {
24
- concurrency: tasks.length
31
+ run() {
32
+ return __async(this, null, function* () {
33
+ const tasks = this._tasks.splice(0, this._concurrency);
34
+ this._usableConcurrency = this._concurrency - tasks.length;
35
+ yield pMap(
36
+ tasks,
37
+ (task) => __async(this, null, function* () {
38
+ yield this._runTask(task);
39
+ }),
40
+ { concurrency: tasks.length }
41
+ );
25
42
  });
26
43
  }
27
44
  addTask(task) {
28
45
  this._tasks.push(task);
29
46
  }
30
- async _runTask(task) {
31
- if (this._stopFlag) {
32
- return;
33
- }
34
- const emitValue = await task(this._stopTask.bind(this));
35
- this._usableConcurrency--;
36
- this.emit(TaskRunner.TASK_FINISH, emitValue);
37
- if (this._tasks.length > 0) {
38
- const nextTasks = this._tasks.splice(0, this._usableConcurrency);
39
- this._usableConcurrency -= nextTasks.length;
40
- if (nextTasks.length > 0) {
41
- await pMap(nextTasks, async _task => {
42
- await this._runTask(_task);
43
- }, {
44
- concurrency: nextTasks.length
45
- });
47
+ _runTask(task) {
48
+ return __async(this, null, function* () {
49
+ if (this._stopFlag) {
50
+ return;
46
51
  }
47
- }
52
+ const emitValue = yield task(this._stopTask.bind(this));
53
+ this._usableConcurrency--;
54
+ this.emit(_TaskRunner.TASK_FINISH, emitValue);
55
+ if (this._tasks.length > 0) {
56
+ const nextTasks = this._tasks.splice(0, this._usableConcurrency);
57
+ this._usableConcurrency -= nextTasks.length;
58
+ if (nextTasks.length > 0) {
59
+ yield pMap(
60
+ nextTasks,
61
+ (_task) => __async(this, null, function* () {
62
+ yield this._runTask(_task);
63
+ }),
64
+ { concurrency: nextTasks.length }
65
+ );
66
+ }
67
+ }
68
+ });
48
69
  }
49
70
  _stopTask() {
50
71
  this._stopFlag = true;
51
72
  }
52
- }
53
- _defineProperty(TaskRunner, "DefaultConcurrency", 10);
54
- _defineProperty(TaskRunner, "TASK_FINISH", 'task-finish');
73
+ };
74
+ let TaskRunner = _TaskRunner;
75
+ TaskRunner.DefaultConcurrency = 10;
76
+ TaskRunner.TASK_FINISH = "task-finish";
77
+ export {
78
+ TaskRunner
79
+ };
@@ -1,78 +1,67 @@
1
1
  import { errorLog } from "../log/error";
2
2
  import { EdgeManager } from "./edge-manager";
3
-
4
- /**
5
- * Calculate the number of packages which must be built before we reach
6
- * the furthest away "root" node
7
- */
8
- export const calculateCriticalPaths = project => {
9
- var _project$dependent;
10
- // Return the memoized value
11
- if (project.criticalPathLength !== undefined) {
3
+ const calculateCriticalPaths = (project) => {
4
+ var _a, _b;
5
+ if (project.criticalPathLength !== void 0) {
12
6
  return project.criticalPathLength;
13
7
  }
14
-
15
- // If no dependents, we are in a "root"
16
- if (((_project$dependent = project.dependent) === null || _project$dependent === void 0 ? void 0 : _project$dependent.length) === 0) {
8
+ if (((_a = project.dependent) == null ? void 0 : _a.length) === 0) {
17
9
  project.criticalPathLength = 0;
18
10
  return project.criticalPathLength;
19
11
  } else {
20
- var _project$dependent2;
21
- // Otherwise we are as long as the longest package + 1
22
12
  const depsLengths = [];
23
- (_project$dependent2 = project.dependent) === null || _project$dependent2 === void 0 ? void 0 : _project$dependent2.forEach(dependentProject => depsLengths.push(calculateCriticalPaths(dependentProject)));
13
+ (_b = project.dependent) == null ? void 0 : _b.forEach(
14
+ (dependentProject) => depsLengths.push(calculateCriticalPaths(dependentProject))
15
+ );
24
16
  project.criticalPathLength = Math.max(...depsLengths) + 1;
25
17
  return project.criticalPathLength;
26
18
  }
27
19
  };
28
- const _recursiveGetDependencySkipCircleDeps = node => {
20
+ const _recursiveGetDependencySkipCircleDeps = (node) => {
29
21
  let allDeps = [];
30
- const foundDepsNameSet = new Set([node.name]);
22
+ const foundDepsNameSet = /* @__PURE__ */ new Set([node.name]);
31
23
  let queue = [node];
32
24
  while (queue.length > 0) {
33
25
  const checkNode = queue.pop();
34
26
  const checkNodeDeps = checkNode.dependency || [];
35
27
  if (checkNodeDeps.length > 0) {
36
- const willIntoQueue = checkNodeDeps.filter(dep => !foundDepsNameSet.has(dep.name));
28
+ const willIntoQueue = checkNodeDeps.filter(
29
+ (dep) => !foundDepsNameSet.has(dep.name)
30
+ );
37
31
  allDeps = [...allDeps, ...willIntoQueue];
38
- willIntoQueue.forEach(dep => foundDepsNameSet.add(dep.name));
32
+ willIntoQueue.forEach((dep) => foundDepsNameSet.add(dep.name));
39
33
  queue = [...queue, ...willIntoQueue];
40
34
  }
41
35
  }
42
36
  return allDeps;
43
37
  };
44
- export const recursiveGetDependency = (project, skipCircleProjects = false) => {
38
+ const recursiveGetDependency = (project, skipCircleProjects = false) => {
45
39
  if (skipCircleProjects) {
46
40
  return _recursiveGetDependencySkipCircleDeps(project);
47
41
  }
48
42
  const dependency = project.dependency || [];
49
43
  let allDependency = [...dependency];
50
44
  for (const dependencyProject of dependency) {
51
- allDependency = [...allDependency, ...recursiveGetDependency(dependencyProject)];
45
+ allDependency = [
46
+ ...allDependency,
47
+ ...recursiveGetDependency(dependencyProject)
48
+ ];
52
49
  }
53
50
  return allDependency;
54
51
  };
55
-
56
- // 拓扑排序
57
- export const sortProjects = projects => {
58
- const sortedQueue = []; // 排好序的队列
59
- let readyIntoSortedQueue = []; // 用来准备放入 sortedQueue的数组
60
- let queue = []; // 用来存放入度为0的节点
52
+ const sortProjects = (projects) => {
53
+ const sortedQueue = [];
54
+ let readyIntoSortedQueue = [];
55
+ let queue = [];
61
56
  const edgeManager = new EdgeManager();
62
- // 初始化队列queue
63
57
  for (const project of projects) {
64
58
  edgeManager.setEdge(project);
65
- // 入度为0进队列
66
- // TODO 可能存在多个 dagNodeFrom === 0 的节点
67
59
  if (edgeManager.getEdge(project) === 0) {
68
60
  queue.push(project);
69
61
  }
70
62
  }
71
-
72
- // 加入最初入度为0的节点
73
63
  sortedQueue.push([...queue]);
74
- let shiftNodesCount = 0; // 计算出队列的节点数量,用于在最后判断是否存在环/依赖循环
75
-
64
+ let shiftNodesCount = 0;
76
65
  while (queue.length > 0) {
77
66
  const checkNode = queue.shift();
78
67
  shiftNodesCount++;
@@ -89,13 +78,12 @@ export const sortProjects = projects => {
89
78
  }
90
79
  }
91
80
  if (shiftNodesCount < projects.length) {
92
- errorLog('Items with a dependency loop');
81
+ errorLog("Items with a dependency loop");
93
82
  } else {
94
- // console.info('No dependency loop');
95
83
  }
96
84
  return sortedQueue;
97
85
  };
98
- export const findCircle = projects => {
86
+ const findCircle = (projects) => {
99
87
  let result = projects.reduce((circleNodes, project) => {
100
88
  if (project.dependencyEdge > 0) {
101
89
  return [...circleNodes, project];
@@ -107,4 +95,10 @@ export const findCircle = projects => {
107
95
  const checkNode = result.shift();
108
96
  checkNode.dependencyEdge--;
109
97
  }
110
- };
98
+ };
99
+ export {
100
+ calculateCriticalPaths,
101
+ findCircle,
102
+ recursiveGetDependency,
103
+ sortProjects
104
+ };
@@ -1,6 +1,29 @@
1
- import os from 'os';
2
- import { execa, signale } from '@modern-js/utils';
3
- import { checkProjectChangeByGit, checkProjectChangeByContent } from "../../projects/check-project-change";
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 os from "os";
22
+ import { execa, signale } from "@modern-js/utils";
23
+ import {
24
+ checkProjectChangeByGit,
25
+ checkProjectChangeByContent
26
+ } from "../../projects/check-project-change";
4
27
  import { errorLog } from "../../log/error";
5
28
  import { MultitasksLogger } from "../../log/multi-tasks-log";
6
29
  const createTask = (config, taskCmds = defaultBuildCmds, taskLogger) => {
@@ -10,18 +33,17 @@ const createTask = (config, taskCmds = defaultBuildCmds, taskLogger) => {
10
33
  disableContentHash = false,
11
34
  enableGitHash = false
12
35
  } = config;
13
- const task = async project => {
14
- console.info('run ', project.name);
15
- // const taskTimeLog = timeLog.initTimeLog({ scope: '' });
36
+ const task = (project) => __async(void 0, null, function* () {
37
+ console.info("run ", project.name);
16
38
  if (!disableContentHash) {
17
- const changed = await checkProjectChangeByContent(project);
39
+ const changed = yield checkProjectChangeByContent(project);
18
40
  if (!changed) {
19
41
  console.info(`${project.name} content not change, skip`);
20
42
  return;
21
43
  }
22
44
  }
23
45
  if (enableGitHash) {
24
- const changed = await checkProjectChangeByGit(project, rootPath);
46
+ const changed = yield checkProjectChangeByGit(project, rootPath);
25
47
  if (!changed) {
26
48
  console.info(`${project.name} not change, skip`);
27
49
  return;
@@ -32,22 +54,18 @@ const createTask = (config, taskCmds = defaultBuildCmds, taskLogger) => {
32
54
  for (const taskCmd of taskCmds) {
33
55
  if (cmd[taskCmd]) {
34
56
  const prefix = `run ${project.name} ${taskCmd} script`;
35
- // timeLog.startTime(taskTimeLog, prefix);
36
57
  signale.time(prefix);
37
58
  try {
38
59
  const childProcess = execa(packageManager, [taskCmd], {
39
60
  cwd: project.extra.path,
40
- stdio: ['pipe', 'pipe', 'pipe']
61
+ stdio: ["pipe", "pipe", "pipe"]
41
62
  });
42
63
  taskLogger.addLogProvider(project.name, {
43
64
  stdout: childProcess.stdout,
44
65
  stderr: childProcess.stderr,
45
- logConfig: {
46
- label: 'BUILD: '
47
- }
66
+ logConfig: { label: "BUILD: " }
48
67
  });
49
- await childProcess;
50
- // timeLog.endTime(taskTimeLog, prefix);
68
+ yield childProcess;
51
69
  signale.timeEnd(prefix);
52
70
  } catch (e) {
53
71
  errorLog(project.name, e.message);
@@ -56,11 +74,11 @@ const createTask = (config, taskCmds = defaultBuildCmds, taskLogger) => {
56
74
  console.info(`${project.name} not have ${taskCmd}, skip it.`);
57
75
  }
58
76
  }
59
- };
77
+ });
60
78
  return task;
61
79
  };
62
- const defaultBuildCmds = ['build'];
63
- export const runBuildTask = async (projectName, operator, config, taskCmds = defaultBuildCmds) => {
80
+ const defaultBuildCmds = ["build"];
81
+ const runBuildTask = (_0, _1, _2, ..._3) => __async(void 0, [_0, _1, _2, ..._3], function* (projectName, operator, config, taskCmds = defaultBuildCmds) {
64
82
  const {
65
83
  withSelf = true,
66
84
  onlySelf = false,
@@ -69,18 +87,15 @@ export const runBuildTask = async (projectName, operator, config, taskCmds = def
69
87
  } = config;
70
88
  const taskLogger = new MultitasksLogger();
71
89
  const task = createTask(config, taskCmds, taskLogger);
72
- // 优先级 onlySelf > withDept、disableWithDeps
73
90
  if (onlySelf) {
74
- await task(operator.getNodeData(projectName, {
75
- checkExist: true
76
- }));
91
+ yield task(operator.getNodeData(projectName, { checkExist: true }));
77
92
  } else if (!disableWithDeps && withDept) {
78
- await operator.traverseDependenciesToProjectToDependent(projectName, task, {
93
+ yield operator.traverseDependenciesToProjectToDependent(projectName, task, {
79
94
  withSelf,
80
95
  runTaskConcurrency: os.cpus().length
81
96
  });
82
97
  } else if (disableWithDeps && withDept) {
83
- await operator.traverseProjectToDependent(projectName, task, {
98
+ yield operator.traverseProjectToDependent(projectName, task, {
84
99
  withSelf,
85
100
  runTaskConcurrency: os.cpus().length
86
101
  });
@@ -90,9 +105,13 @@ export const runBuildTask = async (projectName, operator, config, taskCmds = def
90
105
  runTaskConcurrency: os.cpus().length
91
106
  });
92
107
  }
93
- };
94
- export const runAllBuildTask = async (operator, config, taskCmds = defaultBuildCmds) => {
108
+ });
109
+ const runAllBuildTask = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (operator, config, taskCmds = defaultBuildCmds) {
95
110
  const taskLogger = new MultitasksLogger();
96
111
  const task = createTask(config, taskCmds, taskLogger);
97
- await operator.traverseAllNodes(task);
98
- };
112
+ yield operator.traverseAllNodes(task);
113
+ });
114
+ export {
115
+ runAllBuildTask,
116
+ runBuildTask
117
+ };
@@ -1,16 +1,13 @@
1
- import * as path from 'path';
2
- import { logger } from '@modern-js/utils';
3
- import { FileSystem } from '@rushstack/node-core-library';
4
- export const defaultRemoveDirs = ['node_modules'];
5
- export const runClearTask = (projectNames, projects, config) => {
6
- const {
7
- removeDirs = defaultRemoveDirs,
8
- rootPath
9
- } = config;
1
+ import * as path from "path";
2
+ import { logger } from "@modern-js/utils";
3
+ import { FileSystem } from "@rushstack/node-core-library";
4
+ const defaultRemoveDirs = ["node_modules"];
5
+ const runClearTask = (projectNames, projects, config) => {
6
+ const { removeDirs = defaultRemoveDirs, rootPath } = config;
10
7
  if (projectNames.length > 0) {
11
- projects.forEach(project => {
8
+ projects.forEach((project) => {
12
9
  if (projectNames.includes(project.name)) {
13
- removeDirs.forEach(dir => {
10
+ removeDirs.forEach((dir) => {
14
11
  const removePath = path.join(`${project.extra.path}`, dir);
15
12
  logger.info(`remove ${removePath}`);
16
13
  FileSystem.deleteFolder(removePath);
@@ -18,17 +15,21 @@ export const runClearTask = (projectNames, projects, config) => {
18
15
  }
19
16
  });
20
17
  } else {
21
- removeDirs.forEach(dir => {
18
+ removeDirs.forEach((dir) => {
22
19
  const removePath = path.join(`${rootPath}`, dir);
23
20
  logger.info(`remove ${removePath}`);
24
21
  FileSystem.deleteFolder(removePath);
25
22
  });
26
- projects.forEach(project => {
27
- removeDirs.forEach(dir => {
23
+ projects.forEach((project) => {
24
+ removeDirs.forEach((dir) => {
28
25
  const removePath = path.join(`${project.extra.path}`, dir);
29
26
  logger.info(`remove ${removePath}`);
30
27
  FileSystem.deleteFolder(removePath);
31
28
  });
32
29
  });
33
30
  }
34
- };
31
+ };
32
+ export {
33
+ defaultRemoveDirs,
34
+ runClearTask
35
+ };