@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/README.md
CHANGED
|
@@ -6,3 +6,15 @@ This package ships:
|
|
|
6
6
|
|
|
7
7
|
- `templates/`: app and package templates
|
|
8
8
|
- `assets/`: root workspace config files and upgrade assets for `monorepo`
|
|
9
|
+
- template metadata helpers such as `getTemplateChoices()`, `getTemplateChoice()`, and `getTemplateDefinition()`
|
|
10
|
+
|
|
11
|
+
## Template Discovery
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { getTemplateChoices, getTemplateDefinition } from '@icebreakers/monorepo-templates'
|
|
15
|
+
|
|
16
|
+
const libraries = getTemplateChoices({ category: 'library' })
|
|
17
|
+
const vitepress = getTemplateDefinition('vitepress')
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The returned metadata is a cloned snapshot, so callers can safely format it for CLI help, docs, or scaffold previews without mutating the package registry.
|
|
@@ -31,7 +31,7 @@ jobs:
|
|
|
31
31
|
with:
|
|
32
32
|
fetch-depth: 2
|
|
33
33
|
|
|
34
|
-
- uses: pnpm/action-setup@
|
|
34
|
+
- uses: pnpm/action-setup@v6
|
|
35
35
|
|
|
36
36
|
- name: Setup Node.js environment
|
|
37
37
|
uses: actions/setup-node@v6
|
|
@@ -53,10 +53,16 @@ jobs:
|
|
|
53
53
|
- name: Build
|
|
54
54
|
run: pnpm build
|
|
55
55
|
|
|
56
|
+
- name: Typecheck
|
|
57
|
+
run: pnpm typecheck
|
|
58
|
+
|
|
59
|
+
- name: TSD
|
|
60
|
+
run: pnpm tsd
|
|
61
|
+
|
|
56
62
|
- name: Test
|
|
57
63
|
run: pnpm test
|
|
58
64
|
|
|
59
65
|
- name: Upload coverage reports to Codecov
|
|
60
|
-
uses: codecov/codecov-action@
|
|
66
|
+
uses: codecov/codecov-action@v6
|
|
61
67
|
env:
|
|
62
68
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
@@ -24,7 +24,7 @@ jobs:
|
|
|
24
24
|
- name: Checkout Repo
|
|
25
25
|
uses: actions/checkout@v6
|
|
26
26
|
|
|
27
|
-
- uses: pnpm/action-setup@
|
|
27
|
+
- uses: pnpm/action-setup@v6
|
|
28
28
|
|
|
29
29
|
- name: Setup Node.js environment
|
|
30
30
|
uses: actions/setup-node@v6
|
|
@@ -52,6 +52,6 @@ jobs:
|
|
|
52
52
|
NPM_CONFIG_PROVENANCE: true
|
|
53
53
|
|
|
54
54
|
- name: Upload coverage reports to Codecov
|
|
55
|
-
uses: codecov/codecov-action@
|
|
55
|
+
uses: codecov/codecov-action@v6
|
|
56
56
|
env:
|
|
57
57
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
package/assets/.husky/commit-msg
CHANGED
package/assets/.husky/pre-commit
CHANGED
package/assets/AGENTS.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Project Structure & Module Organization
|
|
4
4
|
|
|
5
|
-
This pnpm + Turbo monorepo keeps template sources under `templates/` (`cli`, `client`, `server`, `vitepress`, `
|
|
5
|
+
This pnpm + Turbo monorepo keeps template sources under `templates/` (`cli`, `client`, `server`, `vitepress`, `tsdown`, `vue-lib`) and reusable tooling under `packages/` (e.g., `monorepo`, `create-icebreaker`). Shared TypeScript and build settings live in root configs such as `turbo.json`, `tsconfig.json`, and `eslint.config.js`. Tests sit alongside their targets in `test/*.test.ts`, and each app owns its public assets (`public/`, `worker/`) to keep deployments self-contained.
|
|
6
6
|
|
|
7
7
|
## Build, Test, and Development Commands
|
|
8
8
|
|
|
@@ -15,11 +15,11 @@ This pnpm + Turbo monorepo keeps template sources under `templates/` (`cli`, `cl
|
|
|
15
15
|
|
|
16
16
|
## Coding Style & Naming Conventions
|
|
17
17
|
|
|
18
|
-
Follow the root `.editorconfig`: two-space indentation, LF line endings, UTF-8. Prefer TypeScript (`.ts`/`.tsx`) and Vue SFCs; name files with kebab-case (`user-table.vue`) and exported symbols with PascalCase for components or camelCase for utilities. ESLint (`@icebreakers/eslint-config`) and Stylelint enforce formatting; run `pnpm lint` before committing, and rely on Husky + lint-staged to auto-fix staged files. Any style-related code changes (CSS, SCSS, Less, Vue style blocks, and similar files) must pass Stylelint checks before commit. All changed code must pass ESLint checks before commit.
|
|
18
|
+
Follow the root `.editorconfig`: two-space indentation, LF line endings, UTF-8. Prefer TypeScript (`.ts`/`.tsx`) and Vue SFCs; name files with kebab-case (`user-table.vue`) and exported symbols with PascalCase for components or camelCase for utilities. ESLint (`@icebreakers/eslint-config`) and Stylelint enforce formatting; run `pnpm lint` before committing, and rely on Husky + lint-staged to auto-fix staged files. Any style-related code changes (CSS, SCSS, Less, Vue style blocks, and similar files) must pass Stylelint checks before commit. All changed JavaScript, TypeScript, and Vue code must pass ESLint checks before commit.
|
|
19
19
|
|
|
20
|
-
`
|
|
20
|
+
`lint-staged.config.js` must include Stylelint checks for staged style files so style validation also runs during pre-commit. It must also route staged TypeScript and Vue files into workspace `typecheck` scripts so Vue workspaces run `vue-tsc` and non-Vue TypeScript workspaces run `tsc`.
|
|
21
21
|
|
|
22
|
-
When a single code file exceeds 300 lines, treat it as a refactor signal and split it into smaller modules.
|
|
22
|
+
When a single code file exceeds 300 lines, treat it as a refactor signal and split it into smaller modules before commit whenever the change touches that area. Do not keep appending responsibilities to an already large file when a folder-based split would make the design clearer.
|
|
23
23
|
|
|
24
24
|
When splitting code, do not create suffix-based sibling files such as `xxx.config.ts` or `xxx.filter.ts` just to move logic around. Create a dedicated folder (for example `xxx/`) and place the split modules inside it with clear responsibilities.
|
|
25
25
|
|
|
@@ -34,7 +34,7 @@ Before running tests, build the packages first and run tests against build artif
|
|
|
34
34
|
|
|
35
35
|
TypeScript issues must be fixed before commit. Do not commit with unresolved TypeScript compile or type-check errors.
|
|
36
36
|
|
|
37
|
-
TypeScript code must be validated with
|
|
37
|
+
TypeScript code must be validated with the relevant workspace `typecheck` script and must not contain type errors. Pure TypeScript workspaces are expected to validate with `tsc` (`pnpm typecheck` or `tsc -p tsconfig.json`). Vue workspaces are expected to validate with `vue-tsc` (typically `vue-tsc -b`).
|
|
38
38
|
|
|
39
39
|
When building TypeScript libraries (type-focused APIs or public type definitions), add and maintain `tsd` type tests to verify exported type behavior.
|
|
40
40
|
|
|
@@ -45,7 +45,8 @@ Commits must conform to Conventional Commit syntax; recent history uses prefixes
|
|
|
45
45
|
For AI-generated or AI-assisted changes, use this verification order before commit or PR:
|
|
46
46
|
|
|
47
47
|
1. Run build first (`pnpm build` or the relevant workspace build command).
|
|
48
|
-
2. Run lint checks, ensuring all changed code passes ESLint and style-related code passes Stylelint.
|
|
49
|
-
3. Run TypeScript checks and fix all type errors before proceeding.
|
|
48
|
+
2. Run lint checks, ensuring all changed JavaScript, TypeScript, and Vue code passes ESLint and all style-related code passes Stylelint.
|
|
49
|
+
3. Run TypeScript checks and fix all type errors before proceeding. Vue workspaces must pass `vue-tsc`; TypeScript workspaces must pass `tsc`.
|
|
50
50
|
4. For TypeScript libraries, run `tsd` type tests and fix all failures before proceeding.
|
|
51
51
|
5. Run tests against built artifacts, including unit, integration, and E2E suites (when available in the affected workspace).
|
|
52
|
+
6. Before commit, review whether the touched files need splitting or refactoring; do not commit avoidable large-file growth when a clearer module boundary is apparent.
|
package/assets/Dockerfile
CHANGED
|
@@ -7,21 +7,12 @@ FROM base AS builder
|
|
|
7
7
|
COPY . /usr/src/app
|
|
8
8
|
WORKDIR /usr/src/app
|
|
9
9
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
|
10
|
-
RUN pnpm run -r build
|
|
11
|
-
&& pnpm deploy --filter=@icebreakers/foo --prod /prod/foo \
|
|
12
|
-
&& pnpm deploy --filter=@icebreakers/bar --prod /prod/bar
|
|
10
|
+
RUN pnpm run -r build
|
|
13
11
|
|
|
14
|
-
FROM base AS
|
|
15
|
-
COPY --from=builder /
|
|
16
|
-
WORKDIR /
|
|
12
|
+
FROM base AS app
|
|
13
|
+
COPY --from=builder /usr/src/app /app
|
|
14
|
+
WORKDIR /app
|
|
17
15
|
EXPOSE 8000
|
|
18
16
|
CMD [ "pnpm", "start" ]
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
COPY --from=builder /prod/bar /prod/bar
|
|
22
|
-
WORKDIR /prod/bar
|
|
23
|
-
EXPOSE 8001
|
|
24
|
-
CMD [ "pnpm", "start" ]
|
|
25
|
-
|
|
26
|
-
# docker build . --target foo --tag foo:latest
|
|
27
|
-
# docker build . --target bar --tag bar:latest
|
|
18
|
+
# docker build . --target app --tag app:latest
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineCommitlintConfig } from 'repoctl/tooling'
|
|
2
2
|
|
|
3
|
-
export default
|
|
3
|
+
export default await defineCommitlintConfig()
|
package/assets/eslint.config.js
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.33.2",
|
|
7
7
|
"author": "ice breaker <hi@sonofmagic.top>",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -17,66 +17,76 @@
|
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
19
|
"build": "turbo run build",
|
|
20
|
+
"tooling:build": "turbo run build --filter=@icebreakers/monorepo --filter=repoctl",
|
|
20
21
|
"dev": "turbo run dev --parallel",
|
|
21
22
|
"test": "vitest run",
|
|
22
23
|
"test:dev": "vitest",
|
|
23
|
-
"lint": "turbo run lint",
|
|
24
|
+
"lint": "pnpm run tooling:build && turbo run lint",
|
|
25
|
+
"tsd": "turbo run tsd",
|
|
24
26
|
"audit": "pnpm audit --audit-level=moderate",
|
|
25
27
|
"audit:fix": "pnpm audit --fix",
|
|
26
28
|
"typecheck": "turbo run typecheck",
|
|
27
29
|
"format": "eslint . --fix",
|
|
28
|
-
"validate": "pnpm run
|
|
30
|
+
"validate": "pnpm run build && pnpm run lint && pnpm run typecheck && pnpm run tsd && pnpm run test",
|
|
29
31
|
"release": "changeset",
|
|
30
|
-
"publish-packages": "
|
|
32
|
+
"publish-packages": "pnpm run build && pnpm run lint && pnpm run test && changeset version && changeset publish",
|
|
31
33
|
"------": "--------------",
|
|
32
34
|
"preinstall": "npx only-allow pnpm",
|
|
33
35
|
"prepare": "husky",
|
|
34
36
|
"commit": "commit",
|
|
35
37
|
"commitlint": "commitlint --edit",
|
|
36
38
|
"-------": "---------------",
|
|
39
|
+
"setup": "repo setup",
|
|
40
|
+
"new": "repo new",
|
|
41
|
+
"check": "repo check",
|
|
42
|
+
"doctor": "repo doctor",
|
|
43
|
+
"sync": "repo sync",
|
|
44
|
+
"clean:repo": "repo clean",
|
|
45
|
+
"mirror": "repo mirror",
|
|
46
|
+
"------simple": "--------------",
|
|
37
47
|
"pr:alpha": "changeset pre enter alpha",
|
|
38
48
|
"pr:beta": "changeset pre enter beta",
|
|
39
49
|
"pr:rc": "changeset pre enter rc",
|
|
40
50
|
"pr:exit": "changeset pre exit",
|
|
41
51
|
"--------": "----------------",
|
|
42
|
-
"script:init": "
|
|
43
|
-
"script:sync": "
|
|
44
|
-
"script:clean": "
|
|
45
|
-
"script:mirror": "
|
|
52
|
+
"script:init": "repo init",
|
|
53
|
+
"script:sync": "repo sync",
|
|
54
|
+
"script:clean": "repo clean",
|
|
55
|
+
"script:mirror": "repo mirror"
|
|
46
56
|
},
|
|
47
57
|
"devDependencies": {
|
|
48
|
-
"@changesets/cli": "^2.
|
|
49
|
-
"@commitlint/cli": "^20.5.
|
|
50
|
-
"@icebreakers/changelog-github": "^0.2
|
|
51
|
-
"@icebreakers/commitlint-config": "^
|
|
52
|
-
"@icebreakers/eslint-config": "^
|
|
58
|
+
"@changesets/cli": "^2.31.0",
|
|
59
|
+
"@commitlint/cli": "^20.5.3",
|
|
60
|
+
"@icebreakers/changelog-github": "^1.0.2",
|
|
61
|
+
"@icebreakers/commitlint-config": "^2.0.0",
|
|
62
|
+
"@icebreakers/eslint-config": "^4.0.10",
|
|
53
63
|
"@icebreakers/monorepo": "workspace:*",
|
|
54
|
-
"@icebreakers/stylelint-config": "^
|
|
55
|
-
"@types/node": "^25.
|
|
64
|
+
"@icebreakers/stylelint-config": "^3.0.6",
|
|
65
|
+
"@types/node": "^25.6.0",
|
|
56
66
|
"@types/semver": "^7.7.1",
|
|
57
|
-
"@vitest/coverage-v8": "~4.1.
|
|
67
|
+
"@vitest/coverage-v8": "~4.1.5",
|
|
58
68
|
"ci-info": "^4.4.0",
|
|
59
69
|
"cross-env": "^10.1.0",
|
|
60
|
-
"defu": "^6.1.
|
|
61
|
-
"es-toolkit": "^1.
|
|
62
|
-
"eslint": "^10.0
|
|
70
|
+
"defu": "^6.1.7",
|
|
71
|
+
"es-toolkit": "^1.46.1",
|
|
72
|
+
"eslint": "^10.3.0",
|
|
63
73
|
"husky": "^9.1.7",
|
|
64
|
-
"
|
|
74
|
+
"lint-staged": "^16.4.0",
|
|
65
75
|
"only-allow": "^1.2.2",
|
|
66
76
|
"pathe": "^2.0.3",
|
|
67
|
-
"pkg-types": "^2.3.
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
77
|
+
"pkg-types": "^2.3.1",
|
|
78
|
+
"repoctl": "workspace:*",
|
|
79
|
+
"stylelint": "^17.11.0",
|
|
80
|
+
"tailwindcss": "^4.2.4",
|
|
81
|
+
"tsd": "^0.33.0",
|
|
82
|
+
"tsdown": "0.21.10",
|
|
71
83
|
"tslib": "^2.8.1",
|
|
72
|
-
"tsup": "^8.5.1",
|
|
73
84
|
"tsx": "^4.21.0",
|
|
74
|
-
"turbo": "^2.
|
|
75
|
-
"type-fest": "^5.
|
|
76
|
-
"typescript": "^
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"yaml": "^2.8.2"
|
|
85
|
+
"turbo": "^2.9.9",
|
|
86
|
+
"type-fest": "^5.6.0",
|
|
87
|
+
"typescript": "^6.0.3",
|
|
88
|
+
"vitest": "~4.1.5",
|
|
89
|
+
"yaml": "^2.8.4"
|
|
80
90
|
},
|
|
81
91
|
"publishConfig": {
|
|
82
92
|
"access": "public",
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { MonorepoConfig } from 'repoctl'
|
|
2
|
+
|
|
3
|
+
function createLintStagedConfig(monorepoCommand: string) {
|
|
4
|
+
return {
|
|
5
|
+
'*.{js,jsx,mjs,ts,tsx,mts,cts}': [
|
|
6
|
+
'eslint --fix',
|
|
7
|
+
],
|
|
8
|
+
'*.vue': [
|
|
9
|
+
'eslint --fix',
|
|
10
|
+
'stylelint --fix --allow-empty-input',
|
|
11
|
+
],
|
|
12
|
+
'*.{ts,tsx,mts,cts,vue}': (files: string[]) => {
|
|
13
|
+
const uniqueFiles = [...new Set(files)]
|
|
14
|
+
if (uniqueFiles.length === 0) {
|
|
15
|
+
return []
|
|
16
|
+
}
|
|
17
|
+
return `${monorepoCommand} verify staged-typecheck ${uniqueFiles.map(file => `'${file.replaceAll('\'', '\'\\\'\'')}'`).join(' ')}`
|
|
18
|
+
},
|
|
19
|
+
'*.{json,md,mdx,html,yml,yaml}': [
|
|
20
|
+
'eslint --fix',
|
|
21
|
+
],
|
|
22
|
+
'*.{css,scss,sass,less}': [
|
|
23
|
+
'stylelint --fix --allow-empty-input',
|
|
24
|
+
],
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
commands: {
|
|
30
|
+
create: {
|
|
31
|
+
defaultTemplate: 'tsdown',
|
|
32
|
+
renameJson: false,
|
|
33
|
+
},
|
|
34
|
+
clean: {
|
|
35
|
+
autoConfirm: false,
|
|
36
|
+
ignorePackages: ['@icebreakers/website'],
|
|
37
|
+
},
|
|
38
|
+
upgrade: {
|
|
39
|
+
skipOverwrite: false,
|
|
40
|
+
mergeTargets: true,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
tooling: {
|
|
44
|
+
commitlint: {
|
|
45
|
+
extends: ['@commitlint/config-conventional'],
|
|
46
|
+
},
|
|
47
|
+
eslint: {
|
|
48
|
+
ignores: ['**/fixtures/**'],
|
|
49
|
+
},
|
|
50
|
+
stylelint: {
|
|
51
|
+
rules: {},
|
|
52
|
+
},
|
|
53
|
+
lintStaged: {
|
|
54
|
+
config: createLintStagedConfig('pnpm exec repoctl'),
|
|
55
|
+
},
|
|
56
|
+
tsconfig: {
|
|
57
|
+
compilerOptions: {},
|
|
58
|
+
},
|
|
59
|
+
vitest: {
|
|
60
|
+
includeWorkspaceRootConfig: false,
|
|
61
|
+
coverageSkipFull: true,
|
|
62
|
+
},
|
|
63
|
+
vitestProject: {
|
|
64
|
+
globals: true,
|
|
65
|
+
testTimeout: 60_000,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
} satisfies MonorepoConfig
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineStylelintConfig } from 'repoctl/tooling'
|
|
2
2
|
|
|
3
|
-
export default
|
|
3
|
+
export default await defineStylelintConfig()
|
package/assets/tsconfig.json
CHANGED
|
@@ -1,51 +1,3 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
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
|
-
}
|
|
2
|
+
"extends": "repoctl/tsconfig"
|
|
51
3
|
}
|
package/assets/turbo.json
CHANGED
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
],
|
|
15
15
|
"outputs": [
|
|
16
16
|
"dist/**",
|
|
17
|
-
"bin/**"
|
|
17
|
+
"bin/**",
|
|
18
|
+
".vitepress/dist/**"
|
|
18
19
|
]
|
|
19
20
|
},
|
|
20
21
|
"lint": {
|
|
@@ -22,12 +23,12 @@
|
|
|
22
23
|
"^lint"
|
|
23
24
|
],
|
|
24
25
|
"inputs": [
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"*.config.{js,ts}",
|
|
26
|
+
"**/*.{js,jsx,cjs,mjs,ts,tsx,cts,mts,vue}",
|
|
27
|
+
"**/*.{json,html,md,mdx,yml,yaml}",
|
|
28
|
+
"*.config.{js,ts,mjs,mts}",
|
|
29
29
|
".eslintrc*",
|
|
30
|
-
".stylelintrc*"
|
|
30
|
+
".stylelintrc*",
|
|
31
|
+
"package.json"
|
|
31
32
|
],
|
|
32
33
|
"outputs": []
|
|
33
34
|
},
|
|
@@ -64,6 +65,16 @@
|
|
|
64
65
|
],
|
|
65
66
|
"outputs": []
|
|
66
67
|
},
|
|
68
|
+
"tsd": {
|
|
69
|
+
"inputs": [
|
|
70
|
+
"src/**",
|
|
71
|
+
"lib/**",
|
|
72
|
+
"test-d/**",
|
|
73
|
+
"package.json",
|
|
74
|
+
"tsconfig*.json"
|
|
75
|
+
],
|
|
76
|
+
"outputs": []
|
|
77
|
+
},
|
|
67
78
|
"release": {
|
|
68
79
|
"cache": false
|
|
69
80
|
},
|
package/assets/vitest.config.ts
CHANGED
|
@@ -1,127 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import path from 'node:path'
|
|
3
|
-
import { fileURLToPath } from 'node:url'
|
|
1
|
+
import { defineVitestConfig } from 'repoctl/tooling'
|
|
4
2
|
import { defineConfig } from 'vitest/config'
|
|
5
|
-
import YAML from 'yaml'
|
|
6
3
|
|
|
7
|
-
|
|
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
|
-
const WINDOWS_PATH_SEPARATOR_RE = /\\/g
|
|
18
|
-
const RELATIVE_CURRENT_DIR_RE = /^\.\//
|
|
19
|
-
const GLOB_TOKEN_RE = /[*?[{]/
|
|
20
|
-
const TRAILING_SLASH_RE = /\/+$/
|
|
21
|
-
|
|
22
|
-
function extractBaseDirFromGlob(pattern: string): string | null {
|
|
23
|
-
if (!pattern) {
|
|
24
|
-
return null
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const normalized = pattern
|
|
28
|
-
.replace(WINDOWS_PATH_SEPARATOR_RE, '/')
|
|
29
|
-
.replace(RELATIVE_CURRENT_DIR_RE, '')
|
|
30
|
-
const globIndex = normalized.search(GLOB_TOKEN_RE)
|
|
31
|
-
const base = globIndex === -1
|
|
32
|
-
? normalized
|
|
33
|
-
: normalized.slice(0, globIndex)
|
|
34
|
-
|
|
35
|
-
const cleaned = base.replace(TRAILING_SLASH_RE, '')
|
|
36
|
-
return cleaned || null
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function loadProjectRootsFromWorkspace(): string[] {
|
|
40
|
-
if (!fs.existsSync(WORKSPACE_FILE)) {
|
|
41
|
-
return []
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
try {
|
|
45
|
-
const workspaceContent = fs.readFileSync(WORKSPACE_FILE, 'utf8')
|
|
46
|
-
const workspace = YAML.parse(workspaceContent) ?? {}
|
|
47
|
-
const packages: unknown[] = Array.isArray(workspace.packages) ? workspace.packages : []
|
|
48
|
-
const roots = packages
|
|
49
|
-
.map(entry => typeof entry === 'string' ? entry.trim() : '')
|
|
50
|
-
.filter(entry => entry && !entry.startsWith('!'))
|
|
51
|
-
.map(extractBaseDirFromGlob)
|
|
52
|
-
.filter((entry): entry is string => Boolean(entry))
|
|
53
|
-
|
|
54
|
-
return roots.length ? [...new Set(roots)] : []
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
console.warn('[vitest] Failed to parse pnpm-workspace.yaml, no project roots will be used.', error)
|
|
58
|
-
return []
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const PROJECT_ROOTS = loadProjectRootsFromWorkspace()
|
|
63
|
-
|
|
64
|
-
if (!PROJECT_ROOTS.length) {
|
|
65
|
-
console.warn('[vitest] No project roots detected. Check pnpm-workspace.yaml to define workspace packages.')
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function findConfig(basePath: string): string | null {
|
|
69
|
-
for (const filename of CONFIG_FILENAMES) {
|
|
70
|
-
const candidate = path.join(basePath, filename)
|
|
71
|
-
if (fs.existsSync(candidate)) {
|
|
72
|
-
return candidate
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return null
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function resolveProjects(): string[] {
|
|
79
|
-
const projects: string[] = []
|
|
80
|
-
|
|
81
|
-
for (const folder of PROJECT_ROOTS) {
|
|
82
|
-
const rootPath = path.resolve(ROOT_DIR, folder)
|
|
83
|
-
if (!fs.existsSync(rootPath)) {
|
|
84
|
-
continue
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const rootConfig = findConfig(rootPath)
|
|
88
|
-
if (rootConfig) {
|
|
89
|
-
projects.push(rootConfig)
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const entries = fs.readdirSync(rootPath, { withFileTypes: true })
|
|
93
|
-
for (const entry of entries) {
|
|
94
|
-
if (!entry.isDirectory()) {
|
|
95
|
-
continue
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const projectDir = path.join(rootPath, entry.name)
|
|
99
|
-
const configPath = findConfig(projectDir)
|
|
100
|
-
if (configPath) {
|
|
101
|
-
projects.push(configPath)
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return projects
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const projects = resolveProjects()
|
|
110
|
-
|
|
111
|
-
export default defineConfig(() => {
|
|
112
|
-
return {
|
|
113
|
-
test: {
|
|
114
|
-
projects,
|
|
115
|
-
coverage: {
|
|
116
|
-
enabled: true,
|
|
117
|
-
skipFull: true,
|
|
118
|
-
exclude: [
|
|
119
|
-
'**/dist/**',
|
|
120
|
-
],
|
|
121
|
-
},
|
|
122
|
-
forceRerunTriggers: [
|
|
123
|
-
'**/{vitest,vite}.config.*/**',
|
|
124
|
-
],
|
|
125
|
-
},
|
|
126
|
-
}
|
|
127
|
-
})
|
|
4
|
+
export default defineConfig(async () => await defineVitestConfig())
|
package/assets-data.mjs
CHANGED
|
@@ -8,13 +8,14 @@ const coreAssetTargets = [
|
|
|
8
8
|
'.npmrc',
|
|
9
9
|
'commitlint.config.ts',
|
|
10
10
|
'eslint.config.js',
|
|
11
|
-
'
|
|
11
|
+
'lint-staged.config.js',
|
|
12
12
|
'stylelint.config.js',
|
|
13
|
-
'
|
|
13
|
+
'repoctl.config.ts',
|
|
14
14
|
'package.json',
|
|
15
15
|
'AGENTS.md',
|
|
16
16
|
// pnpm
|
|
17
17
|
'pnpm-workspace.yaml',
|
|
18
|
+
'scripts',
|
|
18
19
|
// base tsconfig
|
|
19
20
|
'tsconfig.json',
|
|
20
21
|
// turbo
|