@modern-js/monorepo-tools 2.0.0-beta.3 → 2.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +103 -0
- package/bin/modern.js +3 -1
- package/dist/js/modern/cli/build-watch.js +30 -5
- package/dist/js/modern/cli/build.js +31 -5
- package/dist/js/modern/cli/clear.js +30 -5
- package/dist/js/modern/cli/deploy.js +35 -7
- package/dist/js/modern/cli/index.js +1 -1
- package/dist/js/modern/cli/install.js +30 -5
- package/dist/js/modern/cli/new.js +56 -14
- package/dist/js/modern/commands/build-watch.js +32 -18
- package/dist/js/modern/commands/build.js +49 -23
- package/dist/js/modern/commands/clear.js +31 -15
- package/dist/js/modern/commands/deploy.js +38 -24
- package/dist/js/modern/commands/index.js +1 -1
- package/dist/js/modern/commands/install.js +32 -17
- package/dist/js/modern/constants.js +13 -9
- package/dist/js/modern/dag/create.js +27 -23
- package/dist/js/modern/dag/edge-manager.js +5 -4
- package/dist/js/modern/dag/index.js +6 -5
- package/dist/js/modern/dag/operator.js +174 -156
- package/dist/js/modern/dag/task.js +64 -39
- package/dist/js/modern/dag/utils.js +32 -38
- package/dist/js/modern/features/build/index.js +47 -28
- package/dist/js/modern/features/clear/index.js +16 -15
- package/dist/js/modern/features/deploy/index.js +107 -82
- package/dist/js/modern/features/dev/cmds.js +4 -3
- package/dist/js/modern/features/dev/create-task.js +43 -34
- package/dist/js/modern/features/dev/index.js +60 -41
- package/dist/js/modern/features/dev/watch-projects-state.js +47 -24
- package/dist/js/modern/features/install/index.js +43 -22
- package/dist/js/modern/hooks/index.js +6 -3
- package/dist/js/modern/index.js +18 -16
- package/dist/js/modern/locale/en.js +10 -7
- package/dist/js/modern/locale/index.js +6 -6
- package/dist/js/modern/locale/zh.js +11 -8
- package/dist/js/modern/log/error.js +6 -3
- package/dist/js/modern/log/multi-tasks-log.js +25 -34
- package/dist/js/modern/log/time.js +26 -11
- package/dist/js/modern/log/utils.js +9 -5
- package/dist/js/modern/package/index.js +5 -6
- package/dist/js/modern/parse-config/index.js +49 -22
- package/dist/js/modern/parse-config/monorepo.js +41 -26
- package/dist/js/modern/projects/check-project-change.js +59 -30
- package/dist/js/modern/projects/clear-memory-files.js +17 -7
- package/dist/js/modern/projects/get-projects-by-packages-config.js +89 -52
- package/dist/js/modern/projects/get-projects-by-workspace-file.js +68 -32
- package/dist/js/modern/projects/get-projects.js +96 -53
- package/dist/js/modern/type.js +0 -1
- package/dist/js/modern/utils/install.js +36 -19
- package/dist/js/modern/utils/language.js +6 -3
- package/dist/js/node/cli/build-watch.js +51 -10
- package/dist/js/node/cli/build.js +52 -10
- package/dist/js/node/cli/clear.js +51 -10
- package/dist/js/node/cli/deploy.js +56 -12
- package/dist/js/node/cli/index.js +22 -71
- package/dist/js/node/cli/install.js +51 -10
- package/dist/js/node/cli/new.js +75 -19
- package/dist/js/node/commands/build-watch.js +59 -29
- package/dist/js/node/commands/build.js +74 -32
- package/dist/js/node/commands/clear.js +57 -25
- package/dist/js/node/commands/deploy.js +65 -35
- package/dist/js/node/commands/index.js +21 -60
- package/dist/js/node/commands/install.js +59 -28
- package/dist/js/node/constants.js +33 -13
- package/dist/js/node/dag/create.js +46 -28
- package/dist/js/node/dag/edge-manager.js +25 -8
- package/dist/js/node/dag/index.js +30 -13
- package/dist/js/node/dag/operator.js +211 -174
- package/dist/js/node/dag/task.js +92 -46
- package/dist/js/node/dag/utils.js +58 -47
- package/dist/js/node/features/build/index.js +84 -47
- package/dist/js/node/features/clear/index.js +49 -28
- package/dist/js/node/features/deploy/index.js +139 -104
- package/dist/js/node/features/dev/cmds.js +26 -9
- package/dist/js/node/features/dev/create-task.js +80 -51
- package/dist/js/node/features/dev/index.js +98 -58
- package/dist/js/node/features/dev/watch-projects-state.js +71 -30
- package/dist/js/node/features/install/index.js +82 -41
- package/dist/js/node/hooks/index.js +27 -8
- package/dist/js/node/index.js +53 -32
- package/dist/js/node/locale/en.js +30 -11
- package/dist/js/node/locale/index.js +31 -14
- package/dist/js/node/locale/zh.js +31 -12
- package/dist/js/node/log/error.js +26 -7
- package/dist/js/node/log/multi-tasks-log.js +48 -41
- package/dist/js/node/log/time.js +47 -18
- package/dist/js/node/log/utils.js +30 -10
- package/dist/js/node/package/index.js +25 -10
- package/dist/js/node/parse-config/index.js +76 -31
- package/dist/js/node/parse-config/monorepo.js +79 -44
- package/dist/js/node/projects/check-project-change.js +104 -56
- package/dist/js/node/projects/clear-memory-files.js +42 -15
- package/dist/js/node/projects/get-projects-by-packages-config.js +119 -65
- package/dist/js/node/projects/get-projects-by-workspace-file.js +108 -55
- package/dist/js/node/projects/get-projects.js +112 -61
- package/dist/js/node/type.js +15 -5
- package/dist/js/node/utils/install.js +68 -31
- package/dist/js/node/utils/language.js +28 -8
- package/dist/js/node/utils/types.js +15 -0
- package/dist/types/dag/operator.d.ts +3 -0
- package/dist/types/dag/utils.d.ts +1 -0
- package/dist/types/features/dev/index.d.ts +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/projects/get-projects.d.ts +1 -0
- package/package.json +12 -19
|
@@ -1,86 +1,126 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
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
|
+
var dev_exports = {};
|
|
45
|
+
__export(dev_exports, {
|
|
46
|
+
runBuildWatchTask: () => runBuildWatchTask
|
|
5
47
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
const getIgnored = config => watchFilePath => {
|
|
15
|
-
// 默认忽略 node_modules 的变化和 dist 目录下文件的变化
|
|
48
|
+
module.exports = __toCommonJS(dev_exports);
|
|
49
|
+
var import_anymatch = __toESM(require("anymatch"));
|
|
50
|
+
var import_utils = require("@modern-js/utils");
|
|
51
|
+
var import_multi_tasks_log = require("../../log/multi-tasks-log");
|
|
52
|
+
var import_watch_projects_state = require("./watch-projects-state");
|
|
53
|
+
var import_cmds = require("./cmds");
|
|
54
|
+
var import_create_task = require("./create-task");
|
|
55
|
+
const getIgnored = (config) => (watchFilePath) => {
|
|
16
56
|
const nodeModulesPattern = /(?:^|[\\/])node_modules/g;
|
|
17
|
-
if (nodeModulesPattern.test(watchFilePath) || watchFilePath.includes(
|
|
57
|
+
if (nodeModulesPattern.test(watchFilePath) || watchFilePath.includes("dist")) {
|
|
18
58
|
return true;
|
|
19
59
|
}
|
|
20
60
|
if (config.ignoreMaybeChanged) {
|
|
21
|
-
return (0,
|
|
61
|
+
return (0, import_anymatch.default)(config.ignoreMaybeChanged)(watchFilePath);
|
|
22
62
|
}
|
|
23
63
|
return false;
|
|
24
64
|
};
|
|
25
|
-
const runBuildWatchTask =
|
|
26
|
-
const {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
const dependenciesTask = (0, _createTask.createDependenciesTask)(config, taskCmds, taskLogger);
|
|
31
|
-
const devTask = (0, _createTask.createDevTask)(config, taskCmds, taskLogger);
|
|
65
|
+
const runBuildWatchTask = (_0, _1, _2, ..._3) => __async(void 0, [_0, _1, _2, ..._3], function* (projectName, operator, config, taskCmds = import_cmds.defaultBuildWatchCmds) {
|
|
66
|
+
const { needInit = true } = config;
|
|
67
|
+
const taskLogger = new import_multi_tasks_log.MultitasksLogger();
|
|
68
|
+
const dependenciesTask = (0, import_create_task.createDependenciesTask)(config, taskCmds, taskLogger);
|
|
69
|
+
const devTask = (0, import_create_task.createDevTask)(config, taskCmds, taskLogger);
|
|
32
70
|
const fromNodes = operator.getNodeAllDependencyData(projectName);
|
|
33
|
-
const watchedProjectState = new
|
|
34
|
-
const watcher = new
|
|
71
|
+
const watchedProjectState = new import_watch_projects_state.WatchedProjectsState(fromNodes, config);
|
|
72
|
+
const watcher = new import_utils.chokidar.FSWatcher({
|
|
35
73
|
persistent: true,
|
|
36
74
|
cwd: config.rootPath,
|
|
37
75
|
followSymlinks: false,
|
|
38
76
|
ignoreInitial: true,
|
|
39
77
|
ignored: getIgnored(config),
|
|
40
78
|
disableGlobbing: true,
|
|
41
|
-
interval:
|
|
79
|
+
interval: 1e3
|
|
42
80
|
});
|
|
43
81
|
watcher.add(watchedProjectState.getWatchedProjectsPath());
|
|
44
|
-
|
|
45
|
-
// 可能会移除该判断和 neeInit 配置
|
|
46
82
|
if (needInit) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
83
|
+
yield operator.traverseDependenciesToProject(
|
|
84
|
+
projectName,
|
|
85
|
+
(currentProject) => __async(void 0, null, function* () {
|
|
86
|
+
yield dependenciesTask(currentProject);
|
|
87
|
+
})
|
|
88
|
+
);
|
|
50
89
|
}
|
|
51
|
-
|
|
52
|
-
console.info(
|
|
53
|
-
watcher.on(
|
|
54
|
-
|
|
55
|
-
if (eventName === 'add') {
|
|
90
|
+
yield new Promise((resolve) => {
|
|
91
|
+
console.info("start watch");
|
|
92
|
+
watcher.on("all", (eventName, changeFilePath) => __async(void 0, null, function* () {
|
|
93
|
+
if (eventName === "add") {
|
|
56
94
|
watchedProjectState.updateState();
|
|
57
95
|
}
|
|
58
96
|
const changedProject = watchedProjectState.getChangedProject(changeFilePath);
|
|
59
97
|
if (changedProject) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
98
|
+
yield operator.traverseProjectToDependent(
|
|
99
|
+
changedProject.name,
|
|
100
|
+
(currentProject, _, earlyFinish) => __async(void 0, null, function* () {
|
|
101
|
+
if (currentProject.name === projectName) {
|
|
102
|
+
earlyFinish();
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (watchedProjectState.watchProjectsName.includes(
|
|
106
|
+
currentProject.name
|
|
107
|
+
)) {
|
|
108
|
+
console.info("run build", currentProject.name);
|
|
109
|
+
yield dependenciesTask(currentProject);
|
|
110
|
+
}
|
|
111
|
+
}),
|
|
112
|
+
{ withSelf: true }
|
|
113
|
+
);
|
|
73
114
|
resolve(null);
|
|
74
115
|
} else {
|
|
75
|
-
console.info(
|
|
116
|
+
console.info("changed is not in monorepo manager");
|
|
76
117
|
}
|
|
77
|
-
});
|
|
118
|
+
}));
|
|
78
119
|
resolve(null);
|
|
79
120
|
});
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
};
|
|
86
|
-
exports.runBuildWatchTask = runBuildWatchTask;
|
|
121
|
+
yield devTask(operator.getNodeData(projectName, { checkExist: true }));
|
|
122
|
+
});
|
|
123
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
124
|
+
0 && (module.exports = {
|
|
125
|
+
runBuildWatchTask
|
|
126
|
+
});
|
|
@@ -1,25 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __export = (target, all) => {
|
|
25
|
+
for (var name in all)
|
|
26
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
27
|
+
};
|
|
28
|
+
var __copyProps = (to, from, except, desc) => {
|
|
29
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
30
|
+
for (let key of __getOwnPropNames(from))
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
32
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
33
|
+
}
|
|
34
|
+
return to;
|
|
35
|
+
};
|
|
36
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
37
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
38
|
+
mod
|
|
39
|
+
));
|
|
40
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
41
|
+
var watch_projects_state_exports = {};
|
|
42
|
+
__export(watch_projects_state_exports, {
|
|
43
|
+
WatchedProjectsState: () => WatchedProjectsState
|
|
5
44
|
});
|
|
6
|
-
exports
|
|
7
|
-
var path =
|
|
8
|
-
var
|
|
9
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
10
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
|
-
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; }
|
|
12
|
-
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; }
|
|
13
|
-
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; }
|
|
45
|
+
module.exports = __toCommonJS(watch_projects_state_exports);
|
|
46
|
+
var path = __toESM(require("path"));
|
|
47
|
+
var import_utils = require("@modern-js/utils");
|
|
14
48
|
class WatchedProjectsState {
|
|
15
49
|
constructor(fromNodes, config) {
|
|
16
|
-
_defineProperty(this, "_config", void 0);
|
|
17
|
-
_defineProperty(this, "_fromNodes", void 0);
|
|
18
|
-
_defineProperty(this, "_watchProjects", void 0);
|
|
19
|
-
_defineProperty(this, "_projectsFileMap", void 0);
|
|
20
50
|
this._fromNodes = fromNodes;
|
|
21
51
|
this._config = config;
|
|
22
|
-
this._projectsFileMap = new Map();
|
|
52
|
+
this._projectsFileMap = /* @__PURE__ */ new Map();
|
|
23
53
|
this._watchProjects = {};
|
|
24
54
|
this._initState();
|
|
25
55
|
}
|
|
@@ -29,24 +59,30 @@ class WatchedProjectsState {
|
|
|
29
59
|
absolute: true,
|
|
30
60
|
expandDirectories: false,
|
|
31
61
|
followSymbolicLinks: false,
|
|
32
|
-
ignore: [
|
|
62
|
+
ignore: ["**/node_modules/**", ".project-memory/**", "dist/**"]
|
|
33
63
|
};
|
|
34
|
-
this._watchProjects = this._fromNodes.reduce(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
64
|
+
this._watchProjects = this._fromNodes.reduce(
|
|
65
|
+
(ret, node) => {
|
|
66
|
+
const files = import_utils.globby.sync(`${node.extra.path}/**`, globOption);
|
|
67
|
+
for (const filePath of files) {
|
|
68
|
+
this._projectsFileMap.set(
|
|
69
|
+
path.relative(this._config.rootPath, filePath),
|
|
70
|
+
node.extra.path
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
return __spreadProps(__spreadValues({}, ret), {
|
|
74
|
+
[node.extra.path]: node
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
{}
|
|
78
|
+
);
|
|
43
79
|
}
|
|
44
80
|
getChangedProject(changedFilPath) {
|
|
45
81
|
if (this._projectsFileMap.has(changedFilPath)) {
|
|
46
82
|
const projectPath = this._projectsFileMap.get(changedFilPath);
|
|
47
83
|
return this._watchProjects[projectPath];
|
|
48
84
|
}
|
|
49
|
-
return
|
|
85
|
+
return void 0;
|
|
50
86
|
}
|
|
51
87
|
getWatchedProjectsPath() {
|
|
52
88
|
return Object.keys(this._watchProjects);
|
|
@@ -58,7 +94,12 @@ class WatchedProjectsState {
|
|
|
58
94
|
return this._watchProjects;
|
|
59
95
|
}
|
|
60
96
|
get watchProjectsName() {
|
|
61
|
-
return Object.keys(this._watchProjects).map(
|
|
97
|
+
return Object.keys(this._watchProjects).map(
|
|
98
|
+
(projectPath) => this._watchProjects[projectPath].name
|
|
99
|
+
);
|
|
62
100
|
}
|
|
63
101
|
}
|
|
64
|
-
|
|
102
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
103
|
+
0 && (module.exports = {
|
|
104
|
+
WatchedProjectsState
|
|
105
|
+
});
|
|
@@ -1,72 +1,113 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
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
|
+
var install_exports = {};
|
|
45
|
+
__export(install_exports, {
|
|
46
|
+
runInstallTask: () => runInstallTask
|
|
5
47
|
});
|
|
6
|
-
exports
|
|
7
|
-
var path =
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
48
|
+
module.exports = __toCommonJS(install_exports);
|
|
49
|
+
var path = __toESM(require("path"));
|
|
50
|
+
var import_utils = require("@modern-js/utils");
|
|
51
|
+
var import_node_core_library = require("@rushstack/node-core-library");
|
|
52
|
+
var import_constants = require("../../constants");
|
|
53
|
+
var import_install = require("../../utils/install");
|
|
14
54
|
const replaceWorkspaces = ({
|
|
15
55
|
rootPath,
|
|
16
56
|
projectsInWorkspaces
|
|
17
57
|
}) => {
|
|
18
|
-
|
|
19
|
-
const pnpmWsFilePath = path.join(rootPath,
|
|
20
|
-
if (
|
|
21
|
-
const pnpmWorkspace =
|
|
22
|
-
const originalPnpmWorkspaces =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
58
|
+
var _a;
|
|
59
|
+
const pnpmWsFilePath = path.join(rootPath, import_constants.WORKSPACE_FILE.PNPM);
|
|
60
|
+
if (import_utils.fs.existsSync(pnpmWsFilePath)) {
|
|
61
|
+
const pnpmWorkspace = import_utils.fs.readFileSync(pnpmWsFilePath, "utf-8");
|
|
62
|
+
const originalPnpmWorkspaces = import_utils.yaml.load(pnpmWorkspace);
|
|
63
|
+
import_utils.fs.writeFileSync(
|
|
64
|
+
pnpmWsFilePath,
|
|
65
|
+
import_utils.yaml.dump({ packages: projectsInWorkspaces })
|
|
66
|
+
);
|
|
26
67
|
return () => {
|
|
27
|
-
|
|
68
|
+
import_utils.yaml.dump(originalPnpmWorkspaces);
|
|
28
69
|
};
|
|
29
70
|
}
|
|
30
|
-
const pkgFilePath = path.join(rootPath,
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (pkg !== null && pkg !== void 0 && (_pkg$workspaces = pkg.workspaces) !== null && _pkg$workspaces !== void 0 && _pkg$workspaces.packages) {
|
|
71
|
+
const pkgFilePath = path.join(rootPath, import_constants.WORKSPACE_FILE.YARN);
|
|
72
|
+
if (import_utils.fs.existsSync(pkgFilePath)) {
|
|
73
|
+
const pkg = import_node_core_library.JsonFile.load(pkgFilePath);
|
|
74
|
+
if ((_a = pkg == null ? void 0 : pkg.workspaces) == null ? void 0 : _a.packages) {
|
|
35
75
|
const originalPkg = pkg;
|
|
36
76
|
pkg.workspaces.packages = projectsInWorkspaces;
|
|
37
|
-
|
|
77
|
+
import_node_core_library.JsonFile.save(pkg, pkgFilePath);
|
|
38
78
|
return () => {
|
|
39
|
-
|
|
79
|
+
import_node_core_library.JsonFile.save(originalPkg, pkgFilePath);
|
|
40
80
|
};
|
|
41
81
|
}
|
|
42
82
|
}
|
|
43
83
|
return false;
|
|
44
84
|
};
|
|
45
|
-
const runInstallTask =
|
|
46
|
-
const {
|
|
47
|
-
rootPath,
|
|
48
|
-
packageManager
|
|
49
|
-
} = config;
|
|
85
|
+
const runInstallTask = (projectNames, operator, config) => __async(void 0, null, function* () {
|
|
86
|
+
const { rootPath, packageManager } = config;
|
|
50
87
|
let projectsInWorkspaces = [];
|
|
51
88
|
if (projectNames.length === 0) {
|
|
52
|
-
console.info(
|
|
89
|
+
console.info("install all projects");
|
|
53
90
|
return;
|
|
54
91
|
}
|
|
55
92
|
for (const projectName of projectNames) {
|
|
56
93
|
const allDeps = operator.getNodeAllDependencyData(projectName);
|
|
57
|
-
projectsInWorkspaces = [
|
|
94
|
+
projectsInWorkspaces = [
|
|
95
|
+
...projectsInWorkspaces,
|
|
96
|
+
path.relative(rootPath, operator.getNodeData(projectName).extra.path),
|
|
97
|
+
...allDeps.map((p) => path.relative(rootPath, p.extra.path))
|
|
98
|
+
];
|
|
58
99
|
}
|
|
59
100
|
const noDupProjectList = Array.from(new Set(projectsInWorkspaces));
|
|
60
101
|
const restorWorkspace = replaceWorkspaces({
|
|
61
102
|
rootPath,
|
|
62
103
|
projectsInWorkspaces: noDupProjectList
|
|
63
104
|
});
|
|
64
|
-
|
|
65
|
-
rootPath,
|
|
66
|
-
removeLock: true
|
|
67
|
-
});
|
|
105
|
+
yield (0, import_install.installByPackageManager)(packageManager, { rootPath, removeLock: true });
|
|
68
106
|
if (restorWorkspace) {
|
|
69
107
|
restorWorkspace();
|
|
70
108
|
}
|
|
71
|
-
};
|
|
72
|
-
|
|
109
|
+
});
|
|
110
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
111
|
+
0 && (module.exports = {
|
|
112
|
+
runInstallTask
|
|
113
|
+
});
|
|
@@ -1,12 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var hooks_exports = {};
|
|
19
|
+
__export(hooks_exports, {
|
|
20
|
+
hooks: () => hooks
|
|
5
21
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
const afterMonorepoDeploy = (0,
|
|
22
|
+
module.exports = __toCommonJS(hooks_exports);
|
|
23
|
+
var import_plugin = require("@modern-js/plugin");
|
|
24
|
+
const afterMonorepoDeploy = (0, import_plugin.createAsyncWorkflow)();
|
|
9
25
|
const hooks = {
|
|
10
26
|
afterMonorepoDeploy
|
|
11
27
|
};
|
|
12
|
-
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
hooks
|
|
31
|
+
});
|
package/dist/js/node/index.js
CHANGED
|
@@ -1,38 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
var src_exports = {};
|
|
25
|
+
__export(src_exports, {
|
|
26
|
+
default: () => src_default
|
|
5
27
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
28
|
+
module.exports = __toCommonJS(src_exports);
|
|
29
|
+
var import_plugin_changeset = __toESM(require("@modern-js/plugin-changeset"));
|
|
30
|
+
var import_plugin_lint = __toESM(require("@modern-js/plugin-lint"));
|
|
31
|
+
var import_utils = require("@modern-js/utils");
|
|
32
|
+
var import_locale = require("./locale");
|
|
33
|
+
var import_cli = require("./cli");
|
|
34
|
+
var import_language = require("./utils/language");
|
|
35
|
+
var import_hooks = require("./hooks");
|
|
36
|
+
const upgradeModel = import_utils.Import.lazy(
|
|
37
|
+
"@modern-js/upgrade",
|
|
38
|
+
require
|
|
39
|
+
);
|
|
40
|
+
var src_default = () => ({
|
|
41
|
+
name: "@modern-js/monorepo-tools",
|
|
42
|
+
usePlugins: [(0, import_plugin_changeset.default)(), (0, import_plugin_lint.default)()],
|
|
43
|
+
registerHook: import_hooks.hooks,
|
|
44
|
+
setup: (api) => {
|
|
45
|
+
const locale = (0, import_language.getLocaleLanguage)();
|
|
46
|
+
import_locale.i18n.changeLanguage({ locale });
|
|
25
47
|
return {
|
|
26
|
-
commands({
|
|
27
|
-
program
|
|
28
|
-
|
|
29
|
-
(0,
|
|
30
|
-
(
|
|
31
|
-
(0, _cli.newCli)(program, locale);
|
|
32
|
-
upgradeModel.defineCommand(program.command('upgrade'));
|
|
48
|
+
commands({ program }) {
|
|
49
|
+
(0, import_cli.clearCli)(program, api);
|
|
50
|
+
(0, import_cli.deployCli)(program, api);
|
|
51
|
+
(0, import_cli.newCli)(program, locale);
|
|
52
|
+
upgradeModel.defineCommand(program.command("upgrade"));
|
|
33
53
|
}
|
|
34
54
|
};
|
|
35
55
|
},
|
|
36
|
-
post: [
|
|
56
|
+
post: ["@modern-js/plugin-changeset"]
|
|
37
57
|
});
|
|
38
|
-
|
|
58
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
+
0 && (module.exports = {});
|
|
@@ -1,19 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var en_exports = {};
|
|
19
|
+
__export(en_exports, {
|
|
20
|
+
EN_LOCALE: () => EN_LOCALE
|
|
5
21
|
});
|
|
6
|
-
exports
|
|
22
|
+
module.exports = __toCommonJS(en_exports);
|
|
7
23
|
const EN_LOCALE = {
|
|
8
24
|
command: {
|
|
9
25
|
new: {
|
|
10
|
-
describe:
|
|
11
|
-
debug:
|
|
12
|
-
config:
|
|
13
|
-
plugin:
|
|
26
|
+
describe: "generator runner for monorepo project",
|
|
27
|
+
debug: "using debug mode to log something",
|
|
28
|
+
config: "set default generator config(json string)",
|
|
29
|
+
plugin: "use generator plugin to create new sub-solution project or customize Modern.js sub-solution project",
|
|
14
30
|
distTag: `use specified tag version for it's generator`,
|
|
15
|
-
registry:
|
|
31
|
+
registry: "set npm registry url to run npm command"
|
|
16
32
|
}
|
|
17
33
|
}
|
|
18
34
|
};
|
|
19
|
-
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
EN_LOCALE
|
|
38
|
+
});
|