@icebreakers/monorepo 1.0.17 → 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.
- package/dist/{chunk-IQWID4TH.js → chunk-VXG3KCQ5.js} +133 -126
- package/dist/cli.cjs +132 -125
- package/dist/cli.js +2 -2
- package/dist/index.cjs +132 -125
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -244,75 +244,14 @@ init_cjs_shims();
|
|
|
244
244
|
// src/monorepo/index.ts
|
|
245
245
|
init_cjs_shims();
|
|
246
246
|
|
|
247
|
-
// src/monorepo/binaryMirror.ts
|
|
248
|
-
init_cjs_shims();
|
|
249
|
-
var import_comment_json = require("comment-json");
|
|
250
|
-
var import_fs_extra = __toESM(require("fs-extra"), 1);
|
|
251
|
-
var import_pathe = __toESM(require("pathe"), 1);
|
|
252
|
-
|
|
253
|
-
// src/monorepo/mirror/sources.ts
|
|
254
|
-
init_cjs_shims();
|
|
255
|
-
var chinaMirrorsEnvs = {
|
|
256
|
-
COREPACK_NPM_REGISTRY: "https://registry.npmmirror.com",
|
|
257
|
-
EDGEDRIVER_CDNURL: "https://npmmirror.com/mirrors/edgedriver",
|
|
258
|
-
NODEJS_ORG_MIRROR: "https://cdn.npmmirror.com/binaries/node",
|
|
259
|
-
NVM_NODEJS_ORG_MIRROR: "https://cdn.npmmirror.com/binaries/node",
|
|
260
|
-
PHANTOMJS_CDNURL: "https://cdn.npmmirror.com/binaries/phantomjs",
|
|
261
|
-
CHROMEDRIVER_CDNURL: "https://cdn.npmmirror.com/binaries/chromedriver",
|
|
262
|
-
OPERADRIVER_CDNURL: "https://cdn.npmmirror.com/binaries/operadriver",
|
|
263
|
-
CYPRESS_DOWNLOAD_PATH_TEMPLATE: "https://cdn.npmmirror.com/binaries/cypress/${version}/${platform}-${arch}/cypress.zip",
|
|
264
|
-
ELECTRON_MIRROR: "https://cdn.npmmirror.com/binaries/electron/",
|
|
265
|
-
ELECTRON_BUILDER_BINARIES_MIRROR: "https://cdn.npmmirror.com/binaries/electron-builder-binaries/",
|
|
266
|
-
SASS_BINARY_SITE: "https://cdn.npmmirror.com/binaries/node-sass",
|
|
267
|
-
SWC_BINARY_SITE: "https://cdn.npmmirror.com/binaries/node-swc",
|
|
268
|
-
NWJS_URLBASE: "https://cdn.npmmirror.com/binaries/nwjs/v",
|
|
269
|
-
PUPPETEER_DOWNLOAD_HOST: "https://cdn.npmmirror.com/binaries/chrome-for-testing",
|
|
270
|
-
PUPPETEER_DOWNLOAD_BASE_URL: "https://cdn.npmmirror.com/binaries/chrome-for-testing",
|
|
271
|
-
PLAYWRIGHT_DOWNLOAD_HOST: "https://cdn.npmmirror.com/binaries/playwright",
|
|
272
|
-
SENTRYCLI_CDNURL: "https://cdn.npmmirror.com/binaries/sentry-cli",
|
|
273
|
-
SAUCECTL_INSTALL_BINARY_MIRROR: "https://cdn.npmmirror.com/binaries/saucectl",
|
|
274
|
-
RE2_DOWNLOAD_MIRROR: "https://cdn.npmmirror.com/binaries/node-re2",
|
|
275
|
-
RE2_DOWNLOAD_SKIP_PATH: "true",
|
|
276
|
-
PRISMA_ENGINES_MIRROR: "https://cdn.npmmirror.com/binaries/prisma",
|
|
277
|
-
npm_config_better_sqlite3_binary_host: "https://cdn.npmmirror.com/binaries/better-sqlite3",
|
|
278
|
-
npm_config_keytar_binary_host: "https://cdn.npmmirror.com/binaries/keytar",
|
|
279
|
-
npm_config_sharp_binary_host: "https://cdn.npmmirror.com/binaries/sharp",
|
|
280
|
-
npm_config_sharp_libvips_binary_host: "https://cdn.npmmirror.com/binaries/sharp-libvips",
|
|
281
|
-
npm_config_robotjs_binary_host: "https://cdn.npmmirror.com/binaries/robotjs"
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
// src/monorepo/mirror/utils.ts
|
|
285
|
-
init_cjs_shims();
|
|
286
|
-
var import_set_value = __toESM(require_set_value(), 1);
|
|
287
|
-
function setMirror(obj) {
|
|
288
|
-
const platforms = ["linux", "windows", "osx"];
|
|
289
|
-
const prefix = "terminal.integrated.env";
|
|
290
|
-
if (typeof obj === "object" && obj) {
|
|
291
|
-
for (const platform of platforms) {
|
|
292
|
-
(0, import_set_value.default)(obj, [prefix, platform].join(".").replaceAll(".", "\\."), chinaMirrorsEnvs);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
// src/monorepo/binaryMirror.ts
|
|
298
|
-
async function setVscodeBinaryMirror(cwd) {
|
|
299
|
-
const targetJsonPath = import_pathe.default.resolve(cwd, ".vscode/settings.json");
|
|
300
|
-
await import_fs_extra.default.ensureFile(targetJsonPath);
|
|
301
|
-
const json = (0, import_comment_json.parse)(await import_fs_extra.default.readFile(targetJsonPath, "utf8"), void 0, false);
|
|
302
|
-
json && typeof json === "object" && setMirror(json);
|
|
303
|
-
await import_fs_extra.default.writeFile(targetJsonPath, `${(0, import_comment_json.stringify)(json, void 0, 2)}
|
|
304
|
-
`, "utf8");
|
|
305
|
-
}
|
|
306
|
-
|
|
307
247
|
// src/monorepo/clean.ts
|
|
308
248
|
init_cjs_shims();
|
|
309
249
|
var import_checkbox = __toESM(require("@inquirer/checkbox"), 1);
|
|
310
|
-
var
|
|
311
|
-
var
|
|
312
|
-
var
|
|
313
|
-
var import_set_value2 = __toESM(require_set_value(), 1);
|
|
250
|
+
var import_fs_extra = __toESM(require("fs-extra"), 1);
|
|
251
|
+
var import_pathe2 = __toESM(require("pathe"), 1);
|
|
252
|
+
var import_set_value = __toESM(require_set_value(), 1);
|
|
314
253
|
|
|
315
|
-
// src/monorepo/workspace.ts
|
|
254
|
+
// src/monorepo/workspace/index.ts
|
|
316
255
|
init_cjs_shims();
|
|
317
256
|
var import_find_workspace_dir = require("@pnpm/find-workspace-dir");
|
|
318
257
|
var import_workspace = require("@pnpm/workspace.find-packages");
|
|
@@ -387,14 +326,13 @@ var defuArrayFn = createDefu((object, key, currentValue) => {
|
|
|
387
326
|
}
|
|
388
327
|
});
|
|
389
328
|
|
|
390
|
-
// src/monorepo/workspace.ts
|
|
391
|
-
var
|
|
392
|
-
async function getWorkspacePackages(
|
|
329
|
+
// src/monorepo/workspace/index.ts
|
|
330
|
+
var import_pathe = __toESM(require("pathe"), 1);
|
|
331
|
+
async function getWorkspacePackages(workspaceDir, options) {
|
|
393
332
|
const { ignoreRootPackage, ignorePrivatePackage, patterns } = defu(options, {
|
|
394
333
|
ignoreRootPackage: true,
|
|
395
334
|
ignorePrivatePackage: true
|
|
396
335
|
});
|
|
397
|
-
const workspaceDir = await (0, import_find_workspace_dir.findWorkspaceDir)(cwd) ?? cwd;
|
|
398
336
|
const manifest = await (0, import_workspace2.readWorkspaceManifest)(workspaceDir);
|
|
399
337
|
const packages = await (0, import_workspace.findWorkspacePackages)(workspaceDir, {
|
|
400
338
|
patterns: patterns ?? (manifest == null ? void 0 : manifest.packages)
|
|
@@ -405,7 +343,7 @@ async function getWorkspacePackages(cwd, options) {
|
|
|
405
343
|
}
|
|
406
344
|
return true;
|
|
407
345
|
}).map((project) => {
|
|
408
|
-
const pkgJsonPath =
|
|
346
|
+
const pkgJsonPath = import_pathe.default.resolve(project.rootDir, "package.json");
|
|
409
347
|
return {
|
|
410
348
|
...project,
|
|
411
349
|
pkgJsonPath
|
|
@@ -418,18 +356,24 @@ async function getWorkspacePackages(cwd, options) {
|
|
|
418
356
|
}
|
|
419
357
|
return pkgs;
|
|
420
358
|
}
|
|
359
|
+
async function getWorkspaceData(cwd, options) {
|
|
360
|
+
const workspaceDir = await (0, import_find_workspace_dir.findWorkspaceDir)(cwd) ?? cwd;
|
|
361
|
+
const packages = await getWorkspacePackages(workspaceDir, options);
|
|
362
|
+
return {
|
|
363
|
+
cwd,
|
|
364
|
+
workspaceDir,
|
|
365
|
+
packages
|
|
366
|
+
};
|
|
367
|
+
}
|
|
421
368
|
|
|
422
369
|
// src/monorepo/clean.ts
|
|
423
370
|
async function cleanProjects(cwd) {
|
|
424
|
-
const workspaceDir = await (
|
|
425
|
-
const packages = await getWorkspacePackages(workspaceDir, {
|
|
426
|
-
ignorePrivatePackage: false
|
|
427
|
-
});
|
|
371
|
+
const { packages, workspaceDir } = await getWorkspaceData(cwd);
|
|
428
372
|
const cleanDirs = await (0, import_checkbox.default)({
|
|
429
373
|
message: "\u8BF7\u9009\u62E9\u9700\u8981\u6E05\u7406\u7684\u76EE\u5F55",
|
|
430
374
|
choices: packages.map((x) => {
|
|
431
375
|
return {
|
|
432
|
-
name:
|
|
376
|
+
name: import_pathe2.default.relative(workspaceDir, x.rootDir),
|
|
433
377
|
value: x.rootDir,
|
|
434
378
|
checked: true,
|
|
435
379
|
description: x.manifest.name
|
|
@@ -437,17 +381,17 @@ async function cleanProjects(cwd) {
|
|
|
437
381
|
})
|
|
438
382
|
});
|
|
439
383
|
for (const dir of cleanDirs) {
|
|
440
|
-
await
|
|
384
|
+
await import_fs_extra.default.remove(dir);
|
|
441
385
|
}
|
|
442
|
-
const name2 = "package.json";
|
|
443
|
-
const pkgJson = await
|
|
444
|
-
(0,
|
|
445
|
-
await
|
|
386
|
+
const name2 = import_pathe2.default.resolve(workspaceDir, "package.json");
|
|
387
|
+
const pkgJson = await import_fs_extra.default.readJson(name2);
|
|
388
|
+
(0, import_set_value.default)(pkgJson, "devDependencies.@icebreakers/monorepo", "latest", { preservePaths: false });
|
|
389
|
+
await import_fs_extra.default.outputJson(name2, pkgJson, {
|
|
446
390
|
spaces: 2
|
|
447
391
|
});
|
|
448
392
|
}
|
|
449
393
|
|
|
450
|
-
// src/monorepo/git.ts
|
|
394
|
+
// src/monorepo/git/index.ts
|
|
451
395
|
init_cjs_shims();
|
|
452
396
|
|
|
453
397
|
// ../../node_modules/.pnpm/get-value@4.0.1/node_modules/get-value/dist/index.mjs
|
|
@@ -538,7 +482,7 @@ var getValue = /* @__PURE__ */ __name((target, path10, options = {}) => {
|
|
|
538
482
|
}, "getValue");
|
|
539
483
|
var index_default = getValue;
|
|
540
484
|
|
|
541
|
-
// src/monorepo/git.ts
|
|
485
|
+
// src/monorepo/git/index.ts
|
|
542
486
|
var import_git_url_parse = __toESM(require("git-url-parse"), 1);
|
|
543
487
|
var import_simple_git = require("simple-git");
|
|
544
488
|
var GitClient = class {
|
|
@@ -586,17 +530,17 @@ var GitClient = class {
|
|
|
586
530
|
}
|
|
587
531
|
};
|
|
588
532
|
|
|
589
|
-
// src/monorepo/init.ts
|
|
533
|
+
// src/monorepo/init/index.ts
|
|
590
534
|
init_cjs_shims();
|
|
591
535
|
|
|
592
|
-
// src/monorepo/context.ts
|
|
536
|
+
// src/monorepo/context/index.ts
|
|
593
537
|
init_cjs_shims();
|
|
594
|
-
var
|
|
538
|
+
var import_pathe3 = __toESM(require("pathe"), 1);
|
|
595
539
|
var import_types = require("@pnpm/types");
|
|
596
540
|
async function createContext(cwd) {
|
|
597
541
|
const git = new GitClient();
|
|
598
|
-
const
|
|
599
|
-
const
|
|
542
|
+
const { packages, workspaceDir } = await getWorkspaceData(cwd);
|
|
543
|
+
const workspaceFilepath = import_pathe3.default.resolve(workspaceDir, "pnpm-workspace.yaml");
|
|
600
544
|
const gitUrl = await git.getGitUrl();
|
|
601
545
|
const gitUser = await git.getUser();
|
|
602
546
|
return {
|
|
@@ -604,44 +548,45 @@ async function createContext(cwd) {
|
|
|
604
548
|
git,
|
|
605
549
|
gitUrl,
|
|
606
550
|
gitUser,
|
|
551
|
+
workspaceDir,
|
|
607
552
|
workspaceFilepath,
|
|
608
|
-
|
|
553
|
+
packages
|
|
609
554
|
};
|
|
610
555
|
}
|
|
611
556
|
|
|
612
|
-
// src/monorepo/setChangeset.ts
|
|
557
|
+
// src/monorepo/init/setChangeset.ts
|
|
613
558
|
init_cjs_shims();
|
|
614
|
-
var
|
|
615
|
-
var
|
|
616
|
-
var
|
|
559
|
+
var import_fs_extra2 = __toESM(require("fs-extra"), 1);
|
|
560
|
+
var import_pathe4 = __toESM(require("pathe"), 1);
|
|
561
|
+
var import_set_value2 = __toESM(require_set_value(), 1);
|
|
617
562
|
async function setChangeset_default(ctx) {
|
|
618
563
|
const { gitUrl, workspaceFilepath } = ctx;
|
|
619
|
-
if (gitUrl && await
|
|
620
|
-
const changesetConfigPath =
|
|
621
|
-
if (await
|
|
622
|
-
const changesetConfig = await
|
|
564
|
+
if (gitUrl && await import_fs_extra2.default.exists(workspaceFilepath)) {
|
|
565
|
+
const changesetConfigPath = import_pathe4.default.resolve(import_pathe4.default.dirname(workspaceFilepath), ".changeset/config.json");
|
|
566
|
+
if (await import_fs_extra2.default.exists(changesetConfigPath)) {
|
|
567
|
+
const changesetConfig = await import_fs_extra2.default.readJson(
|
|
623
568
|
changesetConfigPath
|
|
624
569
|
);
|
|
625
570
|
if (gitUrl.full_name) {
|
|
626
|
-
(0,
|
|
627
|
-
await
|
|
571
|
+
(0, import_set_value2.default)(changesetConfig, "changelog.1.repo", gitUrl.full_name);
|
|
572
|
+
await import_fs_extra2.default.outputJson(changesetConfigPath, changesetConfig, { spaces: 2 });
|
|
628
573
|
}
|
|
629
574
|
}
|
|
630
575
|
}
|
|
631
576
|
}
|
|
632
577
|
|
|
633
|
-
// src/monorepo/setPkgJson.ts
|
|
578
|
+
// src/monorepo/init/setPkgJson.ts
|
|
634
579
|
init_cjs_shims();
|
|
635
|
-
var
|
|
636
|
-
var
|
|
637
|
-
var
|
|
580
|
+
var import_fs_extra3 = __toESM(require("fs-extra"), 1);
|
|
581
|
+
var import_pathe5 = __toESM(require("pathe"), 1);
|
|
582
|
+
var import_set_value3 = __toESM(require_set_value(), 1);
|
|
638
583
|
async function setPkgJson_default(ctx) {
|
|
639
|
-
const { gitUrl, gitUser,
|
|
640
|
-
if (gitUrl && await
|
|
641
|
-
for (const
|
|
642
|
-
const pkgJson =
|
|
643
|
-
const directory =
|
|
644
|
-
(0,
|
|
584
|
+
const { gitUrl, gitUser, packages, cwd, workspaceFilepath } = ctx;
|
|
585
|
+
if (gitUrl && await import_fs_extra3.default.exists(workspaceFilepath)) {
|
|
586
|
+
for (const pkg of packages) {
|
|
587
|
+
const pkgJson = pkg.manifest;
|
|
588
|
+
const directory = import_pathe5.default.relative(cwd, pkg.rootDir);
|
|
589
|
+
(0, import_set_value3.default)(pkgJson, "bugs.url", `https://github.com/${gitUrl.full_name}/issues`);
|
|
645
590
|
const repository = {
|
|
646
591
|
type: "git",
|
|
647
592
|
url: `git+https://github.com/${gitUrl.full_name}.git`
|
|
@@ -649,23 +594,23 @@ async function setPkgJson_default(ctx) {
|
|
|
649
594
|
if (directory) {
|
|
650
595
|
repository.directory = directory;
|
|
651
596
|
}
|
|
652
|
-
(0,
|
|
597
|
+
(0, import_set_value3.default)(pkgJson, "repository", repository);
|
|
653
598
|
if (gitUser) {
|
|
654
|
-
(0,
|
|
599
|
+
(0, import_set_value3.default)(pkgJson, "author", `${gitUser.name} <${gitUser.email}>`);
|
|
655
600
|
}
|
|
656
|
-
await
|
|
601
|
+
await import_fs_extra3.default.writeJSON(pkg.pkgJsonPath, pkgJson, {
|
|
657
602
|
spaces: 2
|
|
658
603
|
});
|
|
659
604
|
}
|
|
660
605
|
}
|
|
661
606
|
}
|
|
662
607
|
|
|
663
|
-
// src/monorepo/setReadme.ts
|
|
608
|
+
// src/monorepo/init/setReadme.ts
|
|
664
609
|
init_cjs_shims();
|
|
665
|
-
var
|
|
666
|
-
var
|
|
610
|
+
var import_fs_extra4 = __toESM(require("fs-extra"), 1);
|
|
611
|
+
var import_pathe6 = __toESM(require("pathe"), 1);
|
|
667
612
|
async function getRows(ctx) {
|
|
668
|
-
const {
|
|
613
|
+
const { packages, git, cwd } = ctx;
|
|
669
614
|
const gitUrl = await git.getGitUrl();
|
|
670
615
|
const gitUser = await git.getUser();
|
|
671
616
|
const rows = [];
|
|
@@ -673,12 +618,12 @@ async function getRows(ctx) {
|
|
|
673
618
|
rows.push(`# ${gitUrl.name}
|
|
674
619
|
`);
|
|
675
620
|
}
|
|
676
|
-
rows.push("##
|
|
677
|
-
for (const
|
|
678
|
-
const p =
|
|
621
|
+
rows.push("## Packages\n");
|
|
622
|
+
for (const pkg of packages) {
|
|
623
|
+
const p = import_pathe6.default.relative(cwd, pkg.rootDirRealPath);
|
|
679
624
|
if (p) {
|
|
680
|
-
const description =
|
|
681
|
-
rows.push(`- [${
|
|
625
|
+
const description = pkg.manifest.description ? `- ${pkg.manifest.description}` : "";
|
|
626
|
+
rows.push(`- [${pkg.manifest.name}](${p}) ${description}`);
|
|
682
627
|
}
|
|
683
628
|
}
|
|
684
629
|
if (gitUrl) {
|
|
@@ -703,11 +648,11 @@ async function getRows(ctx) {
|
|
|
703
648
|
}
|
|
704
649
|
async function setReadme_default(ctx) {
|
|
705
650
|
const rows = await getRows(ctx);
|
|
706
|
-
await
|
|
651
|
+
await import_fs_extra4.default.writeFile(import_pathe6.default.resolve(ctx.cwd, "README.md"), `${rows.join("\n")}
|
|
707
652
|
`);
|
|
708
653
|
}
|
|
709
654
|
|
|
710
|
-
// src/monorepo/init.ts
|
|
655
|
+
// src/monorepo/init/index.ts
|
|
711
656
|
async function init(cwd) {
|
|
712
657
|
const ctx = await createContext(cwd);
|
|
713
658
|
await setChangeset_default(ctx);
|
|
@@ -715,6 +660,68 @@ async function init(cwd) {
|
|
|
715
660
|
await setReadme_default(ctx);
|
|
716
661
|
}
|
|
717
662
|
|
|
663
|
+
// src/monorepo/mirror/binaryMirror.ts
|
|
664
|
+
init_cjs_shims();
|
|
665
|
+
var import_comment_json = require("comment-json");
|
|
666
|
+
var import_fs_extra5 = __toESM(require("fs-extra"), 1);
|
|
667
|
+
var import_pathe7 = __toESM(require("pathe"), 1);
|
|
668
|
+
|
|
669
|
+
// src/monorepo/mirror/utils.ts
|
|
670
|
+
init_cjs_shims();
|
|
671
|
+
var import_set_value4 = __toESM(require_set_value(), 1);
|
|
672
|
+
|
|
673
|
+
// src/monorepo/mirror/sources.ts
|
|
674
|
+
init_cjs_shims();
|
|
675
|
+
var chinaMirrorsEnvs = {
|
|
676
|
+
COREPACK_NPM_REGISTRY: "https://registry.npmmirror.com",
|
|
677
|
+
EDGEDRIVER_CDNURL: "https://npmmirror.com/mirrors/edgedriver",
|
|
678
|
+
NODEJS_ORG_MIRROR: "https://cdn.npmmirror.com/binaries/node",
|
|
679
|
+
NVM_NODEJS_ORG_MIRROR: "https://cdn.npmmirror.com/binaries/node",
|
|
680
|
+
PHANTOMJS_CDNURL: "https://cdn.npmmirror.com/binaries/phantomjs",
|
|
681
|
+
CHROMEDRIVER_CDNURL: "https://cdn.npmmirror.com/binaries/chromedriver",
|
|
682
|
+
OPERADRIVER_CDNURL: "https://cdn.npmmirror.com/binaries/operadriver",
|
|
683
|
+
CYPRESS_DOWNLOAD_PATH_TEMPLATE: "https://cdn.npmmirror.com/binaries/cypress/${version}/${platform}-${arch}/cypress.zip",
|
|
684
|
+
ELECTRON_MIRROR: "https://cdn.npmmirror.com/binaries/electron/",
|
|
685
|
+
ELECTRON_BUILDER_BINARIES_MIRROR: "https://cdn.npmmirror.com/binaries/electron-builder-binaries/",
|
|
686
|
+
SASS_BINARY_SITE: "https://cdn.npmmirror.com/binaries/node-sass",
|
|
687
|
+
SWC_BINARY_SITE: "https://cdn.npmmirror.com/binaries/node-swc",
|
|
688
|
+
NWJS_URLBASE: "https://cdn.npmmirror.com/binaries/nwjs/v",
|
|
689
|
+
PUPPETEER_DOWNLOAD_HOST: "https://cdn.npmmirror.com/binaries/chrome-for-testing",
|
|
690
|
+
PUPPETEER_DOWNLOAD_BASE_URL: "https://cdn.npmmirror.com/binaries/chrome-for-testing",
|
|
691
|
+
PLAYWRIGHT_DOWNLOAD_HOST: "https://cdn.npmmirror.com/binaries/playwright",
|
|
692
|
+
SENTRYCLI_CDNURL: "https://cdn.npmmirror.com/binaries/sentry-cli",
|
|
693
|
+
SAUCECTL_INSTALL_BINARY_MIRROR: "https://cdn.npmmirror.com/binaries/saucectl",
|
|
694
|
+
RE2_DOWNLOAD_MIRROR: "https://cdn.npmmirror.com/binaries/node-re2",
|
|
695
|
+
RE2_DOWNLOAD_SKIP_PATH: "true",
|
|
696
|
+
PRISMA_ENGINES_MIRROR: "https://cdn.npmmirror.com/binaries/prisma",
|
|
697
|
+
npm_config_better_sqlite3_binary_host: "https://cdn.npmmirror.com/binaries/better-sqlite3",
|
|
698
|
+
npm_config_keytar_binary_host: "https://cdn.npmmirror.com/binaries/keytar",
|
|
699
|
+
npm_config_sharp_binary_host: "https://cdn.npmmirror.com/binaries/sharp",
|
|
700
|
+
npm_config_sharp_libvips_binary_host: "https://cdn.npmmirror.com/binaries/sharp-libvips",
|
|
701
|
+
npm_config_robotjs_binary_host: "https://cdn.npmmirror.com/binaries/robotjs"
|
|
702
|
+
};
|
|
703
|
+
|
|
704
|
+
// src/monorepo/mirror/utils.ts
|
|
705
|
+
function setMirror(obj) {
|
|
706
|
+
const platforms = ["linux", "windows", "osx"];
|
|
707
|
+
const prefix = "terminal.integrated.env";
|
|
708
|
+
if (typeof obj === "object" && obj) {
|
|
709
|
+
for (const platform of platforms) {
|
|
710
|
+
(0, import_set_value4.default)(obj, [prefix, platform].join(".").replaceAll(".", "\\."), chinaMirrorsEnvs);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
// src/monorepo/mirror/binaryMirror.ts
|
|
716
|
+
async function setVscodeBinaryMirror(cwd) {
|
|
717
|
+
const targetJsonPath = import_pathe7.default.resolve(cwd, ".vscode/settings.json");
|
|
718
|
+
await import_fs_extra5.default.ensureFile(targetJsonPath);
|
|
719
|
+
const json = (0, import_comment_json.parse)(await import_fs_extra5.default.readFile(targetJsonPath, "utf8"), void 0, false);
|
|
720
|
+
json && typeof json === "object" && setMirror(json);
|
|
721
|
+
await import_fs_extra5.default.writeFile(targetJsonPath, `${(0, import_comment_json.stringify)(json, void 0, 2)}
|
|
722
|
+
`, "utf8");
|
|
723
|
+
}
|
|
724
|
+
|
|
718
725
|
// src/monorepo/sync.ts
|
|
719
726
|
init_cjs_shims();
|
|
720
727
|
var import_node_os = __toESM(require("os"), 1);
|
|
@@ -730,9 +737,9 @@ var logger = (0, import_consola.createConsola)();
|
|
|
730
737
|
|
|
731
738
|
// src/monorepo/sync.ts
|
|
732
739
|
async function syncNpmMirror(cwd, options) {
|
|
733
|
-
const packages = await
|
|
740
|
+
const { packages, workspaceDir } = await getWorkspaceData(cwd, options);
|
|
734
741
|
logger.info(`[\u5F53\u524D\u5DE5\u4F5C\u533ARepo]:
|
|
735
|
-
${packages.map((x) => `- ${import_picocolors.default.green(x.manifest.name)} : ${import_pathe8.default.relative(
|
|
742
|
+
${packages.map((x) => `- ${import_picocolors.default.green(x.manifest.name)} : ${import_pathe8.default.relative(workspaceDir, x.rootDir)}`).join("\n")}
|
|
736
743
|
`);
|
|
737
744
|
const set6 = new Set(packages.map((x) => x.manifest.name));
|
|
738
745
|
logger.info(`[\u5373\u5C06\u540C\u6B65\u7684\u5305]:
|
|
@@ -769,7 +776,7 @@ init_cjs_shims();
|
|
|
769
776
|
|
|
770
777
|
// package.json
|
|
771
778
|
var name = "@icebreakers/monorepo";
|
|
772
|
-
var version = "1.0
|
|
779
|
+
var version = "1.1.0";
|
|
773
780
|
|
|
774
781
|
// src/scripts.ts
|
|
775
782
|
init_cjs_shims();
|
package/dist/index.d.cts
CHANGED
|
@@ -10,7 +10,7 @@ interface GetWorkspacePackagesOptions {
|
|
|
10
10
|
ignorePrivatePackage?: boolean;
|
|
11
11
|
patterns?: string[];
|
|
12
12
|
}
|
|
13
|
-
declare function getWorkspacePackages(
|
|
13
|
+
declare function getWorkspacePackages(workspaceDir: string, options?: GetWorkspacePackagesOptions): Promise<{
|
|
14
14
|
pkgJsonPath: string;
|
|
15
15
|
rootDir: _pnpm_types.ProjectRootDir;
|
|
16
16
|
rootDirRealPath: _pnpm_types.ProjectRootDirRealPath;
|
|
@@ -19,8 +19,6 @@ declare function getWorkspacePackages(cwd: string, options?: GetWorkspacePackage
|
|
|
19
19
|
writeProjectManifest: (manifest: _pnpm_types.ProjectManifest, force?: boolean | undefined) => Promise<void>;
|
|
20
20
|
}[]>;
|
|
21
21
|
|
|
22
|
-
declare function setVscodeBinaryMirror(cwd: string): Promise<void>;
|
|
23
|
-
|
|
24
22
|
declare function cleanProjects(cwd: string): Promise<void>;
|
|
25
23
|
|
|
26
24
|
interface CliOpts {
|
|
@@ -48,6 +46,8 @@ declare class GitClient {
|
|
|
48
46
|
|
|
49
47
|
declare function init(cwd: string): Promise<void>;
|
|
50
48
|
|
|
49
|
+
declare function setVscodeBinaryMirror(cwd: string): Promise<void>;
|
|
50
|
+
|
|
51
51
|
declare function syncNpmMirror(cwd: string, options?: GetWorkspacePackagesOptions): Promise<void>;
|
|
52
52
|
|
|
53
53
|
declare function setPkgJson(sourcePkgJson: PackageJson, targetPkgJson: PackageJson): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ interface GetWorkspacePackagesOptions {
|
|
|
10
10
|
ignorePrivatePackage?: boolean;
|
|
11
11
|
patterns?: string[];
|
|
12
12
|
}
|
|
13
|
-
declare function getWorkspacePackages(
|
|
13
|
+
declare function getWorkspacePackages(workspaceDir: string, options?: GetWorkspacePackagesOptions): Promise<{
|
|
14
14
|
pkgJsonPath: string;
|
|
15
15
|
rootDir: _pnpm_types.ProjectRootDir;
|
|
16
16
|
rootDirRealPath: _pnpm_types.ProjectRootDirRealPath;
|
|
@@ -19,8 +19,6 @@ declare function getWorkspacePackages(cwd: string, options?: GetWorkspacePackage
|
|
|
19
19
|
writeProjectManifest: (manifest: _pnpm_types.ProjectManifest, force?: boolean | undefined) => Promise<void>;
|
|
20
20
|
}[]>;
|
|
21
21
|
|
|
22
|
-
declare function setVscodeBinaryMirror(cwd: string): Promise<void>;
|
|
23
|
-
|
|
24
22
|
declare function cleanProjects(cwd: string): Promise<void>;
|
|
25
23
|
|
|
26
24
|
interface CliOpts {
|
|
@@ -48,6 +46,8 @@ declare class GitClient {
|
|
|
48
46
|
|
|
49
47
|
declare function init(cwd: string): Promise<void>;
|
|
50
48
|
|
|
49
|
+
declare function setVscodeBinaryMirror(cwd: string): Promise<void>;
|
|
50
|
+
|
|
51
51
|
declare function syncNpmMirror(cwd: string, options?: GetWorkspacePackagesOptions): Promise<void>;
|
|
52
52
|
|
|
53
53
|
declare function setPkgJson(sourcePkgJson: PackageJson, targetPkgJson: PackageJson): void;
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icebreakers/monorepo",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0
|
|
5
|
-
"description": "icebreaker's monorepo
|
|
4
|
+
"version": "1.1.0",
|
|
5
|
+
"description": "The icebreaker's monorepo manager",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"homepage": "https://monorepo.icebreaker.top",
|