@icebreakers/monorepo 2.1.0 → 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 +3 -1
- package/assets/package.json +8 -7
- package/assets/tsconfig.json +1 -0
- package/assets/vitest.config.ts +59 -19
- package/dist/{chunk-EPWHEHM2.js → chunk-WWFO7A5T.js} +43 -3
- package/dist/cli.cjs +43 -3
- package/dist/cli.js +1 -1
- package/dist/index.cjs +43 -3
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +1 -1
- package/package.json +4 -4
- package/templates/apps/client/package.json +9 -9
- package/templates/apps/server/package.json +2 -2
- package/templates/apps/website/package.json +3 -3
- package/templates/packages/tsdown-template/package.json +41 -0
- package/templates/packages/tsdown-template/src/index.ts +5 -0
- package/templates/packages/tsdown-template/test/index.test.ts +11 -0
- package/templates/packages/tsdown-template/tsconfig.json +15 -0
- package/templates/packages/tsdown-template/tsdown.config.ts +9 -0
- package/templates/packages/tsdown-template/vitest.config.ts +15 -0
- package/templates/packages/vue-lib-template/package.json +4 -4
package/assets/gitignore
CHANGED
package/assets/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"version": "0.0.0",
|
|
5
5
|
"private": true,
|
|
6
|
-
"packageManager": "pnpm@10.
|
|
6
|
+
"packageManager": "pnpm@10.20.0",
|
|
7
7
|
"author": "ice breaker <1324318532@qq.com>",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -44,17 +44,17 @@
|
|
|
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.
|
|
47
|
+
"@icebreakers/eslint-config": "^1.5.7",
|
|
48
48
|
"@icebreakers/monorepo": "workspace:*",
|
|
49
|
-
"@icebreakers/stylelint-config": "^1.2.
|
|
49
|
+
"@icebreakers/stylelint-config": "^1.2.3",
|
|
50
50
|
"@types/fs-extra": "^11.0.4",
|
|
51
|
-
"@types/node": "^24.9.
|
|
51
|
+
"@types/node": "^24.9.2",
|
|
52
52
|
"@types/semver": "^7.7.1",
|
|
53
|
-
"@vitest/coverage-v8": "~
|
|
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.
|
|
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",
|
|
@@ -65,6 +65,7 @@
|
|
|
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": "~
|
|
76
|
+
"vitest": "~4.0.4",
|
|
76
77
|
"yaml": "^2.8.1"
|
|
77
78
|
},
|
|
78
79
|
"publishConfig": {
|
package/assets/tsconfig.json
CHANGED
package/assets/vitest.config.ts
CHANGED
|
@@ -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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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.9.
|
|
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.9.
|
|
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.1.
|
|
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,
|
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.9.
|
|
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.9.
|
|
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.1.
|
|
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,
|
package/dist/cli.js
CHANGED
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.9.
|
|
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.9.
|
|
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.1.
|
|
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,
|
package/dist/index.d.cts
CHANGED
|
@@ -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.1.
|
|
280
|
+
var version = "2.1.1";
|
|
273
281
|
|
|
274
282
|
/**
|
|
275
283
|
* @icebreakers/monorepo 包的根目录,所有模板与资产目录都以此为基准。
|
package/dist/index.d.ts
CHANGED
|
@@ -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.1.
|
|
280
|
+
var version = "2.1.1";
|
|
273
281
|
|
|
274
282
|
/**
|
|
275
283
|
* @icebreakers/monorepo 包的根目录,所有模板与资产目录都以此为基准。
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icebreakers/monorepo",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.1.
|
|
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",
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"@pnpm/logger": "^1001.0.1",
|
|
42
42
|
"@pnpm/types": "^1000.9.0",
|
|
43
43
|
"@pnpm/worker": "^1000.3.0",
|
|
44
|
-
"@pnpm/workspace.find-packages": "^1000.0.
|
|
44
|
+
"@pnpm/workspace.find-packages": "^1000.0.43",
|
|
45
45
|
"@pnpm/workspace.read-manifest": "^1000.2.5",
|
|
46
46
|
"c12": "^3.3.1",
|
|
47
|
-
"commander": "^14.0.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
32
|
-
"@trpc/server": "^11.
|
|
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.
|
|
37
|
-
"tailwindcss": "^4.1.
|
|
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.
|
|
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.
|
|
44
|
-
"wrangler": "^4.
|
|
43
|
+
"vue-tsc": "3.1.2",
|
|
44
|
+
"wrangler": "^4.45.1",
|
|
45
45
|
"zod": "^4.1.12"
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@braintree/sanitize-url": "^7.1.1",
|
|
26
|
-
"@tailwindcss/vite": "^4.1.
|
|
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.
|
|
32
|
-
"tailwindcss": "^4.1.
|
|
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,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
|
+
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.
|
|
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
52
|
"jsdom": "^27.0.1",
|
|
53
|
-
"tailwindcss": "^4.1.
|
|
53
|
+
"tailwindcss": "^4.1.16",
|
|
54
54
|
"unplugin-vue-router": "^0.16.0",
|
|
55
|
-
"vite": "^7.1.
|
|
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.
|
|
59
|
+
"vue-tsc": "^3.1.2"
|
|
60
60
|
}
|
|
61
61
|
}
|