diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf77e6b451..7c3969cd54 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,4 +50,11 @@ jobs: with: node-version: 18 cache: pnpm - - run: pnpm i && pnpm check && pnpm lint && pnpm build && { [ "`git status --porcelain=v1`" == "" ] || (echo "Generated types have changed — please run prepublishOnly locally and commit the changes after you have reviewed them"; git diff; exit 1); } + - 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); } diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 24b1229b42..7810870670 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 167a62646e..613551574f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 diff --git a/packages/svelte/package.json b/packages/svelte/package.json index 7357c878d7..d82a4726fd 100644 --- a/packages/svelte/package.json +++ b/packages/svelte/package.json @@ -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": { diff --git a/packages/svelte/scripts/build.js b/packages/svelte/scripts/generate-types.js similarity index 100% rename from packages/svelte/scripts/build.js rename to packages/svelte/scripts/generate-types.js