Skip to content

Commit

Permalink
feat!: library rewrite (#54)
Browse files Browse the repository at this point in the history
**Breaking Changes**

- Remove all preprocessors except for `optimizeImports`
- `optimizeImports`: drop support for `carbon-icons-svelte` version 10, `carbon-pictograms-svelte` version 10
- Rewrite `optimizeCss` plugin from scratch; it's now offered as a Vite/Rollup/Webpack plugin. `carbon-components-svelte@0.85.0` or greater is required
  • Loading branch information
metonym authored Mar 23, 2024
1 parent 4763ff8 commit 2523bef
Show file tree
Hide file tree
Showing 119 changed files with 6,452 additions and 5,044 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/ci.yml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/publish-to-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on:
push:
tags:
- "v*"

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"

- name: Publish package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

# Currently, only npm supports publishing packages with provenance
# https://docs.npmjs.com/generating-provenance-statements
run: |
npm install --force
npm publish --provenance --access public
16 changes: 16 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
on:
pull_request:
push:
branches: [master]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1

- name: Run unit tests
run: |
bun install
bun test
10 changes: 6 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.DS_Store
/node_modules
/dist
/src/*.js
!/src/carbon-components-svelte.js
node_modules
dist
build
public/build/
.svelte-kit
*.tgz
5 changes: 0 additions & 5 deletions .prettierignore

This file was deleted.

37 changes: 15 additions & 22 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](https://nodejs.org/en/download/package-manager/#macos)(version 14 or greater) and [Yarn](https://yarnpkg.com/en/docs/install#mac-stable).
For MacOS, prerequisites include Node.js and Bun.

## Set-up

Expand All @@ -16,43 +16,36 @@ cd carbon-preprocess-svelte
Set the original repository as the upstream:

```sh
git remote add upstream git@github.com:IBM/carbon-preprocess-svelte.git
git remote add upstream git@github.com:carbon-design-system/carbon-preprocess-svelte.git
# verify that the upstream is added
git remote -v
```

Finally, install the project dependencies:

```sh
yarn install
bun install
```

## Workflow

Each preprocessor or plugin should have an integration test. Before running tests, be sure to build the library at least once.
Imports for `carbon-components-svelte` must be regenerated if the `carbon-components-svelte` package is updated.

To update the imports, run the following command:

```sh
yarn prepack
bun run index:components
```

### Unit tests

Run `yarn test:unit` to execute the unit tests (located in `/tests/unit`).

### Integration tests
This will update `src/component-index.ts`, which should be checked into source control.

Run `yarn test:integration` to execute the integration tests (located in `/tests/integration`).

### Continuous Integration

The `yarn prepack` command is executed in Travis CI.
### Unit tests

It does the following:
Run `bun test` to execute the unit tests (located in `/tests`).

1. Build the library
2. Run unit/integration tests in parallel
For watch mode, run `bun test --watch`.

The CI should pass if no unexpected errors occur.
To update snapshots, run `bun test --update-snapshots`.

## Submitting a Pull Request

Expand All @@ -62,10 +55,10 @@ Before submitting a pull request, make sure your fork is up to date with the lat

```sh
git fetch upstream
git checkout master
git merge upstream/master
git checkout main
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/master`.
After you've pushed your changes to remote, submit your PR. Make sure you are comparing `<YOUR_USER_ID>/feature` to `origin/main`.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,4 @@
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
Loading

0 comments on commit 2523bef

Please sign in to comment.