Skip to content

Commit

Permalink
chore: update CONTRIBUTING.md
Browse files Browse the repository at this point in the history
  • Loading branch information
metonym committed Jul 28, 2024
1 parent becb8a8 commit 795ba75
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 2 deletions.
File renamed without changes.
72 changes: 70 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Prerequisites

For MacOS, prerequisites include Node.js and Bun.
[Bun](https://bun.sh/) is used to develop this project.

## Set-up

Expand All @@ -29,7 +29,7 @@ bun install

## Workflow

Imports for `carbon-components-svelte` must be regenerated if the `carbon-components-svelte` package is updated.
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:

Expand All @@ -39,6 +39,8 @@ 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.

### Unit tests

Run `bun test` to execute the unit tests (located in `/tests`).
Expand All @@ -47,6 +49,28 @@ For watch mode, run `bun test --watch`.

To update snapshots, run `bun test --update-snapshots`.

### Linked examples

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`: SvelteKit
- `examples/vite`: Vite
- `examples/vite@svelte-5`: Vite using Svelte 5
- `examples/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.

```sh
bun run build -w
```

## Submitting a Pull Request

### Sync Your Fork
Expand All @@ -62,3 +86,47 @@ git merge upstream/main
### Submit a PR

After you've pushed your changes to remote, submit your PR. Make sure you are comparing `<YOUR_USER_ID>/feature` to `origin/main`.

## Maintainer guide

The following items only apply to project maintainers.

### Release

This library is published to NPM with [provenance](https://docs.npmjs.com/generating-provenance-statements) via a [GitHub workflow](https://github.com/carbon-design-system/carbon-icons-svelte/blob/master/.github/workflows/release.yml).

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.

### Pre-release checklist

1. Update `CHANGELOG.md` and increment `package.json#version`.

```diff
- "version": "0.8.0",
+ "version": "0.9.0",
```

2. Commit the changes and tag the release.

```sh
git commit -am "v0.9.0"
git tag v0.9.0
```

3. 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.

### Post-release checklist

After confirming that the new release is published to NPM, perform the following:

1. Create a [new release](https://github.com/carbon-design-system/carbon-preprocess-svelte/releases/new) on GitHub.

2. Publish the release as the latest release.

3. Close out any issues that were resolved in the release.

0 comments on commit 795ba75

Please sign in to comment.