@icebreakers/monorepo 0.6.4 → 0.6.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/README.md +10 -0
- package/assets/package.json +6 -0
- package/dist/chunk-43YMCN4J.js +959 -0
- package/dist/cli.cjs +387 -22
- package/dist/cli.js +10 -291
- package/dist/index.cjs +677 -8
- package/dist/index.d.cts +48 -1
- package/dist/index.d.ts +48 -1
- package/dist/index.js +25 -1
- package/package.json +1 -10
- package/dist/chunk-UU4G2QIU.js +0 -279
package/dist/index.cjs
CHANGED
|
@@ -5,6 +5,12 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __esm = (fn, res) => function __init() {
|
|
9
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
+
};
|
|
11
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
12
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
13
|
+
};
|
|
8
14
|
var __export = (target, all) => {
|
|
9
15
|
for (var name2 in all)
|
|
10
16
|
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
@@ -27,42 +33,334 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
33
|
));
|
|
28
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
35
|
|
|
36
|
+
// ../../node_modules/.pnpm/tsup@8.3.0_jiti@2.3.1_postcss@8.4.47_tsx@4.19.1_typescript@5.6.3_yaml@2.5.1/node_modules/tsup/assets/cjs_shims.js
|
|
37
|
+
var getImportMetaUrl, importMetaUrl;
|
|
38
|
+
var init_cjs_shims = __esm({
|
|
39
|
+
"../../node_modules/.pnpm/tsup@8.3.0_jiti@2.3.1_postcss@8.4.47_tsx@4.19.1_typescript@5.6.3_yaml@2.5.1/node_modules/tsup/assets/cjs_shims.js"() {
|
|
40
|
+
"use strict";
|
|
41
|
+
getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
42
|
+
importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// ../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js
|
|
47
|
+
var require_isobject = __commonJS({
|
|
48
|
+
"../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js"(exports2, module2) {
|
|
49
|
+
"use strict";
|
|
50
|
+
init_cjs_shims();
|
|
51
|
+
module2.exports = function isObject(val) {
|
|
52
|
+
return val != null && typeof val === "object" && Array.isArray(val) === false;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// ../../node_modules/.pnpm/get-value@3.0.1/node_modules/get-value/index.js
|
|
58
|
+
var require_get_value = __commonJS({
|
|
59
|
+
"../../node_modules/.pnpm/get-value@3.0.1/node_modules/get-value/index.js"(exports2, module2) {
|
|
60
|
+
"use strict";
|
|
61
|
+
init_cjs_shims();
|
|
62
|
+
var isObject = require_isobject();
|
|
63
|
+
module2.exports = function(target, path8, options) {
|
|
64
|
+
if (!isObject(options)) {
|
|
65
|
+
options = { default: options };
|
|
66
|
+
}
|
|
67
|
+
if (!isValidObject(target)) {
|
|
68
|
+
return typeof options.default !== "undefined" ? options.default : target;
|
|
69
|
+
}
|
|
70
|
+
if (typeof path8 === "number") {
|
|
71
|
+
path8 = String(path8);
|
|
72
|
+
}
|
|
73
|
+
const isArray = Array.isArray(path8);
|
|
74
|
+
const isString = typeof path8 === "string";
|
|
75
|
+
const splitChar = options.separator || ".";
|
|
76
|
+
const joinChar = options.joinChar || (typeof splitChar === "string" ? splitChar : ".");
|
|
77
|
+
if (!isString && !isArray) {
|
|
78
|
+
return target;
|
|
79
|
+
}
|
|
80
|
+
if (isString && path8 in target) {
|
|
81
|
+
return isValid(path8, target, options) ? target[path8] : options.default;
|
|
82
|
+
}
|
|
83
|
+
let segs = isArray ? path8 : split(path8, splitChar, options);
|
|
84
|
+
let len = segs.length;
|
|
85
|
+
let idx = 0;
|
|
86
|
+
do {
|
|
87
|
+
let prop = segs[idx];
|
|
88
|
+
if (typeof prop === "number") {
|
|
89
|
+
prop = String(prop);
|
|
90
|
+
}
|
|
91
|
+
while (prop && prop.slice(-1) === "\\") {
|
|
92
|
+
prop = join([prop.slice(0, -1), segs[++idx] || ""], joinChar, options);
|
|
93
|
+
}
|
|
94
|
+
if (prop in target) {
|
|
95
|
+
if (!isValid(prop, target, options)) {
|
|
96
|
+
return options.default;
|
|
97
|
+
}
|
|
98
|
+
target = target[prop];
|
|
99
|
+
} else {
|
|
100
|
+
let hasProp = false;
|
|
101
|
+
let n = idx + 1;
|
|
102
|
+
while (n < len) {
|
|
103
|
+
prop = join([prop, segs[n++]], joinChar, options);
|
|
104
|
+
if (hasProp = prop in target) {
|
|
105
|
+
if (!isValid(prop, target, options)) {
|
|
106
|
+
return options.default;
|
|
107
|
+
}
|
|
108
|
+
target = target[prop];
|
|
109
|
+
idx = n - 1;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (!hasProp) {
|
|
114
|
+
return options.default;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
} while (++idx < len && isValidObject(target));
|
|
118
|
+
if (idx === len) {
|
|
119
|
+
return target;
|
|
120
|
+
}
|
|
121
|
+
return options.default;
|
|
122
|
+
};
|
|
123
|
+
function join(segs, joinChar, options) {
|
|
124
|
+
if (typeof options.join === "function") {
|
|
125
|
+
return options.join(segs);
|
|
126
|
+
}
|
|
127
|
+
return segs[0] + joinChar + segs[1];
|
|
128
|
+
}
|
|
129
|
+
function split(path8, splitChar, options) {
|
|
130
|
+
if (typeof options.split === "function") {
|
|
131
|
+
return options.split(path8);
|
|
132
|
+
}
|
|
133
|
+
return path8.split(splitChar);
|
|
134
|
+
}
|
|
135
|
+
function isValid(key, target, options) {
|
|
136
|
+
if (typeof options.isValid === "function") {
|
|
137
|
+
return options.isValid(key, target);
|
|
138
|
+
}
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
function isValidObject(val) {
|
|
142
|
+
return isObject(val) || Array.isArray(val) || typeof val === "function";
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// ../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js
|
|
148
|
+
var require_is_primitive = __commonJS({
|
|
149
|
+
"../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js"(exports2, module2) {
|
|
150
|
+
"use strict";
|
|
151
|
+
init_cjs_shims();
|
|
152
|
+
module2.exports = function isPrimitive(val) {
|
|
153
|
+
if (typeof val === "object") {
|
|
154
|
+
return val === null;
|
|
155
|
+
}
|
|
156
|
+
return typeof val !== "function";
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
// ../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js
|
|
162
|
+
var require_is_plain_object = __commonJS({
|
|
163
|
+
"../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js"(exports2, module2) {
|
|
164
|
+
"use strict";
|
|
165
|
+
init_cjs_shims();
|
|
166
|
+
var isObject = require_isobject();
|
|
167
|
+
function isObjectObject(o) {
|
|
168
|
+
return isObject(o) === true && Object.prototype.toString.call(o) === "[object Object]";
|
|
169
|
+
}
|
|
170
|
+
module2.exports = function isPlainObject2(o) {
|
|
171
|
+
var ctor, prot;
|
|
172
|
+
if (isObjectObject(o) === false) return false;
|
|
173
|
+
ctor = o.constructor;
|
|
174
|
+
if (typeof ctor !== "function") return false;
|
|
175
|
+
prot = ctor.prototype;
|
|
176
|
+
if (isObjectObject(prot) === false) return false;
|
|
177
|
+
if (prot.hasOwnProperty("isPrototypeOf") === false) {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
return true;
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
// ../../node_modules/.pnpm/set-value@4.1.0/node_modules/set-value/index.js
|
|
186
|
+
var require_set_value = __commonJS({
|
|
187
|
+
"../../node_modules/.pnpm/set-value@4.1.0/node_modules/set-value/index.js"(exports2, module2) {
|
|
188
|
+
"use strict";
|
|
189
|
+
init_cjs_shims();
|
|
190
|
+
var { deleteProperty } = Reflect;
|
|
191
|
+
var isPrimitive = require_is_primitive();
|
|
192
|
+
var isPlainObject2 = require_is_plain_object();
|
|
193
|
+
var isObject = (value) => {
|
|
194
|
+
return typeof value === "object" && value !== null || typeof value === "function";
|
|
195
|
+
};
|
|
196
|
+
var isUnsafeKey = (key) => {
|
|
197
|
+
return key === "__proto__" || key === "constructor" || key === "prototype";
|
|
198
|
+
};
|
|
199
|
+
var validateKey = (key) => {
|
|
200
|
+
if (!isPrimitive(key)) {
|
|
201
|
+
throw new TypeError("Object keys must be strings or symbols");
|
|
202
|
+
}
|
|
203
|
+
if (isUnsafeKey(key)) {
|
|
204
|
+
throw new Error(`Cannot set unsafe key: "${key}"`);
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
var toStringKey = (input) => {
|
|
208
|
+
return Array.isArray(input) ? input.flat().map(String).join(",") : input;
|
|
209
|
+
};
|
|
210
|
+
var createMemoKey = (input, options) => {
|
|
211
|
+
if (typeof input !== "string" || !options) return input;
|
|
212
|
+
let key = input + ";";
|
|
213
|
+
if (options.arrays !== void 0) key += `arrays=${options.arrays};`;
|
|
214
|
+
if (options.separator !== void 0) key += `separator=${options.separator};`;
|
|
215
|
+
if (options.split !== void 0) key += `split=${options.split};`;
|
|
216
|
+
if (options.merge !== void 0) key += `merge=${options.merge};`;
|
|
217
|
+
if (options.preservePaths !== void 0) key += `preservePaths=${options.preservePaths};`;
|
|
218
|
+
return key;
|
|
219
|
+
};
|
|
220
|
+
var memoize = (input, options, fn) => {
|
|
221
|
+
const key = toStringKey(options ? createMemoKey(input, options) : input);
|
|
222
|
+
validateKey(key);
|
|
223
|
+
const value = setValue.cache.get(key) || fn();
|
|
224
|
+
setValue.cache.set(key, value);
|
|
225
|
+
return value;
|
|
226
|
+
};
|
|
227
|
+
var splitString = (input, options = {}) => {
|
|
228
|
+
const sep = options.separator || ".";
|
|
229
|
+
const preserve = sep === "/" ? false : options.preservePaths;
|
|
230
|
+
if (typeof input === "string" && preserve !== false && /\//.test(input)) {
|
|
231
|
+
return [input];
|
|
232
|
+
}
|
|
233
|
+
const parts = [];
|
|
234
|
+
let part = "";
|
|
235
|
+
const push = (part2) => {
|
|
236
|
+
let number;
|
|
237
|
+
if (part2.trim() !== "" && Number.isInteger(number = Number(part2))) {
|
|
238
|
+
parts.push(number);
|
|
239
|
+
} else {
|
|
240
|
+
parts.push(part2);
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
for (let i = 0; i < input.length; i++) {
|
|
244
|
+
const value = input[i];
|
|
245
|
+
if (value === "\\") {
|
|
246
|
+
part += input[++i];
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
if (value === sep) {
|
|
250
|
+
push(part);
|
|
251
|
+
part = "";
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
part += value;
|
|
255
|
+
}
|
|
256
|
+
if (part) {
|
|
257
|
+
push(part);
|
|
258
|
+
}
|
|
259
|
+
return parts;
|
|
260
|
+
};
|
|
261
|
+
var split = (input, options) => {
|
|
262
|
+
if (options && typeof options.split === "function") return options.split(input);
|
|
263
|
+
if (typeof input === "symbol") return [input];
|
|
264
|
+
if (Array.isArray(input)) return input;
|
|
265
|
+
return memoize(input, options, () => splitString(input, options));
|
|
266
|
+
};
|
|
267
|
+
var assignProp = (obj, prop, value, options) => {
|
|
268
|
+
validateKey(prop);
|
|
269
|
+
if (value === void 0) {
|
|
270
|
+
deleteProperty(obj, prop);
|
|
271
|
+
} else if (options && options.merge) {
|
|
272
|
+
const merge = options.merge === "function" ? options.merge : Object.assign;
|
|
273
|
+
if (merge && isPlainObject2(obj[prop]) && isPlainObject2(value)) {
|
|
274
|
+
obj[prop] = merge(obj[prop], value);
|
|
275
|
+
} else {
|
|
276
|
+
obj[prop] = value;
|
|
277
|
+
}
|
|
278
|
+
} else {
|
|
279
|
+
obj[prop] = value;
|
|
280
|
+
}
|
|
281
|
+
return obj;
|
|
282
|
+
};
|
|
283
|
+
var setValue = (target, path8, value, options) => {
|
|
284
|
+
if (!path8 || !isObject(target)) return target;
|
|
285
|
+
const keys = split(path8, options);
|
|
286
|
+
let obj = target;
|
|
287
|
+
for (let i = 0; i < keys.length; i++) {
|
|
288
|
+
const key = keys[i];
|
|
289
|
+
const next = keys[i + 1];
|
|
290
|
+
validateKey(key);
|
|
291
|
+
if (next === void 0) {
|
|
292
|
+
assignProp(obj, key, value, options);
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
if (typeof next === "number" && !Array.isArray(obj[key])) {
|
|
296
|
+
obj = obj[key] = [];
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
if (!isObject(obj[key])) {
|
|
300
|
+
obj[key] = {};
|
|
301
|
+
}
|
|
302
|
+
obj = obj[key];
|
|
303
|
+
}
|
|
304
|
+
return target;
|
|
305
|
+
};
|
|
306
|
+
setValue.split = split;
|
|
307
|
+
setValue.cache = /* @__PURE__ */ new Map();
|
|
308
|
+
setValue.clear = () => {
|
|
309
|
+
setValue.cache = /* @__PURE__ */ new Map();
|
|
310
|
+
};
|
|
311
|
+
module2.exports = setValue;
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
|
|
30
315
|
// src/index.ts
|
|
31
316
|
var src_exports = {};
|
|
32
317
|
__export(src_exports, {
|
|
318
|
+
GitClient: () => GitClient,
|
|
319
|
+
cleanProjects: () => cleanProjects,
|
|
33
320
|
createNewProject: () => createNewProject,
|
|
321
|
+
escapeStringRegexp: () => escapeStringRegexp,
|
|
322
|
+
getFileHash: () => getFileHash,
|
|
323
|
+
getWorkspacePackages: () => getWorkspacePackages,
|
|
324
|
+
init: () => init,
|
|
325
|
+
isFileChanged: () => isFileChanged,
|
|
326
|
+
isMatch: () => isMatch,
|
|
34
327
|
setPkgJson: () => setPkgJson,
|
|
328
|
+
setVscodeBinaryMirror: () => setVscodeBinaryMirror,
|
|
329
|
+
syncNpmMirror: () => syncNpmMirror,
|
|
35
330
|
upgradeMonorepo: () => upgradeMonorepo
|
|
36
331
|
});
|
|
37
332
|
module.exports = __toCommonJS(src_exports);
|
|
38
|
-
|
|
39
|
-
// ../../node_modules/.pnpm/tsup@8.3.0_jiti@2.3.1_postcss@8.4.47_tsx@4.19.1_typescript@5.6.3_yaml@2.5.1/node_modules/tsup/assets/cjs_shims.js
|
|
40
|
-
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
41
|
-
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
333
|
+
init_cjs_shims();
|
|
42
334
|
|
|
43
335
|
// src/lib.ts
|
|
336
|
+
init_cjs_shims();
|
|
44
337
|
var import_node_process = __toESM(require("process"), 1);
|
|
45
338
|
var import_node_url = require("url");
|
|
46
339
|
var import_checkbox = __toESM(require("@inquirer/checkbox"), 1);
|
|
47
340
|
var import_confirm = __toESM(require("@inquirer/confirm"), 1);
|
|
48
341
|
var import_fs_extra = __toESM(require("fs-extra"), 1);
|
|
49
|
-
var import_get_value2 = __toESM(
|
|
342
|
+
var import_get_value2 = __toESM(require_get_value(), 1);
|
|
50
343
|
var import_klaw = __toESM(require("klaw"), 1);
|
|
51
344
|
var import_p_queue = __toESM(require("p-queue"), 1);
|
|
52
345
|
var import_pathe = __toESM(require("pathe"), 1);
|
|
53
346
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
54
|
-
var import_set_value = __toESM(
|
|
347
|
+
var import_set_value = __toESM(require_set_value(), 1);
|
|
348
|
+
|
|
349
|
+
// src/constants.ts
|
|
350
|
+
init_cjs_shims();
|
|
55
351
|
|
|
56
352
|
// package.json
|
|
57
353
|
var name = "@icebreakers/monorepo";
|
|
58
|
-
var version = "0.6.
|
|
354
|
+
var version = "0.6.6";
|
|
59
355
|
|
|
60
356
|
// src/logger.ts
|
|
357
|
+
init_cjs_shims();
|
|
61
358
|
var import_consola = require("consola");
|
|
62
359
|
var logger = (0, import_consola.createConsola)();
|
|
63
360
|
|
|
64
361
|
// src/monorepo/git.ts
|
|
65
|
-
|
|
362
|
+
init_cjs_shims();
|
|
363
|
+
var import_get_value = __toESM(require_get_value(), 1);
|
|
66
364
|
var import_git_url_parse = __toESM(require("git-url-parse"), 1);
|
|
67
365
|
var import_simple_git = require("simple-git");
|
|
68
366
|
var GitClient = class {
|
|
@@ -111,6 +409,7 @@ var GitClient = class {
|
|
|
111
409
|
};
|
|
112
410
|
|
|
113
411
|
// src/scripts.ts
|
|
412
|
+
init_cjs_shims();
|
|
114
413
|
var scripts = {
|
|
115
414
|
"script:init": "monorepo init",
|
|
116
415
|
"script:sync": "monorepo sync",
|
|
@@ -120,6 +419,7 @@ var scripts = {
|
|
|
120
419
|
var scriptsEntries = Object.entries(scripts);
|
|
121
420
|
|
|
122
421
|
// src/targets.ts
|
|
422
|
+
init_cjs_shims();
|
|
123
423
|
function getAssetTargets(raw) {
|
|
124
424
|
const list = [
|
|
125
425
|
".changeset",
|
|
@@ -154,6 +454,7 @@ function getAssetTargets(raw) {
|
|
|
154
454
|
}
|
|
155
455
|
|
|
156
456
|
// src/utils/md5.ts
|
|
457
|
+
init_cjs_shims();
|
|
157
458
|
var import_node_crypto = __toESM(require("crypto"), 1);
|
|
158
459
|
function getFileHash(data) {
|
|
159
460
|
const hashSum = import_node_crypto.default.createHash("md5");
|
|
@@ -172,6 +473,7 @@ function isFileChanged(src, dest) {
|
|
|
172
473
|
}
|
|
173
474
|
|
|
174
475
|
// src/utils/regexp.ts
|
|
476
|
+
init_cjs_shims();
|
|
175
477
|
function escapeStringRegexp(str) {
|
|
176
478
|
return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
177
479
|
}
|
|
@@ -309,9 +611,376 @@ async function createNewProject(name2) {
|
|
|
309
611
|
await import_fs_extra.default.copy(import_pathe.default.join(templatesDir, defaultTemplate), import_pathe.default.join(cwd, targetTemplate));
|
|
310
612
|
logger.success(`${targetTemplate} \u9879\u76EE\u521B\u5EFA\u6210\u529F\uFF01`);
|
|
311
613
|
}
|
|
614
|
+
|
|
615
|
+
// src/monorepo/index.ts
|
|
616
|
+
init_cjs_shims();
|
|
617
|
+
|
|
618
|
+
// src/monorepo/binaryMirror.ts
|
|
619
|
+
init_cjs_shims();
|
|
620
|
+
var import_comment_json = require("comment-json");
|
|
621
|
+
var import_fs_extra2 = __toESM(require("fs-extra"), 1);
|
|
622
|
+
var import_pathe2 = __toESM(require("pathe"), 1);
|
|
623
|
+
|
|
624
|
+
// src/monorepo/mirror/sources.ts
|
|
625
|
+
init_cjs_shims();
|
|
626
|
+
var chinaMirrorsEnvs = {
|
|
627
|
+
COREPACK_NPM_REGISTRY: "https://registry.npmmirror.com",
|
|
628
|
+
EDGEDRIVER_CDNURL: "https://npmmirror.com/mirrors/edgedriver",
|
|
629
|
+
NODEJS_ORG_MIRROR: "https://cdn.npmmirror.com/binaries/node",
|
|
630
|
+
NVM_NODEJS_ORG_MIRROR: "https://cdn.npmmirror.com/binaries/node",
|
|
631
|
+
PHANTOMJS_CDNURL: "https://cdn.npmmirror.com/binaries/phantomjs",
|
|
632
|
+
CHROMEDRIVER_CDNURL: "https://cdn.npmmirror.com/binaries/chromedriver",
|
|
633
|
+
OPERADRIVER_CDNURL: "https://cdn.npmmirror.com/binaries/operadriver",
|
|
634
|
+
CYPRESS_DOWNLOAD_PATH_TEMPLATE: "https://cdn.npmmirror.com/binaries/cypress/${version}/${platform}-${arch}/cypress.zip",
|
|
635
|
+
ELECTRON_MIRROR: "https://cdn.npmmirror.com/binaries/electron/",
|
|
636
|
+
ELECTRON_BUILDER_BINARIES_MIRROR: "https://cdn.npmmirror.com/binaries/electron-builder-binaries/",
|
|
637
|
+
SASS_BINARY_SITE: "https://cdn.npmmirror.com/binaries/node-sass",
|
|
638
|
+
SWC_BINARY_SITE: "https://cdn.npmmirror.com/binaries/node-swc",
|
|
639
|
+
NWJS_URLBASE: "https://cdn.npmmirror.com/binaries/nwjs/v",
|
|
640
|
+
PUPPETEER_DOWNLOAD_HOST: "https://cdn.npmmirror.com/binaries/chrome-for-testing",
|
|
641
|
+
PUPPETEER_DOWNLOAD_BASE_URL: "https://cdn.npmmirror.com/binaries/chrome-for-testing",
|
|
642
|
+
PLAYWRIGHT_DOWNLOAD_HOST: "https://cdn.npmmirror.com/binaries/playwright",
|
|
643
|
+
SENTRYCLI_CDNURL: "https://cdn.npmmirror.com/binaries/sentry-cli",
|
|
644
|
+
SAUCECTL_INSTALL_BINARY_MIRROR: "https://cdn.npmmirror.com/binaries/saucectl",
|
|
645
|
+
RE2_DOWNLOAD_MIRROR: "https://cdn.npmmirror.com/binaries/node-re2",
|
|
646
|
+
RE2_DOWNLOAD_SKIP_PATH: "true",
|
|
647
|
+
PRISMA_ENGINES_MIRROR: "https://cdn.npmmirror.com/binaries/prisma",
|
|
648
|
+
npm_config_better_sqlite3_binary_host: "https://cdn.npmmirror.com/binaries/better-sqlite3",
|
|
649
|
+
npm_config_keytar_binary_host: "https://cdn.npmmirror.com/binaries/keytar",
|
|
650
|
+
npm_config_sharp_binary_host: "https://cdn.npmmirror.com/binaries/sharp",
|
|
651
|
+
npm_config_sharp_libvips_binary_host: "https://cdn.npmmirror.com/binaries/sharp-libvips",
|
|
652
|
+
npm_config_robotjs_binary_host: "https://cdn.npmmirror.com/binaries/robotjs"
|
|
653
|
+
};
|
|
654
|
+
|
|
655
|
+
// src/monorepo/mirror/utils.ts
|
|
656
|
+
init_cjs_shims();
|
|
657
|
+
var import_set_value2 = __toESM(require_set_value(), 1);
|
|
658
|
+
function setMirror(obj) {
|
|
659
|
+
const platforms = ["linux", "windows", "osx"];
|
|
660
|
+
const prefix = "terminal.integrated.env";
|
|
661
|
+
if (typeof obj === "object" && obj) {
|
|
662
|
+
for (const platform of platforms) {
|
|
663
|
+
(0, import_set_value2.default)(obj, [prefix, platform].join(".").replaceAll(".", "\\."), chinaMirrorsEnvs);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
// src/monorepo/binaryMirror.ts
|
|
669
|
+
async function setVscodeBinaryMirror(cwd2) {
|
|
670
|
+
const targetJsonPath = import_pathe2.default.resolve(cwd2, ".vscode/settings.json");
|
|
671
|
+
await import_fs_extra2.default.ensureFile(targetJsonPath);
|
|
672
|
+
const json = (0, import_comment_json.parse)(await import_fs_extra2.default.readFile(targetJsonPath, "utf8"), void 0, false);
|
|
673
|
+
json && typeof json === "object" && setMirror(json);
|
|
674
|
+
await import_fs_extra2.default.writeFile(targetJsonPath, `${(0, import_comment_json.stringify)(json, void 0, 2)}
|
|
675
|
+
`, "utf8");
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
// src/monorepo/clean.ts
|
|
679
|
+
init_cjs_shims();
|
|
680
|
+
var import_fs_extra3 = __toESM(require("fs-extra"), 1);
|
|
681
|
+
var import_pathe3 = __toESM(require("pathe"), 1);
|
|
682
|
+
var dirs = [
|
|
683
|
+
"packages/monorepo",
|
|
684
|
+
"packages/foo",
|
|
685
|
+
// 'apps/cli',
|
|
686
|
+
// 'apps/website',
|
|
687
|
+
"apps"
|
|
688
|
+
];
|
|
689
|
+
async function cleanProjects(cwd2) {
|
|
690
|
+
for (const dir of dirs.map((x) => {
|
|
691
|
+
return import_pathe3.default.resolve(cwd2, x);
|
|
692
|
+
})) {
|
|
693
|
+
await import_fs_extra3.default.remove(dir);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
// src/monorepo/init.ts
|
|
698
|
+
init_cjs_shims();
|
|
699
|
+
|
|
700
|
+
// src/monorepo/context.ts
|
|
701
|
+
init_cjs_shims();
|
|
702
|
+
var import_pathe5 = __toESM(require("pathe"), 1);
|
|
703
|
+
|
|
704
|
+
// src/monorepo/workspace.ts
|
|
705
|
+
init_cjs_shims();
|
|
706
|
+
var import_workspace = require("@pnpm/workspace.find-packages");
|
|
707
|
+
|
|
708
|
+
// ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
|
|
709
|
+
init_cjs_shims();
|
|
710
|
+
function isPlainObject(value) {
|
|
711
|
+
if (value === null || typeof value !== "object") {
|
|
712
|
+
return false;
|
|
713
|
+
}
|
|
714
|
+
const prototype = Object.getPrototypeOf(value);
|
|
715
|
+
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
|
|
716
|
+
return false;
|
|
717
|
+
}
|
|
718
|
+
if (Symbol.iterator in value) {
|
|
719
|
+
return false;
|
|
720
|
+
}
|
|
721
|
+
if (Symbol.toStringTag in value) {
|
|
722
|
+
return Object.prototype.toString.call(value) === "[object Module]";
|
|
723
|
+
}
|
|
724
|
+
return true;
|
|
725
|
+
}
|
|
726
|
+
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
727
|
+
if (!isPlainObject(defaults)) {
|
|
728
|
+
return _defu(baseObject, {}, namespace, merger);
|
|
729
|
+
}
|
|
730
|
+
const object = Object.assign({}, defaults);
|
|
731
|
+
for (const key in baseObject) {
|
|
732
|
+
if (key === "__proto__" || key === "constructor") {
|
|
733
|
+
continue;
|
|
734
|
+
}
|
|
735
|
+
const value = baseObject[key];
|
|
736
|
+
if (value === null || value === void 0) {
|
|
737
|
+
continue;
|
|
738
|
+
}
|
|
739
|
+
if (merger && merger(object, key, value, namespace)) {
|
|
740
|
+
continue;
|
|
741
|
+
}
|
|
742
|
+
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
743
|
+
object[key] = [...value, ...object[key]];
|
|
744
|
+
} else if (isPlainObject(value) && isPlainObject(object[key])) {
|
|
745
|
+
object[key] = _defu(
|
|
746
|
+
value,
|
|
747
|
+
object[key],
|
|
748
|
+
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
749
|
+
merger
|
|
750
|
+
);
|
|
751
|
+
} else {
|
|
752
|
+
object[key] = value;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
return object;
|
|
756
|
+
}
|
|
757
|
+
function createDefu(merger) {
|
|
758
|
+
return (...arguments_) => (
|
|
759
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
760
|
+
arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
|
|
761
|
+
);
|
|
762
|
+
}
|
|
763
|
+
var defu = createDefu();
|
|
764
|
+
var defuFn = createDefu((object, key, currentValue) => {
|
|
765
|
+
if (object[key] !== void 0 && typeof currentValue === "function") {
|
|
766
|
+
object[key] = currentValue(object[key]);
|
|
767
|
+
return true;
|
|
768
|
+
}
|
|
769
|
+
});
|
|
770
|
+
var defuArrayFn = createDefu((object, key, currentValue) => {
|
|
771
|
+
if (Array.isArray(object[key]) && typeof currentValue === "function") {
|
|
772
|
+
object[key] = currentValue(object[key]);
|
|
773
|
+
return true;
|
|
774
|
+
}
|
|
775
|
+
});
|
|
776
|
+
|
|
777
|
+
// src/monorepo/workspace.ts
|
|
778
|
+
var import_pathe4 = __toESM(require("pathe"), 1);
|
|
779
|
+
async function getWorkspacePackages(cwd2, options) {
|
|
780
|
+
const posixCwd = import_pathe4.default.normalize(cwd2);
|
|
781
|
+
const { ignoreRootPackage, ignorePrivatePackage } = defu(options, {
|
|
782
|
+
ignoreRootPackage: true,
|
|
783
|
+
ignorePrivatePackage: true
|
|
784
|
+
});
|
|
785
|
+
const packages = await (0, import_workspace.findWorkspacePackages)(cwd2);
|
|
786
|
+
let pkgs = packages.filter((x) => {
|
|
787
|
+
if (ignorePrivatePackage && x.manifest.private) {
|
|
788
|
+
return false;
|
|
789
|
+
}
|
|
790
|
+
return true;
|
|
791
|
+
}).map((project) => {
|
|
792
|
+
const pkgJsonPath = import_pathe4.default.resolve(project.rootDir, "package.json");
|
|
793
|
+
return {
|
|
794
|
+
...project,
|
|
795
|
+
pkgJsonPath
|
|
796
|
+
};
|
|
797
|
+
});
|
|
798
|
+
if (ignoreRootPackage) {
|
|
799
|
+
pkgs = pkgs.filter((x) => {
|
|
800
|
+
return import_pathe4.default.normalize(
|
|
801
|
+
x.rootDir
|
|
802
|
+
) !== posixCwd;
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
return pkgs;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
// src/monorepo/context.ts
|
|
809
|
+
var import_types = require("@pnpm/types");
|
|
810
|
+
async function createContext(cwd2) {
|
|
811
|
+
const git = new GitClient();
|
|
812
|
+
const workspaceFilepath = import_pathe5.default.resolve(cwd2, "pnpm-workspace.yaml");
|
|
813
|
+
const projects = await getWorkspacePackages(cwd2);
|
|
814
|
+
return {
|
|
815
|
+
cwd: cwd2,
|
|
816
|
+
git,
|
|
817
|
+
workspaceFilepath,
|
|
818
|
+
projects
|
|
819
|
+
};
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
// src/monorepo/setPkgJson.ts
|
|
823
|
+
init_cjs_shims();
|
|
824
|
+
var import_fs_extra4 = __toESM(require("fs-extra"), 1);
|
|
825
|
+
var import_pathe6 = __toESM(require("pathe"), 1);
|
|
826
|
+
var import_set_value3 = __toESM(require_set_value(), 1);
|
|
827
|
+
async function setPkgJson_default(ctx) {
|
|
828
|
+
const { git, projects, cwd: cwd2, workspaceFilepath } = ctx;
|
|
829
|
+
const gitUrl = await git.getGitUrl();
|
|
830
|
+
const gitUser = await git.getUser();
|
|
831
|
+
if (gitUrl && await import_fs_extra4.default.exists(workspaceFilepath)) {
|
|
832
|
+
for (const project of projects) {
|
|
833
|
+
const pkgJson = project.manifest;
|
|
834
|
+
const directory = import_pathe6.default.relative(cwd2, project.rootDir);
|
|
835
|
+
(0, import_set_value3.default)(pkgJson, "bugs.url", `https://github.com/${gitUrl.full_name}/issues`);
|
|
836
|
+
const repository = {
|
|
837
|
+
type: "git",
|
|
838
|
+
url: `git+https://github.com/${gitUrl.full_name}.git`
|
|
839
|
+
};
|
|
840
|
+
if (directory) {
|
|
841
|
+
repository.directory = directory;
|
|
842
|
+
}
|
|
843
|
+
(0, import_set_value3.default)(pkgJson, "repository", repository);
|
|
844
|
+
if (gitUser) {
|
|
845
|
+
(0, import_set_value3.default)(pkgJson, "author", `${gitUser.name} <${gitUser.email}>`);
|
|
846
|
+
}
|
|
847
|
+
await import_fs_extra4.default.writeJSON(project.pkgJsonPath, pkgJson, {
|
|
848
|
+
spaces: 2
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
// src/monorepo/setReadme.ts
|
|
855
|
+
init_cjs_shims();
|
|
856
|
+
var import_fs_extra5 = __toESM(require("fs-extra"), 1);
|
|
857
|
+
var import_pathe7 = __toESM(require("pathe"), 1);
|
|
858
|
+
async function getRows(ctx) {
|
|
859
|
+
const { projects, git, cwd: cwd2 } = ctx;
|
|
860
|
+
const gitUrl = await git.getGitUrl();
|
|
861
|
+
const gitUser = await git.getUser();
|
|
862
|
+
const rows = [];
|
|
863
|
+
if (gitUrl) {
|
|
864
|
+
rows.push(`# ${gitUrl.name}
|
|
865
|
+
`);
|
|
866
|
+
}
|
|
867
|
+
rows.push("## Projects\n");
|
|
868
|
+
for (const project of projects) {
|
|
869
|
+
const p = import_pathe7.default.relative(cwd2, project.rootDirRealPath);
|
|
870
|
+
p && rows.push(`- [${project.manifest.name}](${p}) ${project.manifest.description ? `- ${project.manifest.description}` : ""}`);
|
|
871
|
+
}
|
|
872
|
+
if (gitUrl) {
|
|
873
|
+
rows.push("\n## Contributing\n");
|
|
874
|
+
rows.push("Contributions Welcome! You can contribute in the following ways.");
|
|
875
|
+
rows.push("");
|
|
876
|
+
rows.push("- Create an Issue - Propose a new feature. Report a bug.");
|
|
877
|
+
rows.push("- Pull Request - Fix a bug and typo. Refactor the code.");
|
|
878
|
+
rows.push("- Create third-party middleware - Instruct below.");
|
|
879
|
+
rows.push("- Share - Share your thoughts on the Blog, X, and others.");
|
|
880
|
+
rows.push(`- Make your application - Please try to use ${gitUrl.name}.`);
|
|
881
|
+
rows.push("");
|
|
882
|
+
rows.push("For more details, see [CONTRIBUTING.md](CONTRIBUTING.md).");
|
|
883
|
+
rows.push("\n## Contributors\n");
|
|
884
|
+
rows.push(`Thanks to [all contributors](https://github.com/${gitUrl.full_name}/graphs/contributors)!`);
|
|
885
|
+
}
|
|
886
|
+
rows.push("\n## Authors\n");
|
|
887
|
+
rows.push(`${gitUser.name} <${gitUser.email}>`);
|
|
888
|
+
rows.push("\n## License\n");
|
|
889
|
+
rows.push("Distributed under the MIT License. See [LICENSE](LICENSE) for more information.");
|
|
890
|
+
return rows;
|
|
891
|
+
}
|
|
892
|
+
async function setReadme_default(ctx) {
|
|
893
|
+
const rows = await getRows(ctx);
|
|
894
|
+
await import_fs_extra5.default.writeFile(import_pathe7.default.resolve(ctx.cwd, "README.md"), `${rows.join("\n")}
|
|
895
|
+
`);
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
// src/monorepo/init.ts
|
|
899
|
+
async function init(cwd2) {
|
|
900
|
+
const ctx = await createContext(cwd2);
|
|
901
|
+
await setPkgJson_default(ctx);
|
|
902
|
+
await setReadme_default(ctx);
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
// src/monorepo/sync.ts
|
|
906
|
+
init_cjs_shims();
|
|
907
|
+
var import_node_os = __toESM(require("os"), 1);
|
|
908
|
+
var import_execa = require("execa");
|
|
909
|
+
var import_p_queue2 = __toESM(require("p-queue"), 1);
|
|
910
|
+
var import_picocolors2 = __toESM(require("picocolors"), 1);
|
|
911
|
+
async function syncNpmMirror(cwd2) {
|
|
912
|
+
const packages = await getWorkspacePackages(cwd2);
|
|
913
|
+
const set4 = new Set(packages.map((x) => x.manifest.name));
|
|
914
|
+
logger.info(`[\u5373\u5C06\u540C\u6B65\u7684\u5305]:
|
|
915
|
+
${Array.from(set4).map((x) => `- ${import_picocolors2.default.green(x)}`).join("\n")}
|
|
916
|
+
`);
|
|
917
|
+
const concurrency = Math.max(import_node_os.default.cpus().length, 1);
|
|
918
|
+
const queue2 = new import_p_queue2.default({ concurrency });
|
|
919
|
+
for (const pkgName of set4) {
|
|
920
|
+
if (pkgName) {
|
|
921
|
+
await queue2.add(async () => {
|
|
922
|
+
return (0, import_execa.execa)({
|
|
923
|
+
stdout: ["pipe", "inherit"]
|
|
924
|
+
})`cnpm sync ${pkgName}`;
|
|
925
|
+
});
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
}
|
|
312
929
|
// Annotate the CommonJS export names for ESM import in node:
|
|
313
930
|
0 && (module.exports = {
|
|
931
|
+
GitClient,
|
|
932
|
+
cleanProjects,
|
|
314
933
|
createNewProject,
|
|
934
|
+
escapeStringRegexp,
|
|
935
|
+
getFileHash,
|
|
936
|
+
getWorkspacePackages,
|
|
937
|
+
init,
|
|
938
|
+
isFileChanged,
|
|
939
|
+
isMatch,
|
|
315
940
|
setPkgJson,
|
|
941
|
+
setVscodeBinaryMirror,
|
|
942
|
+
syncNpmMirror,
|
|
316
943
|
upgradeMonorepo
|
|
317
944
|
});
|
|
945
|
+
/*! Bundled license information:
|
|
946
|
+
|
|
947
|
+
isobject/index.js:
|
|
948
|
+
(*!
|
|
949
|
+
* isobject <https://github.com/jonschlinkert/isobject>
|
|
950
|
+
*
|
|
951
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
952
|
+
* Released under the MIT License.
|
|
953
|
+
*)
|
|
954
|
+
|
|
955
|
+
get-value/index.js:
|
|
956
|
+
(*!
|
|
957
|
+
* get-value <https://github.com/jonschlinkert/get-value>
|
|
958
|
+
*
|
|
959
|
+
* Copyright (c) 2014-2018, Jon Schlinkert.
|
|
960
|
+
* Released under the MIT License.
|
|
961
|
+
*)
|
|
962
|
+
|
|
963
|
+
is-primitive/index.js:
|
|
964
|
+
(*!
|
|
965
|
+
* is-primitive <https://github.com/jonschlinkert/is-primitive>
|
|
966
|
+
*
|
|
967
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
968
|
+
* Released under the MIT License.
|
|
969
|
+
*)
|
|
970
|
+
|
|
971
|
+
is-plain-object/index.js:
|
|
972
|
+
(*!
|
|
973
|
+
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
974
|
+
*
|
|
975
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
976
|
+
* Released under the MIT License.
|
|
977
|
+
*)
|
|
978
|
+
|
|
979
|
+
set-value/index.js:
|
|
980
|
+
(*!
|
|
981
|
+
* set-value <https://github.com/jonschlinkert/set-value>
|
|
982
|
+
*
|
|
983
|
+
* Copyright (c) Jon Schlinkert (https://github.com/jonschlinkert).
|
|
984
|
+
* Released under the MIT License.
|
|
985
|
+
*)
|
|
986
|
+
*/
|