@icebreakers/monorepo 2.0.12 → 2.1.1

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/assets/gitignore CHANGED
@@ -33,4 +33,6 @@ yarn-error.log*
33
33
  .turbo
34
34
 
35
35
  dist
36
- vite.config.ts.timestamp-*.mjs
36
+ vite.config.ts.timestamp-*.mjs
37
+ config.ts.timestamp-*.mjs
38
+ .vite-inspect
@@ -3,7 +3,7 @@
3
3
  "type": "module",
4
4
  "version": "0.0.0",
5
5
  "private": true,
6
- "packageManager": "pnpm@10.18.3",
6
+ "packageManager": "pnpm@10.20.0",
7
7
  "author": "ice breaker <1324318532@qq.com>",
8
8
  "repository": {
9
9
  "type": "git",
@@ -44,27 +44,28 @@
44
44
  "@changesets/cli": "^2.29.7",
45
45
  "@commitlint/cli": "^20.1.0",
46
46
  "@icebreakers/commitlint-config": "^1.2.2",
47
- "@icebreakers/eslint-config": "^1.5.3",
47
+ "@icebreakers/eslint-config": "^1.5.7",
48
48
  "@icebreakers/monorepo": "workspace:*",
49
- "@icebreakers/stylelint-config": "^1.2.2",
49
+ "@icebreakers/stylelint-config": "^1.2.3",
50
50
  "@types/fs-extra": "^11.0.4",
51
- "@types/node": "^24.8.1",
51
+ "@types/node": "^24.9.2",
52
52
  "@types/semver": "^7.7.1",
53
- "@vitest/coverage-v8": "~3.2.4",
53
+ "@vitest/coverage-v8": "~4.0.4",
54
54
  "ci-info": "^4.3.1",
55
55
  "cross-env": "^10.1.0",
56
56
  "defu": "^6.1.4",
57
- "es-toolkit": "^1.40.0",
57
+ "es-toolkit": "^1.41.0",
58
58
  "eslint": "^9.38.0",
59
59
  "execa": "^9.6.0",
60
60
  "fs-extra": "^11.3.2",
61
61
  "husky": "^9.1.7",
62
- "lint-staged": "^16.2.4",
62
+ "lint-staged": "^16.2.6",
63
63
  "only-allow": "^1.2.1",
64
64
  "pathe": "^2.0.3",
65
65
  "pkg-types": "^2.3.0",
66
66
  "rimraf": "^6.0.1",
67
67
  "stylelint": "^16.25.0",
68
+ "tsdown": "^0.15.11",
68
69
  "tslib": "^2.8.1",
69
70
  "tsup": "^8.5.0",
70
71
  "tsx": "^4.20.6",
@@ -72,7 +73,7 @@
72
73
  "type-fest": "^5.1.0",
73
74
  "typescript": "^5.9.3",
74
75
  "unbuild": "^3.6.1",
75
- "vitest": "~3.2.4",
76
+ "vitest": "~4.0.4",
76
77
  "yaml": "^2.8.1"
77
78
  },
78
79
  "publishConfig": {
@@ -5,6 +5,7 @@
5
5
  "moduleResolution": "Bundler",
6
6
  "resolveJsonModule": true,
7
7
  "types": [
8
+ "node",
8
9
  "vitest/globals"
9
10
  ],
10
11
  "allowJs": true,
@@ -1,22 +1,62 @@
1
+ import fs from 'node:fs'
2
+ import path from 'node:path'
3
+ import { fileURLToPath } from 'node:url'
1
4
  import { defineConfig } from 'vitest/config'
2
5
 
3
- export default defineConfig(
4
- () => {
5
- return {
6
- test: {
7
- projects: [
8
- 'packages/*',
9
- 'apps/*',
10
- ],
11
- coverage: {
12
- enabled: true,
13
- all: false,
14
- skipFull: true,
15
- },
16
- forceRerunTriggers: [
17
- '**/{vitest,vite}.config.*/**',
18
- ],
19
- },
6
+ const ROOT_DIR = path.dirname(fileURLToPath(new URL(import.meta.url)))
7
+ const PROJECT_ROOTS = ['packages', 'apps']
8
+ const CONFIG_CANDIDATES = [
9
+ 'vitest.config.ts',
10
+ 'vitest.config.mts',
11
+ 'vitest.config.js',
12
+ 'vitest.config.cjs',
13
+ 'vitest.workspace.ts',
14
+ 'vitest.workspace.mts',
15
+ ]
16
+
17
+ function resolveProjects(): string[] {
18
+ const projects: string[] = []
19
+
20
+ for (const folder of PROJECT_ROOTS) {
21
+ const rootPath = path.resolve(ROOT_DIR, folder)
22
+ if (!fs.existsSync(rootPath)) {
23
+ continue
20
24
  }
21
- },
22
- )
25
+
26
+ const entries = fs.readdirSync(rootPath, { withFileTypes: true })
27
+ for (const entry of entries) {
28
+ if (!entry.isDirectory()) {
29
+ continue
30
+ }
31
+
32
+ const projectDir = path.join(rootPath, entry.name)
33
+ const configPath = CONFIG_CANDIDATES
34
+ .map(candidate => path.join(projectDir, candidate))
35
+ .find(fs.existsSync)
36
+
37
+ if (configPath) {
38
+ projects.push(path.relative(ROOT_DIR, configPath))
39
+ }
40
+ }
41
+ }
42
+
43
+ return projects
44
+ }
45
+
46
+ const projects = resolveProjects()
47
+
48
+ export default defineConfig(() => {
49
+ return {
50
+ test: {
51
+ projects,
52
+ coverage: {
53
+ enabled: true,
54
+ all: false,
55
+ skipFull: true,
56
+ },
57
+ forceRerunTriggers: [
58
+ '**/{vitest,vite}.config.*/**',
59
+ ],
60
+ },
61
+ }
62
+ })
@@ -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.8.1__jiti@2.6.1_postcss@8.5._5dc13af78ced6299ba80e541b8e61d04/node_modules/tsup/assets/esm_shims.js
30
+ // ../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.12_@types+node@24.9.2__jiti@2.6.1_postcss@8.5._faa918d0db1b63b3285372cffbc7e0e4/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.8.1__jiti@2.6.1_postcss@8.5._5dc13af78ced6299ba80e541b8e61d04/node_modules/tsup/assets/esm_shims.js"() {
34
+ "../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.12_@types+node@24.9.2__jiti@2.6.1_postcss@8.5._faa918d0db1b63b3285372cffbc7e0e4/node_modules/tsup/assets/esm_shims.js"() {
35
35
  "use strict";
36
36
  }
37
37
  });
