@icebreakers/monorepo 0.4.6 → 0.4.8
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/assets/package.json +5 -14
- package/assets/pnpm-workspace.yaml +1 -0
- package/dist/chunk-63SAAQXN.js +259 -0
- package/dist/cli.cjs +261 -376
- package/dist/cli.js +226 -10
- package/dist/index.cjs +43 -374
- package/dist/index.js +1 -1
- package/package.json +12 -3
- package/assets/scripts/monorepo/binaryMirror.ts +0 -17
- package/assets/scripts/monorepo/clean.ts +0 -14
- package/assets/scripts/monorepo/context.ts +0 -18
- package/assets/scripts/monorepo/git.ts +0 -56
- package/assets/scripts/monorepo/init.ts +0 -8
- package/assets/scripts/monorepo/mirror/sources.ts +0 -31
- package/assets/scripts/monorepo/mirror/utils.ts +0 -12
- package/assets/scripts/monorepo/setPkgJson.ts +0 -37
- package/assets/scripts/monorepo/setReadme.ts +0 -53
- package/assets/scripts/monorepo/sync.ts +0 -15
- package/assets/scripts/monorepo/utils.ts +0 -21
- package/dist/chunk-QDBTTGEJ.js +0 -613
package/dist/cli.cjs
CHANGED
|
@@ -5,12 +5,6 @@ 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
|
-
};
|
|
14
8
|
var __copyProps = (to, from, except, desc) => {
|
|
15
9
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
10
|
for (let key of __getOwnPropNames(from))
|
|
@@ -29,312 +23,54 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
23
|
));
|
|
30
24
|
|
|
31
25
|
// ../../node_modules/.pnpm/tsup@8.3.0_jiti@1.21.6_postcss@8.4.42_tsx@4.19.1_typescript@5.6.2_yaml@2.5.1/node_modules/tsup/assets/cjs_shims.js
|
|
32
|
-
var getImportMetaUrl,
|
|
33
|
-
var
|
|
34
|
-
"../../node_modules/.pnpm/tsup@8.3.0_jiti@1.21.6_postcss@8.4.42_tsx@4.19.1_typescript@5.6.2_yaml@2.5.1/node_modules/tsup/assets/cjs_shims.js"() {
|
|
35
|
-
"use strict";
|
|
36
|
-
getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
37
|
-
importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
// ../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js
|
|
42
|
-
var require_isobject = __commonJS({
|
|
43
|
-
"../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js"(exports2, module2) {
|
|
44
|
-
"use strict";
|
|
45
|
-
init_cjs_shims();
|
|
46
|
-
module2.exports = function isObject(val) {
|
|
47
|
-
return val != null && typeof val === "object" && Array.isArray(val) === false;
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
// ../../node_modules/.pnpm/get-value@3.0.1/node_modules/get-value/index.js
|
|
53
|
-
var require_get_value = __commonJS({
|
|
54
|
-
"../../node_modules/.pnpm/get-value@3.0.1/node_modules/get-value/index.js"(exports2, module2) {
|
|
55
|
-
"use strict";
|
|
56
|
-
init_cjs_shims();
|
|
57
|
-
var isObject = require_isobject();
|
|
58
|
-
module2.exports = function(target, path2, options) {
|
|
59
|
-
if (!isObject(options)) {
|
|
60
|
-
options = { default: options };
|
|
61
|
-
}
|
|
62
|
-
if (!isValidObject(target)) {
|
|
63
|
-
return typeof options.default !== "undefined" ? options.default : target;
|
|
64
|
-
}
|
|
65
|
-
if (typeof path2 === "number") {
|
|
66
|
-
path2 = String(path2);
|
|
67
|
-
}
|
|
68
|
-
const isArray = Array.isArray(path2);
|
|
69
|
-
const isString = typeof path2 === "string";
|
|
70
|
-
const splitChar = options.separator || ".";
|
|
71
|
-
const joinChar = options.joinChar || (typeof splitChar === "string" ? splitChar : ".");
|
|
72
|
-
if (!isString && !isArray) {
|
|
73
|
-
return target;
|
|
74
|
-
}
|
|
75
|
-
if (isString && path2 in target) {
|
|
76
|
-
return isValid(path2, target, options) ? target[path2] : options.default;
|
|
77
|
-
}
|
|
78
|
-
let segs = isArray ? path2 : split(path2, splitChar, options);
|
|
79
|
-
let len = segs.length;
|
|
80
|
-
let idx = 0;
|
|
81
|
-
do {
|
|
82
|
-
let prop = segs[idx];
|
|
83
|
-
if (typeof prop === "number") {
|
|
84
|
-
prop = String(prop);
|
|
85
|
-
}
|
|
86
|
-
while (prop && prop.slice(-1) === "\\") {
|
|
87
|
-
prop = join([prop.slice(0, -1), segs[++idx] || ""], joinChar, options);
|
|
88
|
-
}
|
|
89
|
-
if (prop in target) {
|
|
90
|
-
if (!isValid(prop, target, options)) {
|
|
91
|
-
return options.default;
|
|
92
|
-
}
|
|
93
|
-
target = target[prop];
|
|
94
|
-
} else {
|
|
95
|
-
let hasProp = false;
|
|
96
|
-
let n = idx + 1;
|
|
97
|
-
while (n < len) {
|
|
98
|
-
prop = join([prop, segs[n++]], joinChar, options);
|
|
99
|
-
if (hasProp = prop in target) {
|
|
100
|
-
if (!isValid(prop, target, options)) {
|
|
101
|
-
return options.default;
|
|
102
|
-
}
|
|
103
|
-
target = target[prop];
|
|
104
|
-
idx = n - 1;
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
if (!hasProp) {
|
|
109
|
-
return options.default;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
} while (++idx < len && isValidObject(target));
|
|
113
|
-
if (idx === len) {
|
|
114
|
-
return target;
|
|
115
|
-
}
|
|
116
|
-
return options.default;
|
|
117
|
-
};
|
|
118
|
-
function join(segs, joinChar, options) {
|
|
119
|
-
if (typeof options.join === "function") {
|
|
120
|
-
return options.join(segs);
|
|
121
|
-
}
|
|
122
|
-
return segs[0] + joinChar + segs[1];
|
|
123
|
-
}
|
|
124
|
-
function split(path2, splitChar, options) {
|
|
125
|
-
if (typeof options.split === "function") {
|
|
126
|
-
return options.split(path2);
|
|
127
|
-
}
|
|
128
|
-
return path2.split(splitChar);
|
|
129
|
-
}
|
|
130
|
-
function isValid(key, target, options) {
|
|
131
|
-
if (typeof options.isValid === "function") {
|
|
132
|
-
return options.isValid(key, target);
|
|
133
|
-
}
|
|
134
|
-
return true;
|
|
135
|
-
}
|
|
136
|
-
function isValidObject(val) {
|
|
137
|
-
return isObject(val) || Array.isArray(val) || typeof val === "function";
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
// ../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js
|
|
143
|
-
var require_is_primitive = __commonJS({
|
|
144
|
-
"../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js"(exports2, module2) {
|
|
145
|
-
"use strict";
|
|
146
|
-
init_cjs_shims();
|
|
147
|
-
module2.exports = function isPrimitive(val) {
|
|
148
|
-
if (typeof val === "object") {
|
|
149
|
-
return val === null;
|
|
150
|
-
}
|
|
151
|
-
return typeof val !== "function";
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
// ../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js
|
|
157
|
-
var require_is_plain_object = __commonJS({
|
|
158
|
-
"../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js"(exports2, module2) {
|
|
159
|
-
"use strict";
|
|
160
|
-
init_cjs_shims();
|
|
161
|
-
var isObject = require_isobject();
|
|
162
|
-
function isObjectObject(o) {
|
|
163
|
-
return isObject(o) === true && Object.prototype.toString.call(o) === "[object Object]";
|
|
164
|
-
}
|
|
165
|
-
module2.exports = function isPlainObject(o) {
|
|
166
|
-
var ctor, prot;
|
|
167
|
-
if (isObjectObject(o) === false) return false;
|
|
168
|
-
ctor = o.constructor;
|
|
169
|
-
if (typeof ctor !== "function") return false;
|
|
170
|
-
prot = ctor.prototype;
|
|
171
|
-
if (isObjectObject(prot) === false) return false;
|
|
172
|
-
if (prot.hasOwnProperty("isPrototypeOf") === false) {
|
|
173
|
-
return false;
|
|
174
|
-
}
|
|
175
|
-
return true;
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
// ../../node_modules/.pnpm/set-value@4.1.0/node_modules/set-value/index.js
|
|
181
|
-
var require_set_value = __commonJS({
|
|
182
|
-
"../../node_modules/.pnpm/set-value@4.1.0/node_modules/set-value/index.js"(exports2, module2) {
|
|
183
|
-
"use strict";
|
|
184
|
-
init_cjs_shims();
|
|
185
|
-
var { deleteProperty } = Reflect;
|
|
186
|
-
var isPrimitive = require_is_primitive();
|
|
187
|
-
var isPlainObject = require_is_plain_object();
|
|
188
|
-
var isObject = (value) => {
|
|
189
|
-
return typeof value === "object" && value !== null || typeof value === "function";
|
|
190
|
-
};
|
|
191
|
-
var isUnsafeKey = (key) => {
|
|
192
|
-
return key === "__proto__" || key === "constructor" || key === "prototype";
|
|
193
|
-
};
|
|
194
|
-
var validateKey = (key) => {
|
|
195
|
-
if (!isPrimitive(key)) {
|
|
196
|
-
throw new TypeError("Object keys must be strings or symbols");
|
|
197
|
-
}
|
|
198
|
-
if (isUnsafeKey(key)) {
|
|
199
|
-
throw new Error(`Cannot set unsafe key: "${key}"`);
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
var toStringKey = (input) => {
|
|
203
|
-
return Array.isArray(input) ? input.flat().map(String).join(",") : input;
|
|
204
|
-
};
|
|
205
|
-
var createMemoKey = (input, options) => {
|
|
206
|
-
if (typeof input !== "string" || !options) return input;
|
|
207
|
-
let key = input + ";";
|
|
208
|
-
if (options.arrays !== void 0) key += `arrays=${options.arrays};`;
|
|
209
|
-
if (options.separator !== void 0) key += `separator=${options.separator};`;
|
|
210
|
-
if (options.split !== void 0) key += `split=${options.split};`;
|
|
211
|
-
if (options.merge !== void 0) key += `merge=${options.merge};`;
|
|
212
|
-
if (options.preservePaths !== void 0) key += `preservePaths=${options.preservePaths};`;
|
|
213
|
-
return key;
|
|
214
|
-
};
|
|
215
|
-
var memoize = (input, options, fn) => {
|
|
216
|
-
const key = toStringKey(options ? createMemoKey(input, options) : input);
|
|
217
|
-
validateKey(key);
|
|
218
|
-
const value = setValue.cache.get(key) || fn();
|
|
219
|
-
setValue.cache.set(key, value);
|
|
220
|
-
return value;
|
|
221
|
-
};
|
|
222
|
-
var splitString = (input, options = {}) => {
|
|
223
|
-
const sep = options.separator || ".";
|
|
224
|
-
const preserve = sep === "/" ? false : options.preservePaths;
|
|
225
|
-
if (typeof input === "string" && preserve !== false && /\//.test(input)) {
|
|
226
|
-
return [input];
|
|
227
|
-
}
|
|
228
|
-
const parts = [];
|
|
229
|
-
let part = "";
|
|
230
|
-
const push = (part2) => {
|
|
231
|
-
let number;
|
|
232
|
-
if (part2.trim() !== "" && Number.isInteger(number = Number(part2))) {
|
|
233
|
-
parts.push(number);
|
|
234
|
-
} else {
|
|
235
|
-
parts.push(part2);
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
for (let i = 0; i < input.length; i++) {
|
|
239
|
-
const value = input[i];
|
|
240
|
-
if (value === "\\") {
|
|
241
|
-
part += input[++i];
|
|
242
|
-
continue;
|
|
243
|
-
}
|
|
244
|
-
if (value === sep) {
|
|
245
|
-
push(part);
|
|
246
|
-
part = "";
|
|
247
|
-
continue;
|
|
248
|
-
}
|
|
249
|
-
part += value;
|
|
250
|
-
}
|
|
251
|
-
if (part) {
|
|
252
|
-
push(part);
|
|
253
|
-
}
|
|
254
|
-
return parts;
|
|
255
|
-
};
|
|
256
|
-
var split = (input, options) => {
|
|
257
|
-
if (options && typeof options.split === "function") return options.split(input);
|
|
258
|
-
if (typeof input === "symbol") return [input];
|
|
259
|
-
if (Array.isArray(input)) return input;
|
|
260
|
-
return memoize(input, options, () => splitString(input, options));
|
|
261
|
-
};
|
|
262
|
-
var assignProp = (obj, prop, value, options) => {
|
|
263
|
-
validateKey(prop);
|
|
264
|
-
if (value === void 0) {
|
|
265
|
-
deleteProperty(obj, prop);
|
|
266
|
-
} else if (options && options.merge) {
|
|
267
|
-
const merge = options.merge === "function" ? options.merge : Object.assign;
|
|
268
|
-
if (merge && isPlainObject(obj[prop]) && isPlainObject(value)) {
|
|
269
|
-
obj[prop] = merge(obj[prop], value);
|
|
270
|
-
} else {
|
|
271
|
-
obj[prop] = value;
|
|
272
|
-
}
|
|
273
|
-
} else {
|
|
274
|
-
obj[prop] = value;
|
|
275
|
-
}
|
|
276
|
-
return obj;
|
|
277
|
-
};
|
|
278
|
-
var setValue = (target, path2, value, options) => {
|
|
279
|
-
if (!path2 || !isObject(target)) return target;
|
|
280
|
-
const keys = split(path2, options);
|
|
281
|
-
let obj = target;
|
|
282
|
-
for (let i = 0; i < keys.length; i++) {
|
|
283
|
-
const key = keys[i];
|
|
284
|
-
const next = keys[i + 1];
|
|
285
|
-
validateKey(key);
|
|
286
|
-
if (next === void 0) {
|
|
287
|
-
assignProp(obj, key, value, options);
|
|
288
|
-
break;
|
|
289
|
-
}
|
|
290
|
-
if (typeof next === "number" && !Array.isArray(obj[key])) {
|
|
291
|
-
obj = obj[key] = [];
|
|
292
|
-
continue;
|
|
293
|
-
}
|
|
294
|
-
if (!isObject(obj[key])) {
|
|
295
|
-
obj[key] = {};
|
|
296
|
-
}
|
|
297
|
-
obj = obj[key];
|
|
298
|
-
}
|
|
299
|
-
return target;
|
|
300
|
-
};
|
|
301
|
-
setValue.split = split;
|
|
302
|
-
setValue.cache = /* @__PURE__ */ new Map();
|
|
303
|
-
setValue.clear = () => {
|
|
304
|
-
setValue.cache = /* @__PURE__ */ new Map();
|
|
305
|
-
};
|
|
306
|
-
module2.exports = setValue;
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
// src/cli.ts
|
|
311
|
-
init_cjs_shims();
|
|
26
|
+
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
27
|
+
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
312
28
|
|
|
313
29
|
// src/program.ts
|
|
314
|
-
|
|
30
|
+
var import_node_process2 = __toESM(require("process"), 1);
|
|
315
31
|
var import_commander = require("commander");
|
|
316
32
|
|
|
317
33
|
// package.json
|
|
318
34
|
var name = "@icebreakers/monorepo";
|
|
319
|
-
var version = "0.4.
|
|
35
|
+
var version = "0.4.8";
|
|
320
36
|
|
|
321
37
|
// src/lib.ts
|
|
322
|
-
init_cjs_shims();
|
|
323
38
|
var import_node_process = __toESM(require("process"), 1);
|
|
324
39
|
var import_node_url = require("url");
|
|
325
40
|
var import_checkbox = __toESM(require("@inquirer/checkbox"), 1);
|
|
326
41
|
var import_confirm = __toESM(require("@inquirer/confirm"), 1);
|
|
327
42
|
var import_fs_extra = __toESM(require("fs-extra"), 1);
|
|
328
|
-
var import_get_value2 = __toESM(
|
|
43
|
+
var import_get_value2 = __toESM(require("get-value"), 1);
|
|
329
44
|
var import_klaw = __toESM(require("klaw"), 1);
|
|
330
45
|
var import_p_queue = __toESM(require("p-queue"), 1);
|
|
331
46
|
var import_pathe = __toESM(require("pathe"), 1);
|
|
332
47
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
333
|
-
var import_set_value = __toESM(
|
|
48
|
+
var import_set_value = __toESM(require("set-value"), 1);
|
|
49
|
+
|
|
50
|
+
// src/logger.ts
|
|
51
|
+
var import_consola = require("consola");
|
|
52
|
+
var logger = (0, import_consola.createConsola)();
|
|
53
|
+
|
|
54
|
+
// src/md5.ts
|
|
55
|
+
var import_node_crypto = __toESM(require("crypto"), 1);
|
|
56
|
+
function getFileHash(data) {
|
|
57
|
+
const hashSum = import_node_crypto.default.createHash("md5");
|
|
58
|
+
hashSum.update(data);
|
|
59
|
+
return hashSum.digest("hex");
|
|
60
|
+
}
|
|
61
|
+
function isFileChanged(src, dest) {
|
|
62
|
+
try {
|
|
63
|
+
const currentHash = getFileHash(src);
|
|
64
|
+
const previousHash = getFileHash(dest);
|
|
65
|
+
return currentHash !== previousHash;
|
|
66
|
+
} catch (err) {
|
|
67
|
+
console.error("Error calculating file hash:", err);
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
334
71
|
|
|
335
|
-
//
|
|
336
|
-
|
|
337
|
-
var import_get_value = __toESM(require_get_value(), 1);
|
|
72
|
+
// src/monorepo/git.ts
|
|
73
|
+
var import_get_value = __toESM(require("get-value"), 1);
|
|
338
74
|
var import_git_url_parse = __toESM(require("git-url-parse"), 1);
|
|
339
75
|
var import_simple_git = require("simple-git");
|
|
340
76
|
var GitClient = class {
|
|
@@ -382,42 +118,16 @@ var GitClient = class {
|
|
|
382
118
|
}
|
|
383
119
|
};
|
|
384
120
|
|
|
385
|
-
// src/logger.ts
|
|
386
|
-
init_cjs_shims();
|
|
387
|
-
var import_consola = require("consola");
|
|
388
|
-
var logger = (0, import_consola.createConsola)();
|
|
389
|
-
|
|
390
|
-
// src/md5.ts
|
|
391
|
-
init_cjs_shims();
|
|
392
|
-
var import_node_crypto = __toESM(require("crypto"), 1);
|
|
393
|
-
function getFileHash(data) {
|
|
394
|
-
const hashSum = import_node_crypto.default.createHash("md5");
|
|
395
|
-
hashSum.update(data);
|
|
396
|
-
return hashSum.digest("hex");
|
|
397
|
-
}
|
|
398
|
-
function isFileChanged(src, dest) {
|
|
399
|
-
try {
|
|
400
|
-
const currentHash = getFileHash(src);
|
|
401
|
-
const previousHash = getFileHash(dest);
|
|
402
|
-
return currentHash !== previousHash;
|
|
403
|
-
} catch (err) {
|
|
404
|
-
console.error("Error calculating file hash:", err);
|
|
405
|
-
return false;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
|
|
409
121
|
// src/scripts.ts
|
|
410
|
-
init_cjs_shims();
|
|
411
122
|
var scripts = {
|
|
412
|
-
"script:init": "
|
|
413
|
-
"script:sync": "
|
|
414
|
-
"script:clean": "
|
|
415
|
-
"script:mirror": "
|
|
123
|
+
"script:init": "monorepo init",
|
|
124
|
+
"script:sync": "monorepo sync",
|
|
125
|
+
"script:clean": "monorepo clean",
|
|
126
|
+
"script:mirror": "monorepo mirror"
|
|
416
127
|
};
|
|
417
128
|
var scriptsEntries = Object.entries(scripts);
|
|
418
129
|
|
|
419
130
|
// src/targets.ts
|
|
420
|
-
init_cjs_shims();
|
|
421
131
|
function getTargets(raw) {
|
|
422
132
|
const list = [
|
|
423
133
|
".changeset",
|
|
@@ -442,9 +152,8 @@ function getTargets(raw) {
|
|
|
442
152
|
"vitest.workspace.ts",
|
|
443
153
|
// #region docker
|
|
444
154
|
"Dockerfile",
|
|
445
|
-
".dockerignore"
|
|
155
|
+
".dockerignore"
|
|
446
156
|
// #endregion
|
|
447
|
-
"scripts"
|
|
448
157
|
];
|
|
449
158
|
if (!raw) {
|
|
450
159
|
list.push(".github", "LICENSE", "renovate.json", "SECURITY.md", "CODE_OF_CONDUCT.md", "CONTRIBUTING.md", "netlify.toml");
|
|
@@ -453,7 +162,6 @@ function getTargets(raw) {
|
|
|
453
162
|
}
|
|
454
163
|
|
|
455
164
|
// src/utils.ts
|
|
456
|
-
init_cjs_shims();
|
|
457
165
|
function escapeStringRegexp(str) {
|
|
458
166
|
return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
459
167
|
}
|
|
@@ -481,7 +189,11 @@ function setPkgJson(sourcePkgJson, targetPkgJson) {
|
|
|
481
189
|
(0, import_set_value.default)(targetPkgJson, `dependencies.${x[0].replaceAll(".", "\\.")}`, x[1], { preservePaths: false });
|
|
482
190
|
});
|
|
483
191
|
Object.entries(devDeps).forEach((x) => {
|
|
484
|
-
|
|
192
|
+
if (x[0] === "@icebreakers/monorepo") {
|
|
193
|
+
(0, import_set_value.default)(targetPkgJson, `devDependencies.${x[0].replaceAll(".", "\\.")}`, `^${version}`, { preservePaths: false });
|
|
194
|
+
} else {
|
|
195
|
+
(0, import_set_value.default)(targetPkgJson, `devDependencies.${x[0].replaceAll(".", "\\.")}`, x[1], { preservePaths: false });
|
|
196
|
+
}
|
|
485
197
|
});
|
|
486
198
|
for (const [k, v] of scriptsEntries) {
|
|
487
199
|
(0, import_set_value.default)(targetPkgJson, `scripts.${k}`, v);
|
|
@@ -509,12 +221,6 @@ async function main(opts) {
|
|
|
509
221
|
})
|
|
510
222
|
});
|
|
511
223
|
}
|
|
512
|
-
const removeDirs = ["scripts/monorepo"];
|
|
513
|
-
for (const dir of removeDirs) {
|
|
514
|
-
if (targets.includes(dir)) {
|
|
515
|
-
await import_fs_extra.default.remove(import_pathe.default.resolve(absOutDir, dir));
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
224
|
const regexpArr = targets.map((x) => {
|
|
519
225
|
return new RegExp(`^${escapeStringRegexp(x)}`);
|
|
520
226
|
});
|
|
@@ -575,55 +281,234 @@ async function main(opts) {
|
|
|
575
281
|
}
|
|
576
282
|
}
|
|
577
283
|
|
|
284
|
+
// src/monorepo/binaryMirror.ts
|
|
285
|
+
var import_comment_json = require("comment-json");
|
|
286
|
+
var import_fs_extra2 = __toESM(require("fs-extra"), 1);
|
|
287
|
+
var import_pathe2 = __toESM(require("pathe"), 1);
|
|
288
|
+
|
|
289
|
+
// src/monorepo/mirror/utils.ts
|
|
290
|
+
var import_set_value2 = __toESM(require("set-value"), 1);
|
|
291
|
+
|
|
292
|
+
// src/monorepo/mirror/sources.ts
|
|
293
|
+
var chinaMirrorsEnvs = {
|
|
294
|
+
COREPACK_NPM_REGISTRY: "https://registry.npmmirror.com",
|
|
295
|
+
EDGEDRIVER_CDNURL: "https://npmmirror.com/mirrors/edgedriver",
|
|
296
|
+
NODEJS_ORG_MIRROR: "https://cdn.npmmirror.com/binaries/node",
|
|
297
|
+
NVM_NODEJS_ORG_MIRROR: "https://cdn.npmmirror.com/binaries/node",
|
|
298
|
+
PHANTOMJS_CDNURL: "https://cdn.npmmirror.com/binaries/phantomjs",
|
|
299
|
+
CHROMEDRIVER_CDNURL: "https://cdn.npmmirror.com/binaries/chromedriver",
|
|
300
|
+
OPERADRIVER_CDNURL: "https://cdn.npmmirror.com/binaries/operadriver",
|
|
301
|
+
CYPRESS_DOWNLOAD_PATH_TEMPLATE: "https://cdn.npmmirror.com/binaries/cypress/${version}/${platform}-${arch}/cypress.zip",
|
|
302
|
+
ELECTRON_MIRROR: "https://cdn.npmmirror.com/binaries/electron/",
|
|
303
|
+
ELECTRON_BUILDER_BINARIES_MIRROR: "https://cdn.npmmirror.com/binaries/electron-builder-binaries/",
|
|
304
|
+
SASS_BINARY_SITE: "https://cdn.npmmirror.com/binaries/node-sass",
|
|
305
|
+
SWC_BINARY_SITE: "https://cdn.npmmirror.com/binaries/node-swc",
|
|
306
|
+
NWJS_URLBASE: "https://cdn.npmmirror.com/binaries/nwjs/v",
|
|
307
|
+
PUPPETEER_DOWNLOAD_HOST: "https://cdn.npmmirror.com/binaries/chrome-for-testing",
|
|
308
|
+
PUPPETEER_DOWNLOAD_BASE_URL: "https://cdn.npmmirror.com/binaries/chrome-for-testing",
|
|
309
|
+
PLAYWRIGHT_DOWNLOAD_HOST: "https://cdn.npmmirror.com/binaries/playwright",
|
|
310
|
+
SENTRYCLI_CDNURL: "https://cdn.npmmirror.com/binaries/sentry-cli",
|
|
311
|
+
SAUCECTL_INSTALL_BINARY_MIRROR: "https://cdn.npmmirror.com/binaries/saucectl",
|
|
312
|
+
RE2_DOWNLOAD_MIRROR: "https://cdn.npmmirror.com/binaries/node-re2",
|
|
313
|
+
RE2_DOWNLOAD_SKIP_PATH: "true",
|
|
314
|
+
PRISMA_ENGINES_MIRROR: "https://cdn.npmmirror.com/binaries/prisma",
|
|
315
|
+
npm_config_better_sqlite3_binary_host: "https://cdn.npmmirror.com/binaries/better-sqlite3",
|
|
316
|
+
npm_config_keytar_binary_host: "https://cdn.npmmirror.com/binaries/keytar",
|
|
317
|
+
npm_config_sharp_binary_host: "https://cdn.npmmirror.com/binaries/sharp",
|
|
318
|
+
npm_config_sharp_libvips_binary_host: "https://cdn.npmmirror.com/binaries/sharp-libvips",
|
|
319
|
+
npm_config_robotjs_binary_host: "https://cdn.npmmirror.com/binaries/robotjs"
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
// src/monorepo/mirror/utils.ts
|
|
323
|
+
function setMirror(obj) {
|
|
324
|
+
const platforms = ["linux", "windows", "osx"];
|
|
325
|
+
const prefix = "terminal.integrated.env";
|
|
326
|
+
if (typeof obj === "object" && obj) {
|
|
327
|
+
for (const platform of platforms) {
|
|
328
|
+
(0, import_set_value2.default)(obj, [prefix, platform].join(".").replaceAll(".", "\\."), chinaMirrorsEnvs);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// src/monorepo/binaryMirror.ts
|
|
334
|
+
async function setVscodeBinaryMirror(cwd3) {
|
|
335
|
+
const targetJsonPath = import_pathe2.default.resolve(cwd3, ".vscode/settings.json");
|
|
336
|
+
await import_fs_extra2.default.ensureFile(targetJsonPath);
|
|
337
|
+
const json = (0, import_comment_json.parse)(await import_fs_extra2.default.readFile(targetJsonPath, "utf8"), void 0, false);
|
|
338
|
+
json && typeof json === "object" && setMirror(json);
|
|
339
|
+
await import_fs_extra2.default.writeFile(targetJsonPath, `${(0, import_comment_json.stringify)(json, void 0, 2)}
|
|
340
|
+
`, "utf8");
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// src/monorepo/clean.ts
|
|
344
|
+
var import_pathe3 = __toESM(require("pathe"), 1);
|
|
345
|
+
var import_rimraf = require("rimraf");
|
|
346
|
+
var dirs = [
|
|
347
|
+
"packages/monorepo",
|
|
348
|
+
"packages/foo",
|
|
349
|
+
// 'apps/cli',
|
|
350
|
+
// 'apps/website',
|
|
351
|
+
"apps"
|
|
352
|
+
];
|
|
353
|
+
async function cleanProjects(cwd3) {
|
|
354
|
+
await (0, import_rimraf.rimraf)(dirs.map((x) => {
|
|
355
|
+
return import_pathe3.default.resolve(cwd3, x);
|
|
356
|
+
}));
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
// src/monorepo/context.ts
|
|
360
|
+
var import_pathe5 = __toESM(require("pathe"), 1);
|
|
361
|
+
|
|
362
|
+
// src/monorepo/utils.ts
|
|
363
|
+
var import_workspace = require("@pnpm/workspace.find-packages");
|
|
364
|
+
var import_pathe4 = __toESM(require("pathe"), 1);
|
|
365
|
+
async function getWorkspacePackages(cwd3) {
|
|
366
|
+
const packages = await (0, import_workspace.findWorkspacePackages)(cwd3);
|
|
367
|
+
return (await Promise.allSettled(packages.map(async (project) => {
|
|
368
|
+
const pkgJsonPath = import_pathe4.default.resolve(project.rootDir, "package.json");
|
|
369
|
+
return {
|
|
370
|
+
...project,
|
|
371
|
+
pkgJsonPath
|
|
372
|
+
};
|
|
373
|
+
}))).filter((x) => {
|
|
374
|
+
return x.status === "fulfilled";
|
|
375
|
+
}).map((x) => {
|
|
376
|
+
return x.value;
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// src/monorepo/context.ts
|
|
381
|
+
var import_types = require("@pnpm/types");
|
|
382
|
+
async function createContext(cwd3) {
|
|
383
|
+
const git = new GitClient();
|
|
384
|
+
const workspaceFilepath = import_pathe5.default.resolve(cwd3, "pnpm-workspace.yaml");
|
|
385
|
+
const projects = await getWorkspacePackages(cwd3);
|
|
386
|
+
return {
|
|
387
|
+
cwd: cwd3,
|
|
388
|
+
git,
|
|
389
|
+
workspaceFilepath,
|
|
390
|
+
projects
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// src/monorepo/setPkgJson.ts
|
|
395
|
+
var import_fs_extra3 = __toESM(require("fs-extra"), 1);
|
|
396
|
+
var import_pathe6 = __toESM(require("pathe"), 1);
|
|
397
|
+
var import_set_value3 = __toESM(require("set-value"), 1);
|
|
398
|
+
async function setPkgJson_default(ctx) {
|
|
399
|
+
const { git, projects, cwd: cwd3, workspaceFilepath } = ctx;
|
|
400
|
+
const gitUrl = await git.getGitUrl();
|
|
401
|
+
const gitUser = await git.getUser();
|
|
402
|
+
if (gitUrl && await import_fs_extra3.default.exists(workspaceFilepath)) {
|
|
403
|
+
for (const project of projects) {
|
|
404
|
+
const pkgJson = project.manifest;
|
|
405
|
+
const directory = import_pathe6.default.relative(cwd3, project.rootDir);
|
|
406
|
+
(0, import_set_value3.default)(pkgJson, "bugs.url", `https://github.com/${gitUrl.full_name}/issues`);
|
|
407
|
+
const repository = {
|
|
408
|
+
type: "git",
|
|
409
|
+
url: `git+https://github.com/${gitUrl.full_name}.git`
|
|
410
|
+
};
|
|
411
|
+
if (directory) {
|
|
412
|
+
repository.directory = directory;
|
|
413
|
+
}
|
|
414
|
+
(0, import_set_value3.default)(pkgJson, "repository", repository);
|
|
415
|
+
if (gitUser) {
|
|
416
|
+
(0, import_set_value3.default)(pkgJson, "author", `${gitUser.name} <${gitUser.email}>`);
|
|
417
|
+
}
|
|
418
|
+
await import_fs_extra3.default.writeJSON(project.pkgJsonPath, pkgJson, {
|
|
419
|
+
spaces: 2
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// src/monorepo/setReadme.ts
|
|
426
|
+
var import_fs_extra4 = __toESM(require("fs-extra"), 1);
|
|
427
|
+
var import_pathe7 = __toESM(require("pathe"), 1);
|
|
428
|
+
async function getRows(ctx) {
|
|
429
|
+
const { projects, git, cwd: cwd3 } = ctx;
|
|
430
|
+
const gitUrl = await git.getGitUrl();
|
|
431
|
+
const gitUser = await git.getUser();
|
|
432
|
+
const rows = [];
|
|
433
|
+
if (gitUrl) {
|
|
434
|
+
rows.push(`# ${gitUrl.name}
|
|
435
|
+
`);
|
|
436
|
+
}
|
|
437
|
+
rows.push("## Projects\n");
|
|
438
|
+
for (const project of projects) {
|
|
439
|
+
const p = import_pathe7.default.relative(cwd3, project.rootDirRealPath);
|
|
440
|
+
p && rows.push(`- [${project.manifest.name}](${p}) ${project.manifest.description ? `- ${project.manifest.description}` : ""}`);
|
|
441
|
+
}
|
|
442
|
+
if (gitUrl) {
|
|
443
|
+
rows.push("\n## Contributing\n");
|
|
444
|
+
rows.push("Contributions Welcome! You can contribute in the following ways.");
|
|
445
|
+
rows.push("");
|
|
446
|
+
rows.push("- Create an Issue - Propose a new feature. Report a bug.");
|
|
447
|
+
rows.push("- Pull Request - Fix a bug and typo. Refactor the code.");
|
|
448
|
+
rows.push("- Create third-party middleware - Instruct below.");
|
|
449
|
+
rows.push("- Share - Share your thoughts on the Blog, X, and others.");
|
|
450
|
+
rows.push(`- Make your application - Please try to use ${gitUrl.name}.`);
|
|
451
|
+
rows.push("");
|
|
452
|
+
rows.push("For more details, see [CONTRIBUTING.md](CONTRIBUTING.md).");
|
|
453
|
+
rows.push("\n## Contributors\n");
|
|
454
|
+
rows.push(`Thanks to [all contributors](https://github.com/${gitUrl.full_name}/graphs/contributors)!`);
|
|
455
|
+
}
|
|
456
|
+
rows.push("\n## Authors\n");
|
|
457
|
+
rows.push(`${gitUser.name} <${gitUser.email}>`);
|
|
458
|
+
rows.push("\n## License\n");
|
|
459
|
+
rows.push("Distributed under the MIT License. See [LICENSE](LICENSE) for more information.");
|
|
460
|
+
return rows;
|
|
461
|
+
}
|
|
462
|
+
async function setReadme_default(ctx) {
|
|
463
|
+
const rows = await getRows(ctx);
|
|
464
|
+
await import_fs_extra4.default.writeFile(import_pathe7.default.resolve(ctx.cwd, "README.md"), `${rows.join("\n")}
|
|
465
|
+
`);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
// src/monorepo/init.ts
|
|
469
|
+
async function init(cwd3) {
|
|
470
|
+
const ctx = await createContext(cwd3);
|
|
471
|
+
await setPkgJson_default(ctx);
|
|
472
|
+
await setReadme_default(ctx);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
// src/monorepo/sync.ts
|
|
476
|
+
var import_execa = require("execa");
|
|
477
|
+
async function syncNpmMirror(cwd3) {
|
|
478
|
+
const packages = await getWorkspacePackages(cwd3);
|
|
479
|
+
for (const project of packages) {
|
|
480
|
+
if (project.manifest.name) {
|
|
481
|
+
await (0, import_execa.execa)({
|
|
482
|
+
stdout: ["pipe", "inherit"]
|
|
483
|
+
})`cnpm sync ${project.manifest.name}`;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
578
488
|
// src/program.ts
|
|
489
|
+
var cwd2 = import_node_process2.default.cwd();
|
|
579
490
|
import_commander.program.name(name).version(version);
|
|
580
491
|
import_commander.program.option("-i,--interactive").option("--raw", "raw mode").option("--outDir <dir>", "Output directory").action(async (opts) => {
|
|
581
492
|
await main(opts);
|
|
582
493
|
logger.success("upgrade @icebreakers/monorepo ok!");
|
|
583
494
|
});
|
|
495
|
+
import_commander.program.command("init").action(async () => {
|
|
496
|
+
await init(cwd2);
|
|
497
|
+
logger.success("init finished!");
|
|
498
|
+
});
|
|
499
|
+
import_commander.program.command("sync").action(async () => {
|
|
500
|
+
await syncNpmMirror(cwd2);
|
|
501
|
+
logger.success("sync npm mirror finished!");
|
|
502
|
+
});
|
|
503
|
+
import_commander.program.command("clean").action(async () => {
|
|
504
|
+
await cleanProjects(cwd2);
|
|
505
|
+
logger.success("clean projects finished!");
|
|
506
|
+
});
|
|
507
|
+
import_commander.program.command("mirror").action(async () => {
|
|
508
|
+
await setVscodeBinaryMirror(cwd2);
|
|
509
|
+
logger.success("set vscode binary mirror finished!");
|
|
510
|
+
});
|
|
584
511
|
var program_default = import_commander.program;
|
|
585
512
|
|
|
586
513
|
// src/cli.ts
|
|
587
514
|
program_default.parse();
|
|
588
|
-
/*! Bundled license information:
|
|
589
|
-
|
|
590
|
-
isobject/index.js:
|
|
591
|
-
(*!
|
|
592
|
-
* isobject <https://github.com/jonschlinkert/isobject>
|
|
593
|
-
*
|
|
594
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
595
|
-
* Released under the MIT License.
|
|
596
|
-
*)
|
|
597
|
-
|
|
598
|
-
get-value/index.js:
|
|
599
|
-
(*!
|
|
600
|
-
* get-value <https://github.com/jonschlinkert/get-value>
|
|
601
|
-
*
|
|
602
|
-
* Copyright (c) 2014-2018, Jon Schlinkert.
|
|
603
|
-
* Released under the MIT License.
|
|
604
|
-
*)
|
|
605
|
-
|
|
606
|
-
is-primitive/index.js:
|
|
607
|
-
(*!
|
|
608
|
-
* is-primitive <https://github.com/jonschlinkert/is-primitive>
|
|
609
|
-
*
|
|
610
|
-
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
611
|
-
* Released under the MIT License.
|
|
612
|
-
*)
|
|
613
|
-
|
|
614
|
-
is-plain-object/index.js:
|
|
615
|
-
(*!
|
|
616
|
-
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
617
|
-
*
|
|
618
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
619
|
-
* Released under the MIT License.
|
|
620
|
-
*)
|
|
621
|
-
|
|
622
|
-
set-value/index.js:
|
|
623
|
-
(*!
|
|
624
|
-
* set-value <https://github.com/jonschlinkert/set-value>
|
|
625
|
-
*
|
|
626
|
-
* Copyright (c) Jon Schlinkert (https://github.com/jonschlinkert).
|
|
627
|
-
* Released under the MIT License.
|
|
628
|
-
*)
|
|
629
|
-
*/
|