Skip to content

Commit

Permalink
feat: convert repo to a turborepo monorepo (#783)
Browse files Browse the repository at this point in the history
* feat: add turbo, remove lerna.json

* refactor: move current design system package into packages/camp

* feat: move token-gen into tooling/camp/token-gen

* feat: update github action workflows

* feat: npm i with workspace

* fix: lint/package errors due to regenerated package-lock

* feat: remove extraneous default working-directory in chromatic ci yml

* fix: setup-node ci settings

* fix: update storybook build process due to package-lock change

* fix: package-lock desync

* feat: add back required vite plugins, update vite

* feat: simplify turbo.json

* fix: add all tooling packages into npm workspace

* feat: remove husky config
  • Loading branch information
karrui authored Nov 18, 2024
1 parent 501af14 commit c75aee8
Show file tree
Hide file tree
Showing 907 changed files with 30,707 additions and 40,854 deletions.
33 changes: 13 additions & 20 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
# Workflow name
name: "Chromatic"

defaults:
run:
working-directory: react

# Event for the workflow
on:
push:
Expand All @@ -22,43 +18,40 @@ jobs:
runs-on: ubuntu-latest
# Set job outputs to values from filter step
outputs:
react: ${{ steps.filter.outputs.react }}
camp: ${{ steps.filter.outputs.camp }}
tokengen: ${{ steps.filter.outputs.tokengen }}
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
react:
- react/**
camp:
- packages/camp/**
tokengen:
- token-gen/**
- tooling/camp/token-gen/**
chromatic-deployment:
needs: [changes]
if: ${{ needs.changes.outputs.react == 'true' }}
if: ${{ needs.changes.outputs.camp == 'true' }}
# Operating System
runs-on: ubuntu-latest
defaults:
run:
working-directory: react
# Job steps
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for v2
fetch-depth: 0 # Required for v4
- name: Install dependencies
run: npm i
- name: Publish to Chromatic
uses: chromaui/action@v1
uses: chromaui/action@latest
with:
workingDir: react
token: ${{ secrets.GITHUB_TOKEN }}
workingDir: packages/camp
storybookBaseDir: packages/camp
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
onlyChanged: true
exitOnceUploaded: true
autoAcceptChanges: main
# Skip running Chromatic on dependabot PRs
skip: dependabot/**
# Ignore storybook colorTheme changes
untraced: "react/.storybook/colorThemes/**"
untraced: "packages/camp/.storybook/colorThemes/**"
49 changes: 49 additions & 0 deletions .github/workflows/ci-camp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI (Camp)

defaults:
run:
working-directory: packages/camp

on:
push:
branches:
- main
pull_request:

jobs:
install:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: 'npm'
- run: npm ci

lint:
needs: install
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: 'npm'
- run: npm ci
- run: npm run lint

build:
needs: lint
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: 'npm'
- run: npm ci
- run: npm run build
58 changes: 0 additions & 58 deletions .github/workflows/ci-react.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Publish (React)
name: Publish (Camp)

defaults:
run:
working-directory: react
working-directory: packages/camp

on:
push:
Expand All @@ -16,28 +16,37 @@ permissions:
packages: write

jobs:
publish:
# JOB to run change detection
changes:
runs-on: ubuntu-latest

# Set job outputs to values from filter step
outputs:
camp: ${{ steps.filter.outputs.camp }}
steps:
- uses: actions/checkout@v2
- name: Load Node.js modules
uses: actions/cache@v2
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
filters: |
camp:
- packages/camp/**
publish:
needs: changes
runs-on: ubuntu-latest
if: ${{ needs.changes.outputs.camp == 'true' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: 'npm'
registry-url: "https://registry.npmjs.org"
- run: npm ci
- run: npm run build
- run: npm publish --tag ${{ github.ref_name }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: "lts/*"
registry-url: "https://npm.pkg.github.com/"
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ build-storybook.log
storybook-static
.DS_Store

token-gen/tokens-generated
**/token-gen/tokens-generated

.turbo
7 changes: 3 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[submodule "token-gen/tokens"]
path = token-gen/tokens
url = https://github.com/opengovsg/design-tokens.git
branch = develop
[submodule "tooling/camp/token-gen/tokens"]
path = tooling/camp/token-gen/tokens
url = https://github.com/opengovsg/design-tokens
4 changes: 0 additions & 4 deletions .husky/post-merge

This file was deleted.

4 changes: 0 additions & 4 deletions lerna.json

This file was deleted.

Loading

0 comments on commit c75aee8

Please sign in to comment.