@icebreakers/monorepo 0.6.5 → 0.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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.3.0_jiti@2.3.1_postcss@8.4.47_tsx@4.19.1_typescript@5.6.3_yaml@2.5.1/node_modules/tsup/assets/cjs_shims.js
36
+ // ../../node_modules/.pnpm/tsup@8.3.0_jiti@2.3.1_postcss@8.4.47_tsx@4.19.1_typescript@5.6.3_yaml@2.6.0/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.3.0_jiti@2.3.1_postcss@8.4.47_tsx@4.19.1_typescript@5.6.3_yaml@2.5.1/node_modules/tsup/assets/cjs_shims.js"() {
39
+ "../../node_modules/.pnpm/tsup@8.3.0_jiti@2.3.1_postcss@8.4.47_tsx@4.19.1_typescript@5.6.3_yaml@2.6.0/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();
@@ -60,27 +60,27 @@ var require_get_value = __commonJS({
60
60
  "use strict";
61
61
  init_cjs_shims();
62
62
  var isObject = require_isobject();
63
- module2.exports = function(target, path2, options) {
63
+ module2.exports = function(target, path8, options) {
64
64
  if (!isObject(options)) {
65
65
  options = { default: options };
66
66
  }
67
67
  if (!isValidObject(target)) {
68
68
  return typeof options.default !== "undefined" ? options.default : target;
69
69
  }
70
- if (typeof path2 === "number") {
71
- path2 = String(path2);
70
+ if (typeof path8 === "number") {
71
+ path8 = String(path8);
72
72
  }
73
- const isArray = Array.isArray(path2);
74
- const isString = typeof path2 === "string";
73
+ const isArray = Array.isArray(path8);
74
+ const isString = typeof path8 === "string";
75
75
  const splitChar = options.separator || ".";
76
76
  const joinChar = options.joinChar || (typeof splitChar === "string" ? splitChar : ".");
77
77
  if (!isString && !isArray) {
78
78
  return target;
79
79
  }
80
- if (isString && path2 in target) {
81
- return isValid(path2, target, options) ? target[path2] : options.default;
80
+ if (isString && path8 in target) {
81
+ return isValid(path8, target, options) ? target[path8] : options.default;
82
82
  }
83
- let segs = isArray ? path2 : split(path2, splitChar, options);
83
+ let segs = isArray ? path8 : split(path8, splitChar, options);
84
84
  let len = segs.length;
85
85
  let idx = 0;
86
86
  do {
@@ -126,11 +126,11 @@ var require_get_value = __commonJS({
126
126
  }
127
127
  return segs[0] + joinChar + segs[1];
128
128
  }
129
- function split(path2, splitChar, options) {
129
+ function split(path8, splitChar, options) {
130
130
  if (typeof options.split === "function") {
131
- return options.split(path2);
131
+ return options.split(path8);
132
132
  }
133
- return path2.split(splitChar);
133
+ return path8.split(splitChar);
134
134
  }
135
135
  function isValid(key, target, options) {
136
136
  if (typeof options.isValid === "function") {
@@ -167,7 +167,7 @@ var require_is_plain_object = __commonJS({
167
167
  function isObjectObject(o) {
168
168
  return isObject(o) === true && Object.prototype.toString.call(o) === "[object Object]";
169
169
  }
170
- module2.exports = function isPlainObject(o) {
170
+ module2.exports = function isPlainObject2(o) {
171
171
  var ctor, prot;
172
172
  if (isObjectObject(o) === false) return false;
173
173
  ctor = o.constructor;
@@ -189,7 +189,7 @@ var require_set_value = __commonJS({
189
189
  init_cjs_shims();
190
190
  var { deleteProperty } = Reflect;
191
191
  var isPrimitive = require_is_primitive();
192
- var isPlainObject = require_is_plain_object();
192
+ var isPlainObject2 = require_is_plain_object();
193
193
  var isObject = (value) => {
194
194
  return typeof value === "object" && value !== null || typeof value === "function";
195
195
  };
@@ -270,7 +270,7 @@ var require_set_value = __commonJS({
270
270
  deleteProperty(obj, prop);
271
271
  } else if (options && options.merge) {
272
272
  const merge = options.merge === "function" ? options.merge : Object.assign;
273
- if (merge && isPlainObject(obj[prop]) && isPlainObject(value)) {
273
+ if (merge && isPlainObject2(obj[prop]) && isPlainObject2(value)) {
274
274
  obj[prop] = merge(obj[prop], value);
275
275
  } else {
276
276
  obj[prop] = value;
@@ -280,9 +280,9 @@ var require_set_value = __commonJS({
280
280
  }
281
281
  return obj;
282
282
  };
283
- var setValue = (target, path2, value, options) => {
284
- if (!path2 || !isObject(target)) return target;
285
- const keys = split(path2, options);
283
+ var setValue = (target, path8, value, options) => {
284
+ if (!path8 || !isObject(target)) return target;
285
+ const keys = split(path8, options);
286
286
  let obj = target;
287
287
  for (let i = 0; i < keys.length; i++) {
288
288
  const key = keys[i];
@@ -315,8 +315,18 @@ var require_set_value = __commonJS({
315
315
  // src/index.ts
316
316
  var src_exports = {};
317
317
  __export(src_exports, {
318
+ GitClient: () => GitClient,
319
+ cleanProjects: () => cleanProjects,
318
320
  createNewProject: () => createNewProject,
321
+ escapeStringRegexp: () => escapeStringRegexp,
322
+ getFileHash: () => getFileHash,
323
+ getWorkspacePackages: () => getWorkspacePackages,
324
+ init: () => init,
325
+ isFileChanged: () => isFileChanged,
326
+ isMatch: () => isMatch,
319
327
  setPkgJson: () => setPkgJson,
328
+ setVscodeBinaryMirror: () => setVscodeBinaryMirror,
329
+ syncNpmMirror: () => syncNpmMirror,
320
330
  upgradeMonorepo: () => upgradeMonorepo
321
331
  });
322
332
  module.exports = __toCommonJS(src_exports);
@@ -341,7 +351,7 @@ init_cjs_shims();
341
351
 
342
352
  // package.json
343
353
  var name = "@icebreakers/monorepo";
344
- var version = "0.6.5";
354
+ var version = "0.6.7";
345
355
 
346
356
  // src/logger.ts
347
357
  init_cjs_shims();
@@ -601,10 +611,335 @@ async function createNewProject(name2) {
601
611
  await import_fs_extra.default.copy(import_pathe.default.join(templatesDir, defaultTemplate), import_pathe.default.join(cwd, targetTemplate));
602
612
  logger.success(`${targetTemplate} \u9879\u76EE\u521B\u5EFA\u6210\u529F\uFF01`);
603
613
  }
614
+
615
+ // src/monorepo/index.ts
616
+ init_cjs_shims();
617
+
618
+ // src/monorepo/binaryMirror.ts
619
+ init_cjs_shims();
620
+ var import_comment_json = require("comment-json");
621
+ var import_fs_extra2 = __toESM(require("fs-extra"), 1);
622
+ var import_pathe2 = __toESM(require("pathe"), 1);
623
+
624
+ // src/monorepo/mirror/sources.ts
625
+ init_cjs_shims();
626
+ var chinaMirrorsEnvs = {
627
+ COREPACK_NPM_REGISTRY: "https://registry.npmmirror.com",
628
+ EDGEDRIVER_CDNURL: "https://npmmirror.com/mirrors/edgedriver",
629
+ NODEJS_ORG_MIRROR: "https://cdn.npmmirror.com/binaries/node",
630
+ NVM_NODEJS_ORG_MIRROR: "https://cdn.npmmirror.com/binaries/node",
631
+ PHANTOMJS_CDNURL: "https://cdn.npmmirror.com/binaries/phantomjs",
632
+ CHROMEDRIVER_CDNURL: "https://cdn.npmmirror.com/binaries/chromedriver",
633
+ OPERADRIVER_CDNURL: "https://cdn.npmmirror.com/binaries/operadriver",
634
+ CYPRESS_DOWNLOAD_PATH_TEMPLATE: "https://cdn.npmmirror.com/binaries/cypress/${version}/${platform}-${arch}/cypress.zip",
635
+ ELECTRON_MIRROR: "https://cdn.npmmirror.com/binaries/electron/",
636
+ ELECTRON_BUILDER_BINARIES_MIRROR: "https://cdn.npmmirror.com/binaries/electron-builder-binaries/",
637
+ SASS_BINARY_SITE: "https://cdn.npmmirror.com/binaries/node-sass",
638
+ SWC_BINARY_SITE: "https://cdn.npmmirror.com/binaries/node-swc",
639
+ NWJS_URLBASE: "https://cdn.npmmirror.com/binaries/nwjs/v",
640
+ PUPPETEER_DOWNLOAD_HOST: "https://cdn.npmmirror.com/binaries/chrome-for-testing",
641
+ PUPPETEER_DOWNLOAD_BASE_URL: "https://cdn.npmmirror.com/binaries/chrome-for-testing",
642
+ PLAYWRIGHT_DOWNLOAD_HOST: "https://cdn.npmmirror.com/binaries/playwright",
643
+ SENTRYCLI_CDNURL: "https://cdn.npmmirror.com/binaries/sentry-cli",
644
+ SAUCECTL_INSTALL_BINARY_MIRROR: "https://cdn.npmmirror.com/binaries/saucectl",
645
+ RE2_DOWNLOAD_MIRROR: "https://cdn.npmmirror.com/binaries/node-re2",
646
+ RE2_DOWNLOAD_SKIP_PATH: "true",
647
+ PRISMA_ENGINES_MIRROR: "https://cdn.npmmirror.com/binaries/prisma",
648
+ npm_config_better_sqlite3_binary_host: "https://cdn.npmmirror.com/binaries/better-sqlite3",
649
+ npm_config_keytar_binary_host: "https://cdn.npmmirror.com/binaries/keytar",
650
+ npm_config_sharp_binary_host: "https://cdn.npmmirror.com/binaries/sharp",
651
+ npm_config_sharp_libvips_binary_host: "https://cdn.npmmirror.com/binaries/sharp-libvips",
652
+ npm_config_robotjs_binary_host: "https://cdn.npmmirror.com/binaries/robotjs"
653
+ };
654
+
655
+ // src/monorepo/mirror/utils.ts
656
+ init_cjs_shims();
657
+ var import_set_value2 = __toESM(require_set_value(), 1);
658
+ function setMirror(obj) {
659
+ const platforms = ["linux", "windows", "osx"];
660
+ const prefix = "terminal.integrated.env";
661
+ if (typeof obj === "object" && obj) {
662
+ for (const platform of platforms) {
663
+ (0, import_set_value2.default)(obj, [prefix, platform].join(".").replaceAll(".", "\\."), chinaMirrorsEnvs);
664
+ }
665
+ }
666
+ }
667
+
668
+ // src/monorepo/binaryMirror.ts
669
+ async function setVscodeBinaryMirror(cwd2) {
670
+ const targetJsonPath = import_pathe2.default.resolve(cwd2, ".vscode/settings.json");
671
+ await import_fs_extra2.default.ensureFile(targetJsonPath);
672
+ const json = (0, import_comment_json.parse)(await import_fs_extra2.default.readFile(targetJsonPath, "utf8"), void 0, false);
673
+ json && typeof json === "object" && setMirror(json);
674
+ await import_fs_extra2.default.writeFile(targetJsonPath, `${(0, import_comment_json.stringify)(json, void 0, 2)}
675
+ `, "utf8");
676
+ }
677
+
678
+ // src/monorepo/clean.ts
679
+ init_cjs_shims();
680
+ var import_fs_extra3 = __toESM(require("fs-extra"), 1);
681
+ var import_pathe3 = __toESM(require("pathe"), 1);
682
+ var dirs = [
683
+ "packages/monorepo",
684
+ "packages/foo",
685
+ // 'apps/cli',
686
+ // 'apps/website',
687
+ "apps"
688
+ ];
689
+ async function cleanProjects(cwd2) {
690
+ for (const dir of dirs.map((x) => {
691
+ return import_pathe3.default.resolve(cwd2, x);
692
+ })) {
693
+ await import_fs_extra3.default.remove(dir);
694
+ }
695
+ }
696
+
697
+ // src/monorepo/init.ts
698
+ init_cjs_shims();
699
+
700
+ // src/monorepo/context.ts
701
+ init_cjs_shims();
702
+ var import_pathe5 = __toESM(require("pathe"), 1);
703
+
704
+ // src/monorepo/workspace.ts
705
+ init_cjs_shims();
706
+ var import_workspace = require("@pnpm/workspace.find-packages");
707
+
708
+ // ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
709
+ init_cjs_shims();
710
+ function isPlainObject(value) {
711
+ if (value === null || typeof value !== "object") {
712
+ return false;
713
+ }
714
+ const prototype = Object.getPrototypeOf(value);
715
+ if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
716
+ return false;
717
+ }
718
+ if (Symbol.iterator in value) {
719
+ return false;
720
+ }
721
+ if (Symbol.toStringTag in value) {
722
+ return Object.prototype.toString.call(value) === "[object Module]";
723
+ }
724
+ return true;
725
+ }
726
+ function _defu(baseObject, defaults, namespace = ".", merger) {
727
+ if (!isPlainObject(defaults)) {
728
+ return _defu(baseObject, {}, namespace, merger);
729
+ }
730
+ const object = Object.assign({}, defaults);
731
+ for (const key in baseObject) {
732
+ if (key === "__proto__" || key === "constructor") {
733
+ continue;
734
+ }
735
+ const value = baseObject[key];
736
+ if (value === null || value === void 0) {
737
+ continue;
738
+ }
739
+ if (merger && merger(object, key, value, namespace)) {
740
+ continue;
741
+ }
742
+ if (Array.isArray(value) && Array.isArray(object[key])) {
743
+ object[key] = [...value, ...object[key]];
744
+ } else if (isPlainObject(value) && isPlainObject(object[key])) {
745
+ object[key] = _defu(
746
+ value,
747
+ object[key],
748
+ (namespace ? `${namespace}.` : "") + key.toString(),
749
+ merger
750
+ );
751
+ } else {
752
+ object[key] = value;
753
+ }
754
+ }
755
+ return object;
756
+ }
757
+ function createDefu(merger) {
758
+ return (...arguments_) => (
759
+ // eslint-disable-next-line unicorn/no-array-reduce
760
+ arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
761
+ );
762
+ }
763
+ var defu = createDefu();
764
+ var defuFn = createDefu((object, key, currentValue) => {
765
+ if (object[key] !== void 0 && typeof currentValue === "function") {
766
+ object[key] = currentValue(object[key]);
767
+ return true;
768
+ }
769
+ });
770
+ var defuArrayFn = createDefu((object, key, currentValue) => {
771
+ if (Array.isArray(object[key]) && typeof currentValue === "function") {
772
+ object[key] = currentValue(object[key]);
773
+ return true;
774
+ }
775
+ });
776
+
777
+ // src/monorepo/workspace.ts
778
+ var import_pathe4 = __toESM(require("pathe"), 1);
779
+ async function getWorkspacePackages(cwd2, options) {
780
+ const posixCwd = import_pathe4.default.normalize(cwd2);
781
+ const { ignoreRootPackage, ignorePrivatePackage } = defu(options, {
782
+ ignoreRootPackage: true,
783
+ ignorePrivatePackage: true
784
+ });
785
+ const packages = await (0, import_workspace.findWorkspacePackages)(cwd2);
786
+ let pkgs = packages.filter((x) => {
787
+ if (ignorePrivatePackage && x.manifest.private) {
788
+ return false;
789
+ }
790
+ return true;
791
+ }).map((project) => {
792
+ const pkgJsonPath = import_pathe4.default.resolve(project.rootDir, "package.json");
793
+ return {
794
+ ...project,
795
+ pkgJsonPath
796
+ };
797
+ });
798
+ if (ignoreRootPackage) {
799
+ pkgs = pkgs.filter((x) => {
800
+ return import_pathe4.default.normalize(
801
+ x.rootDir
802
+ ) !== posixCwd;
803
+ });
804
+ }
805
+ return pkgs;
806
+ }
807
+
808
+ // src/monorepo/context.ts
809
+ var import_types = require("@pnpm/types");
810
+ async function createContext(cwd2) {
811
+ const git = new GitClient();
812
+ const workspaceFilepath = import_pathe5.default.resolve(cwd2, "pnpm-workspace.yaml");
813
+ const projects = await getWorkspacePackages(cwd2);
814
+ return {
815
+ cwd: cwd2,
816
+ git,
817
+ workspaceFilepath,
818
+ projects
819
+ };
820
+ }
821
+
822
+ // src/monorepo/setPkgJson.ts
823
+ init_cjs_shims();
824
+ var import_fs_extra4 = __toESM(require("fs-extra"), 1);
825
+ var import_pathe6 = __toESM(require("pathe"), 1);
826
+ var import_set_value3 = __toESM(require_set_value(), 1);
827
+ async function setPkgJson_default(ctx) {
828
+ const { git, projects, cwd: cwd2, workspaceFilepath } = ctx;
829
+ const gitUrl = await git.getGitUrl();
830
+ const gitUser = await git.getUser();
831
+ if (gitUrl && await import_fs_extra4.default.exists(workspaceFilepath)) {
832
+ for (const project of projects) {
833
+ const pkgJson = project.manifest;
834
+ const directory = import_pathe6.default.relative(cwd2, project.rootDir);
835
+ (0, import_set_value3.default)(pkgJson, "bugs.url", `https://github.com/${gitUrl.full_name}/issues`);
836
+ const repository = {
837
+ type: "git",
838
+ url: `git+https://github.com/${gitUrl.full_name}.git`
839
+ };
840
+ if (directory) {
841
+ repository.directory = directory;
842
+ }
843
+ (0, import_set_value3.default)(pkgJson, "repository", repository);
844
+ if (gitUser) {
845
+ (0, import_set_value3.default)(pkgJson, "author", `${gitUser.name} <${gitUser.email}>`);
846
+ }
847
+ await import_fs_extra4.default.writeJSON(project.pkgJsonPath, pkgJson, {
848
+ spaces: 2
849
+ });
850
+ }
851
+ }
852
+ }
853
+
854
+ // src/monorepo/setReadme.ts
855
+ init_cjs_shims();
856
+ var import_fs_extra5 = __toESM(require("fs-extra"), 1);
857
+ var import_pathe7 = __toESM(require("pathe"), 1);
858
+ async function getRows(ctx) {
859
+ const { projects, git, cwd: cwd2 } = ctx;
860
+ const gitUrl = await git.getGitUrl();
861
+ const gitUser = await git.getUser();
862
+ const rows = [];
863
+ if (gitUrl) {
864
+ rows.push(`# ${gitUrl.name}
865
+ `);
866
+ }
867
+ rows.push("## Projects\n");
868
+ for (const project of projects) {
869
+ const p = import_pathe7.default.relative(cwd2, project.rootDirRealPath);
870
+ p && rows.push(`- [${project.manifest.name}](${p}) ${project.manifest.description ? `- ${project.manifest.description}` : ""}`);
871
+ }
872
+ if (gitUrl) {
873
+ rows.push("\n## Contributing\n");
874
+ rows.push("Contributions Welcome! You can contribute in the following ways.");
875
+ rows.push("");
876
+ rows.push("- Create an Issue - Propose a new feature. Report a bug.");
877
+ rows.push("- Pull Request - Fix a bug and typo. Refactor the code.");
878
+ rows.push("- Create third-party middleware - Instruct below.");
879
+ rows.push("- Share - Share your thoughts on the Blog, X, and others.");
880
+ rows.push(`- Make your application - Please try to use ${gitUrl.name}.`);
881
+ rows.push("");
882
+ rows.push("For more details, see [CONTRIBUTING.md](CONTRIBUTING.md).");
883
+ rows.push("\n## Contributors\n");
884
+ rows.push(`Thanks to [all contributors](https://github.com/${gitUrl.full_name}/graphs/contributors)!`);
885
+ }
886
+ rows.push("\n## Authors\n");
887
+ rows.push(`${gitUser.name} <${gitUser.email}>`);
888
+ rows.push("\n## License\n");
889
+ rows.push("Distributed under the MIT License. See [LICENSE](LICENSE) for more information.");
890
+ return rows;
891
+ }
892
+ async function setReadme_default(ctx) {
893
+ const rows = await getRows(ctx);
894
+ await import_fs_extra5.default.writeFile(import_pathe7.default.resolve(ctx.cwd, "README.md"), `${rows.join("\n")}
895
+ `);
896
+ }
897
+
898
+ // src/monorepo/init.ts
899
+ async function init(cwd2) {
900
+ const ctx = await createContext(cwd2);
901
+ await setPkgJson_default(ctx);
902
+ await setReadme_default(ctx);
903
+ }
904
+
905
+ // src/monorepo/sync.ts
906
+ init_cjs_shims();
907
+ var import_node_os = __toESM(require("os"), 1);
908
+ var import_execa = require("execa");
909
+ var import_p_queue2 = __toESM(require("p-queue"), 1);
910
+ var import_picocolors2 = __toESM(require("picocolors"), 1);
911
+ async function syncNpmMirror(cwd2) {
912
+ const packages = await getWorkspacePackages(cwd2);
913
+ const set4 = new Set(packages.map((x) => x.manifest.name));
914
+ logger.info(`[\u5373\u5C06\u540C\u6B65\u7684\u5305]:
915
+ ${Array.from(set4).map((x) => `- ${import_picocolors2.default.green(x)}`).join("\n")}
916
+ `);
917
+ const concurrency = Math.max(import_node_os.default.cpus().length, 1);
918
+ const queue2 = new import_p_queue2.default({ concurrency });
919
+ for (const pkgName of set4) {
920
+ if (pkgName) {
921
+ await queue2.add(async () => {
922
+ return (0, import_execa.execa)({
923
+ stdout: ["pipe", "inherit"]
924
+ })`cnpm sync ${pkgName}`;
925
+ });
926
+ }
927
+ }
928
+ }
604
929
  // Annotate the CommonJS export names for ESM import in node:
605
930
  0 && (module.exports = {
931
+ GitClient,
932
+ cleanProjects,
606
933
  createNewProject,
934
+ escapeStringRegexp,
935
+ getFileHash,
936
+ getWorkspacePackages,
937
+ init,
938
+ isFileChanged,
939
+ isMatch,
607
940
  setPkgJson,
941
+ setVscodeBinaryMirror,
942
+ syncNpmMirror,
608
943
  upgradeMonorepo
609
944
  });
610
945
  /*! Bundled license information:
package/dist/index.d.cts CHANGED
@@ -1,4 +1,9 @@
1
1
  import { PackageJson } from 'pkg-types';
2
+ import * as _pnpm_types from '@pnpm/types';
3
+ import * as simple_git from 'simple-git';
4
+ import { SimpleGitOptions, ConfigValues } from 'simple-git';
5
+ import gitUrlParse from 'git-url-parse';
6
+ import crypto from 'node:crypto';
2
7
 
3
8
  interface CliOpts {
4
9
  interactive?: boolean;
@@ -10,4 +15,46 @@ declare function setPkgJson(sourcePkgJson: PackageJson, targetPkgJson: PackageJs
10
15
  declare function upgradeMonorepo(opts: CliOpts): Promise<void>;
11
16
  declare function createNewProject(name?: string): Promise<void>;
12
17
 
13
- export { createNewProject, setPkgJson, upgradeMonorepo };
18
+ interface GetWorkspacePackagesOptions {
19
+ ignoreRootPackage?: boolean;
20
+ ignorePrivatePackage?: boolean;
21
+ }
22
+ declare function getWorkspacePackages(cwd: string, options?: GetWorkspacePackagesOptions): Promise<{
23
+ pkgJsonPath: string;
24
+ rootDir: _pnpm_types.ProjectRootDir;
25
+ rootDirRealPath: _pnpm_types.ProjectRootDirRealPath;
26
+ modulesDir?: string;
27
+ manifest: _pnpm_types.ProjectManifest;
28
+ writeProjectManifest: (manifest: _pnpm_types.ProjectManifest, force?: boolean | undefined) => Promise<void>;
29
+ }[]>;
30
+
31
+ declare function setVscodeBinaryMirror(cwd: string): Promise<void>;
32
+
33
+ declare function cleanProjects(cwd: string): Promise<void>;
34
+
35
+ declare class GitClient {
36
+ #private;
37
+ private client;
38
+ constructor(options?: Partial<SimpleGitOptions>);
39
+ listConfig(): simple_git.Response<simple_git.ConfigListSummary>;
40
+ init(): Promise<ConfigValues>;
41
+ getConfig(): Promise<ConfigValues>;
42
+ getGitUrl(): Promise<gitUrlParse.GitUrl | undefined>;
43
+ getRepoName(): Promise<string | undefined>;
44
+ getUser(): Promise<{
45
+ name: string;
46
+ email: string;
47
+ }>;
48
+ }
49
+
50
+ declare function init(cwd: string): Promise<void>;
51
+
52
+ declare function syncNpmMirror(cwd: string): Promise<void>;
53
+
54
+ declare function getFileHash(data: crypto.BinaryLike): string;
55
+ declare function isFileChanged(src: crypto.BinaryLike, dest: crypto.BinaryLike): boolean;
56
+
57
+ declare function escapeStringRegexp(str: string): string;
58
+ declare function isMatch(str: string, arr: RegExp[]): boolean;
59
+
60
+ export { type GetWorkspacePackagesOptions, GitClient, cleanProjects, createNewProject, escapeStringRegexp, getFileHash, getWorkspacePackages, init, isFileChanged, isMatch, setPkgJson, setVscodeBinaryMirror, syncNpmMirror, upgradeMonorepo };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,9 @@
1
1
  import { PackageJson } from 'pkg-types';
2
+ import * as _pnpm_types from '@pnpm/types';
3
+ import * as simple_git from 'simple-git';
4
+ import { SimpleGitOptions, ConfigValues } from 'simple-git';
5
+ import gitUrlParse from 'git-url-parse';
6
+ import crypto from 'node:crypto';
2
7
 
3
8
  interface CliOpts {
4
9
  interactive?: boolean;
@@ -10,4 +15,46 @@ declare function setPkgJson(sourcePkgJson: PackageJson, targetPkgJson: PackageJs
10
15
  declare function upgradeMonorepo(opts: CliOpts): Promise<void>;
11
16
  declare function createNewProject(name?: string): Promise<void>;
12
17
 
13
- export { createNewProject, setPkgJson, upgradeMonorepo };
18
+ interface GetWorkspacePackagesOptions {
19
+ ignoreRootPackage?: boolean;
20
+ ignorePrivatePackage?: boolean;
21
+ }
22
+ declare function getWorkspacePackages(cwd: string, options?: GetWorkspacePackagesOptions): Promise<{
23
+ pkgJsonPath: string;
24
+ rootDir: _pnpm_types.ProjectRootDir;
25
+ rootDirRealPath: _pnpm_types.ProjectRootDirRealPath;
26
+ modulesDir?: string;
27
+ manifest: _pnpm_types.ProjectManifest;
28
+ writeProjectManifest: (manifest: _pnpm_types.ProjectManifest, force?: boolean | undefined) => Promise<void>;
29
+ }[]>;
30
+
31
+ declare function setVscodeBinaryMirror(cwd: string): Promise<void>;
32
+
33
+ declare function cleanProjects(cwd: string): Promise<void>;
34
+
35
+ declare class GitClient {
36
+ #private;
37
+ private client;
38
+ constructor(options?: Partial<SimpleGitOptions>);
39
+ listConfig(): simple_git.Response<simple_git.ConfigListSummary>;
40
+ init(): Promise<ConfigValues>;
41
+ getConfig(): Promise<ConfigValues>;
42
+ getGitUrl(): Promise<gitUrlParse.GitUrl | undefined>;
43
+ getRepoName(): Promise<string | undefined>;
44
+ getUser(): Promise<{
45
+ name: string;
46
+ email: string;
47
+ }>;
48
+ }
49
+
50
+ declare function init(cwd: string): Promise<void>;
51
+
52
+ declare function syncNpmMirror(cwd: string): Promise<void>;
53
+
54
+ declare function getFileHash(data: crypto.BinaryLike): string;
55
+ declare function isFileChanged(src: crypto.BinaryLike, dest: crypto.BinaryLike): boolean;
56
+
57
+ declare function escapeStringRegexp(str: string): string;
58
+ declare function isMatch(str: string, arr: RegExp[]): boolean;
59
+
60
+ export { type GetWorkspacePackagesOptions, GitClient, cleanProjects, createNewProject, escapeStringRegexp, getFileHash, getWorkspacePackages, init, isFileChanged, isMatch, setPkgJson, setVscodeBinaryMirror, syncNpmMirror, upgradeMonorepo };
package/dist/index.js CHANGED
@@ -1,14 +1,34 @@
1
1
  import {
2
+ GitClient,
3
+ cleanProjects,
2
4
  createNewProject,
5
+ escapeStringRegexp,
6
+ getFileHash,
7
+ getWorkspacePackages,
8
+ init,
3
9
  init_esm_shims,
10
+ isFileChanged,
11
+ isMatch,
4
12
  setPkgJson,
13
+ setVscodeBinaryMirror,
14
+ syncNpmMirror,
5
15
  upgradeMonorepo
6
- } from "./chunk-E44XFEVA.js";
16
+ } from "./chunk-VZY3ZJJ6.js";
7
17
 
8
18
  // src/index.ts
9
19
  init_esm_shims();
10
20
  export {
21
+ GitClient,
22
+ cleanProjects,
11
23
  createNewProject,
24
+ escapeStringRegexp,
25
+ getFileHash,
26
+ getWorkspacePackages,
27
+ init,
28
+ isFileChanged,
29
+ isMatch,
12
30
  setPkgJson,
31
+ setVscodeBinaryMirror,
32
+ syncNpmMirror,
13
33
  upgradeMonorepo
14
34
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@icebreakers/monorepo",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.7",
5
5
  "description": "icebreaker's monorepo config generator",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",