@icebreakers/monorepo 1.2.3 → 2.0.0
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 +28 -0
- package/assets/.husky/commit-msg +4 -1
- package/assets/.husky/pre-commit +4 -1
- package/assets/monorepo.config.ts +22 -0
- package/assets/package.json +8 -8
- package/assets/turbo.json +10 -2
- package/dist/{chunk-4NCVGJER.js → chunk-JJQVR3B4.js} +573 -364
- package/dist/cli.cjs +603 -397
- package/dist/cli.js +12 -7
- package/dist/index.cjs +622 -382
- package/dist/index.d.cts +275 -14
- package/dist/index.d.ts +275 -14
- package/dist/index.js +31 -3
- package/package.json +3 -2
- package/templates/apps/client/package.json +11 -9
- package/templates/apps/client/wrangler.jsonc +1 -1
- package/templates/apps/server/package.json +2 -2
- package/templates/apps/website/index.md +83 -121
- package/templates/apps/website/monorepo/index.md +34 -56
- package/templates/apps/website/monorepo/manage.md +102 -37
- package/templates/apps/website/monorepo/publish.md +57 -109
- package/templates/apps/website/package.json +3 -1
- package/templates/packages/vue-lib-template/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -33,10 +33,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
));
|
|
34
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
35
|
|
|
36
|
-
// ../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.12_@types+node@24.5.2__jiti@2.
|
|
36
|
+
// ../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.12_@types+node@24.5.2__jiti@2.6.0_postcss@8.5._6bfe6d2ece7a9e60df9bded316a5214d/node_modules/tsup/assets/cjs_shims.js
|
|
37
37
|
var getImportMetaUrl, importMetaUrl;
|
|
38
38
|
var init_cjs_shims = __esm({
|
|
39
|
-
"../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.12_@types+node@24.5.2__jiti@2.
|
|
39
|
+
"../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.12_@types+node@24.5.2__jiti@2.6.0_postcss@8.5._6bfe6d2ece7a9e60df9bded316a5214d/node_modules/tsup/assets/cjs_shims.js"() {
|
|
40
40
|
"use strict";
|
|
41
41
|
getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
42
42
|
importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
@@ -190,9 +190,9 @@ var require_set_value = __commonJS({
|
|
|
190
190
|
}
|
|
191
191
|
return obj;
|
|
192
192
|
};
|
|
193
|
-
var setValue = (target,
|
|
194
|
-
if (!
|
|
195
|
-
const keys = split2(
|
|
193
|
+
var setValue = (target, path13, value, options) => {
|
|
194
|
+
if (!path13 || !isObject2(target)) return target;
|
|
195
|
+
const keys = split2(path13, options);
|
|
196
196
|
let obj = target;
|
|
197
197
|
for (let i = 0; i < keys.length; i++) {
|
|
198
198
|
const key = keys[i];
|
|
@@ -226,33 +226,197 @@ var require_set_value = __commonJS({
|
|
|
226
226
|
var index_exports = {};
|
|
227
227
|
__export(index_exports, {
|
|
228
228
|
GitClient: () => GitClient,
|
|
229
|
+
assetsDir: () => assetsDir,
|
|
229
230
|
cleanProjects: () => cleanProjects,
|
|
231
|
+
createContext: () => createContext,
|
|
230
232
|
createNewProject: () => createNewProject,
|
|
233
|
+
defineMonorepoConfig: () => defineMonorepoConfig,
|
|
231
234
|
escapeStringRegexp: () => escapeStringRegexp,
|
|
235
|
+
getCreateChoices: () => getCreateChoices,
|
|
232
236
|
getFileHash: () => getFileHash,
|
|
237
|
+
getTemplateMap: () => getTemplateMap,
|
|
233
238
|
getWorkspaceData: () => getWorkspaceData,
|
|
234
239
|
getWorkspacePackages: () => getWorkspacePackages,
|
|
235
240
|
init: () => init,
|
|
236
241
|
isFileChanged: () => isFileChanged,
|
|
237
242
|
isMatch: () => isMatch,
|
|
243
|
+
loadMonorepoConfig: () => loadMonorepoConfig,
|
|
244
|
+
logger: () => logger,
|
|
245
|
+
name: () => name,
|
|
246
|
+
packageDir: () => packageDir,
|
|
247
|
+
resolveCommandConfig: () => resolveCommandConfig,
|
|
248
|
+
rootDir: () => rootDir,
|
|
238
249
|
setVscodeBinaryMirror: () => setVscodeBinaryMirror,
|
|
239
250
|
syncNpmMirror: () => syncNpmMirror,
|
|
240
|
-
|
|
251
|
+
templateMap: () => templateMap,
|
|
252
|
+
templatesDir: () => templatesDir,
|
|
253
|
+
upgradeMonorepo: () => upgradeMonorepo,
|
|
254
|
+
version: () => version
|
|
241
255
|
});
|
|
242
256
|
module.exports = __toCommonJS(index_exports);
|
|
243
257
|
init_cjs_shims();
|
|
244
258
|
|
|
245
|
-
// src/
|
|
259
|
+
// src/commands/index.ts
|
|
246
260
|
init_cjs_shims();
|
|
247
261
|
|
|
248
|
-
// src/
|
|
262
|
+
// src/core/git.ts
|
|
249
263
|
init_cjs_shims();
|
|
250
|
-
var import_checkbox = __toESM(require("@inquirer/checkbox"), 1);
|
|
251
|
-
var import_fs_extra = __toESM(require("fs-extra"), 1);
|
|
252
|
-
var import_pathe2 = __toESM(require("pathe"), 1);
|
|
253
|
-
var import_set_value = __toESM(require_set_value(), 1);
|
|
254
264
|
|
|
255
|
-
//
|
|
265
|
+
// ../../node_modules/.pnpm/get-value@4.0.1/node_modules/get-value/dist/index.mjs
|
|
266
|
+
init_cjs_shims();
|
|
267
|
+
var __defProp2 = Object.defineProperty;
|
|
268
|
+
var __name = (target, value) => __defProp2(target, "name", { value, configurable: true });
|
|
269
|
+
var isObject = /* @__PURE__ */ __name((v) => v !== null && typeof v === "object", "isObject");
|
|
270
|
+
var join = /* @__PURE__ */ __name((segs, joinChar, options) => {
|
|
271
|
+
if (typeof options.join === "function") {
|
|
272
|
+
return options.join(segs);
|
|
273
|
+
}
|
|
274
|
+
return segs[0] + joinChar + segs[1];
|
|
275
|
+
}, "join");
|
|
276
|
+
var split = /* @__PURE__ */ __name((path13, splitChar, options) => {
|
|
277
|
+
if (typeof options.split === "function") {
|
|
278
|
+
return options.split(path13);
|
|
279
|
+
}
|
|
280
|
+
return path13.split(splitChar);
|
|
281
|
+
}, "split");
|
|
282
|
+
var isValid = /* @__PURE__ */ __name((key, target = {}, options) => {
|
|
283
|
+
if (typeof (options == null ? void 0 : options.isValid) === "function") {
|
|
284
|
+
return options.isValid(key, target);
|
|
285
|
+
}
|
|
286
|
+
return true;
|
|
287
|
+
}, "isValid");
|
|
288
|
+
var isValidObject = /* @__PURE__ */ __name((v) => {
|
|
289
|
+
return isObject(v) || typeof v === "function";
|
|
290
|
+
}, "isValidObject");
|
|
291
|
+
var getValue = /* @__PURE__ */ __name((target, path13, options = {}) => {
|
|
292
|
+
if (!isObject(options)) {
|
|
293
|
+
options = { default: options };
|
|
294
|
+
}
|
|
295
|
+
if (!isValidObject(target)) {
|
|
296
|
+
return typeof options.default !== "undefined" ? options.default : target;
|
|
297
|
+
}
|
|
298
|
+
if (typeof path13 === "number") {
|
|
299
|
+
path13 = String(path13);
|
|
300
|
+
}
|
|
301
|
+
const pathIsArray = Array.isArray(path13);
|
|
302
|
+
const pathIsString = typeof path13 === "string";
|
|
303
|
+
const splitChar = options.separator || ".";
|
|
304
|
+
const joinChar = options.joinChar || (typeof splitChar === "string" ? splitChar : ".");
|
|
305
|
+
if (!pathIsString && !pathIsArray) {
|
|
306
|
+
return target;
|
|
307
|
+
}
|
|
308
|
+
if (target[path13] !== void 0) {
|
|
309
|
+
return isValid(path13, target, options) ? target[path13] : options.default;
|
|
310
|
+
}
|
|
311
|
+
const segs = pathIsArray ? path13 : split(path13, splitChar, options);
|
|
312
|
+
const len = segs.length;
|
|
313
|
+
let idx = 0;
|
|
314
|
+
do {
|
|
315
|
+
let prop = segs[idx];
|
|
316
|
+
if (typeof prop !== "string") {
|
|
317
|
+
prop = String(prop);
|
|
318
|
+
}
|
|
319
|
+
while (prop && prop.slice(-1) === "\\") {
|
|
320
|
+
prop = join([prop.slice(0, -1), segs[++idx] || ""], joinChar, options);
|
|
321
|
+
}
|
|
322
|
+
if (target[prop] !== void 0) {
|
|
323
|
+
if (!isValid(prop, target, options)) {
|
|
324
|
+
return options.default;
|
|
325
|
+
}
|
|
326
|
+
target = target[prop];
|
|
327
|
+
} else {
|
|
328
|
+
let hasProp = false;
|
|
329
|
+
let n = idx + 1;
|
|
330
|
+
while (n < len) {
|
|
331
|
+
prop = join([prop, segs[n++]], joinChar, options);
|
|
332
|
+
if (hasProp = target[prop] !== void 0) {
|
|
333
|
+
if (!isValid(prop, target, options)) {
|
|
334
|
+
return options.default;
|
|
335
|
+
}
|
|
336
|
+
target = target[prop];
|
|
337
|
+
idx = n - 1;
|
|
338
|
+
break;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
if (!hasProp) {
|
|
342
|
+
return options.default;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
} while (++idx < len && isValidObject(target));
|
|
346
|
+
if (idx === len) {
|
|
347
|
+
return target;
|
|
348
|
+
}
|
|
349
|
+
return options.default;
|
|
350
|
+
}, "getValue");
|
|
351
|
+
var index_default = getValue;
|
|
352
|
+
|
|
353
|
+
// src/core/git.ts
|
|
354
|
+
var import_git_url_parse = __toESM(require("git-url-parse"), 1);
|
|
355
|
+
var import_simple_git = require("simple-git");
|
|
356
|
+
var GitClient = class {
|
|
357
|
+
client;
|
|
358
|
+
#config;
|
|
359
|
+
constructor(options = {}) {
|
|
360
|
+
this.client = (0, import_simple_git.simpleGit)(options);
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* 读取 Git 的 config 列表,原样返回 simple-git 的结果。
|
|
364
|
+
*/
|
|
365
|
+
listConfig() {
|
|
366
|
+
return this.client.listConfig();
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* 初始化配置缓存,避免多次访问 Git 产生的性能损耗。
|
|
370
|
+
*/
|
|
371
|
+
async init() {
|
|
372
|
+
const listConfig = await this.listConfig();
|
|
373
|
+
this.#config = listConfig.all;
|
|
374
|
+
return this.#config;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* 获取缓存的配置,若未初始化则自动触发 init。
|
|
378
|
+
*/
|
|
379
|
+
async getConfig() {
|
|
380
|
+
if (this.#config) {
|
|
381
|
+
return this.#config;
|
|
382
|
+
} else {
|
|
383
|
+
return await this.init();
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* 解析 remote.origin.url,返回 git-url-parse 的结构,便于获取仓库元信息。
|
|
388
|
+
*/
|
|
389
|
+
async getGitUrl() {
|
|
390
|
+
const config = await this.getConfig();
|
|
391
|
+
const x = index_default(config, "remote.origin.url");
|
|
392
|
+
if (x) {
|
|
393
|
+
return (0, import_git_url_parse.default)(x);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* 组合 owner/name,生成常用的仓库名表达。
|
|
398
|
+
*/
|
|
399
|
+
async getRepoName() {
|
|
400
|
+
const url = await this.getGitUrl();
|
|
401
|
+
if (url) {
|
|
402
|
+
return `${url.owner}/${url.name}`;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* 从 Git 配置中提取用户信息,用于填充 package.json author 字段。
|
|
407
|
+
*/
|
|
408
|
+
async getUser() {
|
|
409
|
+
const config = await this.getConfig();
|
|
410
|
+
const name2 = index_default(config, "user.name");
|
|
411
|
+
const email = index_default(config, "user.email");
|
|
412
|
+
return {
|
|
413
|
+
name: name2,
|
|
414
|
+
email
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
// src/core/workspace.ts
|
|
256
420
|
init_cjs_shims();
|
|
257
421
|
var import_find_workspace_dir = require("@pnpm/find-workspace-dir");
|
|
258
422
|
var import_workspace = require("@pnpm/workspace.find-packages");
|
|
@@ -327,7 +491,7 @@ var defuArrayFn = createDefu((object, key, currentValue) => {
|
|
|
327
491
|
}
|
|
328
492
|
});
|
|
329
493
|
|
|
330
|
-
// src/
|
|
494
|
+
// src/core/workspace.ts
|
|
331
495
|
var import_pathe = __toESM(require("pathe"), 1);
|
|
332
496
|
async function getWorkspacePackages(workspaceDir, options) {
|
|
333
497
|
const { ignoreRootPackage, ignorePrivatePackage, patterns } = defu(options, {
|
|
@@ -367,36 +531,102 @@ async function getWorkspaceData(cwd, options) {
|
|
|
367
531
|
};
|
|
368
532
|
}
|
|
369
533
|
|
|
370
|
-
// src/
|
|
534
|
+
// src/commands/clean.ts
|
|
535
|
+
init_cjs_shims();
|
|
536
|
+
var import_checkbox = __toESM(require("@inquirer/checkbox"), 1);
|
|
537
|
+
var import_fs_extra = __toESM(require("fs-extra"), 1);
|
|
538
|
+
var import_pathe3 = __toESM(require("pathe"), 1);
|
|
539
|
+
var import_set_value = __toESM(require_set_value(), 1);
|
|
540
|
+
|
|
541
|
+
// src/core/config.ts
|
|
542
|
+
init_cjs_shims();
|
|
543
|
+
var import_c12 = require("c12");
|
|
544
|
+
var import_pathe2 = __toESM(require("pathe"), 1);
|
|
545
|
+
var cache = /* @__PURE__ */ new Map();
|
|
546
|
+
async function loadConfigInternal(cwd) {
|
|
547
|
+
const { config, configFile } = await (0, import_c12.loadConfig)({
|
|
548
|
+
name: "monorepo",
|
|
549
|
+
cwd,
|
|
550
|
+
// configFile: ['monorepo.config'],
|
|
551
|
+
rcFile: false,
|
|
552
|
+
defaults: {},
|
|
553
|
+
globalRc: false,
|
|
554
|
+
packageJson: false
|
|
555
|
+
});
|
|
556
|
+
return {
|
|
557
|
+
file: configFile ? import_pathe2.default.resolve(configFile) : null,
|
|
558
|
+
config: config ?? {}
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
function defineMonorepoConfig(config) {
|
|
562
|
+
return config;
|
|
563
|
+
}
|
|
564
|
+
async function loadMonorepoConfig(cwd) {
|
|
565
|
+
const key = import_pathe2.default.resolve(cwd);
|
|
566
|
+
if (!cache.has(key)) {
|
|
567
|
+
cache.set(key, loadConfigInternal(key));
|
|
568
|
+
}
|
|
569
|
+
const { config } = await cache.get(key);
|
|
570
|
+
return config;
|
|
571
|
+
}
|
|
572
|
+
async function resolveCommandConfig(name2, cwd) {
|
|
573
|
+
const config = await loadMonorepoConfig(cwd);
|
|
574
|
+
const commands = config.commands ?? {};
|
|
575
|
+
const commandConfig = commands[name2];
|
|
576
|
+
return commandConfig ?? {};
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
// src/commands/clean.ts
|
|
371
580
|
async function cleanProjects(cwd) {
|
|
372
|
-
const
|
|
373
|
-
const
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
581
|
+
const cleanConfig = await resolveCommandConfig("clean", cwd);
|
|
582
|
+
const workspaceOptions = (cleanConfig == null ? void 0 : cleanConfig.includePrivate) ? { ignorePrivatePackage: false } : void 0;
|
|
583
|
+
const { packages, workspaceDir } = await getWorkspaceData(cwd, workspaceOptions);
|
|
584
|
+
const filteredPackages = packages.filter((pkg) => {
|
|
585
|
+
var _a;
|
|
586
|
+
const name3 = pkg.manifest.name ?? "";
|
|
587
|
+
if (!name3) {
|
|
588
|
+
return true;
|
|
589
|
+
}
|
|
590
|
+
if (!((_a = cleanConfig == null ? void 0 : cleanConfig.ignorePackages) == null ? void 0 : _a.length)) {
|
|
591
|
+
return true;
|
|
592
|
+
}
|
|
593
|
+
return !cleanConfig.ignorePackages.includes(name3);
|
|
383
594
|
});
|
|
384
|
-
|
|
385
|
-
|
|
595
|
+
let cleanDirs = [];
|
|
596
|
+
if (cleanConfig == null ? void 0 : cleanConfig.autoConfirm) {
|
|
597
|
+
cleanDirs = filteredPackages.map((pkg) => pkg.rootDir);
|
|
598
|
+
} else {
|
|
599
|
+
cleanDirs = await (0, import_checkbox.default)({
|
|
600
|
+
message: "\u8BF7\u9009\u62E9\u9700\u8981\u6E05\u7406\u7684\u76EE\u5F55",
|
|
601
|
+
choices: filteredPackages.map((x) => {
|
|
602
|
+
return {
|
|
603
|
+
name: import_pathe3.default.relative(workspaceDir, x.rootDir),
|
|
604
|
+
value: x.rootDir,
|
|
605
|
+
checked: true,
|
|
606
|
+
description: x.manifest.name
|
|
607
|
+
};
|
|
608
|
+
})
|
|
609
|
+
});
|
|
386
610
|
}
|
|
387
|
-
const
|
|
611
|
+
const candidates = Array.from(new Set(cleanDirs.filter(Boolean)));
|
|
612
|
+
await Promise.all(candidates.map(async (dir) => {
|
|
613
|
+
if (await import_fs_extra.default.pathExists(dir)) {
|
|
614
|
+
await import_fs_extra.default.remove(dir);
|
|
615
|
+
}
|
|
616
|
+
}));
|
|
617
|
+
const name2 = import_pathe3.default.resolve(workspaceDir, "package.json");
|
|
388
618
|
const pkgJson = await import_fs_extra.default.readJson(name2);
|
|
389
|
-
(0, import_set_value.default)(pkgJson, "devDependencies.@icebreakers/monorepo", "latest", { preservePaths: false });
|
|
619
|
+
(0, import_set_value.default)(pkgJson, "devDependencies.@icebreakers/monorepo", (cleanConfig == null ? void 0 : cleanConfig.pinnedVersion) ?? "latest", { preservePaths: false });
|
|
390
620
|
await import_fs_extra.default.outputJson(name2, pkgJson, {
|
|
391
621
|
spaces: 2
|
|
392
622
|
});
|
|
393
623
|
}
|
|
394
624
|
|
|
395
|
-
// src/
|
|
625
|
+
// src/commands/create.ts
|
|
396
626
|
init_cjs_shims();
|
|
397
627
|
var import_node_process = __toESM(require("process"), 1);
|
|
398
628
|
var import_fs_extra2 = __toESM(require("fs-extra"), 1);
|
|
399
|
-
var
|
|
629
|
+
var import_pathe4 = __toESM(require("pathe"), 1);
|
|
400
630
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
401
631
|
var import_set_value2 = __toESM(require_set_value(), 1);
|
|
402
632
|
|
|
@@ -407,23 +637,22 @@ var import_node_url = require("url");
|
|
|
407
637
|
|
|
408
638
|
// package.json
|
|
409
639
|
var name = "@icebreakers/monorepo";
|
|
410
|
-
var version = "
|
|
640
|
+
var version = "2.0.0";
|
|
411
641
|
|
|
412
642
|
// src/constants.ts
|
|
413
|
-
var
|
|
414
|
-
var
|
|
415
|
-
var templatesDir = import_node_path.default.join(
|
|
416
|
-
var assetsDir = import_node_path.default.join(
|
|
417
|
-
var rootDir = import_node_path.default.
|
|
643
|
+
var packageJsonPath = (0, import_node_url.fileURLToPath)(new URL("../package.json", importMetaUrl));
|
|
644
|
+
var packageDir = import_node_path.default.dirname(packageJsonPath);
|
|
645
|
+
var templatesDir = import_node_path.default.join(packageDir, "templates");
|
|
646
|
+
var assetsDir = import_node_path.default.join(packageDir, "assets");
|
|
647
|
+
var rootDir = import_node_path.default.resolve(packageDir, "..", "..");
|
|
418
648
|
|
|
419
|
-
// src/logger.ts
|
|
649
|
+
// src/core/logger.ts
|
|
420
650
|
init_cjs_shims();
|
|
421
651
|
var import_consola = require("consola");
|
|
422
652
|
var logger = (0, import_consola.createConsola)();
|
|
423
653
|
|
|
424
|
-
// src/
|
|
425
|
-
var
|
|
426
|
-
var fromMap = {
|
|
654
|
+
// src/commands/create.ts
|
|
655
|
+
var templateMap = {
|
|
427
656
|
"tsup": "packages/tsup-template",
|
|
428
657
|
"unbuild": "packages/unbuild-template",
|
|
429
658
|
"vue-lib": "packages/vue-lib-template",
|
|
@@ -432,192 +661,98 @@ var fromMap = {
|
|
|
432
661
|
"vitepress": "apps/website",
|
|
433
662
|
"cli": "apps/cli"
|
|
434
663
|
};
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
const sourceJson = await import_fs_extra2.default.readJson(sourceJsonPath);
|
|
449
|
-
(0, import_set_value2.default)(sourceJson, "version", "0.0.0");
|
|
450
|
-
(0, import_set_value2.default)(sourceJson, "name", import_pathe3.default.basename(targetName));
|
|
451
|
-
await import_fs_extra2.default.outputJson(
|
|
452
|
-
import_pathe3.default.resolve(
|
|
453
|
-
to,
|
|
454
|
-
renameJson ? "package.mock.json" : filename
|
|
455
|
-
),
|
|
456
|
-
sourceJson,
|
|
457
|
-
{ spaces: 2 }
|
|
458
|
-
);
|
|
459
|
-
} else {
|
|
460
|
-
await import_fs_extra2.default.copy(
|
|
461
|
-
import_pathe3.default.resolve(from, filename),
|
|
462
|
-
import_pathe3.default.resolve(to, filename === "gitignore" ? ".gitignore" : filename)
|
|
463
|
-
);
|
|
464
|
-
}
|
|
664
|
+
var defaultTemplate = "unbuild";
|
|
665
|
+
var baseChoices = [
|
|
666
|
+
{ name: "unbuild \u6253\u5305", value: "unbuild" },
|
|
667
|
+
{ name: "tsup \u6253\u5305", value: "tsup" },
|
|
668
|
+
{ name: "vue \u7EC4\u4EF6", value: "vue-lib" },
|
|
669
|
+
{ name: "vue hono \u5168\u6808", value: "vue-hono" },
|
|
670
|
+
{ name: "hono \u6A21\u677F", value: "hono-server" },
|
|
671
|
+
{ name: "vitepress \u6587\u6863", value: "vitepress" },
|
|
672
|
+
{ name: "cli \u6A21\u677F", value: "cli" }
|
|
673
|
+
];
|
|
674
|
+
function getCreateChoices(choices) {
|
|
675
|
+
if (choices == null ? void 0 : choices.length) {
|
|
676
|
+
return choices;
|
|
465
677
|
}
|
|
466
|
-
|
|
678
|
+
return [...baseChoices];
|
|
467
679
|
}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
// ../../node_modules/.pnpm/get-value@4.0.1/node_modules/get-value/dist/index.mjs
|
|
473
|
-
init_cjs_shims();
|
|
474
|
-
var __defProp2 = Object.defineProperty;
|
|
475
|
-
var __name = (target, value) => __defProp2(target, "name", { value, configurable: true });
|
|
476
|
-
var isObject = /* @__PURE__ */ __name((v) => v !== null && typeof v === "object", "isObject");
|
|
477
|
-
var join = /* @__PURE__ */ __name((segs, joinChar, options) => {
|
|
478
|
-
if (typeof options.join === "function") {
|
|
479
|
-
return options.join(segs);
|
|
480
|
-
}
|
|
481
|
-
return segs[0] + joinChar + segs[1];
|
|
482
|
-
}, "join");
|
|
483
|
-
var split = /* @__PURE__ */ __name((path12, splitChar, options) => {
|
|
484
|
-
if (typeof options.split === "function") {
|
|
485
|
-
return options.split(path12);
|
|
486
|
-
}
|
|
487
|
-
return path12.split(splitChar);
|
|
488
|
-
}, "split");
|
|
489
|
-
var isValid = /* @__PURE__ */ __name((key, target = {}, options) => {
|
|
490
|
-
if (typeof (options == null ? void 0 : options.isValid) === "function") {
|
|
491
|
-
return options.isValid(key, target);
|
|
680
|
+
function getTemplateMap(extra) {
|
|
681
|
+
const base = { ...templateMap };
|
|
682
|
+
if (extra && Object.keys(extra).length) {
|
|
683
|
+
Object.assign(base, extra);
|
|
492
684
|
}
|
|
493
|
-
return
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
const pathIsArray = Array.isArray(path12);
|
|
509
|
-
const pathIsString = typeof path12 === "string";
|
|
510
|
-
const splitChar = options.separator || ".";
|
|
511
|
-
const joinChar = options.joinChar || (typeof splitChar === "string" ? splitChar : ".");
|
|
512
|
-
if (!pathIsString && !pathIsArray) {
|
|
513
|
-
return target;
|
|
685
|
+
return base;
|
|
686
|
+
}
|
|
687
|
+
async function createNewProject(options) {
|
|
688
|
+
const cwd = (options == null ? void 0 : options.cwd) ?? import_node_process.default.cwd();
|
|
689
|
+
const createConfig = await resolveCommandConfig("create", cwd);
|
|
690
|
+
const renameJson = (options == null ? void 0 : options.renameJson) ?? (createConfig == null ? void 0 : createConfig.renameJson) ?? false;
|
|
691
|
+
const name2 = (options == null ? void 0 : options.name) ?? (createConfig == null ? void 0 : createConfig.name);
|
|
692
|
+
const requestedTemplate = (options == null ? void 0 : options.type) ?? (createConfig == null ? void 0 : createConfig.type) ?? (createConfig == null ? void 0 : createConfig.defaultTemplate) ?? defaultTemplate;
|
|
693
|
+
const templateDefinitions = getTemplateMap(createConfig == null ? void 0 : createConfig.templateMap);
|
|
694
|
+
const templatesRoot = (createConfig == null ? void 0 : createConfig.templatesDir) ? import_pathe4.default.resolve(cwd, createConfig.templatesDir) : templatesDir;
|
|
695
|
+
const fallbackTemplate = (createConfig == null ? void 0 : createConfig.defaultTemplate) ?? defaultTemplate;
|
|
696
|
+
const bundlerName = typeof requestedTemplate === "string" && templateDefinitions[requestedTemplate] ? requestedTemplate : fallbackTemplate;
|
|
697
|
+
const sourceRelative = templateDefinitions[bundlerName];
|
|
698
|
+
if (!sourceRelative) {
|
|
699
|
+
throw new Error(`\u672A\u627E\u5230\u540D\u4E3A ${bundlerName} \u7684\u6A21\u677F\uFF0C\u8BF7\u68C0\u67E5 monorepo.config.ts`);
|
|
514
700
|
}
|
|
515
|
-
|
|
516
|
-
|
|
701
|
+
const from = import_pathe4.default.join(templatesRoot, sourceRelative);
|
|
702
|
+
const targetName = name2 ?? sourceRelative;
|
|
703
|
+
const to = import_pathe4.default.join(cwd, targetName);
|
|
704
|
+
if (await import_fs_extra2.default.pathExists(to)) {
|
|
705
|
+
throw new Error(`${import_picocolors.default.red("\u76EE\u6807\u76EE\u5F55\u5DF2\u5B58\u5728")}: ${import_pathe4.default.relative(cwd, to)}`);
|
|
517
706
|
}
|
|
518
|
-
|
|
519
|
-
const
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
}
|
|
529
|
-
if (target[prop] !== void 0) {
|
|
530
|
-
if (!isValid(prop, target, options)) {
|
|
531
|
-
return options.default;
|
|
532
|
-
}
|
|
533
|
-
target = target[prop];
|
|
534
|
-
} else {
|
|
535
|
-
let hasProp = false;
|
|
536
|
-
let n = idx + 1;
|
|
537
|
-
while (n < len) {
|
|
538
|
-
prop = join([prop, segs[n++]], joinChar, options);
|
|
539
|
-
if (hasProp = target[prop] !== void 0) {
|
|
540
|
-
if (!isValid(prop, target, options)) {
|
|
541
|
-
return options.default;
|
|
542
|
-
}
|
|
543
|
-
target = target[prop];
|
|
544
|
-
idx = n - 1;
|
|
545
|
-
break;
|
|
707
|
+
await import_fs_extra2.default.ensureDir(to);
|
|
708
|
+
const filelist = await import_fs_extra2.default.readdir(from);
|
|
709
|
+
const shouldSkip = (src) => import_pathe4.default.basename(src) === ".DS_Store";
|
|
710
|
+
const copyTasks = filelist.filter((filename) => filename !== "package.json").map(async (filename) => {
|
|
711
|
+
const sourcePath = import_pathe4.default.resolve(from, filename);
|
|
712
|
+
const targetPath = import_pathe4.default.resolve(to, filename === "gitignore" ? ".gitignore" : filename);
|
|
713
|
+
await import_fs_extra2.default.copy(sourcePath, targetPath, {
|
|
714
|
+
filter(src) {
|
|
715
|
+
if (shouldSkip(src)) {
|
|
716
|
+
return false;
|
|
546
717
|
}
|
|
718
|
+
return true;
|
|
547
719
|
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
client;
|
|
565
|
-
#config;
|
|
566
|
-
constructor(options = {}) {
|
|
567
|
-
this.client = (0, import_simple_git.simpleGit)(options);
|
|
568
|
-
}
|
|
569
|
-
listConfig() {
|
|
570
|
-
return this.client.listConfig();
|
|
571
|
-
}
|
|
572
|
-
async init() {
|
|
573
|
-
const listConfig = await this.listConfig();
|
|
574
|
-
this.#config = listConfig.all;
|
|
575
|
-
return this.#config;
|
|
576
|
-
}
|
|
577
|
-
async getConfig() {
|
|
578
|
-
if (this.#config) {
|
|
579
|
-
return this.#config;
|
|
580
|
-
} else {
|
|
581
|
-
return await this.init();
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
async getGitUrl() {
|
|
585
|
-
const config = await this.getConfig();
|
|
586
|
-
const x = index_default(config, "remote.origin.url");
|
|
587
|
-
if (x) {
|
|
588
|
-
return (0, import_git_url_parse.default)(x);
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
async getRepoName() {
|
|
592
|
-
const url = await this.getGitUrl();
|
|
593
|
-
if (url) {
|
|
594
|
-
return `${url.owner}/${url.name}`;
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
async getUser() {
|
|
598
|
-
const config = await this.getConfig();
|
|
599
|
-
const name2 = index_default(config, "user.name");
|
|
600
|
-
const email = index_default(config, "user.email");
|
|
601
|
-
return {
|
|
602
|
-
name: name2,
|
|
603
|
-
email
|
|
604
|
-
};
|
|
720
|
+
});
|
|
721
|
+
});
|
|
722
|
+
await Promise.all(copyTasks);
|
|
723
|
+
if (filelist.includes("package.json")) {
|
|
724
|
+
const sourceJsonPath = import_pathe4.default.resolve(from, "package.json");
|
|
725
|
+
const sourceJson = await import_fs_extra2.default.readJson(sourceJsonPath);
|
|
726
|
+
(0, import_set_value2.default)(sourceJson, "version", "0.0.0");
|
|
727
|
+
(0, import_set_value2.default)(sourceJson, "name", import_pathe4.default.basename(targetName));
|
|
728
|
+
await import_fs_extra2.default.outputJson(
|
|
729
|
+
import_pathe4.default.resolve(
|
|
730
|
+
to,
|
|
731
|
+
renameJson ? "package.mock.json" : "package.json"
|
|
732
|
+
),
|
|
733
|
+
sourceJson,
|
|
734
|
+
{ spaces: 2 }
|
|
735
|
+
);
|
|
605
736
|
}
|
|
606
|
-
};
|
|
737
|
+
logger.success(`${import_picocolors.default.bgGreenBright(import_picocolors.default.white(`[${bundlerName}]`))} ${targetName} \u9879\u76EE\u521B\u5EFA\u6210\u529F\uFF01`);
|
|
738
|
+
}
|
|
607
739
|
|
|
608
|
-
// src/
|
|
740
|
+
// src/commands/init/index.ts
|
|
609
741
|
init_cjs_shims();
|
|
610
742
|
|
|
611
|
-
// src/
|
|
743
|
+
// src/core/context.ts
|
|
612
744
|
init_cjs_shims();
|
|
613
|
-
var
|
|
745
|
+
var import_pathe5 = __toESM(require("pathe"), 1);
|
|
614
746
|
var import_types = require("@pnpm/types");
|
|
615
747
|
async function createContext(cwd) {
|
|
616
|
-
const git = new GitClient();
|
|
617
748
|
const { packages, workspaceDir } = await getWorkspaceData(cwd);
|
|
618
|
-
const
|
|
749
|
+
const git = new GitClient({
|
|
750
|
+
baseDir: workspaceDir
|
|
751
|
+
});
|
|
752
|
+
const workspaceFilepath = import_pathe5.default.resolve(workspaceDir, "pnpm-workspace.yaml");
|
|
619
753
|
const gitUrl = await git.getGitUrl();
|
|
620
754
|
const gitUser = await git.getUser();
|
|
755
|
+
const config = await loadMonorepoConfig(workspaceDir);
|
|
621
756
|
return {
|
|
622
757
|
cwd,
|
|
623
758
|
git,
|
|
@@ -625,19 +760,20 @@ async function createContext(cwd) {
|
|
|
625
760
|
gitUser,
|
|
626
761
|
workspaceDir,
|
|
627
762
|
workspaceFilepath,
|
|
628
|
-
packages
|
|
763
|
+
packages,
|
|
764
|
+
config
|
|
629
765
|
};
|
|
630
766
|
}
|
|
631
767
|
|
|
632
|
-
// src/
|
|
768
|
+
// src/commands/init/setChangeset.ts
|
|
633
769
|
init_cjs_shims();
|
|
634
770
|
var import_fs_extra3 = __toESM(require("fs-extra"), 1);
|
|
635
|
-
var
|
|
771
|
+
var import_pathe6 = __toESM(require("pathe"), 1);
|
|
636
772
|
var import_set_value3 = __toESM(require_set_value(), 1);
|
|
637
773
|
async function setChangeset_default(ctx) {
|
|
638
774
|
const { gitUrl, workspaceFilepath } = ctx;
|
|
639
775
|
if (gitUrl && await import_fs_extra3.default.exists(workspaceFilepath)) {
|
|
640
|
-
const changesetConfigPath =
|
|
776
|
+
const changesetConfigPath = import_pathe6.default.resolve(import_pathe6.default.dirname(workspaceFilepath), ".changeset/config.json");
|
|
641
777
|
if (await import_fs_extra3.default.exists(changesetConfigPath)) {
|
|
642
778
|
const changesetConfig = await import_fs_extra3.default.readJson(
|
|
643
779
|
changesetConfigPath
|
|
@@ -650,18 +786,22 @@ async function setChangeset_default(ctx) {
|
|
|
650
786
|
}
|
|
651
787
|
}
|
|
652
788
|
|
|
653
|
-
// src/
|
|
789
|
+
// src/commands/init/setPkgJson.ts
|
|
654
790
|
init_cjs_shims();
|
|
655
791
|
var import_fs_extra4 = __toESM(require("fs-extra"), 1);
|
|
656
|
-
var
|
|
792
|
+
var import_pathe7 = __toESM(require("pathe"), 1);
|
|
657
793
|
var import_set_value4 = __toESM(require_set_value(), 1);
|
|
658
794
|
async function setPkgJson_default(ctx) {
|
|
659
795
|
const { gitUrl, gitUser, packages, cwd, workspaceFilepath } = ctx;
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
796
|
+
const workspaceExists = await import_fs_extra4.default.pathExists(workspaceFilepath);
|
|
797
|
+
if (gitUrl && workspaceExists) {
|
|
798
|
+
await Promise.all(packages.map(async (pkg) => {
|
|
799
|
+
if (!await import_fs_extra4.default.pathExists(pkg.pkgJsonPath)) {
|
|
800
|
+
return;
|
|
801
|
+
}
|
|
802
|
+
const pkgJson = JSON.parse(JSON.stringify(pkg.manifest));
|
|
803
|
+
const directory = import_pathe7.default.relative(cwd, pkg.rootDir);
|
|
804
|
+
(0, import_set_value4.default)(pkgJson, ["bugs", "url"], `https://github.com/${gitUrl.full_name}/issues`);
|
|
665
805
|
const repository = {
|
|
666
806
|
type: "git",
|
|
667
807
|
url: `git+https://github.com/${gitUrl.full_name}.git`
|
|
@@ -670,32 +810,38 @@ async function setPkgJson_default(ctx) {
|
|
|
670
810
|
repository.directory = directory;
|
|
671
811
|
}
|
|
672
812
|
(0, import_set_value4.default)(pkgJson, "repository", repository);
|
|
673
|
-
if (gitUser) {
|
|
813
|
+
if ((gitUser == null ? void 0 : gitUser.name) && (gitUser == null ? void 0 : gitUser.email)) {
|
|
674
814
|
(0, import_set_value4.default)(pkgJson, "author", `${gitUser.name} <${gitUser.email}>`);
|
|
675
815
|
}
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
816
|
+
const nextContent = `${JSON.stringify(pkgJson, void 0, 2)}
|
|
817
|
+
`;
|
|
818
|
+
const prevContent = await import_fs_extra4.default.readFile(pkg.pkgJsonPath, "utf8");
|
|
819
|
+
if (prevContent !== nextContent) {
|
|
820
|
+
await import_fs_extra4.default.writeFile(pkg.pkgJsonPath, nextContent, "utf8");
|
|
821
|
+
}
|
|
822
|
+
}));
|
|
680
823
|
}
|
|
681
824
|
}
|
|
682
825
|
|
|
683
|
-
// src/
|
|
826
|
+
// src/commands/init/setReadme.ts
|
|
684
827
|
init_cjs_shims();
|
|
685
828
|
var import_fs_extra5 = __toESM(require("fs-extra"), 1);
|
|
686
|
-
var
|
|
829
|
+
var import_pathe8 = __toESM(require("pathe"), 1);
|
|
687
830
|
async function getRows(ctx) {
|
|
688
|
-
const { packages,
|
|
689
|
-
const gitUrl = await git.getGitUrl();
|
|
690
|
-
const gitUser = await git.getUser();
|
|
831
|
+
const { packages, gitUrl, gitUser, cwd } = ctx;
|
|
691
832
|
const rows = [];
|
|
692
833
|
if (gitUrl) {
|
|
693
834
|
rows.push(`# ${gitUrl.name}
|
|
694
835
|
`);
|
|
695
836
|
}
|
|
696
837
|
rows.push("## Packages\n");
|
|
697
|
-
|
|
698
|
-
const
|
|
838
|
+
const sortedPackages = [...packages].sort((a, b) => {
|
|
839
|
+
const left = a.manifest.name ?? "";
|
|
840
|
+
const right = b.manifest.name ?? "";
|
|
841
|
+
return left.localeCompare(right);
|
|
842
|
+
});
|
|
843
|
+
for (const pkg of sortedPackages) {
|
|
844
|
+
const p = import_pathe8.default.relative(cwd, pkg.rootDirRealPath);
|
|
699
845
|
if (p) {
|
|
700
846
|
const description = pkg.manifest.description ? `- ${pkg.manifest.description}` : "";
|
|
701
847
|
rows.push(`- [${pkg.manifest.name}](${p}) ${description}`);
|
|
@@ -716,36 +862,42 @@ async function getRows(ctx) {
|
|
|
716
862
|
rows.push(`Thanks to [all contributors](https://github.com/${gitUrl.full_name}/graphs/contributors)!`);
|
|
717
863
|
}
|
|
718
864
|
rows.push("\n## Authors\n");
|
|
719
|
-
|
|
865
|
+
if ((gitUser == null ? void 0 : gitUser.name) && (gitUser == null ? void 0 : gitUser.email)) {
|
|
866
|
+
rows.push(`${gitUser.name} <${gitUser.email}>`);
|
|
867
|
+
}
|
|
720
868
|
rows.push("\n## License\n");
|
|
721
869
|
rows.push("Distributed under the MIT License. See [LICENSE](LICENSE) for more information.");
|
|
722
870
|
return rows;
|
|
723
871
|
}
|
|
724
872
|
async function setReadme_default(ctx) {
|
|
725
873
|
const rows = await getRows(ctx);
|
|
726
|
-
await import_fs_extra5.default.writeFile(
|
|
874
|
+
await import_fs_extra5.default.writeFile(import_pathe8.default.resolve(ctx.cwd, "README.md"), `${rows.join("\n")}
|
|
727
875
|
`);
|
|
728
876
|
}
|
|
729
877
|
|
|
730
|
-
// src/
|
|
878
|
+
// src/commands/init/index.ts
|
|
731
879
|
async function init(cwd) {
|
|
880
|
+
var _a;
|
|
732
881
|
const ctx = await createContext(cwd);
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
882
|
+
const initConfig = ((_a = ctx.config.commands) == null ? void 0 : _a.init) ?? {};
|
|
883
|
+
if (!initConfig.skipChangeset) {
|
|
884
|
+
await setChangeset_default(ctx);
|
|
885
|
+
}
|
|
886
|
+
if (!initConfig.skipPkgJson) {
|
|
887
|
+
await setPkgJson_default(ctx);
|
|
888
|
+
}
|
|
889
|
+
if (!initConfig.skipReadme) {
|
|
890
|
+
await setReadme_default(ctx);
|
|
891
|
+
}
|
|
736
892
|
}
|
|
737
893
|
|
|
738
|
-
// src/
|
|
894
|
+
// src/commands/mirror/binaryMirror.ts
|
|
739
895
|
init_cjs_shims();
|
|
740
896
|
var import_comment_json = require("comment-json");
|
|
741
897
|
var import_fs_extra6 = __toESM(require("fs-extra"), 1);
|
|
742
|
-
var
|
|
743
|
-
|
|
744
|
-
// src/monorepo/mirror/utils.ts
|
|
745
|
-
init_cjs_shims();
|
|
746
|
-
var import_set_value5 = __toESM(require_set_value(), 1);
|
|
898
|
+
var import_pathe9 = __toESM(require("pathe"), 1);
|
|
747
899
|
|
|
748
|
-
// src/
|
|
900
|
+
// src/commands/mirror/sources.ts
|
|
749
901
|
init_cjs_shims();
|
|
750
902
|
var chinaMirrorsEnvs = {
|
|
751
903
|
COREPACK_NPM_REGISTRY: "https://registry.npmmirror.com",
|
|
@@ -776,69 +928,132 @@ var chinaMirrorsEnvs = {
|
|
|
776
928
|
npm_config_robotjs_binary_host: "https://cdn.npmmirror.com/binaries/robotjs"
|
|
777
929
|
};
|
|
778
930
|
|
|
779
|
-
// src/
|
|
780
|
-
|
|
931
|
+
// src/commands/mirror/utils.ts
|
|
932
|
+
init_cjs_shims();
|
|
933
|
+
var import_set_value5 = __toESM(require_set_value(), 1);
|
|
934
|
+
function setMirror(obj, envs = chinaMirrorsEnvs) {
|
|
781
935
|
const platforms = ["linux", "windows", "osx"];
|
|
782
936
|
const prefix = "terminal.integrated.env";
|
|
783
937
|
if (typeof obj === "object" && obj) {
|
|
784
938
|
for (const platform of platforms) {
|
|
785
|
-
(0, import_set_value5.default)(obj, [prefix, platform].join(".").replaceAll(".", "\\."),
|
|
939
|
+
(0, import_set_value5.default)(obj, [prefix, platform].join(".").replaceAll(".", "\\."), envs);
|
|
786
940
|
}
|
|
787
941
|
}
|
|
788
942
|
}
|
|
789
943
|
|
|
790
|
-
// src/
|
|
944
|
+
// src/commands/mirror/binaryMirror.ts
|
|
791
945
|
async function setVscodeBinaryMirror(cwd) {
|
|
792
|
-
const
|
|
946
|
+
const mirrorConfig = await resolveCommandConfig("mirror", cwd);
|
|
947
|
+
const targetJsonPath = import_pathe9.default.resolve(cwd, ".vscode/settings.json");
|
|
793
948
|
await import_fs_extra6.default.ensureFile(targetJsonPath);
|
|
794
949
|
const json = (0, import_comment_json.parse)(await import_fs_extra6.default.readFile(targetJsonPath, "utf8"), void 0, false);
|
|
795
|
-
|
|
950
|
+
const env = (mirrorConfig == null ? void 0 : mirrorConfig.env) ? { ...chinaMirrorsEnvs, ...mirrorConfig.env } : chinaMirrorsEnvs;
|
|
951
|
+
json && typeof json === "object" && setMirror(json, env);
|
|
796
952
|
await import_fs_extra6.default.writeFile(targetJsonPath, `${(0, import_comment_json.stringify)(json, void 0, 2)}
|
|
797
953
|
`, "utf8");
|
|
798
954
|
}
|
|
799
955
|
|
|
800
|
-
// src/
|
|
956
|
+
// src/commands/sync.ts
|
|
801
957
|
init_cjs_shims();
|
|
802
958
|
var import_node_os = __toESM(require("os"), 1);
|
|
803
959
|
var import_execa = require("execa");
|
|
804
960
|
var import_p_queue = __toESM(require("p-queue"), 1);
|
|
805
|
-
var
|
|
961
|
+
var import_pathe10 = __toESM(require("pathe"), 1);
|
|
806
962
|
var import_picocolors2 = __toESM(require("picocolors"), 1);
|
|
963
|
+
function renderCommand(template, pkgName) {
|
|
964
|
+
return template.replaceAll("{name}", pkgName);
|
|
965
|
+
}
|
|
807
966
|
async function syncNpmMirror(cwd, options) {
|
|
808
|
-
const
|
|
967
|
+
const syncConfig = await resolveCommandConfig("sync", cwd);
|
|
968
|
+
const {
|
|
969
|
+
concurrency: configConcurrency,
|
|
970
|
+
command: configCommand,
|
|
971
|
+
packages: packageFilter,
|
|
972
|
+
...workspaceOverrides
|
|
973
|
+
} = syncConfig ?? {};
|
|
974
|
+
const workspaceOptions = {
|
|
975
|
+
...workspaceOverrides,
|
|
976
|
+
...options ?? {}
|
|
977
|
+
};
|
|
978
|
+
const { packages, workspaceDir } = await getWorkspaceData(cwd, workspaceOptions);
|
|
809
979
|
logger.info(`[\u5F53\u524D\u5DE5\u4F5C\u533ARepo]:
|
|
810
|
-
${packages.map((x) => `- ${import_picocolors2.default.green(x.manifest.name)} : ${
|
|
980
|
+
${packages.map((x) => `- ${import_picocolors2.default.green(x.manifest.name)} : ${import_pathe10.default.relative(workspaceDir, x.rootDir)}`).join("\n")}
|
|
811
981
|
`);
|
|
812
982
|
const set7 = new Set(packages.map((x) => x.manifest.name));
|
|
983
|
+
if (packageFilter == null ? void 0 : packageFilter.length) {
|
|
984
|
+
for (const name2 of Array.from(set7)) {
|
|
985
|
+
if (!name2 || !packageFilter.includes(name2)) {
|
|
986
|
+
set7.delete(name2);
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
}
|
|
813
990
|
logger.info(`[\u5373\u5C06\u540C\u6B65\u7684\u5305]:
|
|
814
|
-
${Array.from(set7).map((x) => `- ${import_picocolors2.default.green(x)}`).join("\n")}
|
|
991
|
+
${Array.from(set7).map((x) => `- ${import_picocolors2.default.green(x ?? "")}`).join("\n")}
|
|
815
992
|
`);
|
|
816
|
-
const concurrency = Math.max(import_node_os.default.cpus().length, 1);
|
|
817
|
-
const
|
|
993
|
+
const concurrency = configConcurrency ?? Math.max(import_node_os.default.cpus().length, 1);
|
|
994
|
+
const queue = new import_p_queue.default({ concurrency });
|
|
995
|
+
const template = configCommand ?? "cnpm sync {name}";
|
|
996
|
+
const tasks = [];
|
|
818
997
|
for (const pkgName of set7) {
|
|
819
|
-
if (pkgName) {
|
|
820
|
-
|
|
821
|
-
return (0, import_execa.execa)({
|
|
822
|
-
stdout: ["pipe", "inherit"]
|
|
823
|
-
})`cnpm sync ${pkgName}`;
|
|
824
|
-
});
|
|
998
|
+
if (!pkgName) {
|
|
999
|
+
continue;
|
|
825
1000
|
}
|
|
1001
|
+
tasks.push(queue.add(async () => {
|
|
1002
|
+
const command = renderCommand(template, pkgName);
|
|
1003
|
+
return (0, import_execa.execaCommand)(command, {
|
|
1004
|
+
stdio: "inherit"
|
|
1005
|
+
});
|
|
1006
|
+
}));
|
|
826
1007
|
}
|
|
1008
|
+
await Promise.all(tasks);
|
|
827
1009
|
}
|
|
828
1010
|
|
|
829
|
-
// src/
|
|
1011
|
+
// src/commands/upgrade/index.ts
|
|
830
1012
|
init_cjs_shims();
|
|
1013
|
+
var import_node_buffer = require("buffer");
|
|
831
1014
|
var import_node_process2 = __toESM(require("process"), 1);
|
|
832
1015
|
var import_checkbox2 = __toESM(require("@inquirer/checkbox"), 1);
|
|
833
1016
|
var import_confirm = __toESM(require("@inquirer/confirm"), 1);
|
|
834
1017
|
var import_fs_extra7 = __toESM(require("fs-extra"), 1);
|
|
835
1018
|
var import_klaw = __toESM(require("klaw"), 1);
|
|
836
|
-
var
|
|
837
|
-
var import_pathe10 = __toESM(require("pathe"), 1);
|
|
1019
|
+
var import_pathe11 = __toESM(require("pathe"), 1);
|
|
838
1020
|
var import_picocolors3 = __toESM(require("picocolors"), 1);
|
|
839
1021
|
var import_set_value6 = __toESM(require_set_value(), 1);
|
|
840
1022
|
|
|
841
|
-
// src/
|
|
1023
|
+
// src/utils/hash.ts
|
|
1024
|
+
init_cjs_shims();
|
|
1025
|
+
var import_node_crypto = __toESM(require("crypto"), 1);
|
|
1026
|
+
function getFileHash(data) {
|
|
1027
|
+
const hashSum = import_node_crypto.default.createHash("md5");
|
|
1028
|
+
hashSum.update(data);
|
|
1029
|
+
return hashSum.digest("hex");
|
|
1030
|
+
}
|
|
1031
|
+
function isFileChanged(src, dest) {
|
|
1032
|
+
try {
|
|
1033
|
+
const currentHash = getFileHash(src);
|
|
1034
|
+
const previousHash = getFileHash(dest);
|
|
1035
|
+
return currentHash !== previousHash;
|
|
1036
|
+
} catch (err) {
|
|
1037
|
+
logger.error("Error calculating file hash:", err);
|
|
1038
|
+
return false;
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
// src/utils/regexp.ts
|
|
1043
|
+
init_cjs_shims();
|
|
1044
|
+
function escapeStringRegexp(str) {
|
|
1045
|
+
return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
1046
|
+
}
|
|
1047
|
+
function isMatch(str, arr) {
|
|
1048
|
+
for (const reg of arr) {
|
|
1049
|
+
if (reg.test(str)) {
|
|
1050
|
+
return true;
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
return false;
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
// src/commands/upgrade/scripts.ts
|
|
842
1057
|
init_cjs_shims();
|
|
843
1058
|
var scripts = {
|
|
844
1059
|
"script:init": "monorepo init",
|
|
@@ -849,7 +1064,7 @@ var scripts = {
|
|
|
849
1064
|
};
|
|
850
1065
|
var scriptsEntries = Object.entries(scripts);
|
|
851
1066
|
|
|
852
|
-
// src/targets.ts
|
|
1067
|
+
// src/commands/upgrade/targets.ts
|
|
853
1068
|
init_cjs_shims();
|
|
854
1069
|
function getAssetTargets(raw) {
|
|
855
1070
|
const list = [
|
|
@@ -864,6 +1079,7 @@ function getAssetTargets(raw) {
|
|
|
864
1079
|
"eslint.config.js",
|
|
865
1080
|
"lint-staged.config.js",
|
|
866
1081
|
"stylelint.config.js",
|
|
1082
|
+
"monorepo.config.ts",
|
|
867
1083
|
"package.json",
|
|
868
1084
|
// pnpm
|
|
869
1085
|
"pnpm-workspace.yaml",
|
|
@@ -885,85 +1101,101 @@ function getAssetTargets(raw) {
|
|
|
885
1101
|
return list;
|
|
886
1102
|
}
|
|
887
1103
|
|
|
888
|
-
// src/
|
|
889
|
-
init_cjs_shims();
|
|
890
|
-
var import_node_crypto = __toESM(require("crypto"), 1);
|
|
891
|
-
function getFileHash(data) {
|
|
892
|
-
const hashSum = import_node_crypto.default.createHash("md5");
|
|
893
|
-
hashSum.update(data);
|
|
894
|
-
return hashSum.digest("hex");
|
|
895
|
-
}
|
|
896
|
-
function isFileChanged(src, dest) {
|
|
897
|
-
try {
|
|
898
|
-
const currentHash = getFileHash(src);
|
|
899
|
-
const previousHash = getFileHash(dest);
|
|
900
|
-
return currentHash !== previousHash;
|
|
901
|
-
} catch (err) {
|
|
902
|
-
logger.error("Error calculating file hash:", err);
|
|
903
|
-
return false;
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
// src/utils/regexp.ts
|
|
908
|
-
init_cjs_shims();
|
|
909
|
-
function escapeStringRegexp(str) {
|
|
910
|
-
return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
911
|
-
}
|
|
912
|
-
function isMatch(str, arr) {
|
|
913
|
-
for (const reg of arr) {
|
|
914
|
-
if (reg.test(str)) {
|
|
915
|
-
return true;
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
return false;
|
|
919
|
-
}
|
|
920
|
-
|
|
921
|
-
// src/monorepo/upgrade.ts
|
|
922
|
-
var queue = new import_p_queue2.default({ concurrency: 1 });
|
|
1104
|
+
// src/commands/upgrade/index.ts
|
|
923
1105
|
function isWorkspace(version2) {
|
|
924
1106
|
if (typeof version2 === "string") {
|
|
925
1107
|
return version2.startsWith("workspace:");
|
|
926
1108
|
}
|
|
927
1109
|
return false;
|
|
928
1110
|
}
|
|
929
|
-
function setPkgJson(sourcePkgJson, targetPkgJson) {
|
|
1111
|
+
function setPkgJson(sourcePkgJson, targetPkgJson, options) {
|
|
930
1112
|
const packageManager = index_default(sourcePkgJson, "packageManager", { default: "" });
|
|
931
|
-
const
|
|
932
|
-
const
|
|
933
|
-
const targetDeps = index_default(targetPkgJson, "dependencies", { default: {} });
|
|
934
|
-
const targetDevDeps = index_default(targetPkgJson, "devDependencies", { default: {} });
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
1113
|
+
const sourceDeps = index_default(sourcePkgJson, "dependencies", { default: {} });
|
|
1114
|
+
const sourceDevDeps = index_default(sourcePkgJson, "devDependencies", { default: {} });
|
|
1115
|
+
const targetDeps = { ...index_default(targetPkgJson, "dependencies", { default: {} }) };
|
|
1116
|
+
const targetDevDeps = { ...index_default(targetPkgJson, "devDependencies", { default: {} }) };
|
|
1117
|
+
if (packageManager) {
|
|
1118
|
+
targetPkgJson.packageManager = packageManager;
|
|
1119
|
+
}
|
|
1120
|
+
for (const [depName, depVersion] of Object.entries(sourceDeps)) {
|
|
1121
|
+
if (!isWorkspace(targetDeps[depName])) {
|
|
1122
|
+
targetDeps[depName] = depVersion;
|
|
939
1123
|
}
|
|
940
|
-
}
|
|
941
|
-
Object.
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
1124
|
+
}
|
|
1125
|
+
if (Object.keys(targetDeps).length) {
|
|
1126
|
+
targetPkgJson.dependencies = targetDeps;
|
|
1127
|
+
}
|
|
1128
|
+
for (const [depName, depVersion] of Object.entries(sourceDevDeps)) {
|
|
1129
|
+
if (depName === name) {
|
|
1130
|
+
targetDevDeps[depName] = `^${version}`;
|
|
1131
|
+
} else if (!isWorkspace(targetDevDeps[depName])) {
|
|
1132
|
+
targetDevDeps[depName] = depVersion;
|
|
946
1133
|
}
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
|
|
1134
|
+
}
|
|
1135
|
+
if (Object.keys(targetDevDeps).length) {
|
|
1136
|
+
targetPkgJson.devDependencies = targetDevDeps;
|
|
1137
|
+
}
|
|
1138
|
+
const scriptPairs = (options == null ? void 0 : options.scripts) ? Object.entries(options.scripts) : scriptsEntries;
|
|
1139
|
+
if (scriptPairs.length) {
|
|
1140
|
+
const scripts2 = { ...targetPkgJson.scripts ?? {} };
|
|
1141
|
+
for (const [scriptName, scriptCmd] of scriptPairs) {
|
|
1142
|
+
scripts2[scriptName] = scriptCmd;
|
|
1143
|
+
}
|
|
1144
|
+
targetPkgJson.scripts = scripts2;
|
|
950
1145
|
}
|
|
951
1146
|
}
|
|
952
1147
|
function confirmOverwrite(filename) {
|
|
953
1148
|
return (0, import_confirm.default)({ message: `${import_picocolors3.default.greenBright(filename)} \u6587\u4EF6\u5185\u5BB9\u53D1\u751F\u6539\u53D8,\u662F\u5426\u8986\u76D6?`, default: true });
|
|
954
1149
|
}
|
|
1150
|
+
function asBuffer(data) {
|
|
1151
|
+
return typeof data === "string" ? import_node_buffer.Buffer.from(data) : data;
|
|
1152
|
+
}
|
|
1153
|
+
async function shouldWriteFile(targetPath, options) {
|
|
1154
|
+
const { skipOverwrite, source, promptLabel } = options;
|
|
1155
|
+
const exists = await import_fs_extra7.default.pathExists(targetPath);
|
|
1156
|
+
if (!exists) {
|
|
1157
|
+
return true;
|
|
1158
|
+
}
|
|
1159
|
+
if (skipOverwrite) {
|
|
1160
|
+
return false;
|
|
1161
|
+
}
|
|
1162
|
+
const src = asBuffer(source);
|
|
1163
|
+
let destSize = 0;
|
|
1164
|
+
try {
|
|
1165
|
+
const stat = await import_fs_extra7.default.stat(targetPath);
|
|
1166
|
+
destSize = stat.size;
|
|
1167
|
+
} catch {
|
|
1168
|
+
return true;
|
|
1169
|
+
}
|
|
1170
|
+
if (destSize !== src.length) {
|
|
1171
|
+
return confirmOverwrite(promptLabel);
|
|
1172
|
+
}
|
|
1173
|
+
const dest = await import_fs_extra7.default.readFile(targetPath);
|
|
1174
|
+
if (!isFileChanged(src, dest)) {
|
|
1175
|
+
return false;
|
|
1176
|
+
}
|
|
1177
|
+
return confirmOverwrite(promptLabel);
|
|
1178
|
+
}
|
|
955
1179
|
async function upgradeMonorepo(opts) {
|
|
956
|
-
const
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
1180
|
+
const cwd = opts.cwd ?? import_node_process2.default.cwd();
|
|
1181
|
+
const upgradeConfig = await resolveCommandConfig("upgrade", cwd);
|
|
1182
|
+
const merged = {
|
|
1183
|
+
cwd,
|
|
1184
|
+
outDir: "",
|
|
1185
|
+
...upgradeConfig ?? {},
|
|
1186
|
+
...opts
|
|
1187
|
+
};
|
|
1188
|
+
const outDir = merged.outDir ?? "";
|
|
1189
|
+
const absOutDir = import_pathe11.default.isAbsolute(outDir) ? outDir : import_pathe11.default.join(cwd, outDir);
|
|
961
1190
|
const gitClient = new GitClient({
|
|
962
1191
|
baseDir: cwd
|
|
963
1192
|
});
|
|
964
1193
|
const repoName = await gitClient.getRepoName();
|
|
965
|
-
|
|
966
|
-
|
|
1194
|
+
const baseTargets = getAssetTargets(merged.raw);
|
|
1195
|
+
const configTargets = (upgradeConfig == null ? void 0 : upgradeConfig.targets) ?? [];
|
|
1196
|
+
const mergeTargets = upgradeConfig == null ? void 0 : upgradeConfig.mergeTargets;
|
|
1197
|
+
let targets = configTargets.length ? mergeTargets === false ? [...configTargets] : Array.from(/* @__PURE__ */ new Set([...baseTargets, ...configTargets])) : baseTargets;
|
|
1198
|
+
if (merged.interactive) {
|
|
967
1199
|
targets = await (0, import_checkbox2.default)({
|
|
968
1200
|
message: "\u9009\u62E9\u4F60\u9700\u8981\u7684\u6587\u4EF6",
|
|
969
1201
|
choices: targets.map((x) => {
|
|
@@ -977,79 +1209,87 @@ async function upgradeMonorepo(opts) {
|
|
|
977
1209
|
const regexpArr = targets.map((x) => {
|
|
978
1210
|
return new RegExp(`^${escapeStringRegexp(x)}`);
|
|
979
1211
|
});
|
|
1212
|
+
const skipChangesetMarkdown = (upgradeConfig == null ? void 0 : upgradeConfig.skipChangesetMarkdown) ?? true;
|
|
1213
|
+
const scriptOverrides = upgradeConfig == null ? void 0 : upgradeConfig.scripts;
|
|
1214
|
+
const skipOverwrite = merged.skipOverwrite;
|
|
980
1215
|
for await (const file of (0, import_klaw.default)(assetsDir, {
|
|
981
1216
|
filter(p) {
|
|
982
|
-
const str =
|
|
1217
|
+
const str = import_pathe11.default.relative(assetsDir, p);
|
|
983
1218
|
return isMatch(str, regexpArr);
|
|
984
1219
|
}
|
|
985
1220
|
})) {
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
isOverwrite = await confirmOverwrite(relPath);
|
|
1001
|
-
}
|
|
1002
|
-
} else if (skipOverwrite) {
|
|
1003
|
-
isOverwrite = false;
|
|
1004
|
-
}
|
|
1005
|
-
return isOverwrite;
|
|
1006
|
-
}
|
|
1007
|
-
if (relPath === "package.json") {
|
|
1008
|
-
const sourcePath = file.path;
|
|
1009
|
-
if (targetIsExisted) {
|
|
1010
|
-
const sourcePkgJson = await import_fs_extra7.default.readJson(sourcePath);
|
|
1011
|
-
const targetPkgJson = await import_fs_extra7.default.readJson(targetPath);
|
|
1012
|
-
setPkgJson(sourcePkgJson, targetPkgJson);
|
|
1013
|
-
const data = JSON.stringify(targetPkgJson, void 0, 2);
|
|
1014
|
-
await import_fs_extra7.default.outputFile(targetPath, `${data}
|
|
1015
|
-
`, "utf8");
|
|
1016
|
-
logger.success(targetPath);
|
|
1017
|
-
}
|
|
1018
|
-
} else if (relPath === ".changeset/config.json" && repoName) {
|
|
1019
|
-
const changesetJson = await import_fs_extra7.default.readJson(file.path);
|
|
1020
|
-
(0, import_set_value6.default)(changesetJson, "changelog.1.repo", repoName);
|
|
1021
|
-
const data = JSON.stringify(changesetJson, void 0, 2);
|
|
1022
|
-
if (await overwriteOrCopy(data)) {
|
|
1023
|
-
await import_fs_extra7.default.outputFile(targetPath, `${data}
|
|
1024
|
-
`, "utf8");
|
|
1025
|
-
logger.success(targetPath);
|
|
1026
|
-
}
|
|
1027
|
-
} else if (await overwriteOrCopy()) {
|
|
1028
|
-
await import_fs_extra7.default.copy(
|
|
1029
|
-
file.path,
|
|
1030
|
-
targetPath
|
|
1031
|
-
);
|
|
1032
|
-
logger.success(targetPath);
|
|
1033
|
-
}
|
|
1221
|
+
if (!file.stats.isFile()) {
|
|
1222
|
+
continue;
|
|
1223
|
+
}
|
|
1224
|
+
let relPath = import_pathe11.default.relative(assetsDir, file.path);
|
|
1225
|
+
if (relPath === "gitignore") {
|
|
1226
|
+
relPath = ".gitignore";
|
|
1227
|
+
}
|
|
1228
|
+
if (skipChangesetMarkdown && relPath.startsWith(".changeset/") && relPath.endsWith(".md")) {
|
|
1229
|
+
continue;
|
|
1230
|
+
}
|
|
1231
|
+
const targetPath = import_pathe11.default.resolve(absOutDir, relPath);
|
|
1232
|
+
if (relPath === "package.json") {
|
|
1233
|
+
if (!await import_fs_extra7.default.pathExists(targetPath)) {
|
|
1234
|
+
continue;
|
|
1034
1235
|
}
|
|
1035
|
-
|
|
1236
|
+
const sourcePkgJson = await import_fs_extra7.default.readJson(file.path);
|
|
1237
|
+
const targetPkgJson = await import_fs_extra7.default.readJson(targetPath);
|
|
1238
|
+
setPkgJson(sourcePkgJson, targetPkgJson, { scripts: scriptOverrides });
|
|
1239
|
+
const data = `${JSON.stringify(targetPkgJson, void 0, 2)}
|
|
1240
|
+
`;
|
|
1241
|
+
if (await shouldWriteFile(targetPath, { skipOverwrite, source: data, promptLabel: relPath })) {
|
|
1242
|
+
await import_fs_extra7.default.outputFile(targetPath, data, "utf8");
|
|
1243
|
+
logger.success(targetPath);
|
|
1244
|
+
}
|
|
1245
|
+
continue;
|
|
1246
|
+
}
|
|
1247
|
+
if (relPath === ".changeset/config.json" && repoName) {
|
|
1248
|
+
const changesetJson = await import_fs_extra7.default.readJson(file.path);
|
|
1249
|
+
(0, import_set_value6.default)(changesetJson, "changelog.1.repo", repoName);
|
|
1250
|
+
const data = `${JSON.stringify(changesetJson, void 0, 2)}
|
|
1251
|
+
`;
|
|
1252
|
+
if (await shouldWriteFile(targetPath, { skipOverwrite, source: data, promptLabel: relPath })) {
|
|
1253
|
+
await import_fs_extra7.default.outputFile(targetPath, data, "utf8");
|
|
1254
|
+
logger.success(targetPath);
|
|
1255
|
+
}
|
|
1256
|
+
continue;
|
|
1257
|
+
}
|
|
1258
|
+
if (await shouldWriteFile(targetPath, { skipOverwrite, source: await import_fs_extra7.default.readFile(file.path), promptLabel: relPath })) {
|
|
1259
|
+
await import_fs_extra7.default.copy(file.path, targetPath);
|
|
1260
|
+
logger.success(targetPath);
|
|
1261
|
+
}
|
|
1036
1262
|
}
|
|
1037
1263
|
}
|
|
1038
1264
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1039
1265
|
0 && (module.exports = {
|
|
1040
1266
|
GitClient,
|
|
1267
|
+
assetsDir,
|
|
1041
1268
|
cleanProjects,
|
|
1269
|
+
createContext,
|
|
1042
1270
|
createNewProject,
|
|
1271
|
+
defineMonorepoConfig,
|
|
1043
1272
|
escapeStringRegexp,
|
|
1273
|
+
getCreateChoices,
|
|
1044
1274
|
getFileHash,
|
|
1275
|
+
getTemplateMap,
|
|
1045
1276
|
getWorkspaceData,
|
|
1046
1277
|
getWorkspacePackages,
|
|
1047
1278
|
init,
|
|
1048
1279
|
isFileChanged,
|
|
1049
1280
|
isMatch,
|
|
1281
|
+
loadMonorepoConfig,
|
|
1282
|
+
logger,
|
|
1283
|
+
name,
|
|
1284
|
+
packageDir,
|
|
1285
|
+
resolveCommandConfig,
|
|
1286
|
+
rootDir,
|
|
1050
1287
|
setVscodeBinaryMirror,
|
|
1051
1288
|
syncNpmMirror,
|
|
1052
|
-
|
|
1289
|
+
templateMap,
|
|
1290
|
+
templatesDir,
|
|
1291
|
+
upgradeMonorepo,
|
|
1292
|
+
version
|
|
1053
1293
|
});
|
|
1054
1294
|
/*! Bundled license information:
|
|
1055
1295
|
|