@icebreakers/monorepo 1.0.16 → 1.1.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.
@@ -215,95 +215,152 @@ var require_set_value = __commonJS({
215
215
  }
216
216
  });
217
217
 
218
- // src/monorepo/binaryMirror.ts
218
+ // src/monorepo/workspace/index.ts
219
219
  init_esm_shims();
220
- import { parse, stringify } from "comment-json";
221
- import fs from "fs-extra";
222
- import path2 from "pathe";
223
-
224
- // src/monorepo/mirror/sources.ts
225
- init_esm_shims();
226
- var chinaMirrorsEnvs = {
227
- COREPACK_NPM_REGISTRY: "https://registry.npmmirror.com",
228
- EDGEDRIVER_CDNURL: "https://npmmirror.com/mirrors/edgedriver",
229
- NODEJS_ORG_MIRROR: "https://cdn.npmmirror.com/binaries/node",
230
- NVM_NODEJS_ORG_MIRROR: "https://cdn.npmmirror.com/binaries/node",
231
- PHANTOMJS_CDNURL: "https://cdn.npmmirror.com/binaries/phantomjs",
232
- CHROMEDRIVER_CDNURL: "https://cdn.npmmirror.com/binaries/chromedriver",
233
- OPERADRIVER_CDNURL: "https://cdn.npmmirror.com/binaries/operadriver",
234
- CYPRESS_DOWNLOAD_PATH_TEMPLATE: "https://cdn.npmmirror.com/binaries/cypress/${version}/${platform}-${arch}/cypress.zip",
235
- ELECTRON_MIRROR: "https://cdn.npmmirror.com/binaries/electron/",
236
- ELECTRON_BUILDER_BINARIES_MIRROR: "https://cdn.npmmirror.com/binaries/electron-builder-binaries/",
237
- SASS_BINARY_SITE: "https://cdn.npmmirror.com/binaries/node-sass",
238
- SWC_BINARY_SITE: "https://cdn.npmmirror.com/binaries/node-swc",
239
- NWJS_URLBASE: "https://cdn.npmmirror.com/binaries/nwjs/v",
240
- PUPPETEER_DOWNLOAD_HOST: "https://cdn.npmmirror.com/binaries/chrome-for-testing",
241
- PUPPETEER_DOWNLOAD_BASE_URL: "https://cdn.npmmirror.com/binaries/chrome-for-testing",
242
- PLAYWRIGHT_DOWNLOAD_HOST: "https://cdn.npmmirror.com/binaries/playwright",
243
- SENTRYCLI_CDNURL: "https://cdn.npmmirror.com/binaries/sentry-cli",
244
- SAUCECTL_INSTALL_BINARY_MIRROR: "https://cdn.npmmirror.com/binaries/saucectl",
245
- RE2_DOWNLOAD_MIRROR: "https://cdn.npmmirror.com/binaries/node-re2",
246
- RE2_DOWNLOAD_SKIP_PATH: "true",
247
- PRISMA_ENGINES_MIRROR: "https://cdn.npmmirror.com/binaries/prisma",
248
- npm_config_better_sqlite3_binary_host: "https://cdn.npmmirror.com/binaries/better-sqlite3",
249
- npm_config_keytar_binary_host: "https://cdn.npmmirror.com/binaries/keytar",
250
- npm_config_sharp_binary_host: "https://cdn.npmmirror.com/binaries/sharp",
251
- npm_config_sharp_libvips_binary_host: "https://cdn.npmmirror.com/binaries/sharp-libvips",
252
- npm_config_robotjs_binary_host: "https://cdn.npmmirror.com/binaries/robotjs"
253
- };
220
+ import { findWorkspaceDir } from "@pnpm/find-workspace-dir";
221
+ import { findWorkspacePackages } from "@pnpm/workspace.find-packages";
222
+ import { readWorkspaceManifest } from "@pnpm/workspace.read-manifest";
254
223
 
255
- // src/monorepo/mirror/utils.ts
224
+ // ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
256
225
  init_esm_shims();
