chore: check in types (#9863)

To ensure that changes to code/types doesn't result in unwanted changes in type generation, or that bumps to dts-buddy don't cause unwanted regressions, we're checking in the generated types. Types should be committed as-is (don't format it with prettier!). CI is enhanced to check that git sees no changed files after generating the types, which would mean types have changed.
pull/10054/head
Simon H 6 months ago committed by GitHub
parent abc126630a
commit 98a72f5068
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -50,4 +50,11 @@ jobs:
with:
node-version: 18
cache: pnpm
- run: 'pnpm i && pnpm check && pnpm lint'
- name: install
run: pnpm install --frozen-lockfile
- name: type check
run: pnpm check
- name: lint
run: pnpm lint
- name: build and check generated types
run: pnpm build && { [ "`git status --porcelain=v1`" == "" ] || (echo "Generated types have changed — please regenerate types locally and commit the changes after you have reviewed them"; git diff; exit 1); }

@ -28,7 +28,11 @@ jobs:
node-version: 18.x
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Install
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm build && { [ "`git status --porcelain=v1`" == "" ] || (echo "Generated types have changed — please regenerate types locally and commit the changes after you have reviewed them"; git diff; exit 1); }
- name: Create Release Pull Request or Publish to npm
id: changesets

@ -133,6 +133,10 @@ To typecheck the codebase, run `pnpm check` inside `packages/svelte`. To typeche
- `snake_case` for internal variable names and methods.
- `camelCase` for public variable names and methods.
### Generating types
Types are auto-generated from the source, but the result is checked in to ensure no accidental changes slip through. Run `pnpm generate:types` to regenerate the types.
### Sending your pull request
Please make sure the following is done when submitting a pull request:
@ -141,7 +145,7 @@ Please make sure the following is done when submitting a pull request:
1. Make sure your code lints (`pnpm lint`).
1. Make sure your tests pass (`pnpm test`).
All pull requests should be opened against the `main` branch. Make sure the PR does only one thing, otherwise please split it.
All pull requests should be opened against the `main` branch. Make sure the PR does only one thing, otherwise please split it. If this change should contribute to a version bump, run `npx changeset` at the root of the repository after a code change and select the appropriate packages.
#### Breaking changes

@ -1,4 +1,5 @@
/types
/types/*.map
/types/compiler
/compiler.cjs
/action.d.ts

@ -90,11 +90,12 @@
"templating"
],
"scripts": {
"build": "rollup -c && node scripts/build.js && node scripts/check-treeshakeability.js",
"build": "rollup -c && pnpm generate:types && node scripts/check-treeshakeability.js",
"dev": "rollup -cw",
"check": "tsc && cd ./tests/types && tsc",
"check:watch": "tsc --watch",
"generate:version": "node ./scripts/generate-version.js",
"generate:types": "node ./scripts/generate-types.js",
"prepublishOnly": "pnpm build"
},
"devDependencies": {
@ -106,7 +107,7 @@
"@rollup/plugin-virtual": "^3.0.2",
"@types/aria-query": "^5.0.3",
"@types/estree": "^1.0.5",
"dts-buddy": "^0.4.0",
"dts-buddy": "^0.4.3",
"esbuild": "^0.19.2",
"rollup": "^4.1.5",
"source-map": "^0.7.4",

File diff suppressed because it is too large Load Diff

@ -121,8 +121,8 @@ importers:
specifier: ^1.0.5
version: 1.0.5
dts-buddy:
specifier: ^0.4.0
version: 0.4.0(typescript@5.2.2)
specifier: ^0.4.3
version: 0.4.3(typescript@5.2.2)
esbuild:
specifier: ^0.19.2
version: 0.19.5
@ -3646,11 +3646,11 @@ packages:
engines: {node: '>=12'}
dev: true
/dts-buddy@0.4.0(typescript@5.2.2):
resolution: {integrity: sha512-L8sHp1mmpufZhz/+HLIA40hJG6T937rsWhEIED2W2QMbGSpdg1G5pc2EK1WLKvmd1DvGZ0Qs8uoeSUaqK5mqkw==}
/dts-buddy@0.4.3(typescript@5.2.2):
resolution: {integrity: sha512-vytwDCQAj8rqYPbGsrjiOCRv3O2ipwyUwSc5/II1MpS/Eq6KNZNkGU1djOA31nL7jh7092W/nwbwZHCKedf8Vw==}
hasBin: true
peerDependencies:
typescript: '>=5.0.4 <5.3'
typescript: '>=5.0.4 <5.4'
dependencies:
'@jridgewell/source-map': 0.3.5
'@jridgewell/sourcemap-codec': 1.4.15

Loading…
Cancel
Save