Skip to content

Commit

Permalink
feat(turbo): add turbo config
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandre Philibeaux <[email protected]>
  • Loading branch information
philibea committed Jul 12, 2024
1 parent 4483ab9 commit 2f3ff8d
Show file tree
Hide file tree
Showing 24 changed files with 240 additions and 107 deletions.
4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
.git

# dependencies
node_modules
**/node_modules
npm-debug.log

# we are using pnpm here
**/package-lock.json
Expand All @@ -17,5 +19,3 @@ dist/
coverage
# storybook-static
.reports


65 changes: 43 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
jobs:
typecheck:
runs-on: ubuntu-22.04
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_REMOTE_ONLY: true
steps:
- uses: actions/checkout@v4 # v4.1.4
- uses: pnpm/[email protected]
Expand All @@ -19,12 +22,15 @@ jobs:
with:
node-version: 20
cache: "pnpm"
- run: pnpm install
- run: pnpm run build
- run: pnpm install
- run: pnpm typecheck
- run: |
pnpm install
pnpm typecheck
lint:
runs-on: ubuntu-22.04
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_REMOTE_ONLY: true
steps:
- uses: actions/checkout@v4
- uses: pnpm/[email protected]
Expand All @@ -33,12 +39,16 @@ jobs:
with:
node-version: 20
cache: "pnpm"
- run: pnpm install
- run: pnpm run build
- run: pnpm install
- run: pnpm run lint
- run: |
pnpm install
pnpm run build
pnpm run lint
format:
runs-on: ubuntu-22.04
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_REMOTE_ONLY: true
steps:
- uses: actions/checkout@v4
- uses: pnpm/[email protected]
Expand All @@ -47,12 +57,17 @@ jobs:
with:
node-version: 20
cache: "pnpm"
- run: pnpm install
- run: pnpm run build
- run: pnpm install
- run: pnpm run format:ci
- run: |
pnpm install
pnpm run build
pnpm run lint
pnpm run format:ci
test:
runs-on: ubuntu-22.04
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_REMOTE_ONLY: true
needs: [lint, typecheck, format]
strategy:
matrix:
Expand All @@ -67,10 +82,10 @@ jobs:
with:
node-version: ${{ matrix.node }}
cache: "pnpm"
- run: pnpm install
- run: pnpm run build
- run: pnpm install
- run: pnpm run test:unit:coverage
- run: |
pnpm install
pnpm run build
pnpm run test:unit:coverage
- uses: codecov/[email protected]
with:
# files: packages/**/coverage/cobertura-coverage.xmls
Expand Down Expand Up @@ -98,6 +113,9 @@ jobs:
matrix:
node: ["20"]
runs-on: ubuntu-22.04
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_REMOTE_ONLY: true
needs: [lint, typecheck, format]
steps:
- uses: actions/checkout@v4 # v4.1.4
Expand All @@ -106,13 +124,17 @@ jobs:
uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}
- run: pnpm install
- run: pnpm run build
- run: |
pnpm install
pnpm run build
build-examples: # This will build all projects in the examples folder, it assures that all examples are working
strategy:
matrix:
node: ["20"]
runs-on: ubuntu-22.04
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_REMOTE_ONLY: true
needs: [lint, test, format]
steps:
- uses: actions/checkout@v4 # v4.1.4
Expand All @@ -121,7 +143,6 @@ jobs:
uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}
- run: pnpm install
- run: pnpm build
- run: pnpm install
- run: pnpm run build:examples
- run: |
pnpm install
pnpm run build:examples
3 changes: 3 additions & 0 deletions .github/workflows/deploy-storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
IMAGE_NAME: rg.fr-par.scw.cloud/ultraviolet/storybook
DEPLOYMENT_NAME: "storybook"
SCW_DNS: ${{ github.ref_name == 'main' && 'storybook.ultraviolet.scaleway.com' || '' }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_REMOTE_ONLY: true
steps:
- uses: actions/checkout@v4
- name: Inject slug/short variables
Expand Down Expand Up @@ -54,6 +56,7 @@ jobs:
env:
IMAGE: ${{ env.IMAGE_NAME }}:${{ env.BRANCH_SLUG }}
SOURCE_DATE_EPOCH: 0
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
with:
push: true
tags: ${{ env.IMAGE }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pull_request_title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ jobs:
check-title:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4 # v4.1.4
- uses: actions/checkout@v4
- uses: pnpm/[email protected]
- name: Use Node.js
uses: actions/[email protected]
with:
node-version: 20
cache: "pnpm"
- run: pnpm install
- run: pnpm install --prod
- name: Check PR title
env:
TITLE: ${{ github.event.pull_request.title }}
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/size-limit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}
- run: pnpm install
- run: pnpm run build
- run: pnpm run size:packages
- run: |
pnpm install
pnpm run size
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,10 @@ out
#vite
vite.config.ts.*
vitest.config.ts.*

# turbo
.turbo
!.turbo/config.json
examples/*/.turbo
packages/*/.turbo
tools/*/.turbo
33 changes: 0 additions & 33 deletions .jest/a11y.config.ts

This file was deleted.

1 change: 0 additions & 1 deletion .jest/fileMock.ts

This file was deleted.

2 changes: 0 additions & 2 deletions .jest/svg.ts

This file was deleted.

4 changes: 4 additions & 0 deletions .turbo/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"teamid": "team_ultraviolet",
"apiurl": "https://turbopm2juoty-turbo.functions.fnc.fr-par.scw.cloud"
}
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
FROM node:20.15.1-alpine
WORKDIR /build

ARG TURBO_TOKEN=token

ENV TURBO_TOKEN ${TOKEN}

COPY . .

RUN corepack enable
RUN pnpm install --frozen-lockfile
RUN pnpm build:storybook:stats
RUN pnpm turbo storybook:build

RUN pnpm add serve -w

Expand Down
36 changes: 11 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"examples/*",
"utils/*"
],
"packageManager": "pnpm@9.4.0",
"packageManager": "pnpm@9.5.0",
"engines": {
"node": ">=18.x",
"pnpm": ">=9.x"
Expand All @@ -17,11 +17,12 @@
"linux"
],
"scripts": {
"build": "pnpm --filter '@ultraviolet/*' recursive run build",
"build:example": "pnpm --filter '@examples/*' recursive run build",
"build:storybook": "pnpm run build && STORYBOOK_ENVIRONMENT=production storybook build",
"build:storybook:stats": "pnpm run build:storybook --webpack-stats-json",
"build:examples": "pnpm --filter '{examples/**}' recursive exec -- pnpm run build",
"build": "turbo run build",
"size": "turbo run size",
"typecheck": "turbo run typecheck",
"build:examples": "turbo run build --filter '@examples/*' ",
"storybook:build": "STORYBOOK_ENVIRONMENT=production storybook build",
"storybook:build:stats": "pnpm turbo storybook:build -- --webpack-stats-json",
"check:deps": "npx depcheck . --skip-missing=true --ignores='bin,eslint,vite,jest,husky,@commitlint/*,@babel/*,babel-*'",
"commit": "npx git-cz -a --disable-emoji",
"start": "STORYBOOK_ENVIRONMENT=development storybook dev -p 6006",
Expand All @@ -31,16 +32,13 @@
"lint:fix": "pnpm run lint --fix",
"lint": "eslint --report-unused-disable-directives --cache .",
"prebuild": "pnpm --filter '@ultraviolet/*' recursive run prebuild",
"test:unit": "pnpm --filter '@ultraviolet/*' recursive run test:unit",
"test:unit:coverage": "pnpm --filter '@ultraviolet/*' recursive run test:unit:coverage",
"test:unit": "turbo test:unit --filter='@ultraviolet/*' ",
"test:unit:coverage": "turbo test:unit:coverage --filter='@ultraviolet/*' ",
"prepare": "husky",
"size": "pnpm run build && size-limit",
"size:packages": "pnpm --filter '@ultraviolet/*' recursive run size",
"tokens:update": "node ./scripts/figma-synchronise-tokens.mjs && pnpm run format packages/themes/src/themes/console",
"release": "pnpm build && pnpm changeset publish",
"svg": "npx svgo --pretty --multipass",
"svg:all": "pnpm run svg -r -f .",
"typecheck": "pnpm --filter '@ultraviolet/*' recursive run typecheck",
"illustrations:update": "BUCKET_NAME=ultraviolet BUCKET_REGION=fr-par node utils/illustrations/uploadIllustrations.js && pnpm format packages/illustrations/src/"
},
"lint-staged": {
Expand Down Expand Up @@ -68,20 +66,6 @@
"@commitlint/config-conventional"
]
},
"size-limit": [
{
"path": [
"packages/*/dist/**/*.js",
"!packages/illustrations",
"!packages/plus",
"!packages/icons"
],
"limit": "500 kB",
"webpack": false,
"brotli": true,
"running": false
}
],
"pnpm": {
"overrides": {
"vite": "$vite"
Expand Down Expand Up @@ -159,6 +143,7 @@
"emoji-toolkit": "8.0.0",
"esbuild-plugin-browserslist": "0.13.0",
"eslint": "9.6.0",
"eslint-config-turbo": "^2.0.6",
"eslint-plugin-testing-library": "6.2.2",
"expect": "29.7.0",
"file-loader": "6.2.0",
Expand All @@ -179,6 +164,7 @@
"size-limit": "11.1.4",
"storybook": "8.1.11",
"timekeeper": "2.3.1",
"turbo": "2.0.6",
"typescript": "5.5.3",
"vite": "5.3.3",
"vitest": "1.6.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/form/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"build:profile": "npx vite-bundle-visualizer -c vite.config.ts",
"build": "vite build --config vite.config.ts && pnpm run type:generate",
"prebuild": "shx rm -rf dist",
"size": "pnpm run build && size-limit",
"size": "size-limit",
"test:unit:coverage": "pnpm test:unit --coverage",
"test:unit": "LC_ALL=en_US.UTF-8 pnpm vitest --run --config vite.config.ts",
"type:generate": "tsc --declaration -p tsconfig.build.json",
Expand Down
2 changes: 1 addition & 1 deletion packages/icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"build": "vite build --config vite.config.ts && pnpm run type:generate",
"build:profile": "npx vite-bundle-visualizer -c vite.config.ts",
"typecheck": "tsc --noEmit",
"size": "pnpm run build && size-limit"
"size": "size-limit"
},
"keywords": [
"react",
Expand Down
8 changes: 8 additions & 0 deletions packages/icons/turbo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": ["//"],
"tasks": {
"typecheck": {
"dependsOn": ["@ultraviolet/ui#build"]
}
}
}
2 changes: 1 addition & 1 deletion packages/illustrations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"build": "vite build --config vite.config.ts && pnpm run type:generate",
"build:profile": "npx vite-bundle-visualizer -c vite.config.ts",
"typecheck": "tsc --noEmit",
"size": "pnpm run build && size-limit",
"size": "size-limit",
"test:unit": "LC_ALL=en_US.UTF-8 pnpm vitest --run --config vite.config.ts",
"test:unit:coverage": "pnpm test:unit --coverage"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/plus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"build": "vite build --config vite.config.ts && pnpm run type:generate",
"build:profile": "npx vite-bundle-visualizer -c vite.config.ts",
"typecheck": "tsc --noEmit",
"size": "pnpm run build && size-limit",
"size": "size-limit",
"test:unit": "LC_ALL=en_US.UTF-8 pnpm vitest --run --config vite.config.ts",
"test:unit:coverage": "pnpm test:unit --coverage"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"build": "vite build --config vite.config.ts && pnpm run type:generate",
"build:profile": "npx vite-bundle-visualizer -c vite.config.ts",
"typecheck": "tsc --noEmit",
"size": "pnpm run build && size-limit",
"size": "size-limit",
"test:unit": "LC_ALL=en_US.UTF-8 pnpm vitest --run --config vite.config.ts",
"test:unit:coverage": "pnpm test:unit --coverage"
},
Expand Down
Loading

0 comments on commit 2f3ff8d

Please sign in to comment.