257
- var import_set_value = __toESM(require_set_value(), 1);
258
- function setMirror(obj) {
259
- const platforms = ["linux", "windows", "osx"];
260
- const prefix = "terminal.integrated.env";
261
- if (typeof obj === "object" && obj) {
262
- for (const platform of platforms) {
263
- (0, import_set_value.default)(obj, [prefix, platform].join(".").replaceAll(".", "\\."), chinaMirrorsEnvs);
226
+ function isPlainObject(value) {
227
+ if (value === null || typeof value !== "object") {
228
+ return false;
229
+ }
230
+ const prototype = Object.getPrototypeOf(value);
231
+ if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
232
+ return false;
233
+ }
234
+ if (Symbol.iterator in value) {
235
+ return false;
236
+ }
237
+ if (Symbol.toStringTag in value) {
238
+ return Object.prototype.toString.call(value) === "[object Module]";
239
+ }
240
+ return true;
241
+ }
242
+ function _defu(baseObject, defaults, namespace = ".", merger) {
243
+ if (!isPlainObject(defaults)) {
244
+ return _defu(baseObject, {}, namespace, merger);
245
+ }
246
+ const object = Object.assign({}, defaults);
247
+ for (const key in baseObject) {
248
+ if (key === "__proto__" || key === "constructor") {
249
+ continue;
250
+ }
251
+ const value = baseObject[key];
252
+ if (value === null || value === void 0) {
253
+ continue;
254
+ }
255
+ if (merger && merger(object, key, value, namespace)) {
256
+ continue;
257
+ }
258
+ if (Array.isArray(value) && Array.isArray(object[key])) {
259
+ object[key] = [...value, ...object[key]];
260
+ } else if (isPlainObject(value) && isPlainObject(object[key])) {
261
+ object[key] = _defu(
262
+ value,
263
+ object[key],
264
+ (namespace ? `${namespace}.` : "") + key.toString(),
265
+ merger
266
+ );
267
+ } else {
268
+ object[key] = value;
264
269
  }
265
270
  }
271
+ return object;
272
+ }
273
+ function createDefu(merger) {
274
+ return (...arguments_) => (
275
+ // eslint-disable-next-line unicorn/no-array-reduce
276
+ arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
277
+ );
266
278
  }
279
+ var defu = createDefu();
280
+ var defuFn = createDefu((object, key, currentValue) => {
281
+ if (object[key] !== void 0 && typeof currentValue === "function") {
282
+ object[key] = currentValue(object[key]);
283
+ return true;
284
+ }
285
+ });
286
+ var defuArrayFn = createDefu((object, key, currentValue) => {
287
+ if (Array.isArray(object[key]) && typeof currentValue === "function") {
288
+ object[key] = currentValue(object[key]);
289
+ return true;
290
+ }
291
+ });
267
292
 
268
- // src/monorepo/binaryMirror.ts
269
- async function setVscodeBinaryMirror(cwd) {
270
- const targetJsonPath = path2.resolve(cwd, ".vscode/settings.json");
271
- await fs.ensureFile(targetJsonPath);
272
- const json = parse(await fs.readFile(targetJsonPath, "utf8"), void 0, false);
273
- json && typeof json === "object" && setMirror(json);
274
- await fs.writeFile(targetJsonPath, `${stringify(json, void 0, 2)}
275
- `, "utf8");
293
+ // src/monorepo/workspace/index.ts
294
+ import path2 from "pathe";
295
+ async function getWorkspacePackages(workspaceDir, options) {
296
+ const { ignoreRootPackage, ignorePrivatePackage, patterns } = defu(options, {
297
+ ignoreRootPackage: true,
298
+ ignorePrivatePackage: true
299
+ });
300
+ const manifest = await readWorkspaceManifest(workspaceDir);
301
+ const packages = await findWorkspacePackages(workspaceDir, {
302
+ patterns: patterns ?? (manifest == null ? void 0 : manifest.packages)
303
+ });
304
+ let pkgs = packages.filter((x) => {
305
+ if (ignorePrivatePackage && x.manifest.private) {
306
+ return false;
307
+ }
308
+ return true;
309
+ }).map((project) => {
310
+ const pkgJsonPath = path2.resolve(project.rootDir, "package.json");
311
+ return {
312
+ ...project,
313
+ pkgJsonPath
314
+ };
315
+ });
316
+ if (ignoreRootPackage) {
317
+ pkgs = pkgs.filter((x) => {
318
+ return x.rootDir !== workspaceDir;
319
+ });
320
+ }
321
+ return pkgs;
322
+ }
323
+ async function getWorkspaceData(cwd, options) {
324
+ const workspaceDir = await findWorkspaceDir(cwd) ?? cwd;
325
+ const packages = await getWorkspacePackages(workspaceDir, options);
326
+ return {
327
+ cwd,
328
+ workspaceDir,
329
+ packages
330
+ };
276
331
  }
277
332
 
278
333
  // src/monorepo/clean.ts
279
334
  init_esm_shims();
280
- var import_set_value2 = __toESM(require_set_value(), 1);
281
- import fs2 from "fs-extra";
335
+ var import_set_value = __toESM(require_set_value(), 1);
336
+ import checkbox from "@inquirer/checkbox";
337
+ import fs from "fs-extra";
282
338
  import path3 from "pathe";
283
- var cleanDirs = [
284
- "packages/monorepo",
285
- "packages/tsup-template",
286
- "packages/vue-lib-template",
287
- // 'packages/foo',
288
- // 'apps/cli',
289
- // 'apps/website',
290
- "apps"
291
- ];
292
339
  async function cleanProjects(cwd) {
293
- for (const dir of cleanDirs.map((x) => {
294
- return path3.resolve(cwd, x);
295
- })) {
296
- await fs2.remove(dir);
340
+ const { packages, workspaceDir } = await getWorkspaceData(cwd);
341
+ const cleanDirs = await checkbox({
342
+ message: "\u8BF7\u9009\u62E9\u9700\u8981\u6E05\u7406\u7684\u76EE\u5F55",
343
+ choices: packages.map((x) => {
344
+ return {
345
+ name: path3.relative(workspaceDir, x.rootDir),
346
+ value: x.rootDir,
347
+ checked: true,
348
+ description: x.manifest.name
349
+ };
350
+ })
351
+ });
352
+ for (const dir of cleanDirs) {
353
+ await fs.remove(dir);
297
354
  }
298
- const name2 = "package.json";
299
- const pkgJson = await fs2.readJson(name2);
300
- (0, import_set_value2.default)(pkgJson, "devDependencies.@icebreakers/monorepo", "latest", { preservePaths: false });
301
- await fs2.outputJson(name2, pkgJson, {
355
+ const name2 = path3.resolve(workspaceDir, "package.json");
356
+ const pkgJson = await fs.readJson(name2);
357
+ (0, import_set_value.default)(pkgJson, "devDependencies.@icebreakers/monorepo", "latest", { preservePaths: false });
358
+ await fs.outputJson(name2, pkgJson, {
302
359
  spaces: 2
303
360
  });
304
361
  }
305
362
 
306
- // src/monorepo/git.ts
363
+ // src/monorepo/git/index.ts
307
364
  init_esm_shims();
308
365
 
309
366
  // ../../node_modules/.pnpm/get-value@4.0.1/node_modules/get-value/dist/index.mjs
@@ -394,7 +451,7 @@ var getValue = /* @__PURE__ */ __name((target, path11, options = {}) => {
394
451
  }, "getValue");
395
452
  var index_default = getValue;
396
453
 
397
- // src/monorepo/git.ts
454
+ // src/monorepo/git/index.ts
398
455
  import gitUrlParse from "git-url-parse";
399
456
  import { simpleGit } from "simple-git";
400
457
  var GitClient = class {
@@ -442,123 +499,17 @@ var GitClient = class {
442
499
  }
443
500
  };
444
501
 
445
- // src/monorepo/workspace.ts
502
+ // src/monorepo/init/index.ts
446
503
  init_esm_shims();
447
- import { findWorkspacePackages } from "@pnpm/workspace.find-packages";
448
504
 
449
- // ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
505
+ // src/monorepo/context/index.ts
450
506
  init_esm_shims();
451
- function isPlainObject(value) {
452
- if (value === null || typeof value !== "object") {
453
- return false;
454
- }
455
- const prototype = Object.getPrototypeOf(value);
456
- if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
457
- return false;
458
- }
459
- if (Symbol.iterator in value) {
460
- return false;
461
- }
462
- if (Symbol.toStringTag in value) {
463
- return Object.prototype.toString.call(value) === "[object Module]";
464
- }
465
- return true;
466
- }
467
- function _defu(baseObject, defaults, namespace = ".", merger) {
468
- if (!isPlainObject(defaults)) {
469
- return _defu(baseObject, {}, namespace, merger);
470
- }
471
- const object = Object.assign({}, defaults);
472
- for (const key in baseObject) {
473
- if (key === "__proto__" || key === "constructor") {
474
- continue;
475
- }
476
- const value = baseObject[key];
477
- if (value === null || value === void 0) {
478
- continue;
479
- }
480
- if (merger && merger(object, key, value, namespace)) {
481
- continue;
482
- }
483
- if (Array.isArray(value) && Array.isArray(object[key])) {
484
- object[key] = [...value, ...object[key]];
485
- } else if (isPlainObject(value) && isPlainObject(object[key])) {
486
- object[key] = _defu(
487
- value,
488
- object[key],
489
- (namespace ? `${namespace}.` : "") + key.toString(),
490
- merger
491
- );
492
- } else {
493
- object[key] = value;
494
- }
495
- }
496
- return object;
497
- }
498
- function createDefu(merger) {
499
- return (...arguments_) => (
500
- // eslint-disable-next-line unicorn/no-array-reduce
501
- arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
502
- );
503
- }
504
- var defu = createDefu();
505
- var defuFn = createDefu((object, key, currentValue) => {
506
- if (object[key] !== void 0 && typeof currentValue === "function") {
507
- object[key] = currentValue(object[key]);
508
- return true;
509
- }
510
- });
511
- var defuArrayFn = createDefu((object, key, currentValue) => {
512
- if (Array.isArray(object[key]) && typeof currentValue === "function") {
513
- object[key] = currentValue(object[key]);
514
- return true;
515
- }
516
- });
517
-
518
- // src/monorepo/workspace.ts
519
507
  import path4 from "pathe";
520
- async function getWorkspacePackages(cwd, options) {
521
- const posixCwd = path4.normalize(cwd);
522
- const { ignoreRootPackage, ignorePrivatePackage, patterns } = defu(options, {
523
- ignoreRootPackage: true,
524
- ignorePrivatePackage: true
525
- });
526
- const packages = await findWorkspacePackages(cwd, {
527
- patterns
528
- });
529
- let pkgs = packages.filter((x) => {
530
- if (ignorePrivatePackage && x.manifest.private) {
531
- return false;
532
- }
533
- return true;
534
- }).map((project) => {
535
- const pkgJsonPath = path4.resolve(project.rootDir, "package.json");
536
- return {
537
- ...project,
538
- pkgJsonPath
539
- };
540
- });
541
- if (ignoreRootPackage) {
542
- pkgs = pkgs.filter((x) => {
543
- return path4.normalize(
544
- x.rootDir
545
- ) !== posixCwd;
546
- });
547
- }
548
- return pkgs;
549
- }
550
-
551
- // src/monorepo/init.ts
552
- init_esm_shims();
553
-
554
- // src/monorepo/context.ts
555
- init_esm_shims();
556
- import path5 from "pathe";
557
508
  import "@pnpm/types";
558
509
  async function createContext(cwd) {
559
510
  const git = new GitClient();
560
- const workspaceFilepath = path5.resolve(cwd, "pnpm-workspace.yaml");
561
- const projects = await getWorkspacePackages(cwd);
511
+ const { packages, workspaceDir } = await getWorkspaceData(cwd);
512
+ const workspaceFilepath = path4.resolve(workspaceDir, "pnpm-workspace.yaml");
562
513
  const gitUrl = await git.getGitUrl();
563
514
  const gitUser = await git.getUser();
564
515
  return {
@@ -566,44 +517,45 @@ async function createContext(cwd) {
566
517
  git,
567
518
  gitUrl,
568
519
  gitUser,
520
+ workspaceDir,
569
521
  workspaceFilepath,
570
- projects
522
+ packages
571
523
  };
572
524
  }
573
525
 
574
- // src/monorepo/setChangeset.ts
526
+ // src/monorepo/init/setChangeset.ts
575
527
  init_esm_shims();
576
- var import_set_value3 = __toESM(require_set_value(), 1);
577
- import fs3 from "fs-extra";
578
- import path6 from "pathe";
528
+ var import_set_value2 = __toESM(require_set_value(), 1);
529
+ import fs2 from "fs-extra";
530
+ import path5 from "pathe";
579
531
  async function setChangeset_default(ctx) {
580
532
  const { gitUrl, workspaceFilepath } = ctx;
581
- if (gitUrl && await fs3.exists(workspaceFilepath)) {
582
- const changesetConfigPath = path6.resolve(path6.dirname(workspaceFilepath), ".changeset/config.json");
583
- if (await fs3.exists(changesetConfigPath)) {
584
- const changesetConfig = await fs3.readJson(
533
+ if (gitUrl && await fs2.exists(workspaceFilepath)) {
534
+ const changesetConfigPath = path5.resolve(path5.dirname(workspaceFilepath), ".changeset/config.json");
535
+ if (await fs2.exists(changesetConfigPath)) {
536
+ const changesetConfig = await fs2.readJson(
585
537
  changesetConfigPath
586
538
  );
587
539
  if (gitUrl.full_name) {
588
- (0, import_set_value3.default)(changesetConfig, "changelog.1.repo", gitUrl.full_name);
589
- await fs3.outputJson(changesetConfigPath, changesetConfig, { spaces: 2 });
540
+ (0, import_set_value2.default)(changesetConfig, "changelog.1.repo", gitUrl.full_name);
541
+ await fs2.outputJson(changesetConfigPath, changesetConfig, { spaces: 2 });
590
542
  }
591
543
  }
592
544
  }
593
545
  }
594
546
 
595
- // src/monorepo/setPkgJson.ts
547
+ // src/monorepo/init/setPkgJson.ts
596
548
  init_esm_shims();
597
- var import_set_value4 = __toESM(require_set_value(), 1);
598
- import fs4 from "fs-extra";
599
- import path7 from "pathe";
549
+ var import_set_value3 = __toESM(require_set_value(), 1);
550
+ import fs3 from "fs-extra";
551
+ import path6 from "pathe";
600
552
  async function setPkgJson_default(ctx) {
601
- const { gitUrl, gitUser, projects, cwd, workspaceFilepath } = ctx;
602
- if (gitUrl && await fs4.exists(workspaceFilepath)) {
603
- for (const project of projects) {
604
- const pkgJson = project.manifest;
605
- const directory = path7.relative(cwd, project.rootDir);
606
- (0, import_set_value4.default)(pkgJson, "bugs.url", `https://github.com/${gitUrl.full_name}/issues`);
553
+ const { gitUrl, gitUser, packages, cwd, workspaceFilepath } = ctx;
554
+ if (gitUrl && await fs3.exists(workspaceFilepath)) {
555
+ for (const pkg of packages) {
556
+ const pkgJson = pkg.manifest;
557
+ const directory = path6.relative(cwd, pkg.rootDir);
558
+ (0, import_set_value3.default)(pkgJson, "bugs.url", `https://github.com/${gitUrl.full_name}/issues`);
607
559
  const repository = {
608
560
  type: "git",
609
561
  url: `git+https://github.com/${gitUrl.full_name}.git`
@@ -611,23 +563,23 @@ async function setPkgJson_default(ctx) {
611
563
  if (directory) {
612
564
  repository.directory = directory;
613
565
  }
614
- (0, import_set_value4.default)(pkgJson, "repository", repository);
566
+ (0, import_set_value3.default)(pkgJson, "repository", repository);
615
567
  if (gitUser) {
616
- (0, import_set_value4.default)(pkgJson, "author", `${gitUser.name} <${gitUser.email}>`);
568
+ (0, import_set_value3.default)(pkgJson, "author", `${gitUser.name} <${gitUser.email}>`);
617
569
  }
618
- await fs4.writeJSON(project.pkgJsonPath, pkgJson, {
570
+ await fs3.writeJSON(pkg.pkgJsonPath, pkgJson, {
619
571
  spaces: 2
620
572
  });
621
573
  }
622
574
  }
623
575
  }
624
576
 
625
- // src/monorepo/setReadme.ts
577
+ // src/monorepo/init/setReadme.ts
626
578
  init_esm_shims();
627
- import fs5 from "fs-extra";
628
- import path8 from "pathe";
579
+ import fs4 from "fs-extra";
580
+ import path7 from "pathe";
629
581
  async function getRows(ctx) {
630
- const { projects, git, cwd } = ctx;
582
+ const { packages, git, cwd } = ctx;
631
583
  const gitUrl = await git.getGitUrl();
632
584
  const gitUser = await git.getUser();
633
585
  const rows = [];
@@ -635,12 +587,12 @@ async function getRows(ctx) {
635
587
  rows.push(`# ${gitUrl.name}
636
588
  `);
637
589
  }
638
- rows.push("## Projects\n");
639
- for (const project of projects) {
640
- const p = path8.relative(cwd, project.rootDirRealPath);
590
+ rows.push("## Packages\n");
591
+ for (const pkg of packages) {
592
+ const p = path7.relative(cwd, pkg.rootDirRealPath);
641
593
  if (p) {
642
- const description = project.manifest.description ? `- ${project.manifest.description}` : "";
643
- rows.push(`- [${project.manifest.name}](${p}) ${description}`);
594
+ const description = pkg.manifest.description ? `- ${pkg.manifest.description}` : "";
595
+ rows.push(`- [${pkg.manifest.name}](${p}) ${description}`);
644
596
  }
645
597
  }
646
598
  if (gitUrl) {
@@ -665,11 +617,11 @@ async function getRows(ctx) {
665
617
  }
666
618
  async function setReadme_default(ctx) {
667
619
  const rows = await getRows(ctx);
668
- await fs5.writeFile(path8.resolve(ctx.cwd, "README.md"), `${rows.join("\n")}
620
+ await fs4.writeFile(path7.resolve(ctx.cwd, "README.md"), `${rows.join("\n")}
669
621
  `);
670
622
  }
671
623
 
672
- // src/monorepo/init.ts
624
+ // src/monorepo/init/index.ts
673
625
  async function init(cwd) {
674
626
  const ctx = await createContext(cwd);
675
627
  await setChangeset_default(ctx);
@@ -677,6 +629,68 @@ async function init(cwd) {
677
629
  await setReadme_default(ctx);
678
630
  }
679
631
 
632
+ // src/monorepo/mirror/binaryMirror.ts
633
+ init_esm_shims();
634
+ import { parse, stringify } from "comment-json";
635
+ import fs5 from "fs-extra";
636
+ import path8 from "pathe";
637
+
638
+ // src/monorepo/mirror/utils.ts
639
+ init_esm_shims();
640
+ var import_set_value4 = __toESM(require_set_value(), 1);
641
+
642
+ // src/monorepo/mirror/sources.ts
643
+ init_esm_shims();
644
+ var chinaMirrorsEnvs = {
645
+ COREPACK_NPM_REGISTRY: "https://registry.npmmirror.com",
646
+ EDGEDRIVER_CDNURL: "https://npmmirror.com/mirrors/edgedriver",
647
+ NODEJS_ORG_MIRROR: "https://cdn.npmmirror.com/binaries/node",
648
+ NVM_NODEJS_ORG_MIRROR: "https://cdn.npmmirror.com/binaries/node",
649
+ PHANTOMJS_CDNURL: "https://cdn.npmmirror.com/binaries/phantomjs",
650
+ CHROMEDRIVER_CDNURL: "https://cdn.npmmirror.com/binaries/chromedriver",
651
+ OPERADRIVER_CDNURL: "https://cdn.npmmirror.com/binaries/operadriver",
652
+ CYPRESS_DOWNLOAD_PATH_TEMPLATE: "https://cdn.npmmirror.com/binaries/cypress/${version}/${platform}-${arch}/cypress.zip",
653
+ ELECTRON_MIRROR: "https://cdn.npmmirror.com/binaries/electron/",
654
+ ELECTRON_BUILDER_BINARIES_MIRROR: "https://cdn.npmmirror.com/binaries/electron-builder-binaries/",
655
+ SASS_BINARY_SITE: "https://cdn.npmmirror.com/binaries/node-sass",
656
+ SWC_BINARY_SITE: "https://cdn.npmmirror.com/binaries/node-swc",
657
+ NWJS_URLBASE: "https://cdn.npmmirror.com/binaries/nwjs/v",
658
+ PUPPETEER_DOWNLOAD_HOST: "https://cdn.npmmirror.com/binaries/chrome-for-testing",
659
+ PUPPETEER_DOWNLOAD_BASE_URL: "https://cdn.npmmirror.com/binaries/chrome-for-testing",
660
+ PLAYWRIGHT_DOWNLOAD_HOST: "https://cdn.npmmirror.com/binaries/playwright",
661
+ SENTRYCLI_CDNURL: "https://cdn.npmmirror.com/binaries/sentry-cli",
662
+ SAUCECTL_INSTALL_BINARY_MIRROR: "https://cdn.npmmirror.com/binaries/saucectl",
663
+ RE2_DOWNLOAD_MIRROR: "https://cdn.npmmirror.com/binaries/node-re2",
664
+ RE2_DOWNLOAD_SKIP_PATH: "true",
665
+ PRISMA_ENGINES_MIRROR: "https://cdn.npmmirror.com/binaries/prisma",
666
+ npm_config_better_sqlite3_binary_host: "https://cdn.npmmirror.com/binaries/better-sqlite3",
667
+ npm_config_keytar_binary_host: "https://cdn.npmmirror.com/binaries/keytar",
668
+ npm_config_sharp_binary_host: "https://cdn.npmmirror.com/binaries/sharp",
669
+ npm_config_sharp_libvips_binary_host: "https://cdn.npmmirror.com/binaries/sharp-libvips",
670
+ npm_config_robotjs_binary_host: "https://cdn.npmmirror.com/binaries/robotjs"
671
+ };
672
+
673
+ // src/monorepo/mirror/utils.ts
674
+ function setMirror(obj) {
675
+ const platforms = ["linux", "windows", "osx"];
676
+ const prefix = "terminal.integrated.env";
677
+ if (typeof obj === "object" && obj) {
678
+ for (const platform of platforms) {
679
+ (0, import_set_value4.default)(obj, [prefix, platform].join(".").replaceAll(".", "\\."), chinaMirrorsEnvs);
680
+ }
681
+ }
682
+ }
683
+
684
+ // src/monorepo/mirror/binaryMirror.ts
685
+ async function setVscodeBinaryMirror(cwd) {
686
+ const targetJsonPath = path8.resolve(cwd, ".vscode/settings.json");
687
+ await fs5.ensureFile(targetJsonPath);
688
+ const json = parse(await fs5.readFile(targetJsonPath, "utf8"), void 0, false);
689
+ json && typeof json === "object" && setMirror(json);
690
+ await fs5.writeFile(targetJsonPath, `${stringify(json, void 0, 2)}
691
+ `, "utf8");
692
+ }
693
+
680
694
  // src/monorepo/sync.ts
681
695
  init_esm_shims();
682
696
  import os from "os";
@@ -692,9 +706,9 @@ var logger = createConsola();
692
706
 
693
707
  // src/monorepo/sync.ts
694
708
  async function syncNpmMirror(cwd, options) {
695
- const packages = await getWorkspacePackages(cwd, options);
709
+ const { packages, workspaceDir } = await getWorkspaceData(cwd, options);
696
710
  logger.info(`[\u5F53\u524D\u5DE5\u4F5C\u533ARepo]:
697
- ${packages.map((x) => `- ${pc.green(x.manifest.name)} : ${path9.relative(cwd, x.rootDir)}`).join("\n")}
711
+ ${packages.map((x) => `- ${pc.green(x.manifest.name)} : ${path9.relative(workspaceDir, x.rootDir)}`).join("\n")}
698
712
  `);
699
713
  const set6 = new Set(packages.map((x) => x.manifest.name));
700
714
  logger.info(`[\u5373\u5C06\u540C\u6B65\u7684\u5305]:
@@ -753,7 +767,7 @@ function isMatch(str, arr) {
753
767
  init_esm_shims();
754
768
  import process from "process";
755
769
  import { fileURLToPath as fileURLToPath2 } from "url";
756
- import checkbox from "@inquirer/checkbox";
770
+ import checkbox2 from "@inquirer/checkbox";
757
771
  import confirm from "@inquirer/confirm";
758
772
  import fs6 from "fs-extra";
759
773
  var import_set_value5 = __toESM(require_set_value(), 1);
@@ -767,7 +781,7 @@ init_esm_shims();
767
781
 
768
782
  // package.json
769
783
  var name = "@icebreakers/monorepo";
770
- var version = "1.0.16";
784
+ var version = "1.1.0";
771
785
 
772
786
  // src/scripts.ts
773
787
  init_esm_shims();
@@ -865,7 +879,7 @@ async function upgradeMonorepo(opts) {
865
879
  const repoName = await gitClient.getRepoName();
866
880
  let targets = getAssetTargets(raw);
867
881
  if (interactive) {
868
- targets = await checkbox({
882
+ targets = await checkbox2({
869
883
  message: "\u9009\u62E9\u4F60\u9700\u8981\u7684\u6587\u4EF6",
870
884
  choices: targets.map((x) => {
871
885
  return {
@@ -942,11 +956,11 @@ export {
942
956
  defu,
943
957
  require_set_value,
944
958
  logger,
945
- setVscodeBinaryMirror,
959
+ getWorkspacePackages,
946
960
  cleanProjects,
947
961
  GitClient,
948
- getWorkspacePackages,
949
962
  init,
963
+ setVscodeBinaryMirror,
950
964
  syncNpmMirror,
951
965
  getFileHash,
952
966
  isFileChanged,