From dd4061bc38d2a0a2dd5065154647246e5bdc81ad Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Tue, 28 Nov 2023 17:27:49 -0500 Subject: [PATCH] rename dev script, update contributor guide and readme (#9673) * rename dev script, update contributor guide and readme * turns out we can do this! * increase accuracy * justify FILTER --------- Co-authored-by: Rich Harris --- CONTRIBUTING.md | 35 +++++++++++++++++++----------- README.md | 42 +----------------------------------- packages/svelte/package.json | 2 +- 3 files changed, 25 insertions(+), 54 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 924a0a752d..167a62646e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,7 +43,7 @@ The maintainers meet on the final Saturday of each month. While these meetings a ### Prioritization -We do our best to review PRs and RFCs as they are sent, but it is difficult to keep up. We welcome help in reviewing PRs, RFC, and issues. If an item aligns with the current priority on our [roadmap](https://svelte.dev/roadmap), it is more likely to be reviewed quickly. PRs to the most important and active ones repositories get reviewed more quickly while PRs to smaller inactive repos may sit for a bit before we periodically come by and review the pending PRs in a batch. +We do our best to review PRs and RFCs as they are sent, but it is difficult to keep up. We welcome help in reviewing PRs, RFCs, and issues. If an item aligns with the current priority on our [roadmap](https://svelte.dev/roadmap), it is more likely to be reviewed quickly. PRs to the most important and active ones repositories get reviewed more quickly while PRs to smaller inactive repos may sit for a bit before we periodically come by and review the pending PRs in a batch. ## Bugs @@ -74,10 +74,11 @@ Small pull requests are much easier to review and more likely to get merged. ### Installation -1. Ensure you have [pnpm](https://pnpm.io/installation) installed -1. After cloning the repository, run `pnpm install`. You can do this in the root directory or in the `svelte` project -1. Move into the `svelte` directory with `cd packages/svelte` -1. To compile in watch mode, run `pnpm dev` +Ensure you have [pnpm](https://pnpm.io/installation) installed. After cloning the repository, run `pnpm install`. + +### Developing + +To build the UMD version of `svelte/compiler` (this is only necessary for CommonJS consumers, or in-browser use), run `pnpm build` inside `packages/svelte`. To rebuild whenever source files change, run `pnpm dev`. ### Creating a branch @@ -100,18 +101,28 @@ Test samples are kept in `/test/xxx/samples` folder. > PREREQUISITE: Install chromium via playwright by running `pnpm playwright install chromium` 1. To run test, run `pnpm test`. -1. To run test for a specific feature, you can use the `-g` (aka `--grep`) option. For example, to only run test involving transitions, run `pnpm test -- -g transition`. +1. To run a particular test suite, use `pnpm test `, for example: + + ```bash + pnpm test validator + ``` -##### Running solo test +1. To filter tests _within_ a test suite, use `pnpm test -- -t `, for example: -1. To run only one test, rename the test sample folder to end with `.solo`. For example, to run the `test/js/samples/action` only, rename it to `test/js/samples/action.solo`. -1. To run only one test suite, rename the test suite folder to end with `.solo`. For example, to run the `test/js` test suite only, rename it to `test/js.solo`. -1. Remember to rename the test folder back. The CI will fail if there's a solo test. + ```bash + pnpm test validator -- -t a11y-alt-text + ``` + + (You can also do `FILTER= pnpm test ` which removes other tests rather than simply skipping them — this will result in faster and more compact test results, but it's non-idiomatic. Choose your fighter.) ##### Updating `.expected` files -1. Tests suites like `css`, `js`, `server-side-rendering` asserts that the generated output has to match the content in the `.expected` file. For example, in the `js` test suites, the generated js code is compared against the content in `expected.js`. -1. To update the content of the `.expected` file, run the test with `--update` flag. (`pnpm test --update`) +1. Tests suites like `snapshot` and `parser` assert that the generated output matches the existing snapshot. +1. To update these snapshots, run `UPDATE_SNAPSHOTS=true pnpm test`. + +### Typechecking + +To typecheck the codebase, run `pnpm check` inside `packages/svelte`. To typecheck in watch mode, run `pnpm check:watch`. ### Style guide diff --git a/README.md b/README.md index 4dbfee3823..65a180924f 100644 --- a/README.md +++ b/README.md @@ -22,47 +22,7 @@ You may view [our roadmap](https://svelte.dev/roadmap) if you'd like to see what ## Contributing -Please see the [Contributing Guide](CONTRIBUTING.md) and [svelte package](packages/svelte) for contributing to Svelte. - -### Development - -Pull requests are encouraged and always welcome. [Pick an issue](https://github.com/sveltejs/svelte/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) and help us out! - -To install and work on Svelte locally: - -```bash -git clone https://github.com/sveltejs/svelte.git -cd svelte -pnpm install -``` - -> Do not use Yarn to install the dependencies, as the specific package versions in `pnpm-lock.json` are used to build and test Svelte. - -To build the compiler and all the other modules included in the package: - -```bash -pnpm build -``` - -To watch for changes and continually rebuild the package (this is useful if you're using [`pnpm link`](https://pnpm.io/cli/link) to test out changes in a project locally): - -```bash -pnpm dev -``` - -The compiler is written in JavaScript and uses [JSDoc](https://jsdoc.app/index.html) comments for type-checking. - -### Running Tests - -```bash -pnpm test -``` - -To filter tests, use `-g` (aka `--grep`). For example, to only run tests involving transitions: - -```bash -pnpm test -- -g transition -``` +Please see the [Contributing Guide](CONTRIBUTING.md) and the [`svelte`](packages/svelte) package for information on contributing to Svelte. ### svelte.dev diff --git a/packages/svelte/package.json b/packages/svelte/package.json index ee90ad58c3..9f79b53ba7 100644 --- a/packages/svelte/package.json +++ b/packages/svelte/package.json @@ -91,7 +91,7 @@ ], "scripts": { "build": "rollup -c && node scripts/build.js && node scripts/check-treeshakeability.js", - "watch": "rollup -cw", + "dev": "rollup -cw", "check": "tsc && cd ./tests/types && tsc", "check:watch": "tsc --watch", "generate:version": "node ./scripts/generate-version.js",