Skip to content

Commit

Permalink
PNPM (#59)
Browse files Browse the repository at this point in the history
* PNPM migration

* PNPM cleanup

* Updating storybook deploy workflow to use pnpm and cache

* Refactor workflows and add a ci workflow

* Adding typecheck

* Removing occurences of yarn

* Fix storybook workflow

* Build before test
  • Loading branch information
corbanbrook authored Dec 24, 2022
1 parent 3ee4f61 commit 674ee1d
Show file tree
Hide file tree
Showing 61 changed files with 11,164 additions and 10,569 deletions.
36 changes: 36 additions & 0 deletions .github/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Setup Node and PNPM dependencies

runs:
using: 'composite'

steps:
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 7
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: |
${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install dependencies
shell: bash
run: pnpm install --frozen-lockfile
if: ${{ steps.pnpm-cache.outputs.cache-hit != 'true' }}
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI

on: [push]

jobs:
build:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Typecheck
run: pnpm typecheck

- name: Lint
run: pnpm lint

- name: Build
run: pnpm build

- name: Test
run: pnpm test
12 changes: 8 additions & 4 deletions .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: Storybook

on:
push:
branches:
- master

permissions:
contents: write

jobs:
build-and-deploy:
concurrency: ci-${{ github.ref }}
Expand All @@ -13,10 +16,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Install and Build
run: |
yarn
yarn build:storybook
- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Build storybook
run: pnpm build:storybook

- name: Add .nojekyll
run: touch ./docs/.nojekyll
Expand Down
4 changes: 2 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn build
yarn test --changedSince master
pnpm build
pnpm run test --changedSince master
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
public-hoist-pattern[]=*types*
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Components are written in [React](https://reactjs.org/) with [Vanilla Extract](h
### Install

```
yarn add @0xsequence/design-system
pnpm add @0xsequence/design-system
```

### Use
Expand Down Expand Up @@ -39,7 +39,7 @@ const example = () => (
Clone the [Sequence Design System GitHub Project](https://github.com/0xsequence/design-system) then start Storybook.

```
yarn && yarn storybook
pnpm install && pnpm storybook
```

### Used by
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,19 @@
"dist/**"
],
"scripts": {
"start": "yarn storybook",
"start": "pnpm storybook",
"build": "tsc && vite build",
"build:icons": "yarn svgr -d ./src/icons ./public/static/icons --config-file ./svgr.config.json --template ./src/icons/template.cjs",
"build:icons": "pnpm svgr -d ./src/icons ./public/static/icons --config-file ./svgr.config.json --template ./src/icons/template.cjs",
"storybook": "storybook dev -p 6006",
"build:storybook": "storybook build --no-manager-cache -o ./docs",
"test": "jest",
"typecheck": "tsc --noEmit",
"lint": "eslint -c .eslintrc './src/**/*.{ts,tsx}'",
"lint:fix": "eslint -c .eslintrc --fix './src/**/*.{ts,tsx}'",
"format": "prettier --list-different --write src/**/*.{ts,tsx}",
"prepare": "husky install",
"prepack": "yarn build",
"patch": "yarn version --patch && git push --follow-tags"
"prepack": "pnpm build",
"patch": "pnpm version --patch && git push --follow-tags"
},
"dependencies": {
"@radix-ui/colors": "^0.1.8",
Expand All @@ -54,6 +55,7 @@
"@babel/core": "^7.20.7",
"@jest/types": "^29.3.1",
"@storybook/addon-actions": "^7.0.0-beta.13",
"@storybook/addon-docs": "^7.0.0-beta.13",
"@storybook/addon-essentials": "^7.0.0-beta.13",
"@storybook/addon-links": "^7.0.0-beta.13",
"@storybook/react": "^7.0.0-beta.13",
Expand All @@ -70,7 +72,6 @@
"@types/react-dom": "^18.0.9",
"@typescript-eslint/eslint-plugin": "^5.47.0",
"@typescript-eslint/parser": "^5.47.0",
"@vanilla-extract/babel-plugin": "^1.2.0",
"@vanilla-extract/css": "^1.9.2",
"@vanilla-extract/css-utils": "^0.1.3",
"@vanilla-extract/dynamic": "^2.0.3",
Expand Down
Loading

0 comments on commit 674ee1d

Please sign in to comment.