@icebreakers/monorepo 1.0.16 → 1.0.17

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.
@@ -275,24 +275,137 @@ async function setVscodeBinaryMirror(cwd) {
275
275
  `, "utf8");
276
276
  }
277
277
 
278
+ // src/monorepo/workspace.ts
279
+ init_esm_shims();
280
+ import { findWorkspaceDir } from "@pnpm/find-workspace-dir";
281
+ import { findWorkspacePackages } from "@pnpm/workspace.find-packages";
282
+ import { readWorkspaceManifest } from "@pnpm/workspace.read-manifest";
283
+
284
+ // ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
285
+ init_esm_shims();
286
+ function isPlainObject(value) {
287
+ if (value === null || typeof value !== "object") {
288
+ return false;
289
+ }
290
+ const prototype = Object.getPrototypeOf(value);
291
+ if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
292
+ return false;
293
+ }
294
+ if (Symbol.iterator in value) {
295
+ return false;
296
+ }
297
+ if (Symbol.toStringTag in value) {
298
+ return Object.prototype.toString.call(value) === "[object Module]";
299
+ }
300
+ return true;
301
+ }
302
+ function _defu(baseObject, defaults, namespace = ".", merger) {
303
+ if (!isPlainObject(defaults)) {
304
+ return _defu(baseObject, {}, namespace, merger);
305
+ }
306
+ const object = Object.assign({}, defaults);
307
+ for (const key in baseObject) {
308
+ if (key === "__proto__" || key === "constructor") {
309
+ continue;
310
+ }
311
+ const value = baseObject[key];
312
+ if (value === null || value === void 0) {
313
+ continue;
314
+ }
315
+ if (merger && merger(object, key, value, namespace)) {
316
+ continue;
317
+ }
318
+ if (Array.isArray(value) && Array.isArray(object[key])) {
319
+ object[key] = [...value, ...object[key]];
320
+ } else if (isPlainObject(value) && isPlainObject(object[key])) {
321
+ object[key] = _defu(
322
+ value,
323
+ object[key],
324
+ (namespace ? `${namespace}.` : "") + key.toString(),
325
+ merger
326
+ );
327
+ } else {
328
+ object[key] = value;
329
+ }
330
+ }
331
+ return object;
332
+ }
333
+ function createDefu(merger) {
334
+ return (...arguments_) => (
335
+ // eslint-disable-next-line unicorn/no-array-reduce
336
+ arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
337
+ );
338
+ }
339
+ var defu = createDefu();
340
+ var defuFn = createDefu((object, key, currentValue) => {
341
+ if (object[key] !== void 0 && typeof currentValue === "function") {
342
+ object[key] = currentValue(object[key]);
343
+ return true;
344
+ }
345
+ });
346
+ var defuArrayFn = createDefu((object, key, currentValue) => {
347
+ if (Array.isArray(object[key]) && typeof currentValue === "function") {
348
+ object[key] = currentValue(object[key]);
349
+ return true;
350
+ }
351
+ });
352
+
353
+ // src/monorepo/workspace.ts
354
+ import path3 from "pathe";
355
+ async function getWorkspacePackages(cwd, options) {
356
+ const { ignoreRootPackage, ignorePrivatePackage, patterns } = defu(options, {
357
+ ignoreRootPackage: true,
358
+ ignorePrivatePackage: true
359
+ });
360
+ const workspaceDir = await findWorkspaceDir(cwd) ?? cwd;
361
+ const manifest = await readWorkspaceManifest(workspaceDir);
362
+ const packages = await findWorkspacePackages(workspaceDir, {
363
+ patterns: patterns ?? (manifest == null ? void 0 : manifest.packages)
364
+ });
365
+ let pkgs = packages.filter((x) => {
366
+ if (ignorePrivatePackage && x.manifest.private) {
367
+ return false;
368
+ }
369
+ return true;
370
+ }).map((project) => {
371
+ const pkgJsonPath = path3.resolve(project.rootDir, "package.json");
372
+ return {
373
+ ...project,
374
+ pkgJsonPath
375
+ };
376
+ });
377
+ if (ignoreRootPackage) {
378
+ pkgs = pkgs.filter((x) => {
379
+ return x.rootDir !== workspaceDir;
380
+ });
381
+ }
382
+ return pkgs;
383
+ }
384
+
278
385
  // src/monorepo/clean.ts
279
386
  init_esm_shims();
280
387
  var import_set_value2 = __toESM(require_set_value(), 1);
388
+ import checkbox from "@inquirer/checkbox";
389
+ import { findWorkspaceDir as findWorkspaceDir2 } from "@pnpm/find-workspace-dir";
281
390
  import fs2 from "fs-extra";
282
- 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
- ];
391
+ import path4 from "pathe";
292
392
  async function cleanProjects(cwd) {
293
- for (const dir of cleanDirs.map((x) => {
294
- return path3.resolve(cwd, x);
295
- })) {
393
+ const workspaceDir = await findWorkspaceDir2(cwd) ?? cwd;
394
+ const packages = await getWorkspacePackages(workspaceDir, {
395
+ ignorePrivatePackage: false
396
+ });
397
+ const cleanDirs = await checkbox({
398
+ message: "\u8BF7\u9009\u62E9\u9700\u8981\u6E05\u7406\u7684\u76EE\u5F55",
399
+ choices: packages.map((x) => {
400
+ return {
401
+ name: path4.relative(workspaceDir, x.rootDir),
402
+ value: x.rootDir,
403
+ checked: true,
404
+ description: x.manifest.name
405
+ };
406
+ })
407
+ });
408
+ for (const dir of cleanDirs) {
296
409
  await fs2.remove(dir);
297
410
  }
298
411
  const name2 = "package.json";
@@ -442,112 +555,6 @@ var GitClient = class {
442
555
  }
443
556
  };
444
557
 
445
- // src/monorepo/workspace.ts
446
- init_esm_shims();
447
- import { findWorkspacePackages } from "@pnpm/workspace.find-packages";
448
-
449
- // ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
450
- 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
- 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
558
  // src/monorepo/init.ts
552
559
  init_esm_shims();
553
560
 
@@ -753,7 +760,7 @@ function isMatch(str, arr) {
753
760
  init_esm_shims();
754
761
  import process from "process";
755
762
  import { fileURLToPath as fileURLToPath2 } from "url";
756
- import checkbox from "@inquirer/checkbox";
763
+ import checkbox2 from "@inquirer/checkbox";
757
764
  import confirm from "@inquirer/confirm";
758
765
  import fs6 from "fs-extra";
759
766
  var import_set_value5 = __toESM(require_set_value(), 1);
@@ -767,7 +774,7 @@ init_esm_shims();
767
774
 
768
775
  // package.json
769
776
  var name = "@icebreakers/monorepo";
770
- var version = "1.0.16";
777
+ var version = "1.0.17";
771
778
 
772
779
  // src/scripts.ts
773
780
  init_esm_shims();
@@ -865,7 +872,7 @@ async function upgradeMonorepo(opts) {
865
872
  const repoName = await gitClient.getRepoName();
866
873
  let targets = getAssetTargets(raw);
867
874
  if (interactive) {
868
- targets = await checkbox({
875
+ targets = await checkbox2({
869
876
  message: "\u9009\u62E9\u4F60\u9700\u8981\u7684\u6587\u4EF6",
870
877
  choices: targets.map((x) => {
871
878
  return {
@@ -943,9 +950,9 @@ export {
943
950
  require_set_value,
944
951
  logger,
945
952
  setVscodeBinaryMirror,
953
+ getWorkspacePackages,
946
954
  cleanProjects,
947
955
  GitClient,
948
- getWorkspacePackages,
949
956
  init,
950
957
  syncNpmMirror,
951
958
  getFileHash,
package/dist/cli.cjs CHANGED
@@ -232,7 +232,7 @@ init_cjs_shims();
232
232
 
233
233
  // package.json
234
234
  var name = "@icebreakers/monorepo";
235
- var version = "1.0.16";
235
+ var version = "1.0.17";
236
236
 
237
237
  // src/create.ts
238
238
  init_cjs_shims();
@@ -425,22 +425,66 @@ async function setVscodeBinaryMirror(cwd2) {
425
425
 
426
426
  // src/monorepo/clean.ts
427
427
  init_cjs_shims();
428
+ var import_checkbox = __toESM(require("@inquirer/checkbox"), 1);
429
+ var import_find_workspace_dir2 = require("@pnpm/find-workspace-dir");
428
430
  var import_fs_extra3 = __toESM(require("fs-extra"), 1);
429
- var import_pathe3 = __toESM(require("pathe"), 1);
431
+ var import_pathe4 = __toESM(require("pathe"), 1);
430
432
  var import_set_value3 = __toESM(require_set_value(), 1);
431
- var cleanDirs = [
432
- "packages/monorepo",
433
- "packages/tsup-template",
434
- "packages/vue-lib-template",
435
- // 'packages/foo',
436
- // 'apps/cli',
437
- // 'apps/website',
438
- "apps"
439
- ];
433
+
434
+ // src/monorepo/workspace.ts
435
+ init_cjs_shims();
436
+ var import_find_workspace_dir = require("@pnpm/find-workspace-dir");
437
+ var import_workspace = require("@pnpm/workspace.find-packages");
438
+ var import_workspace2 = require("@pnpm/workspace.read-manifest");
439
+ var import_pathe3 = __toESM(require("pathe"), 1);
440
+ async function getWorkspacePackages(cwd2, options) {
441
+ const { ignoreRootPackage, ignorePrivatePackage, patterns } = defu(options, {
442
+ ignoreRootPackage: true,
443
+ ignorePrivatePackage: true
444
+ });
445
+ const workspaceDir = await (0, import_find_workspace_dir.findWorkspaceDir)(cwd2) ?? cwd2;
446
+ const manifest = await (0, import_workspace2.readWorkspaceManifest)(workspaceDir);
447
+ const packages = await (0, import_workspace.findWorkspacePackages)(workspaceDir, {
448
+ patterns: patterns ?? (manifest == null ? void 0 : manifest.packages)
449
+ });
450
+ let pkgs = packages.filter((x) => {
451
+ if (ignorePrivatePackage && x.manifest.private) {
452
+ return false;
453
+ }
454
+ return true;
455
+ }).map((project) => {
456
+ const pkgJsonPath = import_pathe3.default.resolve(project.rootDir, "package.json");
457
+ return {
458
+ ...project,
459
+ pkgJsonPath
460
+ };
461
+ });
462
+ if (ignoreRootPackage) {
463
+ pkgs = pkgs.filter((x) => {
464
+ return x.rootDir !== workspaceDir;
465
+ });
466
+ }
467
+ return pkgs;
468
+ }
469
+
470
+ // src/monorepo/clean.ts
440
471
  async function cleanProjects(cwd2) {
441
- for (const dir of cleanDirs.map((x) => {
442
- return import_pathe3.default.resolve(cwd2, x);
443
- })) {
472
+ const workspaceDir = await (0, import_find_workspace_dir2.findWorkspaceDir)(cwd2) ?? cwd2;
473
+ const packages = await getWorkspacePackages(workspaceDir, {
474
+ ignorePrivatePackage: false
475
+ });
476
+ const cleanDirs = await (0, import_checkbox.default)({
477
+ message: "\u8BF7\u9009\u62E9\u9700\u8981\u6E05\u7406\u7684\u76EE\u5F55",
478
+ choices: packages.map((x) => {
479
+ return {
480
+ name: import_pathe4.default.relative(workspaceDir, x.rootDir),
481
+ value: x.rootDir,
482
+ checked: true,
483
+ description: x.manifest.name
484
+ };
485
+ })
486
+ });
487
+ for (const dir of cleanDirs) {
444
488
  await import_fs_extra3.default.remove(dir);
445
489
  }
446
490
  const name2 = "package.json";
@@ -596,43 +640,6 @@ init_cjs_shims();
596
640
  // src/monorepo/context.ts
597
641
  init_cjs_shims();
598
642
  var import_pathe5 = __toESM(require("pathe"), 1);
599
-
600
- // src/monorepo/workspace.ts
601
- init_cjs_shims();
602
- var import_workspace = require("@pnpm/workspace.find-packages");
603
- var import_pathe4 = __toESM(require("pathe"), 1);
604
- async function getWorkspacePackages(cwd2, options) {
605
- const posixCwd = import_pathe4.default.normalize(cwd2);
606
- const { ignoreRootPackage, ignorePrivatePackage, patterns } = defu(options, {
607
- ignoreRootPackage: true,
608
- ignorePrivatePackage: true
609
- });
610
- const packages = await (0, import_workspace.findWorkspacePackages)(cwd2, {
611
- patterns
612
- });
613
- let pkgs = packages.filter((x) => {
614
- if (ignorePrivatePackage && x.manifest.private) {
615
- return false;
616
- }
617
- return true;
618
- }).map((project) => {
619
- const pkgJsonPath = import_pathe4.default.resolve(project.rootDir, "package.json");
620
- return {
621
- ...project,
622
- pkgJsonPath
623
- };
624
- });
625
- if (ignoreRootPackage) {
626
- pkgs = pkgs.filter((x) => {
627
- return import_pathe4.default.normalize(
628
- x.rootDir
629
- ) !== posixCwd;
630
- });
631
- }
632
- return pkgs;
633
- }
634
-
635
- // src/monorepo/context.ts
636
643
  var import_types = require("@pnpm/types");
637
644
  async function createContext(cwd2) {
638
645
  const git = new GitClient();
@@ -789,7 +796,7 @@ ${Array.from(set7).map((x) => `- ${import_picocolors2.default.green(x)}`).join("
789
796
  init_cjs_shims();
790
797
  var import_node_process2 = __toESM(require("process"), 1);
791
798
  var import_node_url2 = require("url");
792
- var import_checkbox = __toESM(require("@inquirer/checkbox"), 1);
799
+ var import_checkbox2 = __toESM(require("@inquirer/checkbox"), 1);
793
800
  var import_confirm = __toESM(require("@inquirer/confirm"), 1);
794
801
  var import_fs_extra7 = __toESM(require("fs-extra"), 1);
795
802
  var import_klaw = __toESM(require("klaw"), 1);
@@ -927,7 +934,7 @@ async function upgradeMonorepo(opts) {
927
934
  const repoName = await gitClient.getRepoName();
928
935
  let targets = getAssetTargets(raw);
929
936
  if (interactive) {
930
- targets = await (0, import_checkbox.default)({
937
+ targets = await (0, import_checkbox2.default)({
931
938
  message: "\u9009\u62E9\u4F60\u9700\u8981\u7684\u6587\u4EF6",
932
939
  choices: targets.map((x) => {
933
940
  return {
package/dist/cli.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  syncNpmMirror,
12
12
  upgradeMonorepo,
13
13
  version
14
- } from "./chunk-3HPT6GQE.js";
14
+ } from "./chunk-IQWID4TH.js";
15
15
 
16
16
  // src/cli.ts
17
17
  init_esm_shims();
package/dist/index.cjs CHANGED
@@ -306,22 +306,137 @@ async function setVscodeBinaryMirror(cwd) {
306
306
 
307
307
  // src/monorepo/clean.ts
308
308
  init_cjs_shims();
309
+ var import_checkbox = __toESM(require("@inquirer/checkbox"), 1);
310
+ var import_find_workspace_dir2 = require("@pnpm/find-workspace-dir");
309
311
  var import_fs_extra2 = __toESM(require("fs-extra"), 1);
310
- var import_pathe2 = __toESM(require("pathe"), 1);
312
+ var import_pathe3 = __toESM(require("pathe"), 1);
311
313
  var import_set_value2 = __toESM(require_set_value(), 1);
312
- var cleanDirs = [
313
- "packages/monorepo",
314
- "packages/tsup-template",
315
- "packages/vue-lib-template",
316
- // 'packages/foo',
317
- // 'apps/cli',
318
- // 'apps/website',
319
- "apps"
320
- ];
314
+
315
+ // src/monorepo/workspace.ts
316
+ init_cjs_shims();
317
+ var import_find_workspace_dir = require("@pnpm/find-workspace-dir");
318
+ var import_workspace = require("@pnpm/workspace.find-packages");
319
+ var import_workspace2 = require("@pnpm/workspace.read-manifest");
320
+
321
+ // ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
322
+ init_cjs_shims();
323
+ function isPlainObject(value) {
324
+ if (value === null || typeof value !== "object") {
325
+ return false;
326
+ }
327
+ const prototype = Object.getPrototypeOf(value);
328
+ if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
329
+ return false;
330
+ }
331
+ if (Symbol.iterator in value) {
332
+ return false;
333
+ }
334
+ if (Symbol.toStringTag in value) {
335
+ return Object.prototype.toString.call(value) === "[object Module]";
336
+ }
337
+ return true;
338
+ }
339
+ function _defu(baseObject, defaults, namespace = ".", merger) {
340
+ if (!isPlainObject(defaults)) {
341
+ return _defu(baseObject, {}, namespace, merger);
342
+ }
343
+ const object = Object.assign({}, defaults);
344
+ for (const key in baseObject) {
345
+ if (key === "__proto__" || key === "constructor") {
346
+ continue;
347
+ }
348
+ const value = baseObject[key];
349
+ if (value === null || value === void 0) {
350
+ continue;
351
+ }
352
+ if (merger && merger(object, key, value, namespace)) {
353
+ continue;
354
+ }
355
+ if (Array.isArray(value) && Array.isArray(object[key])) {
356
+ object[key] = [...value, ...object[key]];
357
+ } else if (isPlainObject(value) && isPlainObject(object[key])) {
358
+ object[key] = _defu(
359
+ value,
360
+ object[key],
361
+ (namespace ? `${namespace}.` : "") + key.toString(),
362
+ merger
363
+ );
364
+ } else {
365
+ object[key] = value;
366
+ }
367
+ }
368
+ return object;
369
+ }
370
+ function createDefu(merger) {
371
+ return (...arguments_) => (
372
+ // eslint-disable-next-line unicorn/no-array-reduce
373
+ arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
374
+ );
375
+ }
376
+ var defu = createDefu();
377
+ var defuFn = createDefu((object, key, currentValue) => {
378
+ if (object[key] !== void 0 && typeof currentValue === "function") {
379
+ object[key] = currentValue(object[key]);
380
+ return true;
381
+ }
382
+ });
383
+ var defuArrayFn = createDefu((object, key, currentValue) => {
384
+ if (Array.isArray(object[key]) && typeof currentValue === "function") {
385
+ object[key] = currentValue(object[key]);
386
+ return true;
387
+ }
388
+ });
389
+
390
+ // src/monorepo/workspace.ts
391
+ var import_pathe2 = __toESM(require("pathe"), 1);
392
+ async function getWorkspacePackages(cwd, options) {
393
+ const { ignoreRootPackage, ignorePrivatePackage, patterns } = defu(options, {
394
+ ignoreRootPackage: true,
395
+ ignorePrivatePackage: true
396
+ });
397
+ const workspaceDir = await (0, import_find_workspace_dir.findWorkspaceDir)(cwd) ?? cwd;
398
+ const manifest = await (0, import_workspace2.readWorkspaceManifest)(workspaceDir);
399
+ const packages = await (0, import_workspace.findWorkspacePackages)(workspaceDir, {
400
+ patterns: patterns ?? (manifest == null ? void 0 : manifest.packages)
401
+ });
402
+ let pkgs = packages.filter((x) => {
403
+ if (ignorePrivatePackage && x.manifest.private) {
404
+ return false;
405
+ }
406
+ return true;
407
+ }).map((project) => {
408
+ const pkgJsonPath = import_pathe2.default.resolve(project.rootDir, "package.json");
409
+ return {
410
+ ...project,
411
+ pkgJsonPath
412
+ };
413
+ });
414
+ if (ignoreRootPackage) {
415
+ pkgs = pkgs.filter((x) => {
416
+ return x.rootDir !== workspaceDir;
417
+ });
418
+ }
419
+ return pkgs;
420
+ }
421
+
422
+ // src/monorepo/clean.ts
321
423
  async function cleanProjects(cwd) {
322
- for (const dir of cleanDirs.map((x) => {
323
- return import_pathe2.default.resolve(cwd, x);
324
- })) {
424
+ const workspaceDir = await (0, import_find_workspace_dir2.findWorkspaceDir)(cwd) ?? cwd;
425
+ const packages = await getWorkspacePackages(workspaceDir, {
426
+ ignorePrivatePackage: false
427
+ });
428
+ const cleanDirs = await (0, import_checkbox.default)({
429
+ message: "\u8BF7\u9009\u62E9\u9700\u8981\u6E05\u7406\u7684\u76EE\u5F55",
430
+ choices: packages.map((x) => {
431
+ return {
432
+ name: import_pathe3.default.relative(workspaceDir, x.rootDir),
433
+ value: x.rootDir,
434
+ checked: true,
435
+ description: x.manifest.name
436
+ };
437
+ })
438
+ });
439
+ for (const dir of cleanDirs) {
325
440
  await import_fs_extra2.default.remove(dir);
326
441
  }
327
442
  const name2 = "package.json";
@@ -477,114 +592,6 @@ init_cjs_shims();
477
592
  // src/monorepo/context.ts
478
593
  init_cjs_shims();
479
594
  var import_pathe4 = __toESM(require("pathe"), 1);
480
-
481
- // src/monorepo/workspace.ts
482
- init_cjs_shims();
483
- var import_workspace = require("@pnpm/workspace.find-packages");
484
-
485
- // ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
486
- init_cjs_shims();
487
- function isPlainObject(value) {
488
- if (value === null || typeof value !== "object") {
489
- return false;
490
- }
491
- const prototype = Object.getPrototypeOf(value);
492
- if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
493
- return false;
494
- }
495
- if (Symbol.iterator in value) {
496
- return false;
497
- }
498
- if (Symbol.toStringTag in value) {
499
- return Object.prototype.toString.call(value) === "[object Module]";
500
- }
501
- return true;
502
- }
503
- function _defu(baseObject, defaults, namespace = ".", merger) {
504
- if (!isPlainObject(defaults)) {
505
- return _defu(baseObject, {}, namespace, merger);
506
- }
507
- const object = Object.assign({}, defaults);
508
- for (const key in baseObject) {
509
- if (key === "__proto__" || key === "constructor") {
510
- continue;
511
- }
512
- const value = baseObject[key];
513
- if (value === null || value === void 0) {
514
- continue;
515
- }
516
- if (merger && merger(object, key, value, namespace)) {
517
- continue;
518
- }
519
- if (Array.isArray(value) && Array.isArray(object[key])) {
520
- object[key] = [...value, ...object[key]];
521
- } else if (isPlainObject(value) && isPlainObject(object[key])) {
522
- object[key] = _defu(
523
- value,
524
- object[key],
525
- (namespace ? `${namespace}.` : "") + key.toString(),
526
- merger
527
- );
528
- } else {
529
- object[key] = value;
530
- }
531
- }
532
- return object;
533
- }
534
- function createDefu(merger) {
535
- return (...arguments_) => (
536
- // eslint-disable-next-line unicorn/no-array-reduce
537
- arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
538
- );
539
- }
540
- var defu = createDefu();
541
- var defuFn = createDefu((object, key, currentValue) => {
542
- if (object[key] !== void 0 && typeof currentValue === "function") {
543
- object[key] = currentValue(object[key]);
544
- return true;
545
- }
546
- });
547
- var defuArrayFn = createDefu((object, key, currentValue) => {
548
- if (Array.isArray(object[key]) && typeof currentValue === "function") {
549
- object[key] = currentValue(object[key]);
550
- return true;
551
- }
552
- });
553
-
554
- // src/monorepo/workspace.ts
555
- var import_pathe3 = __toESM(require("pathe"), 1);
556
- async function getWorkspacePackages(cwd, options) {
557
- const posixCwd = import_pathe3.default.normalize(cwd);
558
- const { ignoreRootPackage, ignorePrivatePackage, patterns } = defu(options, {
559
- ignoreRootPackage: true,
560
- ignorePrivatePackage: true
561
- });
562
- const packages = await (0, import_workspace.findWorkspacePackages)(cwd, {
563
- patterns
564
- });
565
- let pkgs = packages.filter((x) => {
566
- if (ignorePrivatePackage && x.manifest.private) {
567
- return false;
568
- }
569
- return true;
570
- }).map((project) => {
571
- const pkgJsonPath = import_pathe3.default.resolve(project.rootDir, "package.json");
572
- return {
573
- ...project,
574
- pkgJsonPath
575
- };
576
- });
577
- if (ignoreRootPackage) {
578
- pkgs = pkgs.filter((x) => {
579
- return import_pathe3.default.normalize(
580
- x.rootDir
581
- ) !== posixCwd;
582
- });
583
- }
584
- return pkgs;
585
- }
586
-
587
- // src/monorepo/context.ts
588
595
  var import_types = require("@pnpm/types");
589
596
  async function createContext(cwd) {
590
597
  const git = new GitClient();
@@ -748,7 +755,7 @@ ${Array.from(set6).map((x) => `- ${import_picocolors.default.green(x)}`).join("\
748
755
  init_cjs_shims();
749
756
  var import_node_process = __toESM(require("process"), 1);
750
757
  var import_node_url = require("url");
751
- var import_checkbox = __toESM(require("@inquirer/checkbox"), 1);
758
+ var import_checkbox2 = __toESM(require("@inquirer/checkbox"), 1);
752
759
  var import_confirm = __toESM(require("@inquirer/confirm"), 1);
753
760
  var import_fs_extra6 = __toESM(require("fs-extra"), 1);
754
761
  var import_klaw = __toESM(require("klaw"), 1);
@@ -762,7 +769,7 @@ init_cjs_shims();
762
769
 
763
770
  // package.json
764
771
  var name = "@icebreakers/monorepo";
765
- var version = "1.0.16";
772
+ var version = "1.0.17";
766
773
 
767
774
  // src/scripts.ts
768
775
  init_cjs_shims();
@@ -893,7 +900,7 @@ async function upgradeMonorepo(opts) {
893
900
  const repoName = await gitClient.getRepoName();
894
901
  let targets = getAssetTargets(raw);
895
902
  if (interactive) {
896
- targets = await (0, import_checkbox.default)({
903
+ targets = await (0, import_checkbox2.default)({
897
904
  message: "\u9009\u62E9\u4F60\u9700\u8981\u7684\u6587\u4EF6",
898
905
  choices: targets.map((x) => {
899
906
  return {
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  setVscodeBinaryMirror,
13
13
  syncNpmMirror,
14
14
  upgradeMonorepo
15
- } from "./chunk-3HPT6GQE.js";
15
+ } from "./chunk-IQWID4TH.js";
16
16
 
17
17
  // src/index.ts
18
18
  init_esm_shims();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@icebreakers/monorepo",
3
3
  "type": "module",
4
- "version": "1.0.16",
4
+ "version": "1.0.17",
5
5
  "description": "icebreaker's monorepo config generator",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -38,10 +38,12 @@
38
38
  "@inquirer/confirm": "^5.1.16",
39
39
  "@inquirer/input": "^4.2.2",
40
40
  "@inquirer/select": "^4.3.2",
41
+ "@pnpm/find-workspace-dir": "^1000.1.2",
41
42
  "@pnpm/logger": "^1001.0.0",
42
43
  "@pnpm/types": "^1000.7.0",
43
44
  "@pnpm/worker": "^1000.1.11",
44
45
  "@pnpm/workspace.find-packages": "^1000.0.33",
46
+ "@pnpm/workspace.read-manifest": "^1000.2.2",
45
47
  "commander": "^14.0.0",
46
48
  "comment-json": "^4.2.5",
47
49
  "consola": "^3.4.2",
@@ -29,8 +29,8 @@
29
29
  "dist"
30
30
  ],
31
31
  "scripts": {
32
- "dev": "unbuild --stub",
33
- "build:watch": "tsup --watch --sourcemap",
32
+ "stub": "unbuild --stub",
33
+ "dev": "tsup --watch --sourcemap",
34
34
  "build": "tsup",
35
35
  "test": "vitest run",
36
36
  "test:dev": "vitest",
@@ -54,7 +54,7 @@
54
54
  "unplugin-vue-router": "^0.15.0",
55
55
  "vite": "^7.1.3",
56
56
  "vite-plugin-dts": "^4.5.4",
57
- "vue": "^3.5.19",
57
+ "vue": "^3.5.20",
58
58
  "vue-router": "^4.5.1",
59
59
  "vue-tsc": "^3.0.6"
60
60
  }