@icebreakers/monorepo-templates 0.1.16 → 1.0.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/README.md +12 -0
- package/assets/.changeset/config.json +7 -2
- package/assets/.github/workflows/ci.yml +8 -2
- package/assets/.github/workflows/release.yml +2 -2
- package/assets/.husky/commit-msg +1 -1
- package/assets/.husky/pre-commit +1 -1
- package/assets/.husky/pre-push +5 -0
- package/assets/AGENTS.md +8 -7
- package/assets/Dockerfile +5 -14
- package/assets/commitlint.config.ts +2 -2
- package/assets/eslint.config.js +2 -6
- package/assets/lint-staged.config.js +3 -0
- package/assets/package.json +41 -31
- package/assets/repoctl.config.ts +68 -0
- package/assets/stylelint.config.js +2 -2
- package/assets/tsconfig.json +1 -49
- package/assets/turbo.json +17 -6
- package/assets/vitest.config.ts +2 -125
- package/assets-data.mjs +3 -2
- package/dist/index.d.mts +22 -1
- package/dist/index.mjs +114 -32
- package/package.json +12 -8
- package/template-data.mjs +48 -8
- package/templates/cli/bin/index.js +1 -1
- package/templates/cli/package.json +5 -2
- package/templates/cli/{tsup.config.ts → tsdown.config.ts} +3 -2
- package/templates/client/eslint.config.js +5 -5
- package/templates/client/gitignore +0 -1
- package/templates/client/package.json +22 -22
- package/templates/client/vite.config.ts +4 -3
- package/templates/client/worker-configuration.d.ts +13557 -0
- package/templates/client/wrangler.jsonc +4 -6
- package/templates/server/eslint.config.js +8 -0
- package/templates/server/gitignore +0 -1
- package/templates/server/package.json +9 -8
- package/templates/server/src/app.ts +4 -4
- package/templates/server/tsconfig.json +1 -2
- package/templates/server/{tsup.config.ts → tsdown.config.ts} +2 -1
- package/templates/server/vitest.config.ts +7 -5
- package/templates/server/worker-configuration.d.ts +13557 -0
- package/templates/server/wrangler.jsonc +4 -6
- package/templates/tsdown/package.json +2 -1
- package/templates/tsdown/test-d/index.test-d.ts +5 -0
- package/templates/tsdown/tsconfig.json +1 -2
- package/templates/tsdown/vitest.config.ts +7 -5
- package/templates/vitepress/.vitepress/config.ts +34 -36
- package/templates/vitepress/getting-started.md +243 -0
- package/templates/vitepress/gitignore +2 -1
- package/templates/vitepress/index.md +144 -79
- package/templates/vitepress/monorepo/commands.md +291 -0
- package/templates/vitepress/monorepo/index.md +103 -34
- package/templates/vitepress/monorepo/manage.md +181 -80
- package/templates/vitepress/monorepo/publish.md +128 -57
- package/templates/vitepress/monorepo/templates.md +67 -0
- package/templates/vitepress/monorepo/troubleshooting.md +226 -0
- package/templates/vitepress/package.json +5 -5
- package/templates/vitepress/thinking.md +1 -1
- package/templates/vitepress/tools/husky.md +7 -2
- package/templates/vitepress/tools/lint-staged.md +15 -1
- package/templates/vitepress/why/examples/3.npm-basic-package/package-lock.json +605 -2770
- package/templates/vitepress/why/examples/3.npm-basic-package/package.json +5 -6
- package/templates/vitepress/why/examples/3.npm-basic-package/tsdown.config.ts +16 -0
- package/templates/vitepress/why/examples/usage-cjs/index.js +2 -6
- package/templates/vitepress/why/examples/usage-cjs/package-lock.json +7 -13
- package/templates/vitepress/why/examples/usage-cjs/package.json +2 -2
- package/templates/vitepress/why/examples/usage-esm/index.js +2 -2
- package/templates/vitepress/why/examples/usage-esm/package-lock.json +7 -13
- package/templates/vitepress/why/examples/usage-esm/package.json +2 -2
- package/templates/vitepress/why/modern/bundlers.md +19 -46
- package/templates/vue-lib/eslint.config.js +4 -4
- package/templates/vue-lib/package.json +15 -10
- package/templates/vue-lib/test-d/index.test-d.ts +6 -0
- package/templates/vue-lib/tsconfig.test.json +1 -1
- package/templates/vue-lib/vitest.config.ts +6 -5
- package/assets/monorepo.config.ts +0 -22
- package/assets/nano-staged.js +0 -18
- package/templates/tsup/build.config.ts +0 -24
- package/templates/tsup/package.json +0 -49
- package/templates/tsup/src/index.ts +0 -12
- package/templates/tsup/test/index.test.ts +0 -18
- package/templates/tsup/tsconfig.json +0 -15
- package/templates/tsup/tsup.config.ts +0 -18
- package/templates/tsup/vitest.config.ts +0 -15
- package/templates/unbuild/build.config.ts +0 -24
- package/templates/unbuild/package.json +0 -49
- package/templates/unbuild/src/index.ts +0 -9
- package/templates/unbuild/src/utils.ts +0 -5
- package/templates/unbuild/test/index.test.ts +0 -18
- package/templates/unbuild/tsconfig.json +0 -15
- package/templates/unbuild/vitest.config.ts +0 -15
- package/templates/vitepress/why/examples/3.npm-basic-package/build.config.ts +0 -24
- package/templates/vitepress/why/examples/3.npm-basic-package/tsup.config.ts +0 -16
package/dist/index.d.mts
CHANGED
|
@@ -4,16 +4,25 @@ import select from "@inquirer/select";
|
|
|
4
4
|
import { Command, program } from "commander";
|
|
5
5
|
|
|
6
6
|
//#region src/types.d.ts
|
|
7
|
+
type TemplateCategory = 'app' | 'docs' | 'library' | 'service' | 'tool';
|
|
7
8
|
interface TemplateChoice {
|
|
8
9
|
key: string;
|
|
9
10
|
label: string;
|
|
10
11
|
source: string;
|
|
11
12
|
target: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
category?: TemplateCategory;
|
|
12
15
|
}
|
|
13
16
|
interface TemplateDefinition {
|
|
14
17
|
source: string;
|
|
15
18
|
target: string;
|
|
16
19
|
}
|
|
20
|
+
interface GetTemplateChoicesOptions {
|
|
21
|
+
category?: TemplateCategory;
|
|
22
|
+
}
|
|
23
|
+
interface SuggestTemplateKeyOptions extends GetTemplateChoicesOptions {
|
|
24
|
+
keys?: readonly string[];
|
|
25
|
+
}
|
|
17
26
|
//#endregion
|
|
18
27
|
//#region src/paths.d.ts
|
|
19
28
|
declare const packageDir: string;
|
|
@@ -74,6 +83,18 @@ declare function isGitignoreFile(name: string): boolean;
|
|
|
74
83
|
declare function shouldSkipTemplatePath(rootDir: string, targetPath: string): boolean;
|
|
75
84
|
declare function createTemplateCopyFilter(rootDir: string): (src: string) => boolean;
|
|
76
85
|
//#endregion
|
|
86
|
+
//#region src/templates.d.ts
|
|
87
|
+
declare const templateCategories: readonly ["app", "docs", "library", "service", "tool"];
|
|
88
|
+
declare function isTemplateCategory(value: string): value is TemplateCategory;
|
|
89
|
+
declare function getTemplateChoices(options?: GetTemplateChoicesOptions): TemplateChoice[];
|
|
90
|
+
declare function getTemplateKeys(options?: GetTemplateChoicesOptions): string[];
|
|
91
|
+
declare function getTemplateChoice(key: string): TemplateChoice | undefined;
|
|
92
|
+
declare function isTemplateKey(key: string): boolean;
|
|
93
|
+
declare function getTemplateDefinition(key: string): TemplateDefinition | undefined;
|
|
94
|
+
declare function getTemplateSource(key: string): string | undefined;
|
|
95
|
+
declare function getTemplateTarget(key: string): string | undefined;
|
|
96
|
+
declare function suggestTemplateKey(key: string, options?: SuggestTemplateKeyOptions): string | undefined;
|
|
97
|
+
//#endregion
|
|
77
98
|
//#region src/index.d.ts
|
|
78
99
|
declare const templateChoices: TemplateChoice[];
|
|
79
100
|
declare const assetTargets: string[];
|
|
@@ -82,4 +103,4 @@ declare const templateSourceMap: Record<string, string>;
|
|
|
82
103
|
declare const templateTargetMap: Record<string, string>;
|
|
83
104
|
declare const templateMap: Record<string, string>;
|
|
84
105
|
//#endregion
|
|
85
|
-
export { Command, type TemplateChoice, type TemplateDefinition, assetTargets, assetsDir, checkbox, createTemplateCopyFilter, ensureTemplateAssetsPrepared, execaCommand, getAssetTargets, input, isGitignoreFile, packageDir, prepareAssets, program, runCommand, scaffoldTemplate, scaffoldWorkspace, select, shouldSkipTemplatePath, skeletonDir, templateChoices, templateMap, templateSourceMap, templateTargetMap, templatesDir, toPublishGitignorePath, toWorkspaceGitignorePath };
|
|
106
|
+
export { Command, type GetTemplateChoicesOptions, type SuggestTemplateKeyOptions, type TemplateCategory, type TemplateChoice, type TemplateDefinition, assetTargets, assetsDir, checkbox, createTemplateCopyFilter, ensureTemplateAssetsPrepared, execaCommand, getAssetTargets, getTemplateChoice, getTemplateChoices, getTemplateDefinition, getTemplateKeys, getTemplateSource, getTemplateTarget, input, isGitignoreFile, isTemplateCategory, isTemplateKey, packageDir, prepareAssets, program, runCommand, scaffoldTemplate, scaffoldWorkspace, select, shouldSkipTemplatePath, skeletonDir, suggestTemplateKey, templateCategories, templateChoices, templateMap, templateSourceMap, templateTargetMap, templatesDir, toPublishGitignorePath, toWorkspaceGitignorePath };
|
package/dist/index.mjs
CHANGED
|
@@ -18,12 +18,13 @@ const coreAssetTargets = [
|
|
|
18
18
|
".npmrc",
|
|
19
19
|
"commitlint.config.ts",
|
|
20
20
|
"eslint.config.js",
|
|
21
|
-
"
|
|
21
|
+
"lint-staged.config.js",
|
|
22
22
|
"stylelint.config.js",
|
|
23
|
-
"
|
|
23
|
+
"repoctl.config.ts",
|
|
24
24
|
"package.json",
|
|
25
25
|
"AGENTS.md",
|
|
26
26
|
"pnpm-workspace.yaml",
|
|
27
|
+
"scripts",
|
|
27
28
|
"tsconfig.json",
|
|
28
29
|
"turbo.json",
|
|
29
30
|
"vitest.config.ts",
|
|
@@ -44,64 +45,64 @@ function getAssetTargets$1(core = false) {
|
|
|
44
45
|
return core ? [...coreAssetTargets] : [...assetTargets$1];
|
|
45
46
|
}
|
|
46
47
|
//#endregion
|
|
48
|
+
//#region src/paths.ts
|
|
49
|
+
const packageDir = path$1.resolve(fileURLToPath(new URL("../", import.meta.url)));
|
|
50
|
+
const templatesDir = path$1.join(packageDir, "templates");
|
|
51
|
+
const assetsDir = path$1.join(packageDir, "assets");
|
|
52
|
+
const skeletonDir = assetsDir;
|
|
53
|
+
//#endregion
|
|
47
54
|
//#region template-data.mjs
|
|
48
55
|
const templateChoices$1 = [
|
|
49
|
-
{
|
|
50
|
-
key: "unbuild",
|
|
51
|
-
label: "unbuild 打包",
|
|
52
|
-
source: "unbuild",
|
|
53
|
-
target: "packages/unbuild"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
key: "tsup",
|
|
57
|
-
label: "tsup 打包",
|
|
58
|
-
source: "tsup",
|
|
59
|
-
target: "packages/tsup"
|
|
60
|
-
},
|
|
61
56
|
{
|
|
62
57
|
key: "tsdown",
|
|
63
58
|
label: "tsdown 打包",
|
|
64
59
|
source: "tsdown",
|
|
65
|
-
target: "packages/tsdown"
|
|
60
|
+
target: "packages/tsdown",
|
|
61
|
+
category: "library",
|
|
62
|
+
description: "使用 tsdown 构建的 TypeScript 库包"
|
|
66
63
|
},
|
|
67
64
|
{
|
|
68
65
|
key: "vue-lib",
|
|
69
66
|
label: "vue 组件",
|
|
70
67
|
source: "vue-lib",
|
|
71
|
-
target: "packages/vue-lib"
|
|
68
|
+
target: "packages/vue-lib",
|
|
69
|
+
category: "library",
|
|
70
|
+
description: "Vue 3 组件库模板,适合沉淀可复用 UI"
|
|
72
71
|
},
|
|
73
72
|
{
|
|
74
73
|
key: "vue-hono",
|
|
75
74
|
label: "vue hono 全栈",
|
|
76
75
|
source: "client",
|
|
77
|
-
target: "apps/client"
|
|
76
|
+
target: "apps/client",
|
|
77
|
+
category: "app",
|
|
78
|
+
description: "Vue 3 + Hono 的前后端一体应用模板"
|
|
78
79
|
},
|
|
79
80
|
{
|
|
80
81
|
key: "hono-server",
|
|
81
82
|
label: "hono 模板",
|
|
82
83
|
source: "server",
|
|
83
|
-
target: "apps/server"
|
|
84
|
+
target: "apps/server",
|
|
85
|
+
category: "service",
|
|
86
|
+
description: "Hono API 服务模板"
|
|
84
87
|
},
|
|
85
88
|
{
|
|
86
89
|
key: "vitepress",
|
|
87
90
|
label: "vitepress 文档",
|
|
88
91
|
source: "vitepress",
|
|
89
|
-
target: "apps/website"
|
|
92
|
+
target: "apps/website",
|
|
93
|
+
category: "docs",
|
|
94
|
+
description: "VitePress 文档站模板"
|
|
90
95
|
},
|
|
91
96
|
{
|
|
92
97
|
key: "cli",
|
|
93
98
|
label: "cli 模板",
|
|
94
99
|
source: "cli",
|
|
95
|
-
target: "apps/cli"
|
|
100
|
+
target: "apps/cli",
|
|
101
|
+
category: "tool",
|
|
102
|
+
description: "TypeScript 命令行工具模板"
|
|
96
103
|
}
|
|
97
104
|
];
|
|
98
105
|
//#endregion
|
|
99
|
-
//#region src/paths.ts
|
|
100
|
-
const packageDir = path$1.resolve(fileURLToPath(new URL("../", import.meta.url)));
|
|
101
|
-
const templatesDir = path$1.join(packageDir, "templates");
|
|
102
|
-
const assetsDir = path$1.join(packageDir, "assets");
|
|
103
|
-
const skeletonDir = assetsDir;
|
|
104
|
-
//#endregion
|
|
105
106
|
//#region src/utils/gitignore.ts
|
|
106
107
|
const publishBasename = "gitignore";
|
|
107
108
|
const workspaceBasename = ".gitignore";
|
|
@@ -149,13 +150,13 @@ const skipDirs = new Set([
|
|
|
149
150
|
const skipFiles = new Set([
|
|
150
151
|
".DS_Store",
|
|
151
152
|
"CHANGELOG.md",
|
|
152
|
-
"route-map.d.ts"
|
|
153
|
-
"worker-configuration.d.ts"
|
|
153
|
+
"route-map.d.ts"
|
|
154
154
|
]);
|
|
155
155
|
function shouldSkipTemplatePath(rootDir, targetPath) {
|
|
156
156
|
const basename = path.basename(targetPath);
|
|
157
157
|
if (skipFiles.has(basename)) return true;
|
|
158
158
|
if (basename.endsWith(".tsbuildinfo")) return true;
|
|
159
|
+
if (/\.timestamp-\d+-[a-z0-9]+\.mjs$/i.test(basename)) return true;
|
|
159
160
|
const relative = path.relative(rootDir, targetPath);
|
|
160
161
|
if (!relative || relative.startsWith("..")) return false;
|
|
161
162
|
const segments = relative.split(path.sep);
|
|
@@ -223,8 +224,11 @@ async function copyEntry(from, to, overwriteExisting, filter) {
|
|
|
223
224
|
}
|
|
224
225
|
}
|
|
225
226
|
async function copyAssets(repoRoot, overwriteExisting) {
|
|
227
|
+
const monorepoAssetRoot = path$1.resolve(repoRoot, "packages/monorepo/assets");
|
|
226
228
|
for (const target of assetTargets$1) {
|
|
227
|
-
const
|
|
229
|
+
const packageAsset = path$1.join(monorepoAssetRoot, toPublishGitignorePath(target));
|
|
230
|
+
const repoAsset = path$1.join(repoRoot, target);
|
|
231
|
+
const from = await pathExists$1(packageAsset) ? packageAsset : repoAsset;
|
|
228
232
|
if (!await pathExists$1(from)) continue;
|
|
229
233
|
const to = path$1.join(assetsDir, toPublishGitignorePath(target));
|
|
230
234
|
const stats = await fs.stat(from);
|
|
@@ -277,7 +281,7 @@ async function isPrepared() {
|
|
|
277
281
|
const checks = [
|
|
278
282
|
path.join(assetsDir, "AGENTS.md"),
|
|
279
283
|
path.join(assetsDir, "LICENSE"),
|
|
280
|
-
path.join(templatesDir, "
|
|
284
|
+
path.join(templatesDir, "tsdown")
|
|
281
285
|
];
|
|
282
286
|
return (await Promise.all(checks.map(pathExists))).every(Boolean);
|
|
283
287
|
}
|
|
@@ -399,6 +403,84 @@ async function scaffoldWorkspace(options) {
|
|
|
399
403
|
}
|
|
400
404
|
}
|
|
401
405
|
//#endregion
|
|
406
|
+
//#region src/templates.ts
|
|
407
|
+
const templateCategories = [
|
|
408
|
+
"app",
|
|
409
|
+
"docs",
|
|
410
|
+
"library",
|
|
411
|
+
"service",
|
|
412
|
+
"tool"
|
|
413
|
+
];
|
|
414
|
+
const choices = templateChoices$1;
|
|
415
|
+
const categorySet = new Set(templateCategories);
|
|
416
|
+
function cloneTemplateChoice(choice) {
|
|
417
|
+
return { ...choice };
|
|
418
|
+
}
|
|
419
|
+
function isTemplateCategory(value) {
|
|
420
|
+
return categorySet.has(value);
|
|
421
|
+
}
|
|
422
|
+
function getTemplateChoices(options = {}) {
|
|
423
|
+
const { category } = options;
|
|
424
|
+
return (category ? choices.filter((choice) => choice.category === category) : choices).map(cloneTemplateChoice);
|
|
425
|
+
}
|
|
426
|
+
function getTemplateKeys(options = {}) {
|
|
427
|
+
return getTemplateChoices(options).map((choice) => choice.key);
|
|
428
|
+
}
|
|
429
|
+
function getTemplateChoice(key) {
|
|
430
|
+
const choice = choices.find((item) => item.key === key);
|
|
431
|
+
return choice ? cloneTemplateChoice(choice) : void 0;
|
|
432
|
+
}
|
|
433
|
+
function isTemplateKey(key) {
|
|
434
|
+
return choices.some((choice) => choice.key === key);
|
|
435
|
+
}
|
|
436
|
+
function getTemplateDefinition(key) {
|
|
437
|
+
const choice = getTemplateChoice(key);
|
|
438
|
+
if (!choice) return;
|
|
439
|
+
return {
|
|
440
|
+
source: choice.source,
|
|
441
|
+
target: choice.target
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
function getTemplateSource(key) {
|
|
445
|
+
return getTemplateChoice(key)?.source;
|
|
446
|
+
}
|
|
447
|
+
function getTemplateTarget(key) {
|
|
448
|
+
return getTemplateChoice(key)?.target;
|
|
449
|
+
}
|
|
450
|
+
function getEditDistance(left, right) {
|
|
451
|
+
const previous = Array.from({ length: right.length + 1 }, (_, index) => index);
|
|
452
|
+
for (let leftIndex = 1; leftIndex <= left.length; leftIndex += 1) {
|
|
453
|
+
const current = [leftIndex];
|
|
454
|
+
for (let rightIndex = 1; rightIndex <= right.length; rightIndex += 1) {
|
|
455
|
+
const substitutionCost = left[leftIndex - 1] === right[rightIndex - 1] ? 0 : 1;
|
|
456
|
+
current[rightIndex] = Math.min((current[rightIndex - 1] ?? 0) + 1, (previous[rightIndex] ?? 0) + 1, (previous[rightIndex - 1] ?? 0) + substitutionCost);
|
|
457
|
+
}
|
|
458
|
+
previous.splice(0, previous.length, ...current);
|
|
459
|
+
}
|
|
460
|
+
return previous[right.length] ?? 0;
|
|
461
|
+
}
|
|
462
|
+
function getTemplateSuggestionThreshold(value) {
|
|
463
|
+
if (value.length <= 4) return 1;
|
|
464
|
+
if (value.length <= 8) return 2;
|
|
465
|
+
return 3;
|
|
466
|
+
}
|
|
467
|
+
function suggestTemplateKey(key, options = {}) {
|
|
468
|
+
const normalizedKey = key.trim().toLowerCase();
|
|
469
|
+
if (!normalizedKey) return;
|
|
470
|
+
const keys = options.keys ? [...options.keys] : getTemplateKeys(options);
|
|
471
|
+
const prefixMatch = keys.find((candidate) => {
|
|
472
|
+
const normalizedCandidate = candidate.toLowerCase();
|
|
473
|
+
return normalizedCandidate.startsWith(normalizedKey) || normalizedKey.startsWith(normalizedCandidate);
|
|
474
|
+
});
|
|
475
|
+
if (prefixMatch) return prefixMatch;
|
|
476
|
+
const [best] = keys.map((candidate) => ({
|
|
477
|
+
key: candidate,
|
|
478
|
+
distance: getEditDistance(normalizedKey, candidate.toLowerCase())
|
|
479
|
+
})).sort((left, right) => left.distance - right.distance || left.key.localeCompare(right.key));
|
|
480
|
+
if (!best || best.distance > getTemplateSuggestionThreshold(normalizedKey)) return;
|
|
481
|
+
return best.key;
|
|
482
|
+
}
|
|
483
|
+
//#endregion
|
|
402
484
|
//#region src/utils/command.ts
|
|
403
485
|
async function runCommand(command, args, options = {}) {
|
|
404
486
|
const result = await exec(command, args, {
|
|
@@ -419,11 +501,11 @@ async function execaCommand(command, options = {}) {
|
|
|
419
501
|
}
|
|
420
502
|
//#endregion
|
|
421
503
|
//#region src/index.ts
|
|
422
|
-
const templateChoices =
|
|
504
|
+
const templateChoices = getTemplateChoices();
|
|
423
505
|
const assetTargets = assetTargets$1;
|
|
424
506
|
const getAssetTargets = getAssetTargets$1;
|
|
425
507
|
const templateSourceMap = Object.fromEntries(templateChoices.map((item) => [item.key, item.source]));
|
|
426
508
|
const templateTargetMap = Object.fromEntries(templateChoices.map((item) => [item.key, item.target]));
|
|
427
509
|
const templateMap = templateSourceMap;
|
|
428
510
|
//#endregion
|
|
429
|
-
export { Command, assetTargets, assetsDir, checkbox, createTemplateCopyFilter, ensureTemplateAssetsPrepared, execaCommand, getAssetTargets, input, isGitignoreFile, packageDir, prepareAssets, program, runCommand, scaffoldTemplate, scaffoldWorkspace, select, shouldSkipTemplatePath, skeletonDir, templateChoices, templateMap, templateSourceMap, templateTargetMap, templatesDir, toPublishGitignorePath, toWorkspaceGitignorePath };
|
|
511
|
+
export { Command, assetTargets, assetsDir, checkbox, createTemplateCopyFilter, ensureTemplateAssetsPrepared, execaCommand, getAssetTargets, getTemplateChoice, getTemplateChoices, getTemplateDefinition, getTemplateKeys, getTemplateSource, getTemplateTarget, input, isGitignoreFile, isTemplateCategory, isTemplateKey, packageDir, prepareAssets, program, runCommand, scaffoldTemplate, scaffoldWorkspace, select, shouldSkipTemplatePath, skeletonDir, suggestTemplateKey, templateCategories, templateChoices, templateMap, templateSourceMap, templateTargetMap, templatesDir, toPublishGitignorePath, toWorkspaceGitignorePath };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icebreakers/monorepo-templates",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"description": "Template assets for icebreaker monorepo scaffolding",
|
|
6
6
|
"author": "ice breaker <hi@sonofmagic.top>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -21,14 +21,17 @@
|
|
|
21
21
|
"sideEffects": false,
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
|
-
"types": "./dist/index.d.
|
|
25
|
-
"import":
|
|
24
|
+
"types": "./dist/index.d.mts",
|
|
25
|
+
"import": {
|
|
26
|
+
"types": "./dist/index.d.mts",
|
|
27
|
+
"default": "./dist/index.mjs"
|
|
28
|
+
},
|
|
26
29
|
"default": "./dist/index.mjs"
|
|
27
30
|
},
|
|
28
31
|
"./package.json": "./package.json"
|
|
29
32
|
},
|
|
30
33
|
"main": "./dist/index.mjs",
|
|
31
|
-
"types": "./dist/index.d.
|
|
34
|
+
"types": "./dist/index.d.mts",
|
|
32
35
|
"files": [
|
|
33
36
|
"assets",
|
|
34
37
|
"assets-data.mjs",
|
|
@@ -40,9 +43,9 @@
|
|
|
40
43
|
"node": ">=18.0.0"
|
|
41
44
|
},
|
|
42
45
|
"dependencies": {
|
|
43
|
-
"@inquirer/checkbox": "^5.1.
|
|
44
|
-
"@inquirer/input": "^5.0.
|
|
45
|
-
"@inquirer/select": "^5.1.
|
|
46
|
+
"@inquirer/checkbox": "^5.1.4",
|
|
47
|
+
"@inquirer/input": "^5.0.12",
|
|
48
|
+
"@inquirer/select": "^5.1.4",
|
|
46
49
|
"commander": "^14.0.3",
|
|
47
50
|
"nanoexec": "^1.1.0"
|
|
48
51
|
},
|
|
@@ -52,7 +55,8 @@
|
|
|
52
55
|
"scripts": {
|
|
53
56
|
"dev": "tsdown --watch --sourcemap",
|
|
54
57
|
"build": "tsdown",
|
|
55
|
-
"typecheck": "tsc -p tsconfig.json",
|
|
58
|
+
"typecheck": "node ../../node_modules/typescript/bin/tsc -p tsconfig.json",
|
|
59
|
+
"tsd": "pnpm build && tsd --files test-d/**/*.test-d.ts",
|
|
56
60
|
"sync:assets": "pnpm run build && node scripts/sync-assets.mjs",
|
|
57
61
|
"lint": "eslint ."
|
|
58
62
|
}
|
package/template-data.mjs
CHANGED
|
@@ -1,10 +1,50 @@
|
|
|
1
1
|
export const templateChoices = [
|
|
2
|
-
{
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
{
|
|
3
|
+
key: 'tsdown',
|
|
4
|
+
label: 'tsdown 打包',
|
|
5
|
+
source: 'tsdown',
|
|
6
|
+
target: 'packages/tsdown',
|
|
7
|
+
category: 'library',
|
|
8
|
+
description: '使用 tsdown 构建的 TypeScript 库包',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
key: 'vue-lib',
|
|
12
|
+
label: 'vue 组件',
|
|
13
|
+
source: 'vue-lib',
|
|
14
|
+
target: 'packages/vue-lib',
|
|
15
|
+
category: 'library',
|
|
16
|
+
description: 'Vue 3 组件库模板,适合沉淀可复用 UI',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
key: 'vue-hono',
|
|
20
|
+
label: 'vue hono 全栈',
|
|
21
|
+
source: 'client',
|
|
22
|
+
target: 'apps/client',
|
|
23
|
+
category: 'app',
|
|
24
|
+
description: 'Vue 3 + Hono 的前后端一体应用模板',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
key: 'hono-server',
|
|
28
|
+
label: 'hono 模板',
|
|
29
|
+
source: 'server',
|
|
30
|
+
target: 'apps/server',
|
|
31
|
+
category: 'service',
|
|
32
|
+
description: 'Hono API 服务模板',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
key: 'vitepress',
|
|
36
|
+
label: 'vitepress 文档',
|
|
37
|
+
source: 'vitepress',
|
|
38
|
+
target: 'apps/website',
|
|
39
|
+
category: 'docs',
|
|
40
|
+
description: 'VitePress 文档站模板',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
key: 'cli',
|
|
44
|
+
label: 'cli 模板',
|
|
45
|
+
source: 'cli',
|
|
46
|
+
target: 'apps/cli',
|
|
47
|
+
category: 'tool',
|
|
48
|
+
description: 'TypeScript 命令行工具模板',
|
|
49
|
+
},
|
|
10
50
|
]
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import '../dist/cli.
|
|
2
|
+
import '../dist/cli.mjs'
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
21
|
"start": "tsx src/index.ts",
|
|
22
|
-
"dev": "
|
|
23
|
-
"build": "
|
|
22
|
+
"dev": "tsdown --watch --sourcemap",
|
|
23
|
+
"build": "tsdown",
|
|
24
24
|
"lint": "eslint .",
|
|
25
25
|
"lint:fix": "eslint . --fix",
|
|
26
26
|
"typecheck": "tsc -p tsconfig.json"
|
|
@@ -28,6 +28,9 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"consola": "^3.4.2"
|
|
30
30
|
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"tsdown": "0.21.10"
|
|
33
|
+
},
|
|
31
34
|
"publishConfig": {
|
|
32
35
|
"bin": {
|
|
33
36
|
"ice": "./bin/index.js"
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { defineConfig } from '
|
|
1
|
+
import { defineConfig } from 'tsdown'
|
|
2
2
|
|
|
3
3
|
export default defineConfig({
|
|
4
4
|
entry: ['src/index.ts', 'src/cli.ts'],
|
|
5
5
|
shims: true,
|
|
6
|
-
format: ['
|
|
6
|
+
format: ['esm', 'cjs'],
|
|
7
7
|
clean: true,
|
|
8
8
|
dts: true,
|
|
9
|
+
target: 'node18',
|
|
9
10
|
})
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { fileURLToPath } from 'node:url'
|
|
2
|
-
import {
|
|
2
|
+
import { defineEslintConfig } from 'repoctl/tooling'
|
|
3
3
|
|
|
4
4
|
const tailwindEntryPoint = fileURLToPath(new URL('./src/style.css', import.meta.url))
|
|
5
5
|
|
|
6
|
-
export default
|
|
7
|
-
{
|
|
6
|
+
export default await defineEslintConfig({
|
|
7
|
+
options: {
|
|
8
8
|
vue: true,
|
|
9
9
|
typescript: true,
|
|
10
10
|
tailwindcss: {
|
|
11
11
|
entryPoint: tailwindEntryPoint,
|
|
12
12
|
},
|
|
13
|
-
ignores: ['**/fixtures/**'],
|
|
13
|
+
ignores: ['**/fixtures/**', 'worker-configuration.d.ts'],
|
|
14
14
|
},
|
|
15
|
-
)
|
|
15
|
+
})
|
|
@@ -15,38 +15,38 @@
|
|
|
15
15
|
"typecheck": "vue-tsc -b"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@faker-js/faker": "^10.
|
|
19
|
-
"@tanstack/vue-query": "^5.
|
|
20
|
-
"@tanstack/vue-query-devtools": "^6.1.
|
|
18
|
+
"@faker-js/faker": "^10.4.0",
|
|
19
|
+
"@tanstack/vue-query": "^5.100.9",
|
|
20
|
+
"@tanstack/vue-query-devtools": "^6.1.28",
|
|
21
21
|
"@tanstack/vue-table": "^8.21.3",
|
|
22
|
-
"@tanstack/vue-virtual": "^3.13.
|
|
23
|
-
"@trpc/client": "^11.
|
|
22
|
+
"@tanstack/vue-virtual": "^3.13.24",
|
|
23
|
+
"@trpc/client": "^11.17.0",
|
|
24
24
|
"clsx": "^2.1.1",
|
|
25
25
|
"pinia": "^3.0.4",
|
|
26
26
|
"tailwind-merge": "^3.5.0",
|
|
27
27
|
"tailwind-variants": "^3.2.2",
|
|
28
|
-
"vue": "^3.5.
|
|
29
|
-
"vue-i18n": "^11.
|
|
30
|
-
"vue-router": "^5.0.
|
|
28
|
+
"vue": "^3.5.33",
|
|
29
|
+
"vue-i18n": "^11.4.0",
|
|
30
|
+
"vue-router": "^5.0.6"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@cloudflare/vite-plugin": "^1.
|
|
34
|
-
"@hono/node-server": "^
|
|
33
|
+
"@cloudflare/vite-plugin": "^1.36.0",
|
|
34
|
+
"@hono/node-server": "^2.0.1",
|
|
35
35
|
"@hono/trpc-server": "^0.4.2",
|
|
36
|
-
"@tailwindcss/vite": "^4.2.
|
|
37
|
-
"@trpc/server": "^11.
|
|
38
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
36
|
+
"@tailwindcss/vite": "^4.2.4",
|
|
37
|
+
"@trpc/server": "^11.17.0",
|
|
38
|
+
"@vitejs/plugin-vue": "^6.0.6",
|
|
39
39
|
"@vitejs/plugin-vue-jsx": "^5.1.5",
|
|
40
|
-
"@vue/tsconfig": "^0.9.
|
|
40
|
+
"@vue/tsconfig": "^0.9.1",
|
|
41
41
|
"consola": "^3.4.2",
|
|
42
|
-
"hono": "^4.12.
|
|
43
|
-
"tailwindcss": "^4.2.
|
|
44
|
-
"typescript": "~
|
|
45
|
-
"vite": "^8.0.
|
|
46
|
-
"vite-plugin-vue-devtools": "^8.1.
|
|
42
|
+
"hono": "^4.12.17",
|
|
43
|
+
"tailwindcss": "^4.2.4",
|
|
44
|
+
"typescript": "~6.0.3",
|
|
45
|
+
"vite": "^8.0.10",
|
|
46
|
+
"vite-plugin-vue-devtools": "^8.1.1",
|
|
47
47
|
"vite-tsconfig-paths": "^6.1.1",
|
|
48
|
-
"vue-tsc": "3.2.
|
|
49
|
-
"wrangler": "^4.
|
|
50
|
-
"zod": "^4.3
|
|
48
|
+
"vue-tsc": "3.2.8",
|
|
49
|
+
"wrangler": "^4.88.0",
|
|
50
|
+
"zod": "^4.4.3"
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -8,7 +8,7 @@ import VueDevTools from 'vite-plugin-vue-devtools'
|
|
|
8
8
|
import VueRouter from 'vue-router/vite'
|
|
9
9
|
|
|
10
10
|
// https://vite.dev/config/
|
|
11
|
-
export default defineConfig({
|
|
11
|
+
export default defineConfig(({ command }) => ({
|
|
12
12
|
build: {
|
|
13
13
|
target: 'baseline-widely-available',
|
|
14
14
|
},
|
|
@@ -22,12 +22,13 @@ export default defineConfig({
|
|
|
22
22
|
VueRouter(
|
|
23
23
|
{
|
|
24
24
|
dts: path.resolve(import.meta.dirname, 'src/route-map.d.ts'),
|
|
25
|
+
watch: command === 'serve',
|
|
25
26
|
},
|
|
26
27
|
),
|
|
27
28
|
Vue(),
|
|
28
29
|
VueJsx(),
|
|
29
30
|
Tailwindcss(),
|
|
30
31
|
cloudflare(),
|
|
31
|
-
VueDevTools(),
|
|
32
|
+
command === 'serve' ? VueDevTools() : null,
|
|
32
33
|
],
|
|
33
|
-
})
|
|
34
|
+
}))
|