@icebreakers/monorepo 2.0.10 → 2.0.11

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.
@@ -48,7 +48,7 @@
48
48
  "@icebreakers/monorepo": "workspace:*",
49
49
  "@icebreakers/stylelint-config": "^1.2.1",
50
50
  "@types/fs-extra": "^11.0.4",
51
- "@types/node": "^24.7.2",
51
+ "@types/node": "^24.8.0",
52
52
  "@types/semver": "^7.7.1",
53
53
  "@vitest/coverage-v8": "~3.2.4",
54
54
  "ci-info": "^4.3.1",
@@ -27,11 +27,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  mod
28
28
  ));
29
29
 
30
- // ../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.12_@types+node@24.7.2__jiti@2.6.1_postcss@8.5._3d4ae7d8e5b6f496c0110ecf5a7e8328/node_modules/tsup/assets/esm_shims.js
30
+ // ../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.12_@types+node@24.8.0__jiti@2.6.1_postcss@8.5._ab94ebbbd28243190e5d9689f774411e/node_modules/tsup/assets/esm_shims.js
31
31
  import path from "path";
32
32
  import { fileURLToPath } from "url";
33
33
  var init_esm_shims = __esm({
34
- "../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.12_@types+node@24.7.2__jiti@2.6.1_postcss@8.5._3d4ae7d8e5b6f496c0110ecf5a7e8328/node_modules/tsup/assets/esm_shims.js"() {
34
+ "../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.12_@types+node@24.8.0__jiti@2.6.1_postcss@8.5._ab94ebbbd28243190e5d9689f774411e/node_modules/tsup/assets/esm_shims.js"() {
35
35
  "use strict";
36
36
  }
37
37
  });
@@ -578,7 +578,7 @@ async function cleanProjects(cwd) {
578
578
 
579
579
  // package.json
580
580
  var name = "@icebreakers/monorepo";
581
- var version = "2.0.10";
581
+ var version = "2.0.11";
582
582
 
583
583
  // src/constants.ts
584
584
  init_esm_shims();
@@ -595,6 +595,88 @@ init_esm_shims();
595
595
  import { createConsola } from "consola";
596
596
  var logger = createConsola();
597
597
 
598
+ // src/utils/fs.ts
599
+ init_esm_shims();
600
+ function isIgnorableFsError(error) {
601
+ if (!error) {
602
+ return false;
603
+ }
604
+ const code = error.code;
605
+ return code === "ENOENT" || code === "EBUSY" || code === "EEXIST";
606
+ }
607
+
608
+ // src/utils/gitignore.ts
609
+ init_esm_shims();
610
+ var publishBasename = "gitignore";
611
+ var workspaceBasename = ".gitignore";
612
+ function detectSeparator(input) {
613
+ if (input.includes("\\") && !input.includes("/")) {
614
+ return "\\";
615
+ }
616
+ return "/";
617
+ }
618
+ function replaceBasename(input, from, to) {
619
+ if (!input) {
620
+ return input;
621
+ }
622
+ const separator = detectSeparator(input);
623
+ const normalized = input.replace(/[\\/]/g, separator);
624
+ const hasTrailingSeparator = normalized.endsWith(separator);
625
+ const segments = normalized.split(separator);
626
+ if (hasTrailingSeparator && segments[segments.length - 1] === "") {
627
+ segments.pop();
628
+ }
629
+ const lastIndex = segments.length - 1;
630
+ if (lastIndex >= 0 && segments[lastIndex] === from) {
631
+ segments[lastIndex] = to;
632
+ const rebuilt = segments.join(separator);
633
+ return hasTrailingSeparator ? `${rebuilt}${separator}` : rebuilt;
634
+ }
635
+ return input;
636
+ }
637
+ function toPublishGitignorePath(input) {
638
+ return replaceBasename(input, workspaceBasename, publishBasename);
639
+ }
640
+ function toWorkspaceGitignorePath(input) {
641
+ return replaceBasename(input, publishBasename, workspaceBasename);
642
+ }
643
+ function isGitignoreFile(name2) {
644
+ return toPublishGitignorePath(name2) !== name2 || toWorkspaceGitignorePath(name2) !== name2;
645
+ }
646
+
647
+ // src/utils/hash.ts
648
+ init_esm_shims();
649
+ import crypto from "crypto";
650
+ function getFileHash(data) {
651
+ const hashSum = crypto.createHash("md5");
652
+ hashSum.update(data);
653
+ return hashSum.digest("hex");
654
+ }
655
+ function isFileChanged(src, dest) {
656
+ try {
657
+ const currentHash = getFileHash(src);
658
+ const previousHash = getFileHash(dest);
659
+ return currentHash !== previousHash;
660
+ } catch (err) {
661
+ logger.error("Error calculating file hash:", err);
662
+ return false;
663
+ }
664
+ }
665
+
666
+ // src/utils/regexp.ts
667
+ init_esm_shims();
668
+ function escapeStringRegexp(str) {
669
+ return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
670
+ }
671
+ function isMatch(str, arr) {
672
+ for (const reg of arr) {
673
+ if (reg.test(str)) {
674
+ return true;
675
+ }
676
+ }
677
+ return false;
678
+ }
679
+
598
680
  // src/commands/create.ts
599
681
  init_esm_shims();
600
682
  var import_set_value2 = __toESM(require_set_value(), 1);
@@ -660,7 +742,7 @@ async function createNewProject(options) {
660
742
  const shouldSkip = (src) => path6.basename(src) === ".DS_Store";
661
743
  const copyTasks = filelist.filter((filename) => filename !== "package.json").map(async (filename) => {
662
744
  const sourcePath = path6.resolve(from, filename);
663
- const targetPath = path6.resolve(to, filename === "gitignore" ? ".gitignore" : filename);
745
+ const targetPath = path6.resolve(to, toWorkspaceGitignorePath(filename));
664
746
  await fs2.copy(sourcePath, targetPath, {
665
747
  filter(src) {
666
748
  if (shouldSkip(src)) {
@@ -960,49 +1042,6 @@ ${Array.from(set7).map((x) => `- ${pc2.green(x ?? "")}`).join("\n")}
960
1042
  await Promise.all(tasks);
961
1043
  }
962
1044
 
963
- // src/utils/fs.ts
964
- init_esm_shims();
965
- function isIgnorableFsError(error) {
966
- if (!error) {
967
- return false;
968
- }
969
- const code = error.code;
970
- return code === "ENOENT" || code === "EBUSY" || code === "EEXIST";
971
- }
972
-
973
- // src/utils/hash.ts
974
- init_esm_shims();
975
- import crypto from "crypto";
976
- function getFileHash(data) {
977
- const hashSum = crypto.createHash("md5");
978
- hashSum.update(data);
979
- return hashSum.digest("hex");
980
- }
981
- function isFileChanged(src, dest) {
982
- try {
983
- const currentHash = getFileHash(src);
984
- const previousHash = getFileHash(dest);
985
- return currentHash !== previousHash;
986
- } catch (err) {
987
- logger.error("Error calculating file hash:", err);
988
- return false;
989
- }
990
- }
991
-
992
- // src/utils/regexp.ts
993
- init_esm_shims();
994
- function escapeStringRegexp(str) {
995
- return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
996
- }
997
- function isMatch(str, arr) {
998
- for (const reg of arr) {
999
- if (reg.test(str)) {
1000
- return true;
1001
- }
1002
- }
1003
- return false;
1004
- }
1005
-
1006
1045
  // src/commands/upgrade/index.ts
1007
1046
  init_esm_shims();
1008
1047
  var import_set_value6 = __toESM(require_set_value(), 1);
@@ -1276,17 +1315,14 @@ async function upgradeMonorepo(opts) {
1276
1315
  const pendingOverwrites = [];
1277
1316
  for await (const file of klaw(assetsDir, {
1278
1317
  filter(p) {
1279
- const str = path13.relative(assetsDir, p);
1280
- return isMatch(str, regexpArr);
1318
+ const rel = toWorkspaceGitignorePath(path13.relative(assetsDir, p));
1319
+ return isMatch(rel, regexpArr);
1281
1320
  }
1282
1321
  })) {
1283
1322
  if (!file.stats.isFile()) {
1284
1323
  continue;
1285
1324
  }
1286
- let relPath = path13.relative(assetsDir, file.path);
1287
- if (relPath === "gitignore") {
1288
- relPath = ".gitignore";
1289
- }
1325
+ const relPath = toWorkspaceGitignorePath(path13.relative(assetsDir, file.path));
1290
1326
  if (skipChangesetMarkdown && relPath.startsWith(".changeset/") && relPath.endsWith(".md")) {
1291
1327
  continue;
1292
1328
  }
@@ -1388,6 +1424,14 @@ export {
1388
1424
  assetsDir,
1389
1425
  rootDir,
1390
1426
  logger,
1427
+ isIgnorableFsError,
1428
+ toPublishGitignorePath,
1429
+ toWorkspaceGitignorePath,
1430
+ isGitignoreFile,
1431
+ getFileHash,
1432
+ isFileChanged,
1433
+ escapeStringRegexp,
1434
+ isMatch,
1391
1435
  templateMap,
1392
1436
  defaultTemplate,
1393
1437
  getCreateChoices,
@@ -1397,11 +1441,6 @@ export {
1397
1441
  init,
1398
1442
  setVscodeBinaryMirror,
1399
1443
  syncNpmMirror,
1400
- isIgnorableFsError,
1401
- getFileHash,
1402
- isFileChanged,
1403
- escapeStringRegexp,
1404
- isMatch,
1405
1444
  upgradeMonorepo
1406
1445
  };
1407
1446
  /*! Bundled license information:
package/dist/cli.cjs CHANGED
@@ -28,10 +28,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  mod
29
29
  ));
30
30
 
31
- // ../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.12_@types+node@24.7.2__jiti@2.6.1_postcss@8.5._3d4ae7d8e5b6f496c0110ecf5a7e8328/node_modules/tsup/assets/cjs_shims.js
31
+ // ../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.12_@types+node@24.8.0__jiti@2.6.1_postcss@8.5._ab94ebbbd28243190e5d9689f774411e/node_modules/tsup/assets/cjs_shims.js
32
32
  var getImportMetaUrl, importMetaUrl;
33
33
  var init_cjs_shims = __esm({
34
- "../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.12_@types+node@24.7.2__jiti@2.6.1_postcss@8.5._3d4ae7d8e5b6f496c0110ecf5a7e8328/node_modules/tsup/assets/cjs_shims.js"() {
34
+ "../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.12_@types+node@24.8.0__jiti@2.6.1_postcss@8.5._ab94ebbbd28243190e5d9689f774411e/node_modules/tsup/assets/cjs_shims.js"() {
35
35
  "use strict";
36
36
  getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
37
37
  importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
@@ -605,7 +605,7 @@ var import_node_url = require("url");
605
605
 
606
606
  // package.json
607
607
  var name = "@icebreakers/monorepo";
608
- var version = "2.0.10";
608
+ var version = "2.0.11";
609
609
 
610
610
  // src/constants.ts
611
611
  var packageJsonPath = (0, import_node_url.fileURLToPath)(new URL("../package.json", importMetaUrl));
@@ -619,6 +619,82 @@ init_cjs_shims();
619
619
  var import_consola = require("consola");
620
620
  var logger = (0, import_consola.createConsola)();
621
621
 
622
+ // src/utils/fs.ts
623
+ init_cjs_shims();
624
+ function isIgnorableFsError(error) {
625
+ if (!error) {
626
+ return false;
627
+ }
628
+ const code = error.code;
629
+ return code === "ENOENT" || code === "EBUSY" || code === "EEXIST";
630
+ }
631
+
632
+ // src/utils/gitignore.ts
633
+ init_cjs_shims();
634
+ var publishBasename = "gitignore";
635
+ var workspaceBasename = ".gitignore";
636
+ function detectSeparator(input2) {
637
+ if (input2.includes("\\") && !input2.includes("/")) {
638
+ return "\\";
639
+ }
640
+ return "/";
641
+ }
642
+ function replaceBasename(input2, from, to) {
643
+ if (!input2) {
644
+ return input2;
645
+ }
646
+ const separator = detectSeparator(input2);
647
+ const normalized = input2.replace(/[\\/]/g, separator);
648
+ const hasTrailingSeparator = normalized.endsWith(separator);
649
+ const segments = normalized.split(separator);
650
+ if (hasTrailingSeparator && segments[segments.length - 1] === "") {
651
+ segments.pop();
652
+ }
653
+ const lastIndex = segments.length - 1;
654
+ if (lastIndex >= 0 && segments[lastIndex] === from) {
655
+ segments[lastIndex] = to;
656
+ const rebuilt = segments.join(separator);
657
+ return hasTrailingSeparator ? `${rebuilt}${separator}` : rebuilt;
658
+ }
659
+ return input2;
660
+ }
661
+ function toWorkspaceGitignorePath(input2) {
662
+ return replaceBasename(input2, publishBasename, workspaceBasename);
663
+ }
664
+
665
+ // src/utils/hash.ts
666
+ init_cjs_shims();
667
+ var import_node_crypto = __toESM(require("crypto"), 1);
668
+ function getFileHash(data) {
669
+ const hashSum = import_node_crypto.default.createHash("md5");
670
+ hashSum.update(data);
671
+ return hashSum.digest("hex");
672
+ }
673
+ function isFileChanged(src, dest) {
674
+ try {
675
+ const currentHash = getFileHash(src);
676
+ const previousHash = getFileHash(dest);
677
+ return currentHash !== previousHash;
678
+ } catch (err) {
679
+ logger.error("Error calculating file hash:", err);
680
+ return false;
681
+ }
682
+ }
683
+
684
+ // src/utils/regexp.ts
685
+ init_cjs_shims();
686
+ function escapeStringRegexp(str) {
687
+ return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
688
+ }
689
+ function isMatch(str, arr) {
690
+ for (const reg of arr) {
691
+ if (reg.test(str)) {
692
+ return true;
693
+ }
694
+ }
695
+ return false;
696
+ }
697
+
622
698
  // src/commands/create.ts
623
699
  var templateMap = {
624
700
  "tsup": "packages/tsup-template",
@@ -678,7 +754,7 @@ async function createNewProject(options) {
678
754
  const shouldSkip = (src) => import_pathe4.default.basename(src) === ".DS_Store";
679
755
  const copyTasks = filelist.filter((filename) => filename !== "package.json").map(async (filename) => {
680
756
  const sourcePath = import_pathe4.default.resolve(from, filename);
681
- const targetPath = import_pathe4.default.resolve(to, filename === "gitignore" ? ".gitignore" : filename);
757
+ const targetPath = import_pathe4.default.resolve(to, toWorkspaceGitignorePath(filename));
682
758
  await import_fs_extra2.default.copy(sourcePath, targetPath, {
683
759
  filter(src) {
684
760
  if (shouldSkip(src)) {
@@ -987,49 +1063,6 @@ var import_klaw = __toESM(require("klaw"), 1);
987
1063
  var import_pathe11 = __toESM(require("pathe"), 1);
988
1064
  var import_set_value6 = __toESM(require_set_value(), 1);
989
1065
 
990
- // src/utils/fs.ts
991
- init_cjs_shims();
992
- function isIgnorableFsError(error) {
993
- if (!error) {
994
- return false;
995
- }
996
- const code = error.code;
997
- return code === "ENOENT" || code === "EBUSY" || code === "EEXIST";
998
- }
999
-
1000
- // src/utils/hash.ts
1001
- init_cjs_shims();
1002
- var import_node_crypto = __toESM(require("crypto"), 1);
1003
- function getFileHash(data) {
1004
- const hashSum = import_node_crypto.default.createHash("md5");
1005
- hashSum.update(data);
1006
- return hashSum.digest("hex");
1007
- }
1008
- function isFileChanged(src, dest) {
1009
- try {
1010
- const currentHash = getFileHash(src);
1011
- const previousHash = getFileHash(dest);
1012
- return currentHash !== previousHash;
1013
- } catch (err) {
1014
- logger.error("Error calculating file hash:", err);
1015
- return false;
1016
- }
1017
- }
1018
-
1019
- // src/utils/regexp.ts
1020
- init_cjs_shims();
1021
- function escapeStringRegexp(str) {
1022
- return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
1023
- }
1024
- function isMatch(str, arr) {
1025
- for (const reg of arr) {
1026
- if (reg.test(str)) {
1027
- return true;
1028
- }
1029
- }
1030
- return false;
1031
- }
1032
-
1033
1066
  // src/commands/upgrade/overwrite.ts
1034
1067
  init_cjs_shims();
1035
1068
  var import_node_buffer = require("buffer");
@@ -1294,17 +1327,14 @@ async function upgradeMonorepo(opts) {
1294
1327
  const pendingOverwrites = [];
1295
1328
  for await (const file of (0, import_klaw.default)(assetsDir, {
1296
1329
  filter(p) {
1297
- const str = import_pathe11.default.relative(assetsDir, p);
1298
- return isMatch(str, regexpArr);
1330
+ const rel = toWorkspaceGitignorePath(import_pathe11.default.relative(assetsDir, p));
1331
+ return isMatch(rel, regexpArr);
1299
1332
  }
1300
1333
  })) {
1301
1334
  if (!file.stats.isFile()) {
1302
1335
  continue;
1303
1336
  }
1304
- let relPath = import_pathe11.default.relative(assetsDir, file.path);
1305
- if (relPath === "gitignore") {
1306
- relPath = ".gitignore";
1307
- }
1337
+ const relPath = toWorkspaceGitignorePath(import_pathe11.default.relative(assetsDir, file.path));
1308
1338
  if (skipChangesetMarkdown && relPath.startsWith(".changeset/") && relPath.endsWith(".md")) {
1309
1339
  continue;
1310
1340
  }
package/dist/cli.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  syncNpmMirror,
13
13
  upgradeMonorepo,
14
14
  version
15
- } from "./chunk-3TJYHDE6.js";
15
+ } from "./chunk-T3OVPIEE.js";
16
16
 
17
17
  // src/cli.ts
18
18
  init_esm_shims();
package/dist/index.cjs CHANGED
@@ -33,10 +33,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
33
  ));
34
34
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
35
 
36
- // ../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.12_@types+node@24.7.2__jiti@2.6.1_postcss@8.5._3d4ae7d8e5b6f496c0110ecf5a7e8328/node_modules/tsup/assets/cjs_shims.js
36
+ // ../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.12_@types+node@24.8.0__jiti@2.6.1_postcss@8.5._ab94ebbbd28243190e5d9689f774411e/node_modules/tsup/assets/cjs_shims.js
37
37
  var getImportMetaUrl, importMetaUrl;
38
38
  var init_cjs_shims = __esm({
39
- "../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.12_@types+node@24.7.2__jiti@2.6.1_postcss@8.5._3d4ae7d8e5b6f496c0110ecf5a7e8328/node_modules/tsup/assets/cjs_shims.js"() {
39
+ "../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.12_@types+node@24.8.0__jiti@2.6.1_postcss@8.5._ab94ebbbd28243190e5d9689f774411e/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();
@@ -239,6 +239,7 @@ __export(index_exports, {
239
239
  getWorkspacePackages: () => getWorkspacePackages,
240
240
  init: () => init,
241
241
  isFileChanged: () => isFileChanged,
242
+ isGitignoreFile: () => isGitignoreFile,
242
243
  isIgnorableFsError: () => isIgnorableFsError,
243
244
  isMatch: () => isMatch,
244
245
  loadMonorepoConfig: () => loadMonorepoConfig,
@@ -251,6 +252,8 @@ __export(index_exports, {
251
252
  syncNpmMirror: () => syncNpmMirror,
252
253
  templateMap: () => templateMap,
253
254
  templatesDir: () => templatesDir,
255
+ toPublishGitignorePath: () => toPublishGitignorePath,
256
+ toWorkspaceGitignorePath: () => toWorkspaceGitignorePath,
254
257
  upgradeMonorepo: () => upgradeMonorepo,
255
258
  version: () => version
256
259
  });
@@ -638,7 +641,7 @@ var import_node_url = require("url");
638
641
 
639
642
  // package.json
640
643
  var name = "@icebreakers/monorepo";
641
- var version = "2.0.10";
644
+ var version = "2.0.11";
642
645
 
643
646
  // src/constants.ts
644
647
  var packageJsonPath = (0, import_node_url.fileURLToPath)(new URL("../package.json", importMetaUrl));
@@ -652,6 +655,88 @@ init_cjs_shims();
652
655
  var import_consola = require("consola");
653
656
  var logger = (0, import_consola.createConsola)();
654
657
 
658
+ // src/utils/fs.ts
659
+ init_cjs_shims();
660
+ function isIgnorableFsError(error) {
661
+ if (!error) {
662
+ return false;
663
+ }
664
+ const code = error.code;
665
+ return code === "ENOENT" || code === "EBUSY" || code === "EEXIST";
666
+ }
667
+
668
+ // src/utils/gitignore.ts
669
+ init_cjs_shims();
670
+ var publishBasename = "gitignore";
671
+ var workspaceBasename = ".gitignore";
672
+ function detectSeparator(input) {
673
+ if (input.includes("\\") && !input.includes("/")) {
674
+ return "\\";
675
+ }
676
+ return "/";
677
+ }
678
+ function replaceBasename(input, from, to) {
679
+ if (!input) {
680
+ return input;
681
+ }
682
+ const separator = detectSeparator(input);
683
+ const normalized = input.replace(/[\\/]/g, separator);
684
+ const hasTrailingSeparator = normalized.endsWith(separator);
685
+ const segments = normalized.split(separator);
686
+ if (hasTrailingSeparator && segments[segments.length - 1] === "") {
687
+ segments.pop();
688
+ }
689
+ const lastIndex = segments.length - 1;
690
+ if (lastIndex >= 0 && segments[lastIndex] === from) {
691
+ segments[lastIndex] = to;
692
+ const rebuilt = segments.join(separator);
693
+ return hasTrailingSeparator ? `${rebuilt}${separator}` : rebuilt;
694
+ }
695
+ return input;
696
+ }
697
+ function toPublishGitignorePath(input) {
698
+ return replaceBasename(input, workspaceBasename, publishBasename);
699
+ }
700
+ function toWorkspaceGitignorePath(input) {
701
+ return replaceBasename(input, publishBasename, workspaceBasename);
702
+ }
703
+ function isGitignoreFile(name2) {
704
+ return toPublishGitignorePath(name2) !== name2 || toWorkspaceGitignorePath(name2) !== name2;
705
+ }
706
+
707
+ // src/utils/hash.ts
708
+ init_cjs_shims();
709
+ var import_node_crypto = __toESM(require("crypto"), 1);
710
+ function getFileHash(data) {
711
+ const hashSum = import_node_crypto.default.createHash("md5");
712
+ hashSum.update(data);
713
+ return hashSum.digest("hex");
714
+ }
715
+ function isFileChanged(src, dest) {
716
+ try {
717
+ const currentHash = getFileHash(src);
718
+ const previousHash = getFileHash(dest);
719
+ return currentHash !== previousHash;
720
+ } catch (err) {
721
+ logger.error("Error calculating file hash:", err);
722
+ return false;
723
+ }
724
+ }
725
+
726
+ // src/utils/regexp.ts
727
+ init_cjs_shims();
728
+ function escapeStringRegexp(str) {
729
+ return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
730
+ }
731
+ function isMatch(str, arr) {
732
+ for (const reg of arr) {
733
+ if (reg.test(str)) {
734
+ return true;
735
+ }
736
+ }
737
+ return false;
738
+ }
739
+
655
740
  // src/commands/create.ts
656
741
  var templateMap = {
657
742
  "tsup": "packages/tsup-template",
@@ -711,7 +796,7 @@ async function createNewProject(options) {
711
796
  const shouldSkip = (src) => import_pathe4.default.basename(src) === ".DS_Store";
712
797
  const copyTasks = filelist.filter((filename) => filename !== "package.json").map(async (filename) => {
713
798
  const sourcePath = import_pathe4.default.resolve(from, filename);
714
- const targetPath = import_pathe4.default.resolve(to, filename === "gitignore" ? ".gitignore" : filename);
799
+ const targetPath = import_pathe4.default.resolve(to, toWorkspaceGitignorePath(filename));
715
800
  await import_fs_extra2.default.copy(sourcePath, targetPath, {
716
801
  filter(src) {
717
802
  if (shouldSkip(src)) {
@@ -1020,49 +1105,6 @@ var import_klaw = __toESM(require("klaw"), 1);
1020
1105
  var import_pathe11 = __toESM(require("pathe"), 1);
1021
1106
  var import_set_value6 = __toESM(require_set_value(), 1);
1022
1107
 
1023
- // src/utils/fs.ts
1024
- init_cjs_shims();
1025
- function isIgnorableFsError(error) {
1026
- if (!error) {
1027
- return false;
1028
- }
1029
- const code = error.code;
1030
- return code === "ENOENT" || code === "EBUSY" || code === "EEXIST";
1031
- }
1032
-
1033
- // src/utils/hash.ts
1034
- init_cjs_shims();
1035
- var import_node_crypto = __toESM(require("crypto"), 1);
1036
- function getFileHash(data) {
1037
- const hashSum = import_node_crypto.default.createHash("md5");
1038
- hashSum.update(data);
1039
- return hashSum.digest("hex");
1040
- }
1041
- function isFileChanged(src, dest) {
1042
- try {
1043
- const currentHash = getFileHash(src);
1044
- const previousHash = getFileHash(dest);
1045
- return currentHash !== previousHash;
1046
- } catch (err) {
1047
- logger.error("Error calculating file hash:", err);
1048
- return false;
1049
- }
1050
- }
1051
-
1052
- // src/utils/regexp.ts
1053
- init_cjs_shims();
1054
- function escapeStringRegexp(str) {
1055
- return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
1056
- }
1057
- function isMatch(str, arr) {
1058
- for (const reg of arr) {
1059
- if (reg.test(str)) {
1060
- return true;
1061
- }
1062
- }
1063
- return false;
1064
- }
1065
-
1066
1108
  // src/commands/upgrade/overwrite.ts
1067
1109
  init_cjs_shims();
1068
1110
  var import_node_buffer = require("buffer");
@@ -1327,17 +1369,14 @@ async function upgradeMonorepo(opts) {
1327
1369
  const pendingOverwrites = [];
1328
1370
  for await (const file of (0, import_klaw.default)(assetsDir, {
1329
1371
  filter(p) {
1330
- const str = import_pathe11.default.relative(assetsDir, p);
1331
- return isMatch(str, regexpArr);
1372
+ const rel = toWorkspaceGitignorePath(import_pathe11.default.relative(assetsDir, p));
1373
+ return isMatch(rel, regexpArr);
1332
1374
  }
1333
1375
  })) {
1334
1376
  if (!file.stats.isFile()) {
1335
1377
  continue;
1336
1378
  }
1337
- let relPath = import_pathe11.default.relative(assetsDir, file.path);
1338
- if (relPath === "gitignore") {
1339
- relPath = ".gitignore";
1340
- }
1379
+ const relPath = toWorkspaceGitignorePath(import_pathe11.default.relative(assetsDir, file.path));
1341
1380
  if (skipChangesetMarkdown && relPath.startsWith(".changeset/") && relPath.endsWith(".md")) {
1342
1381
  continue;
1343
1382
  }
@@ -1435,6 +1474,7 @@ async function upgradeMonorepo(opts) {
1435
1474
  getWorkspacePackages,
1436
1475
  init,
1437
1476
  isFileChanged,
1477
+ isGitignoreFile,
1438
1478
  isIgnorableFsError,
1439
1479
  isMatch,
1440
1480
  loadMonorepoConfig,
@@ -1447,6 +1487,8 @@ async function upgradeMonorepo(opts) {
1447
1487
  syncNpmMirror,
1448
1488
  templateMap,
1449
1489
  templatesDir,
1490
+ toPublishGitignorePath,
1491
+ toWorkspaceGitignorePath,
1450
1492
  upgradeMonorepo,
1451
1493
  version
1452
1494
  });
package/dist/index.d.cts CHANGED
@@ -269,7 +269,7 @@ declare function syncNpmMirror(cwd: string, options?: GetWorkspacePackagesOption
269
269
  declare function upgradeMonorepo(opts: CliOpts): Promise<void>;
270
270
 
271
271
  var name = "@icebreakers/monorepo";
272
- var version = "2.0.10";
272
+ var version = "2.0.11";
273
273
 
274
274
  /**
275
275
  * @icebreakers/monorepo 包的根目录,所有模板与资产目录都以此为基准。
@@ -328,6 +328,20 @@ declare const logger: consola.ConsolaInstance;
328
328
  */
329
329
  declare function isIgnorableFsError(error: unknown): error is NodeJS.ErrnoException;
330
330
 
331
+ /**
332
+ * Map a workspace path (containing `.gitignore`) to its packaged variant.
333
+ */
334
+ declare function toPublishGitignorePath(input: string): string;
335
+ /**
336
+ * Map a packaged path (containing `gitignore`) back to the workspace form.
337
+ */
338
+ declare function toWorkspaceGitignorePath(input: string): string;
339
+ /**
340
+ * Convenient helper to check whether a filename (with or without dot prefix)
341
+ * should be treated as a gitignore file.
342
+ */
343
+ declare function isGitignoreFile(name: string): boolean;
344
+
331
345
  /**
332
346
  * 生成给定二进制内容的 md5 摘要,用于快速比较文件内容。
333
347
  */
@@ -346,4 +360,4 @@ declare function escapeStringRegexp(str: string): string;
346
360
  */
347
361
  declare function isMatch(str: string, arr: RegExp[]): boolean;
348
362
 
349
- export { type CleanCommandConfig, type CliOpts, type Context, type CreateChoiceOption, type CreateCommandConfig, type CreateNewProjectOptions, type GetWorkspacePackagesOptions, GitClient, type InitCommandConfig, type MirrorCommandConfig, type MonorepoConfig, type SyncCommandConfig, type UpgradeCommandConfig, assetsDir, cleanProjects, createContext, createNewProject, defineMonorepoConfig, escapeStringRegexp, getCreateChoices, getFileHash, getTemplateMap, getWorkspaceData, getWorkspacePackages, init, isFileChanged, isIgnorableFsError, isMatch, loadMonorepoConfig, logger, name, packageDir, resolveCommandConfig, rootDir, setVscodeBinaryMirror, syncNpmMirror, templateMap, templatesDir, upgradeMonorepo, version };
363
+ export { type CleanCommandConfig, type CliOpts, type Context, type CreateChoiceOption, type CreateCommandConfig, type CreateNewProjectOptions, type GetWorkspacePackagesOptions, GitClient, type InitCommandConfig, type MirrorCommandConfig, type MonorepoConfig, type SyncCommandConfig, type UpgradeCommandConfig, assetsDir, cleanProjects, createContext, createNewProject, defineMonorepoConfig, escapeStringRegexp, getCreateChoices, getFileHash, getTemplateMap, getWorkspaceData, getWorkspacePackages, init, isFileChanged, isGitignoreFile, isIgnorableFsError, isMatch, loadMonorepoConfig, logger, name, packageDir, resolveCommandConfig, rootDir, setVscodeBinaryMirror, syncNpmMirror, templateMap, templatesDir, toPublishGitignorePath, toWorkspaceGitignorePath, upgradeMonorepo, version };
package/dist/index.d.ts CHANGED
@@ -269,7 +269,7 @@ declare function syncNpmMirror(cwd: string, options?: GetWorkspacePackagesOption
269
269
  declare function upgradeMonorepo(opts: CliOpts): Promise<void>;
270
270
 
271
271
  var name = "@icebreakers/monorepo";
272
- var version = "2.0.10";
272
+ var version = "2.0.11";
273
273
 
274
274
  /**
275
275
  * @icebreakers/monorepo 包的根目录,所有模板与资产目录都以此为基准。
@@ -328,6 +328,20 @@ declare const logger: consola.ConsolaInstance;
328
328
  */
329
329
  declare function isIgnorableFsError(error: unknown): error is NodeJS.ErrnoException;
330
330
 
331
+ /**
332
+ * Map a workspace path (containing `.gitignore`) to its packaged variant.
333
+ */
334
+ declare function toPublishGitignorePath(input: string): string;
335
+ /**
336
+ * Map a packaged path (containing `gitignore`) back to the workspace form.
337
+ */
338
+ declare function toWorkspaceGitignorePath(input: string): string;
339
+ /**
340
+ * Convenient helper to check whether a filename (with or without dot prefix)
341
+ * should be treated as a gitignore file.
342
+ */
343
+ declare function isGitignoreFile(name: string): boolean;
344
+
331
345
  /**
332
346
  * 生成给定二进制内容的 md5 摘要,用于快速比较文件内容。
333
347
  */
@@ -346,4 +360,4 @@ declare function escapeStringRegexp(str: string): string;
346
360
  */
347
361
  declare function isMatch(str: string, arr: RegExp[]): boolean;
348
362
 
349
- export { type CleanCommandConfig, type CliOpts, type Context, type CreateChoiceOption, type CreateCommandConfig, type CreateNewProjectOptions, type GetWorkspacePackagesOptions, GitClient, type InitCommandConfig, type MirrorCommandConfig, type MonorepoConfig, type SyncCommandConfig, type UpgradeCommandConfig, assetsDir, cleanProjects, createContext, createNewProject, defineMonorepoConfig, escapeStringRegexp, getCreateChoices, getFileHash, getTemplateMap, getWorkspaceData, getWorkspacePackages, init, isFileChanged, isIgnorableFsError, isMatch, loadMonorepoConfig, logger, name, packageDir, resolveCommandConfig, rootDir, setVscodeBinaryMirror, syncNpmMirror, templateMap, templatesDir, upgradeMonorepo, version };
363
+ export { type CleanCommandConfig, type CliOpts, type Context, type CreateChoiceOption, type CreateCommandConfig, type CreateNewProjectOptions, type GetWorkspacePackagesOptions, GitClient, type InitCommandConfig, type MirrorCommandConfig, type MonorepoConfig, type SyncCommandConfig, type UpgradeCommandConfig, assetsDir, cleanProjects, createContext, createNewProject, defineMonorepoConfig, escapeStringRegexp, getCreateChoices, getFileHash, getTemplateMap, getWorkspaceData, getWorkspacePackages, init, isFileChanged, isGitignoreFile, isIgnorableFsError, isMatch, loadMonorepoConfig, logger, name, packageDir, resolveCommandConfig, rootDir, setVscodeBinaryMirror, syncNpmMirror, templateMap, templatesDir, toPublishGitignorePath, toWorkspaceGitignorePath, upgradeMonorepo, version };
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ import {
14
14
  init,
15
15
  init_esm_shims,
16
16
  isFileChanged,
17
+ isGitignoreFile,
17
18
  isIgnorableFsError,
18
19
  isMatch,
19
20
  loadMonorepoConfig,
@@ -26,9 +27,11 @@ import {
26
27
  syncNpmMirror,
27
28
  templateMap,
28
29
  templatesDir,
30
+ toPublishGitignorePath,
31
+ toWorkspaceGitignorePath,
29
32
  upgradeMonorepo,
30
33
  version
31
- } from "./chunk-3TJYHDE6.js";
34
+ } from "./chunk-T3OVPIEE.js";
32
35
 
33
36
  // src/index.ts
34
37
  init_esm_shims();
@@ -47,6 +50,7 @@ export {
47
50
  getWorkspacePackages,
48
51
  init,
49
52
  isFileChanged,
53
+ isGitignoreFile,
50
54
  isIgnorableFsError,
51
55
  isMatch,
52
56
  loadMonorepoConfig,
@@ -59,6 +63,8 @@ export {
59
63
  syncNpmMirror,
60
64
  templateMap,
61
65
  templatesDir,
66
+ toPublishGitignorePath,
67
+ toWorkspaceGitignorePath,
62
68
  upgradeMonorepo,
63
69
  version
64
70
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@icebreakers/monorepo",
3
3
  "type": "module",
4
- "version": "2.0.10",
4
+ "version": "2.0.11",
5
5
  "description": "The icebreaker's monorepo manager",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@faker-js/faker": "^10.1.0",
18
- "@tanstack/vue-query": "^5.90.3",
18
+ "@tanstack/vue-query": "^5.90.5",
19
19
  "@tanstack/vue-table": "^8.21.3",
20
20
  "@tanstack/vue-virtual": "^3.13.12",
21
21
  "@trpc/client": "^11.6.0",
@@ -33,7 +33,7 @@
33
33
  "@vitejs/plugin-vue": "^6.0.1",
34
34
  "@vitejs/plugin-vue-jsx": "^5.1.1",
35
35
  "@vue/tsconfig": "^0.8.1",
36
- "hono": "^4.9.12",
36
+ "hono": "^4.10.0",
37
37
  "tailwindcss": "^4.1.14",
38
38
  "typescript": "~5.9.3",
39
39
  "unplugin-vue-router": "^0.16.0",
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "devDependencies": {
54
54
  "@hono/node-server": "^1.19.5",
55
- "hono": "^4.9.12",
55
+ "hono": "^4.10.0",
56
56
  "wrangler": "^4.43.0",
57
57
  "zod": "^4.1.12"
58
58
  }