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 46ea325
Show file tree
Hide file tree
Showing 12 changed files with 170 additions and 55 deletions.
59 changes: 37 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ 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
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
lint:
runs-on: ubuntu-22.04
steps:
Expand All @@ -33,10 +35,13 @@ 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
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
format:
runs-on: ubuntu-22.04
steps:
Expand All @@ -47,10 +52,14 @@ 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
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
test:
runs-on: ubuntu-22.04
needs: [lint, typecheck, format]
Expand All @@ -67,10 +76,12 @@ 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
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
- uses: codecov/[email protected]
with:
# files: packages/**/coverage/cobertura-coverage.xmls
Expand Down Expand Up @@ -106,8 +117,11 @@ jobs:
uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}
- run: pnpm install
- run: pnpm run build
- run: |
pnpm install
pnpm run build
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
build-examples: # This will build all projects in the examples folder, it assures that all examples are working
strategy:
matrix:
Expand All @@ -121,7 +135,8 @@ 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
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
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
31 changes: 8 additions & 23 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": "turbo build --filter='!./examples/*'",
"size": "turbo run size --filter='@ultraviolet/*'",
"build:examples": "turbo build --filter '@examples/*' ",
"typecheck": "turbo typecheck --filter='!./examples/*' ",
"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",
"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 @@ -179,6 +163,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
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
64 changes: 64 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"$schema": "https://turbo.build/schema.json",
"globalDependencies": ["tsconfig.json"],
"ui": "stream",
"globalEnv": [
"STORYBOOK_ENVIRONMENT",
"ENVIRONMENT",
"NODE_ENV",
"VERSION",
"PROXY",
"RELEASE_NAME"
],
"tasks": {
"build": {
"dependsOn": ["^build"],
"outputs": [
"build/**",
"dist/**",
".next/**",
"!.next/cache/**",
"out/**"
]
},
"size": {
"dependsOn": ["^build"]
},
"size:packages": {
"dependsOn": ["^build"]
},
"typecheck": {
"dependsOn": ["^build"]
},
"test:unit": {
"dependsOn": ["^build"],
"passThroughEnv": ["VITEST_*"]
},
"test:unit:coverage": {
"dependsOn": ["^build"],
"passThroughEnv": ["VITEST_*"]
}
}
}

0 comments on commit 46ea325

Please sign in to comment.