Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(turbo): add turbo config #4006

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/small-tools-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@ultraviolet/illustrations": patch
"@ultraviolet/icons": patch
"@ultraviolet/form": patch
"@ultraviolet/plus": patch
"@ultraviolet/ui": patch
"@ultraviolet/themes": patch
---

Add turborepo
philibea marked this conversation as resolved.
Show resolved Hide resolved
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


2 changes: 1 addition & 1 deletion .github/workflows/changesets-renovate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
fetch-depth: 10
ref: ${{ github.head_ref }}
- name: Git Identity
run: |
Expand Down
73 changes: 36 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,26 @@ 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: actions/checkout@v4
- uses: pnpm/action-setup@v4.0.0
- name: Use Node.js
uses: actions/setup-node@v4.0.3
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/action-setup@v4.0.0
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 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/action-setup@v4.0.0
Expand All @@ -47,30 +57,32 @@ 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 format:ci

test:
runs-on: ubuntu-22.04
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_REMOTE_ONLY: true
needs: [lint, typecheck, format]
strategy:
matrix:
node: ["20"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
fetch-depth: 10
- uses: pnpm/action-setup@v4.0.0
- name: Use Node.js
uses: actions/setup-node@v4.0.3
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 test:unit:coverage
- uses: codecov/codecov-action@v4.5.0
with:
# files: packages/**/coverage/cobertura-coverage.xmls
Expand Down Expand Up @@ -98,6 +110,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,22 +121,6 @@ jobs:
uses: actions/setup-node@v4.0.3
with:
node-version: ${{ matrix.node }}
- run: pnpm install
- run: 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
needs: [lint, test, format]
steps:
- uses: actions/checkout@v4 # v4.1.4
- uses: pnpm/action-setup@v4.0.0
- name: Use Node.js
uses: actions/setup-node@v4.0.3
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
10 changes: 8 additions & 2 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 All @@ -79,13 +82,15 @@ jobs:
echo "SCW_MIN_SCALE=0" >> $GITHUB_ENV
fi

- name: Set scw_cpu_limit
- name: Set scw_limit
id: set-cpu-limit
run: |
if [[ "${{ env.BRANCH_SLUG }}" == "main" ]]; then
echo "SCW_CPU_LIMIT=560" >> $GITHUB_ENV
echo "SCW_CPU_LIMIT=1120" >> $GITHUB_ENV
echo "SCW_MEMORY_LIMIT=1024" >> $GITHUB_ENV
else
echo "SCW_CPU_LIMIT=140" >> $GITHUB_ENV
echo "SCW_MEMORY_LIMIT=256" >> $GITHUB_ENV
fi

- name: Deploy Serverless Container Scaleway
Expand All @@ -105,6 +110,7 @@ jobs:
scw_cpu_limit: ${{ env.SCW_CPU_LIMIT }}
scw_max_concurrency: ${{ env.SCW_MAX_CONCURRENCY }}
scw_sandbox: "v2"
scw_memory_limit: ${{ env.SCW_MEMORY_LIMIT }}

- name: Update deployment status
uses: bobheadxi/deployments@v1.5.0
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/action-setup@v4.0.0
- name: Use Node.js
uses: actions/setup-node@v4.0.3
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/setup-node@v4.0.3
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 ${TURBO_TOKEN}

COPY . .

RUN corepack enable
RUN pnpm install --frozen-lockfile
RUN pnpm build:storybook:stats
RUN pnpm turbo run storybook:build --output-logs=hash-only

RUN pnpm add serve -w

Expand Down
36 changes: 10 additions & 26 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,14 @@
"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",
"test:unit": "turbo run test:unit",
"test:unit:coverage": "turbo run test:unit:coverage",
"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 @@ -30,17 +33,11 @@
"format:ci": "biome ci .",
"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",
"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 +65,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 +162,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
Loading
Loading