The plugin is built to support both latest swc_core
, with some features to support older SWC versions.
Usually, the development is done using the base plugin, targeting the latest AST version, and the latest Nightly Rust version.
Changelog is managed with changeset
, and each change to the plugin's core must be logged using pnpm changeset
.
Currently, the plugin is tested in two ways
-
Fixture tests located in
src/tests/fixtures
.The plugin transforms are run directly on samples of JS code. These tests are run during packing process to ensure plugin is functionally working.
You can run them manually on base plugin with
cargo test
. -
Integration tests, run using Playwright.
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.
- Bump packages versions
- Run
pnpm changeset version
to generateCHANGELOG.md
and bumppackage.json
version. - Update
CHANGELOG.md
with additional details, e.g. notable/breaking changes. - Manually update the
package.version
field inCargo.toml
to matchpackage.json
. - Check the base plugin using
cargo test
. - Make a release commit
release: v{version}
. - Tag the release with new git tag
v{version}
.
- Run
- Build packages
- Run build script with
pnpm build --test --build
. - Verify that
target/bundles
contains several tarballs named in formeffector-swc-plugin-{version}-swc{tag}.tgz
.
- Run build script with
- Publish
- For each labeled tarball, run
npm publish target/bundles/effector-swc-plugin-{version}-swc{tag}.tgz --tag swc{tag}
. - For the latest, non-labeled tarball, run
npm publish target/bundles/effector-swc-plugin-{version}.tgz
.
- For each labeled tarball, run