@icebreakers/monorepo-templates 0.0.0 → 0.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/README.md +1 -2
- package/assets/package.json +3 -3
- package/dist/index.d.mts +14 -2
- package/dist/index.mjs +27 -38
- package/package.json +9 -2
- package/templates/client/package.json +3 -3
- package/templates/server/package.json +1 -1
- package/assets/.changeset/create-icebreaker-interactive.md +0 -5
- package/assets/.changeset/monorepo-templates-package.md +0 -5
- package/assets/.changeset/skills-sync-resources.md +0 -5
- package/skeleton/.editorconfig +0 -12
- package/skeleton/LICENSE +0 -21
- package/skeleton/commitlint.config.ts +0 -3
- package/skeleton/eslint.config.js +0 -7
- package/skeleton/gitignore +0 -38
- package/skeleton/lint-staged.config.js +0 -11
- package/skeleton/package.json +0 -88
- package/skeleton/pnpm-workspace.yaml +0 -11
- package/skeleton/renovate.json +0 -28
- package/skeleton/stylelint.config.js +0 -3
- package/skeleton/tsconfig.json +0 -51
- package/skeleton/turbo.json +0 -74
- package/skeleton/vitest.config.ts +0 -123
package/README.md
CHANGED
|
@@ -4,6 +4,5 @@ Template assets and metadata used by `create-icebreaker` and `@icebreakers/monor
|
|
|
4
4
|
|
|
5
5
|
This package ships:
|
|
6
6
|
|
|
7
|
-
- `skeleton/`: minimal root workspace config files
|
|
8
7
|
- `templates/`: app and package templates
|
|
9
|
-
- `assets/`: upgrade assets for `monorepo`
|
|
8
|
+
- `assets/`: root workspace config files and upgrade assets for `monorepo`
|
package/assets/package.json
CHANGED
|
@@ -53,13 +53,13 @@
|
|
|
53
53
|
"@icebreakers/monorepo": "workspace:*",
|
|
54
54
|
"@icebreakers/stylelint-config": "^1.2.5",
|
|
55
55
|
"@types/fs-extra": "^11.0.4",
|
|
56
|
-
"@types/node": "^25.0.
|
|
56
|
+
"@types/node": "^25.0.9",
|
|
57
57
|
"@types/semver": "^7.7.1",
|
|
58
58
|
"@vitest/coverage-v8": "~4.0.17",
|
|
59
59
|
"ci-info": "^4.3.1",
|
|
60
60
|
"cross-env": "^10.1.0",
|
|
61
61
|
"defu": "^6.1.4",
|
|
62
|
-
"es-toolkit": "^1.
|
|
62
|
+
"es-toolkit": "^1.44.0",
|
|
63
63
|
"eslint": "^9.39.2",
|
|
64
64
|
"execa": "^9.6.1",
|
|
65
65
|
"fs-extra": "^11.3.3",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"pathe": "^2.0.3",
|
|
70
70
|
"pkg-types": "^2.3.0",
|
|
71
71
|
"rimraf": "^6.1.2",
|
|
72
|
-
"stylelint": "^
|
|
72
|
+
"stylelint": "^17.0.0",
|
|
73
73
|
"tsdown": "0.19.0",
|
|
74
74
|
"tslib": "^2.8.1",
|
|
75
75
|
"tsup": "^8.5.1",
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import { execaCommand } from "execa";
|
|
2
|
+
import checkbox from "@inquirer/checkbox";
|
|
3
|
+
import input from "@inquirer/input";
|
|
4
|
+
import select from "@inquirer/select";
|
|
5
|
+
import { Command, program } from "commander";
|
|
6
|
+
|
|
1
7
|
//#region src/paths.d.ts
|
|
2
8
|
declare const packageDir: string;
|
|
3
9
|
declare const templatesDir: string;
|
|
4
|
-
declare const skeletonDir: string;
|
|
5
10
|
declare const assetsDir: string;
|
|
11
|
+
declare const skeletonDir: string;
|
|
6
12
|
//#endregion
|
|
7
13
|
//#region src/prepare.d.ts
|
|
8
14
|
interface PrepareAssetsOptions {
|
|
@@ -11,6 +17,12 @@ interface PrepareAssetsOptions {
|
|
|
11
17
|
}
|
|
12
18
|
declare function prepareAssets(options?: PrepareAssetsOptions): Promise<void>;
|
|
13
19
|
//#endregion
|
|
20
|
+
//#region src/utils/command.d.ts
|
|
21
|
+
interface RunCommandOptions {
|
|
22
|
+
cwd?: string;
|
|
23
|
+
}
|
|
24
|
+
declare function runCommand(command: string, args: string[], options?: RunCommandOptions): Promise<void>;
|
|
25
|
+
//#endregion
|
|
14
26
|
//#region src/utils/gitignore.d.ts
|
|
15
27
|
declare function toPublishGitignorePath(input: string): string;
|
|
16
28
|
declare function toWorkspaceGitignorePath(input: string): string;
|
|
@@ -34,4 +46,4 @@ declare const templateSourceMap: Record<string, string>;
|
|
|
34
46
|
declare const templateTargetMap: Record<string, string>;
|
|
35
47
|
declare const templateMap: Record<string, string>;
|
|
36
48
|
//#endregion
|
|
37
|
-
export { TemplateChoice, assetTargets, assetsDir, createTemplateCopyFilter, getAssetTargets, isGitignoreFile, packageDir, prepareAssets, shouldSkipTemplatePath, skeletonDir, templateChoices, templateMap, templateSourceMap, templateTargetMap, templatesDir, toPublishGitignorePath, toWorkspaceGitignorePath };
|
|
49
|
+
export { Command, TemplateChoice, assetTargets, assetsDir, checkbox, createTemplateCopyFilter, execaCommand, getAssetTargets, input, isGitignoreFile, packageDir, prepareAssets, program, runCommand, select, shouldSkipTemplatePath, skeletonDir, templateChoices, templateMap, templateSourceMap, templateTargetMap, templatesDir, toPublishGitignorePath, toWorkspaceGitignorePath };
|
package/dist/index.mjs
CHANGED
|
@@ -2,6 +2,11 @@ import * as path$1 from "node:path";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import fs from "node:fs/promises";
|
|
5
|
+
import { execa, execaCommand } from "execa";
|
|
6
|
+
import checkbox from "@inquirer/checkbox";
|
|
7
|
+
import input from "@inquirer/input";
|
|
8
|
+
import select from "@inquirer/select";
|
|
9
|
+
import { Command, program } from "commander";
|
|
5
10
|
|
|
6
11
|
//#region assets-data.mjs
|
|
7
12
|
const coreAssetTargets = [
|
|
@@ -96,21 +101,21 @@ const templateChoices$1 = [
|
|
|
96
101
|
//#region src/paths.ts
|
|
97
102
|
const packageDir = path$1.resolve(fileURLToPath(new URL("../", import.meta.url)));
|
|
98
103
|
const templatesDir = path$1.join(packageDir, "templates");
|
|
99
|
-
const skeletonDir = path$1.join(packageDir, "skeleton");
|
|
100
104
|
const assetsDir = path$1.join(packageDir, "assets");
|
|
105
|
+
const skeletonDir = assetsDir;
|
|
101
106
|
|
|
102
107
|
//#endregion
|
|
103
108
|
//#region src/utils/gitignore.ts
|
|
104
109
|
const publishBasename = "gitignore";
|
|
105
110
|
const workspaceBasename = ".gitignore";
|
|
106
|
-
function detectSeparator(input) {
|
|
107
|
-
if (input.includes("\\") && !input.includes("/")) return "\\";
|
|
111
|
+
function detectSeparator(input$1) {
|
|
112
|
+
if (input$1.includes("\\") && !input$1.includes("/")) return "\\";
|
|
108
113
|
return "/";
|
|
109
114
|
}
|
|
110
|
-
function replaceBasename(input, from, to) {
|
|
111
|
-
if (!input) return input;
|
|
112
|
-
const separator = detectSeparator(input);
|
|
113
|
-
const normalized = input.replace(/[\\/]/g, separator);
|
|
115
|
+
function replaceBasename(input$1, from, to) {
|
|
116
|
+
if (!input$1) return input$1;
|
|
117
|
+
const separator = detectSeparator(input$1);
|
|
118
|
+
const normalized = input$1.replace(/[\\/]/g, separator);
|
|
114
119
|
const hasTrailingSeparator = normalized.endsWith(separator);
|
|
115
120
|
const segments = normalized.split(separator);
|
|
116
121
|
if (hasTrailingSeparator && segments[segments.length - 1] === "") segments.pop();
|
|
@@ -120,13 +125,13 @@ function replaceBasename(input, from, to) {
|
|
|
120
125
|
const rebuilt = segments.join(separator);
|
|
121
126
|
return hasTrailingSeparator ? `${rebuilt}${separator}` : rebuilt;
|
|
122
127
|
}
|
|
123
|
-
return input;
|
|
128
|
+
return input$1;
|
|
124
129
|
}
|
|
125
|
-
function toPublishGitignorePath(input) {
|
|
126
|
-
return replaceBasename(input, workspaceBasename, publishBasename);
|
|
130
|
+
function toPublishGitignorePath(input$1) {
|
|
131
|
+
return replaceBasename(input$1, workspaceBasename, publishBasename);
|
|
127
132
|
}
|
|
128
|
-
function toWorkspaceGitignorePath(input) {
|
|
129
|
-
return replaceBasename(input, publishBasename, workspaceBasename);
|
|
133
|
+
function toWorkspaceGitignorePath(input$1) {
|
|
134
|
+
return replaceBasename(input$1, publishBasename, workspaceBasename);
|
|
130
135
|
}
|
|
131
136
|
function isGitignoreFile(name) {
|
|
132
137
|
return toPublishGitignorePath(name) !== name || toWorkspaceGitignorePath(name) !== name;
|
|
@@ -166,22 +171,6 @@ function createTemplateCopyFilter(rootDir) {
|
|
|
166
171
|
|
|
167
172
|
//#endregion
|
|
168
173
|
//#region src/prepare.ts
|
|
169
|
-
const skeletonFiles = [
|
|
170
|
-
".editorconfig",
|
|
171
|
-
".gitignore",
|
|
172
|
-
".npmrc",
|
|
173
|
-
"package.json",
|
|
174
|
-
"pnpm-workspace.yaml",
|
|
175
|
-
"turbo.json",
|
|
176
|
-
"tsconfig.json",
|
|
177
|
-
"eslint.config.js",
|
|
178
|
-
"stylelint.config.js",
|
|
179
|
-
"vitest.config.ts",
|
|
180
|
-
"commitlint.config.ts",
|
|
181
|
-
"lint-staged.config.js",
|
|
182
|
-
"renovate.json",
|
|
183
|
-
"LICENSE"
|
|
184
|
-
];
|
|
185
174
|
async function pathExists(targetPath) {
|
|
186
175
|
try {
|
|
187
176
|
await fs.access(targetPath);
|
|
@@ -235,13 +224,6 @@ async function copyEntry(from, to, overwriteExisting, filter) {
|
|
|
235
224
|
throw error;
|
|
236
225
|
}
|
|
237
226
|
}
|
|
238
|
-
async function copySkeleton(repoRoot, overwriteExisting) {
|
|
239
|
-
for (const file of skeletonFiles) {
|
|
240
|
-
const from = path$1.join(repoRoot, file);
|
|
241
|
-
if (!await pathExists(from)) continue;
|
|
242
|
-
await copyEntry(from, path$1.join(skeletonDir, toPublishGitignorePath(file)), overwriteExisting);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
227
|
async function copyAssets(repoRoot, overwriteExisting) {
|
|
246
228
|
for (const target of assetTargets$1) {
|
|
247
229
|
const from = path$1.join(repoRoot, target);
|
|
@@ -268,12 +250,19 @@ async function prepareAssets(options = {}) {
|
|
|
268
250
|
if (!await pathExists(path$1.join(repoRoot, "templates"))) return;
|
|
269
251
|
await resetDir(assetsDir, overwriteExisting);
|
|
270
252
|
await resetDir(templatesDir, overwriteExisting);
|
|
271
|
-
await resetDir(skeletonDir, overwriteExisting);
|
|
272
|
-
await copySkeleton(repoRoot, overwriteExisting);
|
|
273
253
|
await copyAssets(repoRoot, overwriteExisting);
|
|
274
254
|
await copyTemplates(repoRoot, overwriteExisting);
|
|
275
255
|
}
|
|
276
256
|
|
|
257
|
+
//#endregion
|
|
258
|
+
//#region src/utils/command.ts
|
|
259
|
+
async function runCommand(command, args, options = {}) {
|
|
260
|
+
await execa(command, args, {
|
|
261
|
+
stdio: "inherit",
|
|
262
|
+
...options
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
|
|
277
266
|
//#endregion
|
|
278
267
|
//#region src/index.ts
|
|
279
268
|
const templateChoices = templateChoices$1;
|
|
@@ -284,4 +273,4 @@ const templateTargetMap = Object.fromEntries(templateChoices.map((item) => [item
|
|
|
284
273
|
const templateMap = templateSourceMap;
|
|
285
274
|
|
|
286
275
|
//#endregion
|
|
287
|
-
export { assetTargets, assetsDir, createTemplateCopyFilter, getAssetTargets, isGitignoreFile, packageDir, prepareAssets, shouldSkipTemplatePath, skeletonDir, templateChoices, templateMap, templateSourceMap, templateTargetMap, templatesDir, toPublishGitignorePath, toWorkspaceGitignorePath };
|
|
276
|
+
export { Command, assetTargets, assetsDir, checkbox, createTemplateCopyFilter, execaCommand, getAssetTargets, input, isGitignoreFile, packageDir, prepareAssets, program, runCommand, select, shouldSkipTemplatePath, skeletonDir, 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.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"description": "Template assets for icebreaker monorepo scaffolding",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -32,19 +32,26 @@
|
|
|
32
32
|
"assets",
|
|
33
33
|
"assets-data.mjs",
|
|
34
34
|
"dist",
|
|
35
|
-
"skeleton",
|
|
36
35
|
"template-data.mjs",
|
|
37
36
|
"templates"
|
|
38
37
|
],
|
|
39
38
|
"engines": {
|
|
40
39
|
"node": ">=18.0.0"
|
|
41
40
|
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@inquirer/checkbox": "^5.0.4",
|
|
43
|
+
"@inquirer/input": "^5.0.4",
|
|
44
|
+
"@inquirer/select": "^5.0.4",
|
|
45
|
+
"commander": "^14.0.2",
|
|
46
|
+
"execa": "^9.6.1"
|
|
47
|
+
},
|
|
42
48
|
"publishConfig": {
|
|
43
49
|
"access": "public"
|
|
44
50
|
},
|
|
45
51
|
"scripts": {
|
|
46
52
|
"dev": "tsdown --watch --sourcemap",
|
|
47
53
|
"build": "tsdown",
|
|
54
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
48
55
|
"sync:assets": "node scripts/sync-assets.mjs",
|
|
49
56
|
"lint": "eslint ."
|
|
50
57
|
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@faker-js/faker": "^10.2.0",
|
|
18
|
-
"@tanstack/vue-query": "^5.92.
|
|
18
|
+
"@tanstack/vue-query": "^5.92.7",
|
|
19
19
|
"@tanstack/vue-query-devtools": "^6.1.3",
|
|
20
20
|
"@tanstack/vue-table": "^8.21.3",
|
|
21
21
|
"@tanstack/vue-virtual": "^3.13.18",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"vue-router": "^4.6.4"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@cloudflare/vite-plugin": "^1.
|
|
32
|
+
"@cloudflare/vite-plugin": "^1.21.0",
|
|
33
33
|
"@hono/node-server": "^1.19.9",
|
|
34
34
|
"@hono/trpc-server": "^0.4.2",
|
|
35
35
|
"@tailwindcss/vite": "^4.1.18",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"vite-plugin-vue-devtools": "^8.0.5",
|
|
47
47
|
"vite-tsconfig-paths": "^6.0.4",
|
|
48
48
|
"vue-tsc": "3.2.2",
|
|
49
|
-
"wrangler": "^4.59.
|
|
49
|
+
"wrangler": "^4.59.2",
|
|
50
50
|
"zod": "^4.3.5"
|
|
51
51
|
}
|
|
52
52
|
}
|
package/skeleton/.editorconfig
DELETED
package/skeleton/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 ice breaker
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/skeleton/gitignore
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
2
|
-
|
|
3
|
-
# dependencies
|
|
4
|
-
node_modules
|
|
5
|
-
.pnp
|
|
6
|
-
.pnp.js
|
|
7
|
-
|
|
8
|
-
# testing
|
|
9
|
-
coverage
|
|
10
|
-
|
|
11
|
-
# next.js
|
|
12
|
-
.next/
|
|
13
|
-
out/
|
|
14
|
-
build
|
|
15
|
-
|
|
16
|
-
# misc
|
|
17
|
-
.DS_Store
|
|
18
|
-
*.pem
|
|
19
|
-
|
|
20
|
-
# debug
|
|
21
|
-
npm-debug.log*
|
|
22
|
-
yarn-debug.log*
|
|
23
|
-
yarn-error.log*
|
|
24
|
-
.pnpm-debug.log*
|
|
25
|
-
|
|
26
|
-
# local env files
|
|
27
|
-
.env.local
|
|
28
|
-
.env.development.local
|
|
29
|
-
.env.test.local
|
|
30
|
-
.env.production.local
|
|
31
|
-
|
|
32
|
-
# turbo
|
|
33
|
-
.turbo
|
|
34
|
-
|
|
35
|
-
dist
|
|
36
|
-
vite.config.ts.timestamp-*.mjs
|
|
37
|
-
config.ts.timestamp-*.mjs
|
|
38
|
-
.vite-inspect
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
'*.{js,jsx,mjs,ts,tsx,mts,vue}': [
|
|
3
|
-
'eslint --fix',
|
|
4
|
-
],
|
|
5
|
-
'*.{json,md,mdx,css,html,yml,yaml,scss}': [
|
|
6
|
-
// 'prettier --with-node-modules --ignore-path .prettierignore --write',
|
|
7
|
-
'eslint --fix',
|
|
8
|
-
],
|
|
9
|
-
// for rust
|
|
10
|
-
// '*.rs': ['cargo fmt --'],
|
|
11
|
-
}
|
package/skeleton/package.json
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "monorepo-template",
|
|
3
|
-
"type": "module",
|
|
4
|
-
"version": "0.0.0",
|
|
5
|
-
"private": true,
|
|
6
|
-
"packageManager": "pnpm@10.28.0",
|
|
7
|
-
"author": "ice breaker <1324318532@qq.com>",
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/sonofmagic/monorepo-template.git"
|
|
11
|
-
},
|
|
12
|
-
"bugs": {
|
|
13
|
-
"url": "https://github.com/sonofmagic/monorepo-template/issues"
|
|
14
|
-
},
|
|
15
|
-
"engines": {
|
|
16
|
-
"node": ">=20.0.0"
|
|
17
|
-
},
|
|
18
|
-
"scripts": {
|
|
19
|
-
"build": "turbo run build",
|
|
20
|
-
"dev": "turbo run dev --parallel",
|
|
21
|
-
"test": "vitest run",
|
|
22
|
-
"test:dev": "vitest",
|
|
23
|
-
"lint": "turbo run lint",
|
|
24
|
-
"audit": "pnpm audit --audit-level=moderate",
|
|
25
|
-
"audit:fix": "pnpm audit --fix",
|
|
26
|
-
"typecheck": "turbo run typecheck",
|
|
27
|
-
"format": "eslint . --fix",
|
|
28
|
-
"validate": "pnpm run typecheck && pnpm run lint && pnpm run test",
|
|
29
|
-
"release": "changeset",
|
|
30
|
-
"publish-packages": "turbo run build lint test && changeset version && changeset publish",
|
|
31
|
-
"------": "--------------",
|
|
32
|
-
"preinstall": "npx only-allow pnpm",
|
|
33
|
-
"prepare": "husky",
|
|
34
|
-
"commit": "commit",
|
|
35
|
-
"commitlint": "commitlint --edit",
|
|
36
|
-
"-------": "---------------",
|
|
37
|
-
"pr:alpha": "changeset pre enter alpha",
|
|
38
|
-
"pr:beta": "changeset pre enter beta",
|
|
39
|
-
"pr:rc": "changeset pre enter rc",
|
|
40
|
-
"pr:exit": "changeset pre exit",
|
|
41
|
-
"--------": "----------------",
|
|
42
|
-
"script:init": "monorepo init",
|
|
43
|
-
"script:sync": "monorepo sync",
|
|
44
|
-
"script:clean": "monorepo clean",
|
|
45
|
-
"script:mirror": "monorepo mirror"
|
|
46
|
-
},
|
|
47
|
-
"devDependencies": {
|
|
48
|
-
"@changesets/cli": "^2.29.8",
|
|
49
|
-
"@commitlint/cli": "^20.3.1",
|
|
50
|
-
"@icebreakers/changelog-github": "^0.1.0",
|
|
51
|
-
"@icebreakers/commitlint-config": "^1.2.5",
|
|
52
|
-
"@icebreakers/eslint-config": "^1.6.13",
|
|
53
|
-
"@icebreakers/monorepo": "workspace:*",
|
|
54
|
-
"@icebreakers/stylelint-config": "^1.2.5",
|
|
55
|
-
"@types/fs-extra": "^11.0.4",
|
|
56
|
-
"@types/node": "^25.0.8",
|
|
57
|
-
"@types/semver": "^7.7.1",
|
|
58
|
-
"@vitest/coverage-v8": "~4.0.17",
|
|
59
|
-
"ci-info": "^4.3.1",
|
|
60
|
-
"cross-env": "^10.1.0",
|
|
61
|
-
"defu": "^6.1.4",
|
|
62
|
-
"es-toolkit": "^1.43.0",
|
|
63
|
-
"eslint": "^9.39.2",
|
|
64
|
-
"execa": "^9.6.1",
|
|
65
|
-
"fs-extra": "^11.3.3",
|
|
66
|
-
"husky": "^9.1.7",
|
|
67
|
-
"lint-staged": "^16.2.7",
|
|
68
|
-
"only-allow": "^1.2.2",
|
|
69
|
-
"pathe": "^2.0.3",
|
|
70
|
-
"pkg-types": "^2.3.0",
|
|
71
|
-
"rimraf": "^6.1.2",
|
|
72
|
-
"stylelint": "^16.26.1",
|
|
73
|
-
"tsdown": "0.19.0",
|
|
74
|
-
"tslib": "^2.8.1",
|
|
75
|
-
"tsup": "^8.5.1",
|
|
76
|
-
"tsx": "^4.21.0",
|
|
77
|
-
"turbo": "^2.7.4",
|
|
78
|
-
"type-fest": "^5.4.1",
|
|
79
|
-
"typescript": "^5.9.3",
|
|
80
|
-
"unbuild": "^3.6.1",
|
|
81
|
-
"vitest": "~4.0.17",
|
|
82
|
-
"yaml": "^2.8.2"
|
|
83
|
-
},
|
|
84
|
-
"publishConfig": {
|
|
85
|
-
"access": "public",
|
|
86
|
-
"registry": "https://registry.npmjs.org"
|
|
87
|
-
}
|
|
88
|
-
}
|
package/skeleton/renovate.json
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
3
|
-
"extends": [
|
|
4
|
-
"config:recommended",
|
|
5
|
-
"group:allNonMajor",
|
|
6
|
-
":semanticCommitTypeAll(chore)"
|
|
7
|
-
],
|
|
8
|
-
"commitBody": "[skip netlify]",
|
|
9
|
-
"rangeStrategy": "bump",
|
|
10
|
-
"npm": {
|
|
11
|
-
"commitMessageTopic": "{{prettyDepType}} {{depName}}"
|
|
12
|
-
},
|
|
13
|
-
"ignoreDeps": [
|
|
14
|
-
"node"
|
|
15
|
-
],
|
|
16
|
-
"automerge": true,
|
|
17
|
-
"automergeType": "pr",
|
|
18
|
-
"packageRules": [
|
|
19
|
-
{
|
|
20
|
-
"matchUpdateTypes": [
|
|
21
|
-
"minor",
|
|
22
|
-
"patch",
|
|
23
|
-
"pin",
|
|
24
|
-
"digest"
|
|
25
|
-
]
|
|
26
|
-
}
|
|
27
|
-
]
|
|
28
|
-
}
|
package/skeleton/tsconfig.json
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
// 指定 ECMAScript 目标版本,ESNext 表示支持最新的 ES 特性
|
|
4
|
-
"target": "ESNext",
|
|
5
|
-
|
|
6
|
-
// 指定模块系统,ESNext 使用原生 ES 模块 (import/export)
|
|
7
|
-
"module": "ESNext",
|
|
8
|
-
|
|
9
|
-
// 模块解析策略,Bundler 模式适用于打包工具(如 Vite、Webpack),支持更宽松的解析规则
|
|
10
|
-
"moduleResolution": "Bundler",
|
|
11
|
-
|
|
12
|
-
// 允许导入 .json 文件,并自动生成类型声明
|
|
13
|
-
"resolveJsonModule": true,
|
|
14
|
-
|
|
15
|
-
// 指定要包含的类型声明文件,node 提供 Node.js API 类型,vitest/globals 提供测试全局变量类型
|
|
16
|
-
"types": [
|
|
17
|
-
"node",
|
|
18
|
-
"vitest/globals"
|
|
19
|
-
],
|
|
20
|
-
|
|
21
|
-
// 允许编译 JavaScript 文件,使其可以被导入和进行类型检查
|
|
22
|
-
"allowJs": true,
|
|
23
|
-
|
|
24
|
-
// 启用所有严格类型检查选项,包括 noImplicitAny、strictNullChecks 等
|
|
25
|
-
"strict": true,
|
|
26
|
-
|
|
27
|
-
// 严格检查可选属性类型,区分 undefined 和缺失的属性
|
|
28
|
-
"exactOptionalPropertyTypes": true,
|
|
29
|
-
|
|
30
|
-
// 要求子类重写父类方法时必须使用 override 关键字
|
|
31
|
-
"noImplicitOverride": true,
|
|
32
|
-
|
|
33
|
-
// 禁止通过索引签名(如 obj['key'])访问未在索引签名中定义的属性
|
|
34
|
-
"noPropertyAccessFromIndexSignature": true,
|
|
35
|
-
|
|
36
|
-
// 访问索引签名时返回 undefined | T,而不是 T(防止未定义访问错误)
|
|
37
|
-
"noUncheckedIndexedAccess": true,
|
|
38
|
-
|
|
39
|
-
// 不生成输出文件(仅用于类型检查,实际由打包工具处理编译)
|
|
40
|
-
"noEmit": true,
|
|
41
|
-
|
|
42
|
-
// 允许从没有默认导出的模块中默认导入(如 import React from 'react')
|
|
43
|
-
"allowSyntheticDefaultImports": true,
|
|
44
|
-
|
|
45
|
-
// 启用 ES 模块互操作性,为 CommonJS 模块提供 synthetic default imports
|
|
46
|
-
"esModuleInterop": true,
|
|
47
|
-
|
|
48
|
-
// 跳过库文件的类型检查,提高编译速度(库文件通常已经有类型声明)
|
|
49
|
-
"skipLibCheck": true
|
|
50
|
-
}
|
|
51
|
-
}
|
package/skeleton/turbo.json
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://turborepo.com/schema.json",
|
|
3
|
-
"tasks": {
|
|
4
|
-
"build": {
|
|
5
|
-
"dependsOn": [
|
|
6
|
-
"^build"
|
|
7
|
-
],
|
|
8
|
-
"inputs": [
|
|
9
|
-
"src/**",
|
|
10
|
-
"lib/**",
|
|
11
|
-
"package.json",
|
|
12
|
-
"tsconfig*.json",
|
|
13
|
-
"*.config.{js,ts,mjs,mts}"
|
|
14
|
-
],
|
|
15
|
-
"outputs": [
|
|
16
|
-
"dist/**",
|
|
17
|
-
"bin/**"
|
|
18
|
-
]
|
|
19
|
-
},
|
|
20
|
-
"lint": {
|
|
21
|
-
"dependsOn": [
|
|
22
|
-
"^lint"
|
|
23
|
-
],
|
|
24
|
-
"inputs": [
|
|
25
|
-
"src/**",
|
|
26
|
-
"lib/**",
|
|
27
|
-
"test/**",
|
|
28
|
-
"*.config.{js,ts}",
|
|
29
|
-
".eslintrc*",
|
|
30
|
-
".stylelintrc*"
|
|
31
|
-
],
|
|
32
|
-
"outputs": []
|
|
33
|
-
},
|
|
34
|
-
"dev": {
|
|
35
|
-
"cache": false,
|
|
36
|
-
"persistent": true
|
|
37
|
-
},
|
|
38
|
-
"test": {
|
|
39
|
-
"dependsOn": [
|
|
40
|
-
"^test"
|
|
41
|
-
],
|
|
42
|
-
"inputs": [
|
|
43
|
-
"src/**",
|
|
44
|
-
"lib/**",
|
|
45
|
-
"test/**",
|
|
46
|
-
"package.json",
|
|
47
|
-
"vitest.config.{js,ts}",
|
|
48
|
-
"tsconfig*.json"
|
|
49
|
-
],
|
|
50
|
-
"outputs": [
|
|
51
|
-
"coverage/**"
|
|
52
|
-
]
|
|
53
|
-
},
|
|
54
|
-
"typecheck": {
|
|
55
|
-
"dependsOn": [
|
|
56
|
-
"^typecheck"
|
|
57
|
-
],
|
|
58
|
-
"inputs": [
|
|
59
|
-
"src/**",
|
|
60
|
-
"lib/**",
|
|
61
|
-
"test/**",
|
|
62
|
-
"package.json",
|
|
63
|
-
"tsconfig*.json"
|
|
64
|
-
],
|
|
65
|
-
"outputs": []
|
|
66
|
-
},
|
|
67
|
-
"release": {
|
|
68
|
-
"cache": false
|
|
69
|
-
},
|
|
70
|
-
"sync": {
|
|
71
|
-
"cache": false
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs'
|
|
2
|
-
import path from 'node:path'
|
|
3
|
-
import { fileURLToPath } from 'node:url'
|
|
4
|
-
import { defineConfig } from 'vitest/config'
|
|
5
|
-
import YAML from 'yaml'
|
|
6
|
-
|
|
7
|
-
const ROOT_DIR = path.dirname(fileURLToPath(new URL(import.meta.url)))
|
|
8
|
-
const WORKSPACE_FILE = path.resolve(ROOT_DIR, 'pnpm-workspace.yaml')
|
|
9
|
-
const CONFIG_FILENAMES = [
|
|
10
|
-
'vitest.config.ts',
|
|
11
|
-
'vitest.config.mts',
|
|
12
|
-
'vitest.config.cts',
|
|
13
|
-
'vitest.config.js',
|
|
14
|
-
'vitest.config.cjs',
|
|
15
|
-
'vitest.config.mjs',
|
|
16
|
-
] as const
|
|
17
|
-
|
|
18
|
-
function extractBaseDirFromGlob(pattern: string): string | null {
|
|
19
|
-
if (!pattern) {
|
|
20
|
-
return null
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const normalized = pattern
|
|
24
|
-
.replace(/\\/g, '/')
|
|
25
|
-
.replace(/^\.\//, '')
|
|
26
|
-
const globIndex = normalized.search(/[*?[{]/)
|
|
27
|
-
const base = globIndex === -1
|
|
28
|
-
? normalized
|
|
29
|
-
: normalized.slice(0, globIndex)
|
|
30
|
-
|
|
31
|
-
const cleaned = base.replace(/\/+$/, '')
|
|
32
|
-
return cleaned || null
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function loadProjectRootsFromWorkspace(): string[] {
|
|
36
|
-
if (!fs.existsSync(WORKSPACE_FILE)) {
|
|
37
|
-
return []
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
try {
|
|
41
|
-
const workspaceContent = fs.readFileSync(WORKSPACE_FILE, 'utf8')
|
|
42
|
-
const workspace = YAML.parse(workspaceContent) ?? {}
|
|
43
|
-
const packages: unknown[] = Array.isArray(workspace.packages) ? workspace.packages : []
|
|
44
|
-
const roots = packages
|
|
45
|
-
.map(entry => typeof entry === 'string' ? entry.trim() : '')
|
|
46
|
-
.filter(entry => entry && !entry.startsWith('!'))
|
|
47
|
-
.map(extractBaseDirFromGlob)
|
|
48
|
-
.filter((entry): entry is string => Boolean(entry))
|
|
49
|
-
|
|
50
|
-
return roots.length ? Array.from(new Set(roots)) : []
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
console.warn('[vitest] Failed to parse pnpm-workspace.yaml, no project roots will be used.', error)
|
|
54
|
-
return []
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const PROJECT_ROOTS = loadProjectRootsFromWorkspace()
|
|
59
|
-
|
|
60
|
-
if (!PROJECT_ROOTS.length) {
|
|
61
|
-
console.warn('[vitest] No project roots detected. Check pnpm-workspace.yaml to define workspace packages.')
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function findConfig(basePath: string): string | null {
|
|
65
|
-
for (const filename of CONFIG_FILENAMES) {
|
|
66
|
-
const candidate = path.join(basePath, filename)
|
|
67
|
-
if (fs.existsSync(candidate)) {
|
|
68
|
-
return candidate
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return null
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function resolveProjects(): string[] {
|
|
75
|
-
const projects: string[] = []
|
|
76
|
-
|
|
77
|
-
for (const folder of PROJECT_ROOTS) {
|
|
78
|
-
const rootPath = path.resolve(ROOT_DIR, folder)
|
|
79
|
-
if (!fs.existsSync(rootPath)) {
|
|
80
|
-
continue
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const rootConfig = findConfig(rootPath)
|
|
84
|
-
if (rootConfig) {
|
|
85
|
-
projects.push(rootConfig)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const entries = fs.readdirSync(rootPath, { withFileTypes: true })
|
|
89
|
-
for (const entry of entries) {
|
|
90
|
-
if (!entry.isDirectory()) {
|
|
91
|
-
continue
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const projectDir = path.join(rootPath, entry.name)
|
|
95
|
-
const configPath = findConfig(projectDir)
|
|
96
|
-
if (configPath) {
|
|
97
|
-
projects.push(configPath)
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return projects
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const projects = resolveProjects()
|
|
106
|
-
|
|
107
|
-
export default defineConfig(() => {
|
|
108
|
-
return {
|
|
109
|
-
test: {
|
|
110
|
-
projects,
|
|
111
|
-
coverage: {
|
|
112
|
-
enabled: true,
|
|
113
|
-
skipFull: true,
|
|
114
|
-
exclude: [
|
|
115
|
-
'**/dist/**',
|
|
116
|
-
],
|
|
117
|
-
},
|
|
118
|
-
forceRerunTriggers: [
|
|
119
|
-
'**/{vitest,vite}.config.*/**',
|
|
120
|
-
],
|
|
121
|
-
},
|
|
122
|
-
}
|
|
123
|
-
})
|