@@ -370,6 +370,17 @@ var GitClient = class {
370
370
  email
371
371
  };
372
372
  }
373
+ /**
374
+ * 获取当前仓库的顶层目录路径。
375
+ */
376
+ async getRepoRoot() {
377
+ try {
378
+ const root = await this.client.revparse(["--show-toplevel"]);
379
+ return typeof root === "string" ? root.trim() : void 0;
380
+ } catch {
381
+ return void 0;
382
+ }
383
+ }
373
384
  };
374
385
 
375
386
  // src/core/workspace.ts
@@ -578,7 +589,7 @@ async function cleanProjects(cwd) {
578
589
 
579
590
  // package.json
580
591
  var name = "@icebreakers/monorepo";
581
- var version = "2.0.12";
592
+ var version = "2.1.1";
582
593
 
583
594
  // src/constants.ts
584
595
  init_esm_shims();
@@ -686,6 +697,7 @@ import path6 from "pathe";
686
697
  import pc from "picocolors";
687
698
  var templateMap = {
688
699
  "tsup": "packages/tsup-template",
700
+ "tsdown": "packages/tsdown-template",
689
701
  "unbuild": "packages/unbuild-template",
690
702
  "vue-lib": "packages/vue-lib-template",
691
703
  "hono-server": "apps/server",
@@ -697,6 +709,7 @@ var defaultTemplate = "unbuild";
697
709
  var baseChoices = [
698
710
  { name: "unbuild \u6253\u5305", value: "unbuild" },
699
711
  { name: "tsup \u6253\u5305", value: "tsup" },
712
+ { name: "tsdown \u6253\u5305", value: "tsdown" },
700
713
  { name: "vue \u7EC4\u4EF6", value: "vue-lib" },
701
714
  { name: "vue hono \u5168\u6808", value: "vue-hono" },
702
715
  { name: "hono \u6A21\u677F", value: "hono-server" },
@@ -716,6 +729,32 @@ function getTemplateMap(extra) {
716
729
  }
717
730
  return base;
718
731
  }
732
+ async function applyGitMetadata(pkgJson, repoDir, targetDir) {
733
+ try {
734
+ const git = new GitClient({ baseDir: repoDir });
735
+ const repoName = await git.getRepoName();
736
+ if (!repoName) {
737
+ return;
738
+ }
739
+ (0, import_set_value2.default)(pkgJson, ["bugs", "url"], `https://github.com/${repoName}/issues`);
740
+ const repository = {
741
+ type: "git",
742
+ url: `git+https://github.com/${repoName}.git`
743
+ };
744
+ const repoRoot = await git.getRepoRoot();
745
+ const directoryBase = repoRoot ?? repoDir;
746
+ const relative = path6.relative(directoryBase, targetDir);
747
+ if (relative && relative !== ".") {
748
+ repository.directory = relative.split(path6.sep).join("/");
749
+ }
750
+ (0, import_set_value2.default)(pkgJson, "repository", repository);
751
+ const gitUser = await git.getUser();
752
+ if ((gitUser == null ? void 0 : gitUser.name) && (gitUser == null ? void 0 : gitUser.email)) {
753
+ (0, import_set_value2.default)(pkgJson, "author", `${gitUser.name} <${gitUser.email}>`);
754
+ }
755
+ } catch {
756
+ }
757
+ }
719
758
  async function createNewProject(options) {
720
759
  const cwd = (options == null ? void 0 : options.cwd) ?? process.cwd();
721
760
  const createConfig = await resolveCommandConfig("create", cwd);
@@ -759,6 +798,7 @@ async function createNewProject(options) {
759
798
  (0, import_set_value2.default)(sourceJson, "version", "0.0.0");
760
799
  const packageName = (name2 == null ? void 0 : name2.startsWith("@")) ? name2 : path6.basename(targetName);
761
800
  (0, import_set_value2.default)(sourceJson, "name", packageName);
801
+ await applyGitMetadata(sourceJson, cwd, to);
762
802
  await fs2.outputJson(
763
803
  path6.resolve(
764
804
  to,
@@ -1240,7 +1280,7 @@ function setPkgJson(sourcePkgJson, targetPkgJson, options) {
1240
1280
 
1241
1281
  // src/commands/upgrade/targets.ts
1242
1282
  init_esm_shims();
1243
- function getAssetTargets(raw) {
1283
+ function getAssetTargets(core) {
1244
1284
  const list = [
1245
1285
  ".changeset",
1246
1286
  ".husky",
@@ -1269,7 +1309,7 @@ function getAssetTargets(raw) {
1269
1309
  ".dockerignore"
1270
1310
  // #endregion
1271
1311
  ];
1272
- if (!raw) {
1312
+ if (!core) {
1273
1313
  list.push(".github", "LICENSE", "renovate.json", "SECURITY.md", "CODE_OF_CONDUCT.md", "CONTRIBUTING.md", "netlify.toml");
1274
1314
  }
1275
1315
  return list;
@@ -1291,7 +1331,9 @@ async function upgradeMonorepo(opts) {
1291
1331
  baseDir: cwd
1292
1332
  });
1293
1333
  const repoName = await gitClient.getRepoName();
1294
- const baseTargets = getAssetTargets(merged.raw);
1334
+ const useCoreAssets = merged.core ?? false;
1335
+ merged.core = useCoreAssets;
1336
+ const baseTargets = getAssetTargets(useCoreAssets);
1295
1337
  const configTargets = (upgradeConfig == null ? void 0 : upgradeConfig.targets) ?? [];
1296
1338
  const mergeTargets = upgradeConfig == null ? void 0 : upgradeConfig.mergeTargets;
1297
1339
  let targets = configTargets.length ? mergeTargets === false ? [...configTargets] : Array.from(/* @__PURE__ */ new Set([...baseTargets, ...configTargets])) : baseTargets;
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.8.1__jiti@2.6.1_postcss@8.5._5dc13af78ced6299ba80e541b8e61d04/node_modules/tsup/assets/cjs_shims.js
31
+ // ../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.12_@types+node@24.9.2__jiti@2.6.1_postcss@8.5._faa918d0db1b63b3285372cffbc7e0e4/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.8.1__jiti@2.6.1_postcss@8.5._5dc13af78ced6299ba80e541b8e61d04/node_modules/tsup/assets/cjs_shims.js"() {
34
+ "../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.12_@types+node@24.9.2__jiti@2.6.1_postcss@8.5._faa918d0db1b63b3285372cffbc7e0e4/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();
@@ -385,6 +385,17 @@ var GitClient = class {
385
385
  email
386
386
  };
387
387
  }
388
+ /**
389
+ * 获取当前仓库的顶层目录路径。
390
+ */
391
+ async getRepoRoot() {
392
+ try {
393
+ const root = await this.client.revparse(["--show-toplevel"]);
394
+ return typeof root === "string" ? root.trim() : void 0;
395
+ } catch {
396
+ return void 0;
397
+ }
398
+ }
388
399
  };
389
400
 
390
401
  // src/core/workspace.ts
@@ -605,7 +616,7 @@ var import_node_url = require("url");
605
616
 
606
617
  // package.json
607
618
  var name = "@icebreakers/monorepo";
608
- var version = "2.0.12";
619
+ var version = "2.1.1";
609
620
 
610
621
  // src/constants.ts
611
622
  var packageJsonPath = (0, import_node_url.fileURLToPath)(new URL("../package.json", importMetaUrl));
@@ -698,6 +709,7 @@ function isMatch(str, arr) {
698
709
  // src/commands/create.ts
699
710
  var templateMap = {
700
711
  "tsup": "packages/tsup-template",
712
+ "tsdown": "packages/tsdown-template",
701
713
  "unbuild": "packages/unbuild-template",
702
714
  "vue-lib": "packages/vue-lib-template",
703
715
  "hono-server": "apps/server",
@@ -709,6 +721,7 @@ var defaultTemplate = "unbuild";
709
721
  var baseChoices = [
710
722
  { name: "unbuild \u6253\u5305", value: "unbuild" },
711
723
  { name: "tsup \u6253\u5305", value: "tsup" },
724
+ { name: "tsdown \u6253\u5305", value: "tsdown" },
712
725
  { name: "vue \u7EC4\u4EF6", value: "vue-lib" },
713
726
  { name: "vue hono \u5168\u6808", value: "vue-hono" },
714
727
  { name: "hono \u6A21\u677F", value: "hono-server" },
@@ -728,6 +741,32 @@ function getTemplateMap(extra) {
728
741
  }
729
742
  return base;
730
743
  }
744
+ async function applyGitMetadata(pkgJson, repoDir, targetDir) {
745
+ try {
746
+ const git = new GitClient({ baseDir: repoDir });
747
+ const repoName = await git.getRepoName();
748
+ if (!repoName) {
749
+ return;
750
+ }
751
+ (0, import_set_value2.default)(pkgJson, ["bugs", "url"], `https://github.com/${repoName}/issues`);
752
+ const repository = {
753
+ type: "git",
754
+ url: `git+https://github.com/${repoName}.git`
755
+ };
756
+ const repoRoot = await git.getRepoRoot();
757
+ const directoryBase = repoRoot ?? repoDir;
758
+ const relative = import_pathe4.default.relative(directoryBase, targetDir);
759
+ if (relative && relative !== ".") {
760
+ repository.directory = relative.split(import_pathe4.default.sep).join("/");
761
+ }
762
+ (0, import_set_value2.default)(pkgJson, "repository", repository);
763
+ const gitUser = await git.getUser();
764
+ if ((gitUser == null ? void 0 : gitUser.name) && (gitUser == null ? void 0 : gitUser.email)) {
765
+ (0, import_set_value2.default)(pkgJson, "author", `${gitUser.name} <${gitUser.email}>`);
766
+ }
767
+ } catch {
768
+ }
769
+ }
731
770
  async function createNewProject(options) {
732
771
  const cwd2 = (options == null ? void 0 : options.cwd) ?? import_node_process.default.cwd();
733
772
  const createConfig = await resolveCommandConfig("create", cwd2);
@@ -771,6 +810,7 @@ async function createNewProject(options) {
771
810
  (0, import_set_value2.default)(sourceJson, "version", "0.0.0");
772
811
  const packageName = (name2 == null ? void 0 : name2.startsWith("@")) ? name2 : import_pathe4.default.basename(targetName);
773
812
  (0, import_set_value2.default)(sourceJson, "name", packageName);
813
+ await applyGitMetadata(sourceJson, cwd2, to);
774
814
  await import_fs_extra2.default.outputJson(
775
815
  import_pathe4.default.resolve(
776
816
  to,
@@ -1252,7 +1292,7 @@ function setPkgJson(sourcePkgJson, targetPkgJson, options) {
1252
1292
 
1253
1293
  // src/commands/upgrade/targets.ts
1254
1294
  init_cjs_shims();
1255
- function getAssetTargets(raw) {
1295
+ function getAssetTargets(core) {
1256
1296
  const list = [
1257
1297
  ".changeset",
1258
1298
  ".husky",
@@ -1281,7 +1321,7 @@ function getAssetTargets(raw) {
1281
1321
  ".dockerignore"
1282
1322
  // #endregion
1283
1323
  ];
1284
- if (!raw) {
1324
+ if (!core) {
1285
1325
  list.push(".github", "LICENSE", "renovate.json", "SECURITY.md", "CODE_OF_CONDUCT.md", "CONTRIBUTING.md", "netlify.toml");
1286
1326
  }
1287
1327
  return list;
@@ -1303,7 +1343,9 @@ async function upgradeMonorepo(opts) {
1303
1343
  baseDir: cwd2
1304
1344
  });
1305
1345
  const repoName = await gitClient.getRepoName();
1306
- const baseTargets = getAssetTargets(merged.raw);
1346
+ const useCoreAssets = merged.core ?? false;
1347
+ merged.core = useCoreAssets;
1348
+ const baseTargets = getAssetTargets(useCoreAssets);
1307
1349
  const configTargets = (upgradeConfig == null ? void 0 : upgradeConfig.targets) ?? [];
1308
1350
  const mergeTargets = upgradeConfig == null ? void 0 : upgradeConfig.mergeTargets;
1309
1351
  let targets = configTargets.length ? mergeTargets === false ? [...configTargets] : Array.from(/* @__PURE__ */ new Set([...baseTargets, ...configTargets])) : baseTargets;
@@ -1420,11 +1462,13 @@ async function upgradeMonorepo(opts) {
1420
1462
  // src/cli/program.ts
1421
1463
  var cwd = import_node_process3.default.cwd();
1422
1464
  import_commander.program.name(name).version(version);
1423
- import_commander.program.command("upgrade").description("\u5347\u7EA7/\u540C\u6B65 monorepo \u76F8\u5173\u5305").alias("up").option("-i,--interactive").option("--raw", "raw mode").option("--outDir <dir>", "Output directory").option("-s,--skip-overwrite", "skip overwrite").action(async (opts) => {
1424
- await upgradeMonorepo({
1465
+ import_commander.program.command("upgrade").description("\u5347\u7EA7/\u540C\u6B65 monorepo \u76F8\u5173\u5305").alias("up").option("-i,--interactive").option("-c,--core", "\u4EC5\u540C\u6B65\u6838\u5FC3\u914D\u7F6E\uFF0C\u8DF3\u8FC7 GitHub \u76F8\u5173\u8D44\u4EA7").option("--outDir <dir>", "Output directory").option("-s,--skip-overwrite", "skip overwrite").action(async (opts) => {
1466
+ const normalized = {
1425
1467
  ...opts,
1468
+ core: opts.core ?? false,
1426
1469
  cwd
1427
- });
1470
+ };
1471
+ await upgradeMonorepo(normalized);
1428
1472
  logger.success("upgrade @icebreakers/monorepo ok!");
1429
1473
  });
1430
1474
  import_commander.program.command("init").description("\u521D\u59CB\u5316 package.json \u548C README.md").action(async () => {
package/dist/cli.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  syncNpmMirror,
13
13
  upgradeMonorepo,
14
14
  version
15
- } from "./chunk-TI2PH65O.js";
15
+ } from "./chunk-WWFO7A5T.js";
16
16
 
17
17
  // src/cli.ts
18
18
  init_esm_shims();
@@ -25,11 +25,13 @@ import select from "@inquirer/select";
25
25
  import { program } from "commander";
26
26
  var cwd = process.cwd();
27
27
  program.name(name).version(version);
28
- program.command("upgrade").description("\u5347\u7EA7/\u540C\u6B65 monorepo \u76F8\u5173\u5305").alias("up").option("-i,--interactive").option("--raw", "raw mode").option("--outDir <dir>", "Output directory").option("-s,--skip-overwrite", "skip overwrite").action(async (opts) => {
29
- await upgradeMonorepo({
28
+ program.command("upgrade").description("\u5347\u7EA7/\u540C\u6B65 monorepo \u76F8\u5173\u5305").alias("up").option("-i,--interactive").option("-c,--core", "\u4EC5\u540C\u6B65\u6838\u5FC3\u914D\u7F6E\uFF0C\u8DF3\u8FC7 GitHub \u76F8\u5173\u8D44\u4EA7").option("--outDir <dir>", "Output directory").option("-s,--skip-overwrite", "skip overwrite").action(async (opts) => {
29
+ const normalized = {
30
30
  ...opts,
31
+ core: opts.core ?? false,
31
32
  cwd
32
- });
33
+ };
34
+ await upgradeMonorepo(normalized);
33
35
  logger.success("upgrade @icebreakers/monorepo ok!");
34
36
  });
35
37
  program.command("init").description("\u521D\u59CB\u5316 package.json \u548C README.md").action(async () => {
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.8.1__jiti@2.6.1_postcss@8.5._5dc13af78ced6299ba80e541b8e61d04/node_modules/tsup/assets/cjs_shims.js
36
+ // ../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.12_@types+node@24.9.2__jiti@2.6.1_postcss@8.5._faa918d0db1b63b3285372cffbc7e0e4/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.8.1__jiti@2.6.1_postcss@8.5._5dc13af78ced6299ba80e541b8e61d04/node_modules/tsup/assets/cjs_shims.js"() {
39
+ "../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.12_@types+node@24.9.2__jiti@2.6.1_postcss@8.5._faa918d0db1b63b3285372cffbc7e0e4/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();
@@ -418,6 +418,17 @@ var GitClient = class {
418
418
  email
419
419
  };
420
420
  }
421
+ /**
422
+ * 获取当前仓库的顶层目录路径。
423
+ */
424
+ async getRepoRoot() {
425
+ try {
426
+ const root = await this.client.revparse(["--show-toplevel"]);
427
+ return typeof root === "string" ? root.trim() : void 0;
428
+ } catch {
429
+ return void 0;
430
+ }
431
+ }
421
432
  };
422
433
 
423
434
  // src/core/workspace.ts
@@ -641,7 +652,7 @@ var import_node_url = require("url");
641
652
 
642
653
  // package.json
643
654
  var name = "@icebreakers/monorepo";
644
- var version = "2.0.12";
655
+ var version = "2.1.1";
645
656
 
646
657
  // src/constants.ts
647
658
  var packageJsonPath = (0, import_node_url.fileURLToPath)(new URL("../package.json", importMetaUrl));
@@ -740,6 +751,7 @@ function isMatch(str, arr) {
740
751
  // src/commands/create.ts
741
752
  var templateMap = {
742
753
  "tsup": "packages/tsup-template",
754
+ "tsdown": "packages/tsdown-template",
743
755
  "unbuild": "packages/unbuild-template",
744
756
  "vue-lib": "packages/vue-lib-template",
745
757
  "hono-server": "apps/server",
@@ -751,6 +763,7 @@ var defaultTemplate = "unbuild";
751
763
  var baseChoices = [
752
764
  { name: "unbuild \u6253\u5305", value: "unbuild" },
753
765
  { name: "tsup \u6253\u5305", value: "tsup" },
766
+ { name: "tsdown \u6253\u5305", value: "tsdown" },
754
767
  { name: "vue \u7EC4\u4EF6", value: "vue-lib" },
755
768
  { name: "vue hono \u5168\u6808", value: "vue-hono" },
756
769
  { name: "hono \u6A21\u677F", value: "hono-server" },
@@ -770,6 +783,32 @@ function getTemplateMap(extra) {
770
783
  }
771
784
  return base;
772
785
  }
786
+ async function applyGitMetadata(pkgJson, repoDir, targetDir) {
787
+ try {
788
+ const git = new GitClient({ baseDir: repoDir });
789
+ const repoName = await git.getRepoName();
790
+ if (!repoName) {
791
+ return;
792
+ }
793
+ (0, import_set_value2.default)(pkgJson, ["bugs", "url"], `https://github.com/${repoName}/issues`);
794
+ const repository = {
795
+ type: "git",
796
+ url: `git+https://github.com/${repoName}.git`
797
+ };
798
+ const repoRoot = await git.getRepoRoot();
799
+ const directoryBase = repoRoot ?? repoDir;
800
+ const relative = import_pathe4.default.relative(directoryBase, targetDir);
801
+ if (relative && relative !== ".") {
802
+ repository.directory = relative.split(import_pathe4.default.sep).join("/");
803
+ }
804
+ (0, import_set_value2.default)(pkgJson, "repository", repository);
805
+ const gitUser = await git.getUser();
806
+ if ((gitUser == null ? void 0 : gitUser.name) && (gitUser == null ? void 0 : gitUser.email)) {
807
+ (0, import_set_value2.default)(pkgJson, "author", `${gitUser.name} <${gitUser.email}>`);
808
+ }
809
+ } catch {
810
+ }
811
+ }
773
812
  async function createNewProject(options) {
774
813
  const cwd = (options == null ? void 0 : options.cwd) ?? import_node_process.default.cwd();
775
814
  const createConfig = await resolveCommandConfig("create", cwd);
@@ -813,6 +852,7 @@ async function createNewProject(options) {
813
852
  (0, import_set_value2.default)(sourceJson, "version", "0.0.0");
814
853
  const packageName = (name2 == null ? void 0 : name2.startsWith("@")) ? name2 : import_pathe4.default.basename(targetName);
815
854
  (0, import_set_value2.default)(sourceJson, "name", packageName);
855
+ await applyGitMetadata(sourceJson, cwd, to);
816
856
  await import_fs_extra2.default.outputJson(
817
857
  import_pathe4.default.resolve(
818
858
  to,
@@ -1294,7 +1334,7 @@ function setPkgJson(sourcePkgJson, targetPkgJson, options) {
1294
1334
 
1295
1335
  // src/commands/upgrade/targets.ts
1296
1336
  init_cjs_shims();
1297
- function getAssetTargets(raw) {
1337
+ function getAssetTargets(core) {
1298
1338
  const list = [
1299
1339
  ".changeset",
1300
1340
  ".husky",
@@ -1323,7 +1363,7 @@ function getAssetTargets(raw) {
1323
1363
  ".dockerignore"
1324
1364
  // #endregion
1325
1365
  ];
1326
- if (!raw) {
1366
+ if (!core) {
1327
1367
  list.push(".github", "LICENSE", "renovate.json", "SECURITY.md", "CODE_OF_CONDUCT.md", "CONTRIBUTING.md", "netlify.toml");
1328
1368
  }
1329
1369
  return list;
@@ -1345,7 +1385,9 @@ async function upgradeMonorepo(opts) {
1345
1385
  baseDir: cwd
1346
1386
  });
1347
1387
  const repoName = await gitClient.getRepoName();
1348
- const baseTargets = getAssetTargets(merged.raw);
1388
+ const useCoreAssets = merged.core ?? false;
1389
+ merged.core = useCoreAssets;
1390
+ const baseTargets = getAssetTargets(useCoreAssets);
1349
1391
  const configTargets = (upgradeConfig == null ? void 0 : upgradeConfig.targets) ?? [];
1350
1392
  const mergeTargets = upgradeConfig == null ? void 0 : upgradeConfig.mergeTargets;
1351
1393
  let targets = configTargets.length ? mergeTargets === false ? [...configTargets] : Array.from(/* @__PURE__ */ new Set([...baseTargets, ...configTargets])) : baseTargets;
package/dist/index.d.cts CHANGED
@@ -48,7 +48,7 @@ declare function getWorkspaceData(cwd: string, options?: GetWorkspacePackagesOpt
48
48
  */
49
49
  interface CliOpts {
50
50
  interactive?: boolean;
51
- raw?: boolean;
51
+ core?: boolean;
52
52
  outDir?: string;
53
53
  cwd?: string;
54
54
  skipOverwrite?: boolean;
@@ -159,6 +159,7 @@ declare function resolveCommandConfig<Name extends keyof NonNullable<MonorepoCon
159
159
  */
160
160
  declare const templateMap: {
161
161
  readonly tsup: "packages/tsup-template";
162
+ readonly tsdown: "packages/tsdown-template";
162
163
  readonly unbuild: "packages/unbuild-template";
163
164
  readonly 'vue-lib': "packages/vue-lib-template";
164
165
  readonly 'hono-server': "apps/server";
@@ -182,6 +183,9 @@ declare function getCreateChoices(choices?: CreateChoiceOption[]): CreateChoiceO
182
183
  } | {
183
184
  readonly name: "tsup 打包";
184
185
  readonly value: "tsup";
186
+ } | {
187
+ readonly name: "tsdown 打包";
188
+ readonly value: "tsdown";
185
189
  } | {
186
190
  readonly name: "vue 组件";
187
191
  readonly value: "vue-lib";
@@ -241,6 +245,10 @@ declare class GitClient {
241
245
  name: string;
242
246
  email: string;
243
247
  }>;
248
+ /**
249
+ * 获取当前仓库的顶层目录路径。
250
+ */
251
+ getRepoRoot(): Promise<string | undefined>;
244
252
  }
245
253
 
246
254
  /**
@@ -269,7 +277,7 @@ declare function syncNpmMirror(cwd: string, options?: GetWorkspacePackagesOption
269
277
  declare function upgradeMonorepo(opts: CliOpts): Promise<void>;
270
278
 
271
279
  var name = "@icebreakers/monorepo";
272
- var version = "2.0.12";
280
+ var version = "2.1.1";
273
281
 
274
282
  /**
275
283
  * @icebreakers/monorepo 包的根目录,所有模板与资产目录都以此为基准。
package/dist/index.d.ts CHANGED
@@ -48,7 +48,7 @@ declare function getWorkspaceData(cwd: string, options?: GetWorkspacePackagesOpt
48
48
  */
49
49
  interface CliOpts {
50
50
  interactive?: boolean;
51
- raw?: boolean;
51
+ core?: boolean;
52
52
  outDir?: string;
53
53
  cwd?: string;
54
54
  skipOverwrite?: boolean;
@@ -159,6 +159,7 @@ declare function resolveCommandConfig<Name extends keyof NonNullable<MonorepoCon
159
159
  */
160
160
  declare const templateMap: {
161
161
  readonly tsup: "packages/tsup-template";
162
+ readonly tsdown: "packages/tsdown-template";
162
163
  readonly unbuild: "packages/unbuild-template";
163
164
  readonly 'vue-lib': "packages/vue-lib-template";
164
165
  readonly 'hono-server': "apps/server";
@@ -182,6 +183,9 @@ declare function getCreateChoices(choices?: CreateChoiceOption[]): CreateChoiceO
182
183
  } | {
183
184
  readonly name: "tsup 打包";
184
185
  readonly value: "tsup";
186
+ } | {
187
+ readonly name: "tsdown 打包";
188
+ readonly value: "tsdown";
185
189
  } | {
186
190
  readonly name: "vue 组件";
187
191
  readonly value: "vue-lib";
@@ -241,6 +245,10 @@ declare class GitClient {
241
245
  name: string;
242
246
  email: string;
243
247
  }>;
248
+ /**
249
+ * 获取当前仓库的顶层目录路径。
250
+ */
251
+ getRepoRoot(): Promise<string | undefined>;
244
252
  }
245
253
 
246
254
  /**
@@ -269,7 +277,7 @@ declare function syncNpmMirror(cwd: string, options?: GetWorkspacePackagesOption
269
277
  declare function upgradeMonorepo(opts: CliOpts): Promise<void>;
270
278
 
271
279
  var name = "@icebreakers/monorepo";
272
- var version = "2.0.12";
280
+ var version = "2.1.1";
273
281
 
274
282
  /**
275
283
  * @icebreakers/monorepo 包的根目录,所有模板与资产目录都以此为基准。
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ import {
31
31
  toWorkspaceGitignorePath,
32
32
  upgradeMonorepo,
33
33
  version
34
- } from "./chunk-TI2PH65O.js";
34
+ } from "./chunk-WWFO7A5T.js";
35
35
 
36
36
  // src/index.ts
37
37
  init_esm_shims();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@icebreakers/monorepo",
3
3
  "type": "module",
4
- "version": "2.0.12",
4
+ "version": "2.1.1",
5
5
  "description": "The icebreaker's monorepo manager",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -39,12 +39,12 @@
39
39
  "@inquirer/select": "^4.4.0",
40
40
  "@pnpm/find-workspace-dir": "^1000.1.3",
41
41
  "@pnpm/logger": "^1001.0.1",
42
- "@pnpm/types": "^1000.8.0",
43
- "@pnpm/worker": "^1000.2.0",
44
- "@pnpm/workspace.find-packages": "^1000.0.41",
45
- "@pnpm/workspace.read-manifest": "^1000.2.4",
42
+ "@pnpm/types": "^1000.9.0",
43
+ "@pnpm/worker": "^1000.3.0",
44
+ "@pnpm/workspace.find-packages": "^1000.0.43",
45
+ "@pnpm/workspace.read-manifest": "^1000.2.5",
46
46
  "c12": "^3.3.1",
47
- "commander": "^14.0.1",
47
+ "commander": "^14.0.2",
48
48
  "comment-json": "^4.4.1",
49
49
  "consola": "^3.4.2",
50
50
  "execa": "^9.6.0",
@@ -59,7 +59,7 @@
59
59
  },
60
60
  "devDependencies": {
61
61
  "@types/klaw": "^3.0.7",
62
- "@types/micromatch": "^4.0.9",
62
+ "@types/micromatch": "^4.0.10",
63
63
  "@types/set-value": "^4.0.3",
64
64
  "fast-glob": "^3.3.3",
65
65
  "fdir": "^6.5.0",
@@ -18,30 +18,30 @@
18
18
  "@tanstack/vue-query": "^5.90.5",
19
19
  "@tanstack/vue-table": "^8.21.3",
20
20
  "@tanstack/vue-virtual": "^3.13.12",
21
- "@trpc/client": "^11.6.0",
21
+ "@trpc/client": "^11.7.1",
22
22
  "pinia": "^3.0.3",
23
23
  "vue": "^3.5.22",
24
24
  "vue-i18n": "^11.1.12",
25
25
  "vue-router": "^4.6.3"
26
26
  },
27
27
  "devDependencies": {
28
- "@cloudflare/vite-plugin": "^1.13.13",
28
+ "@cloudflare/vite-plugin": "^1.13.16",
29
29
  "@hono/node-server": "^1.19.5",
30
30
  "@hono/trpc-server": "^0.4.0",
31
- "@tailwindcss/vite": "^4.1.14",
32
- "@trpc/server": "^11.6.0",
31
+ "@tailwindcss/vite": "^4.1.16",
32
+ "@trpc/server": "^11.7.1",
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.10.1",
37
- "tailwindcss": "^4.1.14",
36
+ "hono": "^4.10.3",
37
+ "tailwindcss": "^4.1.16",
38
38
  "typescript": "~5.9.3",
39
39
  "unplugin-vue-router": "^0.16.0",
40
- "vite": "^7.1.10",
40
+ "vite": "^7.1.12",
41
41
  "vite-plugin-vue-devtools": "^8.0.3",
42
42
  "vite-tsconfig-paths": "^5.1.4",
43
- "vue-tsc": "3.1.1",
44
- "wrangler": "^4.43.0",
43
+ "vue-tsc": "3.1.2",
44
+ "wrangler": "^4.45.1",
45
45
  "zod": "^4.1.12"
46
46
  }
47
47
  }
@@ -52,8 +52,8 @@
52
52
  },
53
53
  "devDependencies": {
54
54
  "@hono/node-server": "^1.19.5",
55
- "hono": "^4.10.1",
56
- "wrangler": "^4.43.0",
55
+ "hono": "^4.10.3",
56
+ "wrangler": "^4.45.1",
57
57
  "zod": "^4.1.12"
58
58
  }
59
59
  }
@@ -101,9 +101,9 @@ npx monorepo up # 使用本地 CLI
101
101
  npx @icebreakers/monorepo@latest up # 直接使用远端 CLI
102
102
 
103
103
  # 常用参数
104
- # --raw 排除 GitHub 相关文件
105
- # -i 以交互方式筛选文件
106
- # -s 跳过新增,仅覆盖已存在文件
104
+ # -c, --core 仅同步核心配置,排除 GitHub 相关文件
105
+ # -i 以交互方式筛选文件
106
+ # -s 跳过新增,仅覆盖已存在文件
107
107
  ```
108
108
 
109
109
  升级 CLI 后再执行 `up`,可以同步获得模板最新的工作流、脚手架与配置。
@@ -23,13 +23,13 @@
23
23
  },
24
24
  "devDependencies": {
25
25
  "@braintree/sanitize-url": "^7.1.1",
26
- "@tailwindcss/vite": "^4.1.14",
26
+ "@tailwindcss/vite": "^4.1.16",
27
27
  "cytoscape": "^3.33.1",
28
28
  "cytoscape-cose-bilkent": "^4.1.0",
29
29
  "dayjs": "^1.11.18",
30
30
  "debug": "^4.4.3",
31
- "mermaid": "^11.12.0",
32
- "tailwindcss": "^4.1.14",
31
+ "mermaid": "^11.12.1",
32
+ "tailwindcss": "^4.1.16",
33
33
  "vitepress": "^1.6.4",
34
34
  "vitepress-plugin-mermaid": "^2.0.17"
35
35
  }
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@icebreakers/tsdown-template",
3
+ "type": "module",
4
+ "version": "0.0.0",
5
+ "description": "tsdown bundler template",
6
+ "author": "ice breaker <1324318532@qq.com>",
7
+ "license": "MIT",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/sonofmagic/monorepo-template.git",
11
+ "directory": "packages/tsdown-template"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/sonofmagic/monorepo-template/issues"
15
+ },
16
+ "keywords": [],
17
+ "sideEffects": false,
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.mjs",
22
+ "require": "./dist/index.cjs"
23
+ }
24
+ },
25
+ "main": "./dist/index.cjs",
26
+ "module": "./dist/index.mjs",
27
+ "types": "./dist/index.d.ts",
28
+ "files": [
29
+ "dist"
30
+ ],
31
+ "scripts": {
32
+ "dev": "tsdown -w",
33
+ "build": "tsdown",
34
+ "test": "vitest run",
35
+ "test:dev": "vitest",
36
+ "release": "pnpm publish",
37
+ "lint": "eslint .",
38
+ "lint:fix": "eslint . --fix"
39
+ },
40
+ "publishConfig": {}
41
+ }
@@ -0,0 +1,5 @@
1
+ export function greet(name: string) {
2
+ return `hello ${name}`
3
+ }
4
+
5
+ export const VERSION = '0.0.0'
@@ -0,0 +1,11 @@
1
+ import { greet, VERSION } from '@/index'
2
+
3
+ describe('tsdown template', () => {
4
+ it('greets with provided name', () => {
5
+ expect(greet('world')).toBe('hello world')
6
+ })
7
+
8
+ it('exposes version placeholder', () => {
9
+ expect(VERSION).toBe('0.0.0')
10
+ })
11
+ })
@@ -0,0 +1,15 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "baseUrl": ".",
5
+ "paths": {
6
+ "@/*": [
7
+ "src/*"
8
+ ]
9
+ }
10
+ },
11
+ "include": [
12
+ "src",
13
+ "test"
14
+ ]
15
+ }
@@ -0,0 +1,9 @@
1
+ import { defineConfig } from 'tsdown'
2
+
3
+ export default defineConfig({
4
+ entry: ['./src/index.ts'],
5
+ format: ['esm', 'cjs'],
6
+ dts: true,
7
+ clean: true,
8
+ target: 'node18',
9
+ })
@@ -0,0 +1,15 @@
1
+ import path from 'node:path'
2
+ import { defineProject } from 'vitest/config'
3
+
4
+ export default defineProject({
5
+ test: {
6
+ alias: [
7
+ {
8
+ find: '@',
9
+ replacement: path.resolve(__dirname, './src'),
10
+ },
11
+ ],
12
+ globals: true,
13
+ testTimeout: 60_000,
14
+ },
15
+ })
@@ -45,17 +45,17 @@
45
45
  "types": "./dist/index.d.ts"
46
46
  },
47
47
  "devDependencies": {
48
- "@tailwindcss/vite": "^4.1.14",
48
+ "@tailwindcss/vite": "^4.1.16",
49
49
  "@vitejs/plugin-vue": "^6.0.1",
50
50
  "@vue/test-utils": "^2.4.6",
51
51
  "@vue/tsconfig": "^0.8.1",
52
- "jsdom": "^27.0.0",
53
- "tailwindcss": "^4.1.14",
52
+ "jsdom": "^27.0.1",
53
+ "tailwindcss": "^4.1.16",
54
54
  "unplugin-vue-router": "^0.16.0",
55
- "vite": "^7.1.10",
55
+ "vite": "^7.1.12",
56
56
  "vite-plugin-dts": "^4.5.4",
57
57
  "vue": "^3.5.22",
58
58
  "vue-router": "^4.6.3",
59
- "vue-tsc": "^3.1.1"
59
+ "vue-tsc": "^3.1.2"
60
60
  }
61
61
  }