@icebreakers/monorepo 0.4.6 → 0.4.7
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-46UL2RFM.js +315 -0
- package/dist/cli.cjs +15191 -304
- package/dist/cli.js +15213 -5
- package/dist/index.cjs +43 -374
- package/dist/index.js +1 -1
- package/package.json +10 -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/index.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 __export = (target, all) => {
|
|
15
9
|
for (var name in all)
|
|
16
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -33,285 +27,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
27
|
));
|
|
34
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
29
|
|
|
36
|
-
// ../../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
|
|
37
|
-
var getImportMetaUrl, importMetaUrl;
|
|
38
|
-
var init_cjs_shims = __esm({
|
|
39
|
-
"../../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"() {
|
|
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, path2, 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 path2 === "number") {
|
|
71
|
-
path2 = String(path2);
|
|
72
|
-
}
|
|
73
|
-
const isArray = Array.isArray(path2);
|
|
74
|
-
const isString = typeof path2 === "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 && path2 in target) {
|
|
81
|
-
return isValid(path2, target, options) ? target[path2] : options.default;
|
|
82
|
-
}
|
|
83
|
-
let segs = isArray ? path2 : split(path2, 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(path2, splitChar, options) {
|
|
130
|
-
if (typeof options.split === "function") {
|
|
131
|
-
return options.split(path2);
|
|
132
|
-
}
|
|
133
|
-
return path2.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 isPlainObject(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 isPlainObject = 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 && isPlainObject(obj[prop]) && isPlainObject(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, path2, value, options) => {
|
|
284
|
-
if (!path2 || !isObject(target)) return target;
|
|
285
|
-
const keys = split(path2, 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
|
-
|
|
315
30
|
// src/index.ts
|
|
316
31
|
var src_exports = {};
|
|
317
32
|
__export(src_exports, {
|
|
@@ -319,25 +34,51 @@ __export(src_exports, {
|
|
|
319
34
|
setPkgJson: () => setPkgJson
|
|
320
35
|
});
|
|
321
36
|
module.exports = __toCommonJS(src_exports);
|
|
322
|
-
|
|
37
|
+
|
|
38
|
+
// ../../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
|
|
39
|
+
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
40
|
+
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
323
41
|
|
|
324
42
|
// src/lib.ts
|
|
325
|
-
init_cjs_shims();
|
|
326
43
|
var import_node_process = __toESM(require("process"), 1);
|
|
327
44
|
var import_node_url = require("url");
|
|
328
45
|
var import_checkbox = __toESM(require("@inquirer/checkbox"), 1);
|
|
329
46
|
var import_confirm = __toESM(require("@inquirer/confirm"), 1);
|
|
330
47
|
var import_fs_extra = __toESM(require("fs-extra"), 1);
|
|
331
|
-
var import_get_value2 = __toESM(
|
|
48
|
+
var import_get_value2 = __toESM(require("get-value"), 1);
|
|
332
49
|
var import_klaw = __toESM(require("klaw"), 1);
|
|
333
50
|
var import_p_queue = __toESM(require("p-queue"), 1);
|
|
334
51
|
var import_pathe = __toESM(require("pathe"), 1);
|
|
335
52
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
336
|
-
var import_set_value = __toESM(
|
|
53
|
+
var import_set_value = __toESM(require("set-value"), 1);
|
|
54
|
+
|
|
55
|
+
// package.json
|
|
56
|
+
var version = "0.4.7";
|
|
57
|
+
|
|
58
|
+
// src/logger.ts
|
|
59
|
+
var import_consola = require("consola");
|
|
60
|
+
var logger = (0, import_consola.createConsola)();
|
|
337
61
|
|
|
338
|
-
//
|
|
339
|
-
|
|
340
|
-
|
|
62
|
+
// src/md5.ts
|
|
63
|
+
var import_node_crypto = __toESM(require("crypto"), 1);
|
|
64
|
+
function getFileHash(data) {
|
|
65
|
+
const hashSum = import_node_crypto.default.createHash("md5");
|
|
66
|
+
hashSum.update(data);
|
|
67
|
+
return hashSum.digest("hex");
|
|
68
|
+
}
|
|
69
|
+
function isFileChanged(src, dest) {
|
|
70
|
+
try {
|
|
71
|
+
const currentHash = getFileHash(src);
|
|
72
|
+
const previousHash = getFileHash(dest);
|
|
73
|
+
return currentHash !== previousHash;
|
|
74
|
+
} catch (err) {
|
|
75
|
+
console.error("Error calculating file hash:", err);
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// src/monorepo/git.ts
|
|
81
|
+
var import_get_value = __toESM(require("get-value"), 1);
|
|
341
82
|
var import_git_url_parse = __toESM(require("git-url-parse"), 1);
|
|
342
83
|
var import_simple_git = require("simple-git");
|
|
343
84
|
var GitClient = class {
|
|
@@ -385,42 +126,16 @@ var GitClient = class {
|
|
|
385
126
|
}
|
|
386
127
|
};
|
|
387
128
|
|
|
388
|
-
// src/logger.ts
|
|
389
|
-
init_cjs_shims();
|
|
390
|
-
var import_consola = require("consola");
|
|
391
|
-
var logger = (0, import_consola.createConsola)();
|
|
392
|
-
|
|
393
|
-
// src/md5.ts
|
|
394
|
-
init_cjs_shims();
|
|
395
|
-
var import_node_crypto = __toESM(require("crypto"), 1);
|
|
396
|
-
function getFileHash(data) {
|
|
397
|
-
const hashSum = import_node_crypto.default.createHash("md5");
|
|
398
|
-
hashSum.update(data);
|
|
399
|
-
return hashSum.digest("hex");
|
|
400
|
-
}
|
|
401
|
-
function isFileChanged(src, dest) {
|
|
402
|
-
try {
|
|
403
|
-
const currentHash = getFileHash(src);
|
|
404
|
-
const previousHash = getFileHash(dest);
|
|
405
|
-
return currentHash !== previousHash;
|
|
406
|
-
} catch (err) {
|
|
407
|
-
console.error("Error calculating file hash:", err);
|
|
408
|
-
return false;
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
|
|
412
129
|
// src/scripts.ts
|
|
413
|
-
init_cjs_shims();
|
|
414
130
|
var scripts = {
|
|
415
|
-
"script:init": "
|
|
416
|
-
"script:sync": "
|
|
417
|
-
"script:clean": "
|
|
418
|
-
"script:mirror": "
|
|
131
|
+
"script:init": "monorepo init",
|
|
132
|
+
"script:sync": "monorepo sync",
|
|
133
|
+
"script:clean": "monorepo clean",
|
|
134
|
+
"script:mirror": "monorepo mirror"
|
|
419
135
|
};
|
|
420
136
|
var scriptsEntries = Object.entries(scripts);
|
|
421
137
|
|
|
422
138
|
// src/targets.ts
|
|
423
|
-
init_cjs_shims();
|
|
424
139
|
function getTargets(raw) {
|
|
425
140
|
const list = [
|
|
426
141
|
".changeset",
|
|
@@ -445,9 +160,8 @@ function getTargets(raw) {
|
|
|
445
160
|
"vitest.workspace.ts",
|
|
446
161
|
// #region docker
|
|
447
162
|
"Dockerfile",
|
|
448
|
-
".dockerignore"
|
|
163
|
+
".dockerignore"
|
|
449
164
|
// #endregion
|
|
450
|
-
"scripts"
|
|
451
165
|
];
|
|
452
166
|
if (!raw) {
|
|
453
167
|
list.push(".github", "LICENSE", "renovate.json", "SECURITY.md", "CODE_OF_CONDUCT.md", "CONTRIBUTING.md", "netlify.toml");
|
|
@@ -456,7 +170,6 @@ function getTargets(raw) {
|
|
|
456
170
|
}
|
|
457
171
|
|
|
458
172
|
// src/utils.ts
|
|
459
|
-
init_cjs_shims();
|
|
460
173
|
function escapeStringRegexp(str) {
|
|
461
174
|
return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
462
175
|
}
|
|
@@ -484,7 +197,11 @@ function setPkgJson(sourcePkgJson, targetPkgJson) {
|
|
|
484
197
|
(0, import_set_value.default)(targetPkgJson, `dependencies.${x[0].replaceAll(".", "\\.")}`, x[1], { preservePaths: false });
|
|
485
198
|
});
|
|
486
199
|
Object.entries(devDeps).forEach((x) => {
|
|
487
|
-
|
|
200
|
+
if (x[0] === "@icebreakers/monorepo") {
|
|
201
|
+
(0, import_set_value.default)(targetPkgJson, `devDependencies.${x[0].replaceAll(".", "\\.")}`, `^${version}`, { preservePaths: false });
|
|
202
|
+
} else {
|
|
203
|
+
(0, import_set_value.default)(targetPkgJson, `devDependencies.${x[0].replaceAll(".", "\\.")}`, x[1], { preservePaths: false });
|
|
204
|
+
}
|
|
488
205
|
});
|
|
489
206
|
for (const [k, v] of scriptsEntries) {
|
|
490
207
|
(0, import_set_value.default)(targetPkgJson, `scripts.${k}`, v);
|
|
@@ -512,12 +229,6 @@ async function main(opts) {
|
|
|
512
229
|
})
|
|
513
230
|
});
|
|
514
231
|
}
|
|
515
|
-
const removeDirs = ["scripts/monorepo"];
|
|
516
|
-
for (const dir of removeDirs) {
|
|
517
|
-
if (targets.includes(dir)) {
|
|
518
|
-
await import_fs_extra.default.remove(import_pathe.default.resolve(absOutDir, dir));
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
232
|
const regexpArr = targets.map((x) => {
|
|
522
233
|
return new RegExp(`^${escapeStringRegexp(x)}`);
|
|
523
234
|
});
|
|
@@ -582,45 +293,3 @@ async function main(opts) {
|
|
|
582
293
|
main,
|
|
583
294
|
setPkgJson
|
|
584
295
|
});
|
|
585
|
-
/*! Bundled license information:
|
|
586
|
-
|
|
587
|
-
isobject/index.js:
|
|
588
|
-
(*!
|
|
589
|
-
* isobject <https://github.com/jonschlinkert/isobject>
|
|
590
|
-
*
|
|
591
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
592
|
-
* Released under the MIT License.
|
|
593
|
-
*)
|
|
594
|
-
|
|
595
|
-
get-value/index.js:
|
|
596
|
-
(*!
|
|
597
|
-
* get-value <https://github.com/jonschlinkert/get-value>
|
|
598
|
-
*
|
|
599
|
-
* Copyright (c) 2014-2018, Jon Schlinkert.
|
|
600
|
-
* Released under the MIT License.
|
|
601
|
-
*)
|
|
602
|
-
|
|
603
|
-
is-primitive/index.js:
|
|
604
|
-
(*!
|
|
605
|
-
* is-primitive <https://github.com/jonschlinkert/is-primitive>
|
|
606
|
-
*
|
|
607
|
-
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
608
|
-
* Released under the MIT License.
|
|
609
|
-
*)
|
|
610
|
-
|
|
611
|
-
is-plain-object/index.js:
|
|
612
|
-
(*!
|
|
613
|
-
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
614
|
-
*
|
|
615
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
616
|
-
* Released under the MIT License.
|
|
617
|
-
*)
|
|
618
|
-
|
|
619
|
-
set-value/index.js:
|
|
620
|
-
(*!
|
|
621
|
-
* set-value <https://github.com/jonschlinkert/set-value>
|
|
622
|
-
*
|
|
623
|
-
* Copyright (c) Jon Schlinkert (https://github.com/jonschlinkert).
|
|
624
|
-
* Released under the MIT License.
|
|
625
|
-
*)
|
|
626
|
-
*/
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icebreakers/monorepo",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.7",
|
|
5
5
|
"description": "icebreaker's monorepo config generator",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -35,18 +35,25 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@inquirer/checkbox": "^3.0.1",
|
|
37
37
|
"@inquirer/confirm": "^4.0.1",
|
|
38
|
+
"@pnpm/workspace.find-packages": "^4.0.10",
|
|
38
39
|
"commander": "^12.1.0",
|
|
40
|
+
"comment-json": "^4.2.5",
|
|
39
41
|
"consola": "^3.2.3",
|
|
40
42
|
"fs-extra": "^11.2.0",
|
|
43
|
+
"get-value": "^3.0.1",
|
|
41
44
|
"git-url-parse": "^15.0.0",
|
|
42
45
|
"klaw": "^4.1.0",
|
|
43
46
|
"p-queue": "^8.0.1",
|
|
44
47
|
"pathe": "^1.1.2",
|
|
45
48
|
"picocolors": "^1.1.0",
|
|
46
|
-
"
|
|
49
|
+
"set-value": "^4.1.0",
|
|
50
|
+
"simple-git": "^3.27.0"
|
|
47
51
|
},
|
|
48
52
|
"devDependencies": {
|
|
49
|
-
"@types
|
|
53
|
+
"@pnpm/types": "^12.2.0",
|
|
54
|
+
"@types/get-value": "^3.0.5",
|
|
55
|
+
"@types/git-url-parse": "^9.0.3",
|
|
56
|
+
"@types/set-value": "^4.0.3"
|
|
50
57
|
},
|
|
51
58
|
"scripts": {
|
|
52
59
|
"dev": "tsup --watch --sourcemap",
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import process from 'node:process'
|
|
2
|
-
import { parse, stringify } from 'comment-json'
|
|
3
|
-
import fs from 'fs-extra'
|
|
4
|
-
import path from 'pathe'
|
|
5
|
-
import { setMirror } from './mirror/utils'
|
|
6
|
-
|
|
7
|
-
const cwd = process.cwd()
|
|
8
|
-
|
|
9
|
-
const targetJsonPath = path.resolve(cwd, '.vscode/settings.json')
|
|
10
|
-
|
|
11
|
-
await fs.ensureFile(targetJsonPath)
|
|
12
|
-
|
|
13
|
-
const json = parse(await fs.readFile(targetJsonPath, 'utf8'), undefined, false)
|
|
14
|
-
|
|
15
|
-
json && typeof json === 'object' && setMirror(json)
|
|
16
|
-
|
|
17
|
-
await fs.writeFile(targetJsonPath, `${stringify(json, undefined, 2)}\n`, 'utf8')
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import path from 'pathe'
|
|
2
|
-
import { rimraf } from 'rimraf'
|
|
3
|
-
|
|
4
|
-
const dirs = [
|
|
5
|
-
'packages/monorepo',
|
|
6
|
-
'packages/foo',
|
|
7
|
-
// 'apps/cli',
|
|
8
|
-
// 'apps/website',
|
|
9
|
-
'apps',
|
|
10
|
-
]
|
|
11
|
-
|
|
12
|
-
await rimraf(dirs.map((x) => {
|
|
13
|
-
return path.resolve(import.meta.dirname, '../..', x)
|
|
14
|
-
}))
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import process from 'node:process'
|
|
2
|
-
import path from 'pathe'
|
|
3
|
-
import { GitClient } from './git'
|
|
4
|
-
import { getWorkspacePackages } from './utils'
|
|
5
|
-
|
|
6
|
-
export async function createContext(cwd = process.cwd()) {
|
|
7
|
-
const git = new GitClient()
|
|
8
|
-
const workspaceFilepath = path.resolve(import.meta.dirname, '../../pnpm-workspace.yaml')
|
|
9
|
-
const projects = await getWorkspacePackages(cwd)
|
|
10
|
-
return {
|
|
11
|
-
cwd,
|
|
12
|
-
git,
|
|
13
|
-
workspaceFilepath,
|
|
14
|
-
projects,
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export type Context = Awaited<ReturnType<typeof createContext>>
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { ConfigValues, SimpleGit, SimpleGitOptions } from 'simple-git'
|
|
2
|
-
import get from 'get-value'
|
|
3
|
-
import gitUrlParse from 'git-url-parse'
|
|
4
|
-
import { simpleGit } from 'simple-git'
|
|
5
|
-
|
|
6
|
-
export class GitClient {
|
|
7
|
-
private client: SimpleGit
|
|
8
|
-
#config: ConfigValues | undefined
|
|
9
|
-
constructor(options: Partial<SimpleGitOptions> = {}) {
|
|
10
|
-
this.client = simpleGit(options)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
listConfig() {
|
|
14
|
-
return this.client.listConfig()
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
async init() {
|
|
18
|
-
const listConfig = await this.listConfig()
|
|
19
|
-
this.#config = listConfig.all
|
|
20
|
-
return this.#config
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async getConfig() {
|
|
24
|
-
if (this.#config) {
|
|
25
|
-
return this.#config
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
return await this.init()
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
async getGitUrl() {
|
|
33
|
-
const config = await this.getConfig()
|
|
34
|
-
const x = get(config, 'remote.origin.url')
|
|
35
|
-
if (x) {
|
|
36
|
-
return gitUrlParse(x)
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
async getRepoName() {
|
|
41
|
-
const url = await this.getGitUrl()
|
|
42
|
-
if (url) {
|
|
43
|
-
return `${url.owner}/${url.name}`
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
async getUser() {
|
|
48
|
-
const config = await this.getConfig()
|
|
49
|
-
const name: string = get(config, 'user.name')
|
|
50
|
-
const email: string = get(config, 'user.email')
|
|
51
|
-
return {
|
|
52
|
-
name,
|
|
53
|
-
email,
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-template-curly-in-string */
|
|
2
|
-
// https://github.com/cnpm/binary-mirror-config/blob/master/package.json
|
|
3
|
-
|
|
4
|
-
export const chinaMirrorsEnvs = {
|
|
5
|
-
COREPACK_NPM_REGISTRY: 'https://registry.npmmirror.com',
|
|
6
|
-
EDGEDRIVER_CDNURL: 'https://npmmirror.com/mirrors/edgedriver',
|
|
7
|
-
NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node',
|
|
8
|
-
NVM_NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node',
|
|
9
|
-
PHANTOMJS_CDNURL: 'https://cdn.npmmirror.com/binaries/phantomjs',
|
|
10
|
-
CHROMEDRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/chromedriver',
|
|
11
|
-
OPERADRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/operadriver',
|
|
12
|
-
CYPRESS_DOWNLOAD_PATH_TEMPLATE: 'https://cdn.npmmirror.com/binaries/cypress/${version}/${platform}-${arch}/cypress.zip',
|
|
13
|
-
ELECTRON_MIRROR: 'https://cdn.npmmirror.com/binaries/electron/',
|
|
14
|
-
ELECTRON_BUILDER_BINARIES_MIRROR: 'https://cdn.npmmirror.com/binaries/electron-builder-binaries/',
|
|
15
|
-
SASS_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-sass',
|
|
16
|
-
SWC_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-swc',
|
|
17
|
-
NWJS_URLBASE: 'https://cdn.npmmirror.com/binaries/nwjs/v',
|
|
18
|
-
PUPPETEER_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
|
|
19
|
-
PUPPETEER_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
|
|
20
|
-
PLAYWRIGHT_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries/playwright',
|
|
21
|
-
SENTRYCLI_CDNURL: 'https://cdn.npmmirror.com/binaries/sentry-cli',
|
|
22
|
-
SAUCECTL_INSTALL_BINARY_MIRROR: 'https://cdn.npmmirror.com/binaries/saucectl',
|
|
23
|
-
RE2_DOWNLOAD_MIRROR: 'https://cdn.npmmirror.com/binaries/node-re2',
|
|
24
|
-
RE2_DOWNLOAD_SKIP_PATH: 'true',
|
|
25
|
-
PRISMA_ENGINES_MIRROR: 'https://cdn.npmmirror.com/binaries/prisma',
|
|
26
|
-
npm_config_better_sqlite3_binary_host: 'https://cdn.npmmirror.com/binaries/better-sqlite3',
|
|
27
|
-
npm_config_keytar_binary_host: 'https://cdn.npmmirror.com/binaries/keytar',
|
|
28
|
-
npm_config_sharp_binary_host: 'https://cdn.npmmirror.com/binaries/sharp',
|
|
29
|
-
npm_config_sharp_libvips_binary_host: 'https://cdn.npmmirror.com/binaries/sharp-libvips',
|
|
30
|
-
npm_config_robotjs_binary_host: 'https://cdn.npmmirror.com/binaries/robotjs',
|
|
31
|
-
}
|