@rtorcato/repo-tooling 2.59.0
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/AGENTS.md +113 -0
- package/LICENSE +21 -0
- package/README.md +201 -0
- package/dist/cli/commands/doctor.js +336 -0
- package/dist/cli/commands/fix-targets.js +192 -0
- package/dist/cli/commands/fix.js +440 -0
- package/dist/cli/commands/setup-presets.js +281 -0
- package/dist/cli/commands/setup.js +501 -0
- package/dist/cli/generators/agent-rules.js +103 -0
- package/dist/cli/generators/badges.js +88 -0
- package/dist/cli/generators/build.js +216 -0
- package/dist/cli/generators/bun.js +25 -0
- package/dist/cli/generators/community-health.js +145 -0
- package/dist/cli/generators/docs-site.js +436 -0
- package/dist/cli/generators/git.js +164 -0
- package/dist/cli/generators/github-actions.js +35 -0
- package/dist/cli/generators/github-workflows.js +24 -0
- package/dist/cli/generators/gitlab-ci.js +10 -0
- package/dist/cli/generators/index.js +123 -0
- package/dist/cli/generators/linting.js +54 -0
- package/dist/cli/generators/misc.js +298 -0
- package/dist/cli/generators/nx.js +16 -0
- package/dist/cli/generators/package-json.js +317 -0
- package/dist/cli/generators/pnpm-workspace.js +126 -0
- package/dist/cli/generators/postcss.js +24 -0
- package/dist/cli/generators/readme.js +268 -0
- package/dist/cli/generators/security.js +156 -0
- package/dist/cli/generators/skills-install.js +70 -0
- package/dist/cli/generators/tailwind.js +34 -0
- package/dist/cli/generators/testing.js +88 -0
- package/dist/cli/generators/treeshake.js +148 -0
- package/dist/cli/generators/tsconfig.js +27 -0
- package/dist/cli/generators/turborepo.js +35 -0
- package/dist/cli/generators/typedoc.js +40 -0
- package/dist/cli/index.js +332 -0
- package/dist/cli/utils/copy-preset.js +98 -0
- package/dist/cli/utils/detect-language.js +22 -0
- package/dist/cli/utils/format.js +32 -0
- package/dist/cli/utils/install.js +28 -0
- package/dist/cli/utils/lockfile.js +84 -0
- package/dist/languages/js/checks.js +949 -0
- package/dist/languages/js/ci.js +251 -0
- package/dist/languages/js/fixers.js +735 -0
- package/dist/languages/registry.js +37 -0
- package/dist/languages/swift/checks.js +127 -0
- package/dist/languages/swift/ci.js +165 -0
- package/dist/languages/swift/fixers.js +102 -0
- package/dist/languages/swift/git-hooks.js +63 -0
- package/dist/languages/swift/gitignore.js +43 -0
- package/dist/languages/swift/scaffold.js +244 -0
- package/package.json +461 -0
- package/tooling/biome/README.md +90 -0
- package/tooling/biome/biome.json +63 -0
- package/tooling/bun/bunfig.toml +14 -0
- package/tooling/changesets/README.md +35 -0
- package/tooling/changesets/config.json +11 -0
- package/tooling/claude/repo-tooling.md +87 -0
- package/tooling/commitlint/commitlint.d.mts +4 -0
- package/tooling/commitlint/commitlint.mjs +40 -0
- package/tooling/cypress/cypress.config.d.mts +4 -0
- package/tooling/cypress/cypress.config.mjs +11 -0
- package/tooling/docusaurus/index.d.mts +17 -0
- package/tooling/docusaurus/index.mjs +38 -0
- package/tooling/docusaurus/sync-changelog.mjs +42 -0
- package/tooling/docusaurus/theme-tokens.css +79 -0
- package/tooling/docusaurus/theme.css +378 -0
- package/tooling/esbuild/index.d.mts +6 -0
- package/tooling/esbuild/index.mjs +102 -0
- package/tooling/eslint/base.d.mts +6 -0
- package/tooling/eslint/base.mjs +122 -0
- package/tooling/eslint/nextjs.d.mts +4 -0
- package/tooling/eslint/nextjs.mjs +22 -0
- package/tooling/eslint/types.d.ts +58 -0
- package/tooling/github-actions/workflows/cloudflare-pages.yml +42 -0
- package/tooling/github-actions/workflows/docker-publish.yml +44 -0
- package/tooling/github-actions/workflows/preview-deployments.yml +54 -0
- package/tooling/github-actions/workflows/vercel-deploy.yml +40 -0
- package/tooling/jest-presets/browser/jest-preset.d.mts +4 -0
- package/tooling/jest-presets/browser/jest-preset.mjs +14 -0
- package/tooling/jest-presets/node/jest-preset.d.mts +4 -0
- package/tooling/jest-presets/node/jest-preset.mjs +13 -0
- package/tooling/mcp/mcp.json.example +27 -0
- package/tooling/nx/nx.json +24 -0
- package/tooling/oxlint/README.md +25 -0
- package/tooling/oxlint/oxlintrc.json +28 -0
- package/tooling/playwright/playwright.config.d.mts +4 -0
- package/tooling/playwright/playwright.config.mjs +19 -0
- package/tooling/prettier/index.d.mts +4 -0
- package/tooling/prettier/index.mjs +36 -0
- package/tooling/release-please/.release-please-manifest.json +3 -0
- package/tooling/release-please/release-please-config.json +9 -0
- package/tooling/rolldown/rolldown.config.d.mts +18 -0
- package/tooling/rolldown/rolldown.config.mjs +59 -0
- package/tooling/rollup/rollup.config.d.mts +20 -0
- package/tooling/rollup/rollup.config.mjs +70 -0
- package/tooling/semantic-release/docker.d.mts +4 -0
- package/tooling/semantic-release/docker.mjs +59 -0
- package/tooling/semantic-release/github.d.mts +4 -0
- package/tooling/semantic-release/github.mjs +79 -0
- package/tooling/semantic-release/index.d.mts +4 -0
- package/tooling/semantic-release/index.mjs +80 -0
- package/tooling/swift/periphery.yml +4 -0
- package/tooling/swift/swiftlint.yml +23 -0
- package/tooling/tests/exports-resolution.d.mts +14 -0
- package/tooling/tests/exports-resolution.mjs +68 -0
- package/tooling/tests/ssr-safety.d.mts +14 -0
- package/tooling/tests/ssr-safety.mjs +53 -0
- package/tooling/tsup/index.d.mts +8 -0
- package/tooling/tsup/index.mjs +33 -0
- package/tooling/typedoc/typedoc.json +7 -0
- package/tooling/typescript/README.md +49 -0
- package/tooling/typescript/reset.d.ts +9 -0
- package/tooling/typescript/tsconfig.base.json +84 -0
- package/tooling/typescript/tsconfig.build.json +11 -0
- package/tooling/typescript/tsconfig.bun.json +9 -0
- package/tooling/typescript/tsconfig.express.json +9 -0
- package/tooling/typescript/tsconfig.next.json +20 -0
- package/tooling/typescript/tsconfig.node.json +9 -0
- package/tooling/typescript/tsconfig.react.json +15 -0
- package/tooling/typescript/tsconfig.test.json +8 -0
- package/tooling/typescript/v1/tsconfig.base.json +81 -0
- package/tooling/typescript/v1/tsconfig.express.json +9 -0
- package/tooling/typescript/v1/tsconfig.next.json +19 -0
- package/tooling/typescript/v1/tsconfig.node.json +9 -0
- package/tooling/typescript/v1/tsconfig.react.json +14 -0
- package/tooling/typescript/v1/tsconfig.test.json +8 -0
- package/tooling/vite/vite.config.d.mts +4 -0
- package/tooling/vite/vite.config.mjs +18 -0
- package/tooling/vitest/jsdom-shims.d.mts +1 -0
- package/tooling/vitest/jsdom-shims.mjs +58 -0
- package/tooling/vitest/vitest.config.d.mts +4 -0
- package/tooling/vitest/vitest.config.mjs +25 -0
- package/tooling/vitest/vitest.config.react.d.mts +4 -0
- package/tooling/vitest/vitest.config.react.mjs +27 -0
- package/tooling/vitest/vitest.setup.d.mts +1 -0
- package/tooling/vitest/vitest.setup.mjs +3 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/** Coverage is uploaded when Vitest is the test runner (it emits an lcov report). */
|
|
2
|
+
export function usesCoverage(config) {
|
|
3
|
+
return config.testing.framework === 'vitest';
|
|
4
|
+
}
|
|
5
|
+
function lintCommand(config) {
|
|
6
|
+
return config.linting.tool === 'biome' || config.linting.tool === 'both'
|
|
7
|
+
? 'pnpm check'
|
|
8
|
+
: 'pnpm lint';
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Checkout โ Node โ pnpm โ restore the cache the `dependencies` job primed.
|
|
12
|
+
* Identical in every downstream job, so it's one const rather than five copies.
|
|
13
|
+
*/
|
|
14
|
+
const SETUP_STEPS = ` - name: ๐ฆ Checkout repository
|
|
15
|
+
uses: actions/checkout@v7
|
|
16
|
+
|
|
17
|
+
- name: ๐ฆ Setup Node.js
|
|
18
|
+
uses: actions/setup-node@v6
|
|
19
|
+
with:
|
|
20
|
+
node-version-file: .nvmrc
|
|
21
|
+
|
|
22
|
+
- name: ๐ฆ Setup pnpm
|
|
23
|
+
uses: pnpm/action-setup@v6
|
|
24
|
+
|
|
25
|
+
- name: ๐ฆ Restore dependencies cache
|
|
26
|
+
uses: actions/cache@v5
|
|
27
|
+
with:
|
|
28
|
+
path: |
|
|
29
|
+
~/.pnpm-store
|
|
30
|
+
node_modules
|
|
31
|
+
key: \${{ needs.dependencies.outputs.cache-key }}`;
|
|
32
|
+
/** Primes the pnpm store + node_modules cache every other job restores. */
|
|
33
|
+
const DEPENDENCIES_JOB = {
|
|
34
|
+
id: 'dependencies',
|
|
35
|
+
extra: ` outputs:
|
|
36
|
+
cache-key: \${{ steps.cache-key.outputs.key }}`,
|
|
37
|
+
steps: ` - name: ๐ฆ Checkout repository
|
|
38
|
+
uses: actions/checkout@v7
|
|
39
|
+
|
|
40
|
+
- name: ๐ฆ Setup Node.js
|
|
41
|
+
uses: actions/setup-node@v6
|
|
42
|
+
with:
|
|
43
|
+
node-version-file: .nvmrc
|
|
44
|
+
|
|
45
|
+
- name: ๐ฆ Setup pnpm
|
|
46
|
+
uses: pnpm/action-setup@v6
|
|
47
|
+
|
|
48
|
+
- name: ๐ฆ Generate cache key
|
|
49
|
+
id: cache-key
|
|
50
|
+
run: echo "key=\${{ runner.os }}-pnpm-\${{ hashFiles('**/pnpm-lock.yaml') }}" >> $GITHUB_OUTPUT
|
|
51
|
+
|
|
52
|
+
- name: ๐ฆ Cache dependencies
|
|
53
|
+
uses: actions/cache@v5
|
|
54
|
+
with:
|
|
55
|
+
path: |
|
|
56
|
+
~/.pnpm-store
|
|
57
|
+
node_modules
|
|
58
|
+
key: \${{ steps.cache-key.outputs.key }}
|
|
59
|
+
restore-keys: |
|
|
60
|
+
\${{ runner.os }}-pnpm-
|
|
61
|
+
|
|
62
|
+
- name: ๐ฆ Install dependencies
|
|
63
|
+
run: pnpm install --frozen-lockfile`,
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* The GitHub Actions jobs for a JS repo, in workflow order. The `release` job
|
|
67
|
+
* needs the ids of everything that ran before it, so the list is assembled
|
|
68
|
+
* rather than filtered from a fixed shape.
|
|
69
|
+
*/
|
|
70
|
+
export function githubJobs(config) {
|
|
71
|
+
const hasTypeScript = config.typescript.enabled;
|
|
72
|
+
const hasTests = config.testing.framework !== 'none';
|
|
73
|
+
const hasBuild = config.bundler !== 'none';
|
|
74
|
+
const isLibrary = config.projectType === 'library';
|
|
75
|
+
const hasCoverage = usesCoverage(config);
|
|
76
|
+
const jobs = [
|
|
77
|
+
DEPENDENCIES_JOB,
|
|
78
|
+
{
|
|
79
|
+
id: 'lint',
|
|
80
|
+
needs: ['dependencies'],
|
|
81
|
+
steps: `${SETUP_STEPS}
|
|
82
|
+
|
|
83
|
+
- name: ๐ Run linting
|
|
84
|
+
run: ${lintCommand(config)}
|
|
85
|
+
|
|
86
|
+
- name: ๐งน Check for unused files, exports, and dependencies
|
|
87
|
+
run: pnpm knip`,
|
|
88
|
+
},
|
|
89
|
+
];
|
|
90
|
+
if (hasTypeScript) {
|
|
91
|
+
jobs.push({
|
|
92
|
+
id: 'typecheck',
|
|
93
|
+
needs: ['dependencies'],
|
|
94
|
+
steps: `${SETUP_STEPS}
|
|
95
|
+
|
|
96
|
+
- name: ๐ Type check
|
|
97
|
+
run: pnpm typecheck`,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
if (hasTests) {
|
|
101
|
+
const coverageUpload = hasCoverage
|
|
102
|
+
? `
|
|
103
|
+
|
|
104
|
+
- name: ๐ Upload coverage to Codecov
|
|
105
|
+
uses: codecov/codecov-action@v5
|
|
106
|
+
with:
|
|
107
|
+
token: \${{ secrets.CODECOV_TOKEN }}
|
|
108
|
+
fail_ci_if_error: false`
|
|
109
|
+
: '';
|
|
110
|
+
jobs.push({
|
|
111
|
+
id: 'test',
|
|
112
|
+
needs: ['dependencies'],
|
|
113
|
+
steps: `${SETUP_STEPS}
|
|
114
|
+
|
|
115
|
+
- name: ๐งช Run tests
|
|
116
|
+
run: ${hasCoverage ? 'pnpm coverage' : 'pnpm test'}${coverageUpload}`,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
if (hasBuild) {
|
|
120
|
+
// attw and publint validate what's about to be published โ libraries only.
|
|
121
|
+
const attw = isLibrary
|
|
122
|
+
? '\n - name: ๐ Validate type resolution (are-the-types-wrong)\n run: pnpm attw\n'
|
|
123
|
+
: '';
|
|
124
|
+
const publint = config.publint
|
|
125
|
+
? '\n - name: ๐ Validate package with publint\n run: pnpm exec publint --strict\n'
|
|
126
|
+
: '';
|
|
127
|
+
jobs.push({
|
|
128
|
+
id: 'build',
|
|
129
|
+
needs: ['dependencies'],
|
|
130
|
+
steps: `${SETUP_STEPS}
|
|
131
|
+
|
|
132
|
+
- name: ๐๏ธ Build project
|
|
133
|
+
run: pnpm build
|
|
134
|
+
${attw}${publint}
|
|
135
|
+
- name: ๐ฆ Upload build artifacts
|
|
136
|
+
uses: actions/upload-artifact@v7
|
|
137
|
+
with:
|
|
138
|
+
name: build-artifacts
|
|
139
|
+
path: |
|
|
140
|
+
dist/
|
|
141
|
+
package.json
|
|
142
|
+
README.md
|
|
143
|
+
retention-days: 7`,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
if (isLibrary && config.semanticRelease) {
|
|
147
|
+
jobs.push({
|
|
148
|
+
id: 'release',
|
|
149
|
+
// Gate the publish on everything that ran before it.
|
|
150
|
+
needs: jobs.map((job) => job.id),
|
|
151
|
+
if: "github.ref == 'refs/heads/main'",
|
|
152
|
+
extra: ` permissions:
|
|
153
|
+
contents: write
|
|
154
|
+
issues: write
|
|
155
|
+
pull-requests: write
|
|
156
|
+
id-token: write`,
|
|
157
|
+
steps: ` - name: ๐ฆ Checkout repository
|
|
158
|
+
uses: actions/checkout@v7
|
|
159
|
+
with:
|
|
160
|
+
fetch-depth: 0
|
|
161
|
+
# RELEASE_TOKEN (admin PAT) lets semantic-release push the version
|
|
162
|
+
# commit + tag to a protected main; GITHUB_TOKEN can't bypass branch
|
|
163
|
+
# protection. Falls back to GITHUB_TOKEN when no PAT is set.
|
|
164
|
+
token: \${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
|
|
165
|
+
|
|
166
|
+
- name: ๐ฆ Setup Node.js
|
|
167
|
+
uses: actions/setup-node@v6
|
|
168
|
+
with:
|
|
169
|
+
node-version-file: .nvmrc
|
|
170
|
+
registry-url: 'https://registry.npmjs.org'
|
|
171
|
+
|
|
172
|
+
- name: ๐ฆ Setup pnpm
|
|
173
|
+
uses: pnpm/action-setup@v6
|
|
174
|
+
|
|
175
|
+
- name: ๐ฆ Restore dependencies cache
|
|
176
|
+
uses: actions/cache@v5
|
|
177
|
+
with:
|
|
178
|
+
path: |
|
|
179
|
+
~/.pnpm-store
|
|
180
|
+
node_modules
|
|
181
|
+
key: \${{ needs.dependencies.outputs.cache-key }}
|
|
182
|
+
|
|
183
|
+
- name: ๐ง Configure Git
|
|
184
|
+
run: |
|
|
185
|
+
git config --global user.name "github-actions[bot]"
|
|
186
|
+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
187
|
+
|
|
188
|
+
- name: ๐ Run semantic-release
|
|
189
|
+
# Publishes to npm via OIDC trusted publishing โ no NPM_TOKEN. Requires
|
|
190
|
+
# the \`id-token: write\` permission above + a trusted publisher configured
|
|
191
|
+
# for the package on npmjs.com (Settings โ Trusted Publisher).
|
|
192
|
+
env:
|
|
193
|
+
GITHUB_TOKEN: \${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
|
|
194
|
+
run: npx semantic-release`,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
return jobs;
|
|
198
|
+
}
|
|
199
|
+
/** The `.gitlab-ci.yml` spec for a JS repo โ node image, pnpm store cache, pnpm scripts. */
|
|
200
|
+
export function gitlabSpec(config) {
|
|
201
|
+
const hasTypeScript = config.typescript.enabled;
|
|
202
|
+
const hasTests = config.testing.framework !== 'none';
|
|
203
|
+
const hasLint = config.linting.tool !== 'none';
|
|
204
|
+
const hasBuild = config.bundler !== 'none';
|
|
205
|
+
const jobs = [
|
|
206
|
+
...(hasLint ? [{ id: 'lint', stage: 'test', script: [lintCommand(config)] }] : []),
|
|
207
|
+
...(hasTypeScript ? [{ id: 'typecheck', stage: 'test', script: ['pnpm typecheck'] }] : []),
|
|
208
|
+
...(hasTests ? [{ id: 'test', stage: 'test', script: [gitlabTestCommand(config)] }] : []),
|
|
209
|
+
...(hasBuild
|
|
210
|
+
? [
|
|
211
|
+
{
|
|
212
|
+
id: 'build',
|
|
213
|
+
stage: 'build',
|
|
214
|
+
script: ['pnpm build'],
|
|
215
|
+
extra: ` artifacts:
|
|
216
|
+
paths:
|
|
217
|
+
- dist/
|
|
218
|
+
expire_in: 1 week`,
|
|
219
|
+
},
|
|
220
|
+
]
|
|
221
|
+
: []),
|
|
222
|
+
];
|
|
223
|
+
return {
|
|
224
|
+
image: 'node:22',
|
|
225
|
+
preamble: `variables:
|
|
226
|
+
PNPM_CACHE_FOLDER: .pnpm-store
|
|
227
|
+
|
|
228
|
+
cache:
|
|
229
|
+
key:
|
|
230
|
+
files:
|
|
231
|
+
- pnpm-lock.yaml
|
|
232
|
+
paths:
|
|
233
|
+
- .pnpm-store
|
|
234
|
+
- node_modules
|
|
235
|
+
|
|
236
|
+
default:
|
|
237
|
+
before_script:
|
|
238
|
+
- corepack enable
|
|
239
|
+
- corepack prepare pnpm@latest --activate
|
|
240
|
+
- pnpm config set store-dir "$PNPM_CACHE_FOLDER"
|
|
241
|
+
- pnpm install --frozen-lockfile`,
|
|
242
|
+
jobs,
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
function gitlabTestCommand(config) {
|
|
246
|
+
if (config.testing.framework === 'vitest')
|
|
247
|
+
return 'pnpm exec vitest run';
|
|
248
|
+
if (config.testing.framework === 'playwright' || config.testing.framework === 'cypress')
|
|
249
|
+
return 'pnpm test:e2e';
|
|
250
|
+
return 'pnpm test';
|
|
251
|
+
}
|