|
1 | 1 | # Contributing to @effector/swc-plugin |
2 | 2 |
|
3 | | -## Developing plugin |
| 3 | +## Development |
4 | 4 |
|
5 | | -The plugin is built to support both _latest_ `swc_core`, with some features to support older SWC versions. |
| 5 | +This plugin supports `swc_core@49.0.0+` and `@swc/core@1.15.0+` with stable Plugin ABI and targets the _latest_ version available. Breaking changes in Plugin ABI by SWC require a major version bump. |
6 | 6 |
|
7 | | -Usually, the development is done using the base plugin, targeting the latest AST version, and the latest _Nightly_ Rust version. |
| 7 | +### Making Changes |
8 | 8 |
|
9 | | -### Changelog |
| 9 | +Changelog is managed with `@changesets/cli`. When making changes to the plugin code document them briefly using `pnpm changeset` before committing. |
10 | 10 |
|
11 | | -Changelog is managed with `changeset`, and each change to the plugin's core must be logged using `pnpm changeset`. |
| 11 | +### Testing |
12 | 12 |
|
13 | | -### Tests |
| 13 | +#### Fixtures |
14 | 14 |
|
15 | | -Currently, the plugin is tested in two ways |
| 15 | +Plugin Transform is run against a set of JS code samples (located at `tests/fixtures`) directly. Run manually with `cargo test`. |
16 | 16 |
|
17 | | -- **Fixture tests** located in `src/tests/fixtures`. |
| 17 | +#### Integration |
18 | 18 |
|
19 | | - The plugin transforms are run directly on samples of JS code. These tests are run during packing process to ensure plugin is functionally working. |
| 19 | +Pre-built `wasm` file with the plugin is loaded into different _host runtimes_ (usually Next.js), and several Playwright-based end-to-end tests are run. These tests are managed manually and should be run after packing to ensure the plugin is compatible with supported host runtimes. |
20 | 20 |
|
21 | | - You can run them manually on base plugin with `cargo test`. |
| 21 | +## Releasing |
22 | 22 |
|
23 | | -- **Integration tests**, run using Playwright. |
| 23 | +### 1. Version Bump |
24 | 24 |
|
25 | | - Pre-built `wasm` files are loaded into different _host runtimes_, e.g. Next.js. These tests are run manually after packing to ensure published labels are compatible with host runtimes. |
| 25 | +1. Run `pnpm changeset version` |
| 26 | +2. Update `CHANGELOG.md` with notable changes |
| 27 | +3. Sync version from `package.json` -> to `Cargo.toml` |
| 28 | +4. Run fixture tests with `cargo test` |
| 29 | +5. Commit as `release: v{version}` and git tag with `v{version}` |
26 | 30 |
|
27 | | -## Release process |
| 31 | +### 2. Build |
28 | 32 |
|
29 | | -1. **Bump packages versions** |
30 | | - 1. Run `pnpm changeset version` to generate `CHANGELOG.md` and bump `package.json` version. |
31 | | - 2. Update `CHANGELOG.md` with additional details, e.g. notable/breaking changes. |
32 | | - 3. Manually update the `package.version` field in `Cargo.toml` to match `package.json`. |
33 | | - 4. Check the base plugin using `cargo test`. |
34 | | - 5. Make a release commit `release: v{version}`. |
35 | | - 6. Tag the release with new git tag `v{version}`. |
36 | | -2. **Build packages** |
37 | | - 1. Run build script with `pnpm build --test --build`. |
38 | | - 2. Verify that `target/bundles` contains several tarballs named in form `effector-swc-plugin-{version}-swc{tag}.tgz`. |
39 | | -3. **Publish** |
40 | | - 1. For each labeled tarball, run `npm publish target/bundles/effector-swc-plugin-{version}-swc{tag}.tgz --tag swc{tag}`. |
41 | | - 2. For the _latest_, non-labeled tarball, run `npm publish target/bundles/effector-swc-plugin-{version}.tgz`. |
| 33 | +Build a tarball `cargo make bundle` -> `target/bundle/effector-swc-plugin-{version}.tgz` |
| 34 | + |
| 35 | +### 3. Publish |
| 36 | + |
| 37 | +Run `npm publish target/bundle/effector-swc-plugin-{version}.tgz` |
0 commit comments