Bun is used to develop this project.
Fork the repository and clone your fork:
git clone <YOUR_FORK>
cd carbon-preprocess-svelte
Set the original repository as the upstream:
git remote add upstream [email protected]:carbon-design-system/carbon-preprocess-svelte.git
# verify that the upstream is added
git remote -v
Finally, install the project dependencies:
bun install
Imports for carbon-components-svelte
must be regenerated if the carbon-components-svelte
package is updated (i.e., a new component is added).
To update the imports, run the following command:
bun run index:components
This will update src/component-index.ts
, which should be checked into source control.
Note that for this package, carbon-components-svelte
is intentionally a devDependency
, as it is only used for generating the component index, and not depended on at runtime.
Run bun test
to execute the unit tests (located in /tests
).
For watch mode, run bun test --watch
.
To update snapshots, run bun test --update-snapshots
.
To simulate real-world usage of the package, you can link the package to an example project. This is useful for testing changes end-to-end.
Example set-ups are located in the examples
directory:
examples/rollup
: Rollup (Vite-compatible API)examples/sveltekit
: SvelteKitexamples/vite
: Viteexamples/vite@svelte-5
: Vite using Svelte 5examples/webpack
: Webpack
Note that other Svelte frameworks use Vite under the hood (e.g., Astro, Routify).
carbon-preprocess-svelte
is linked locally in these examples, so changes to the package will be reflected in the example projects.
Rebuilding the project in watch mode will automatically update the linked examples.
bun run build -w
Before submitting a pull request, make sure your fork is up to date with the latest upstream changes.
git fetch upstream
git checkout main
git merge upstream/main
After you've pushed your changes to remote, submit your PR. Make sure you are comparing <YOUR_USER_ID>/feature
to origin/main
.
The following items only apply to project maintainers.
This library is published to NPM with provenance via a GitHub workflow.
The workflow is automatically triggered when pushing a tag that begins with v
(e.g., v0.9.0
).
However, maintainers must perform a few things in preparation for a release.
- Update
CHANGELOG.md
and incrementpackage.json#version
.
- "version": "0.8.0",
+ "version": "0.9.0",
- Commit the changes and tag the release.
git commit -am "v0.9.0"
git tag v0.9.0
- Push the tag to the remote.
Finally, push the tag to the remote repository.
This will trigger the release.yml
workflow. If the build steps succeed, the new version of the packge will be published to NPM.
After confirming that the new release is published to NPM, perform the following:
-
Create a new release on GitHub.
-
Publish the release as the latest release.
-
Close out any issues that were resolved in the release.