Skip to content

Commit a24aae7

Browse files
committed
chore: optimize turborepo
1 parent 491b5bc commit a24aae7

File tree

8 files changed

+131
-65
lines changed

8 files changed

+131
-65
lines changed

.github/workflows/pull-request-build-lint-api.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ jobs:
2727
github.event.pull_request.draft == false &&
2828
github.event.pull_request.requested_reviewers != null
2929
steps:
30-
- uses: actions/checkout@v4
30+
- uses: actions/checkout@v6
3131
- name: Set up Python
32-
uses: actions/setup-python@v5
32+
uses: actions/setup-python@v6
3333
with:
3434
python-version: "3.12.x"
35+
cache: 'pip'
36+
cache-dependency-path: 'apps/api/requirements.txt'
3537
- name: Install Pylint
3638
run: python -m pip install ruff
3739
- name: Install API Dependencies

.github/workflows/pull-request-build-lint-web-apps.yml

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,42 @@ jobs:
2727
env:
2828
TURBO_SCM_BASE: ${{ github.event.pull_request.base.sha }}
2929
TURBO_SCM_HEAD: ${{ github.sha }}
30+
NODE_OPTIONS: "--max-old-space-size=4096"
3031
steps:
3132
- name: Checkout code
32-
uses: actions/checkout@v4
33+
uses: actions/checkout@v6
3334
with:
3435
fetch-depth: 50
3536
filter: blob:none
3637

3738
- name: Set up Node.js
38-
uses: actions/setup-node@v4
39+
uses: actions/setup-node@v6
3940

4041
- name: Enable Corepack and pnpm
4142
run: corepack enable pnpm
4243

43-
- name: Install dependencies
44-
run: pnpm install --frozen-lockfile
44+
- name: Get pnpm store directory
45+
shell: bash
46+
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
4547

46-
- name: Build Affected
47-
run: pnpm turbo run build --affected
48+
- name: Cache pnpm store
49+
uses: actions/cache@v4
50+
with:
51+
path: ${{ env.STORE_PATH }}
52+
key: pnpm-store-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
53+
restore-keys: |
54+
pnpm-store-${{ runner.os }}-
4855
49-
- name: Lint Affected
50-
run: pnpm turbo run check:lint --affected
56+
- name: Cache Turbo
57+
uses: actions/cache@v4
58+
with:
59+
path: .turbo
60+
key: turbo-${{ runner.os }}-${{ github.sha }}
61+
restore-keys: |
62+
turbo-${{ runner.os }}-
5163
52-
- name: Check Affected format
53-
run: pnpm turbo run check:format --affected
64+
- name: Install dependencies
65+
run: pnpm install --frozen-lockfile
5466

55-
- name: Check Affected types
56-
run: pnpm turbo run check:types --affected
67+
- name: Build, Lint, Format, and Type Check
68+
run: pnpm turbo run build check:lint check:format check:types --affected

eslint.config.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import promisePlugin from "eslint-plugin-promise";
1010
import reactPlugin from "eslint-plugin-react";
1111
import reactHooksPlugin from "eslint-plugin-react-hooks";
1212
import reactRefreshPlugin from "eslint-plugin-react-refresh";
13+
import turboPlugin from "eslint-plugin-turbo";
1314
import vitestPlugin from "@vitest/eslint-plugin";
1415
// import storybookPlugin from "eslint-plugin-storybook";
1516

@@ -42,6 +43,7 @@ export default defineConfig([
4243
jsxA11yPlugin.flatConfigs.recommended,
4344
reactRefreshPlugin.configs.recommended,
4445
reactRefreshPlugin.configs.vite,
46+
turboPlugin.configs["flat/recommended"],
4547
tseslint.configs.recommendedTypeChecked,
4648
vitestPlugin.configs.recommended,
4749
// TODO: enable storybook linting once issues are resolved

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"eslint-plugin-react-hooks": "7.0.1",
3636
"eslint-plugin-react-refresh": "0.4.24",
3737
"eslint-plugin-storybook": "10.1.4",
38+
"eslint-plugin-turbo": "2.6.3",
3839
"globals": "16.5.0",
3940
"husky": "9.1.7",
4041
"lint-staged": "16.2.7",

packages/shared-state/package.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,20 @@
44
"license": "AGPL-3.0",
55
"description": "Shared state shared across multiple apps internally",
66
"private": true,
7-
"main": "./src/index.ts",
8-
"types": "./src/index.ts",
7+
"type": "module",
8+
"main": "./dist/index.js",
9+
"module": "./dist/index.js",
10+
"types": "./dist/index.d.ts",
11+
"exports": {
12+
".": {
13+
"types": "./dist/index.d.ts",
14+
"import": "./dist/index.js"
15+
},
16+
"./package.json": "./package.json"
17+
},
918
"scripts": {
19+
"build": "tsdown",
20+
"dev": "tsdown --watch",
1021
"check:lint": "eslint . --max-warnings=191",
1122
"check:types": "tsc --noEmit",
1223
"check:format": "prettier --check .",
@@ -28,6 +39,7 @@
2839
"@plane/typescript-config": "workspace:*",
2940
"@types/lodash-es": "catalog:",
3041
"@types/node": "catalog:",
42+
"tsdown": "catalog:",
3143
"typescript": "catalog:"
3244
}
3345
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { defineConfig } from "tsdown";
2+
3+
export default defineConfig({
4+
entry: ["src/index.ts"],
5+
format: ["esm"],
6+
dts: true,
7+
platform: "neutral",
8+
});

pnpm-lock.yaml

Lines changed: 25 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

turbo.json

Lines changed: 53 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,95 @@
11
{
2-
"$schema": "https://turbo.build/schema.json",
2+
"$schema": "https://turborepo.com/schema.json",
3+
"globalDependencies": [".npmrc"],
34
"globalEnv": [
5+
"APP_VERSION",
6+
"DEV",
7+
"ENABLE_EXPERIMENTAL_COREPACK",
8+
"LOG_LEVEL",
49
"NODE_ENV",
5-
"VITE_API_BASE_URL",
6-
"VITE_ADMIN_BASE_URL",
10+
"SENTRY_DSN",
11+
"SENTRY_ENVIRONMENT",
12+
"SENTRY_TRACES_SAMPLE_RATE",
713
"VITE_ADMIN_BASE_PATH",
8-
"VITE_SPACE_BASE_URL",
9-
"VITE_SPACE_BASE_PATH",
10-
"VITE_WEB_BASE_URL",
11-
"VITE_LIVE_BASE_URL",
12-
"VITE_LIVE_BASE_PATH",
14+
"VITE_ADMIN_BASE_URL",
15+
"VITE_API_BASE_PATH",
16+
"VITE_API_BASE_URL",
17+
"VITE_APP_VERSION",
1318
"VITE_ENABLE_SESSION_RECORDER",
14-
"VITE_SESSION_RECORDER_KEY",
15-
"VITE_POSTHOG_KEY",
16-
"VITE_POSTHOG_HOST",
19+
"VITE_LIVE_BASE_PATH",
20+
"VITE_LIVE_BASE_URL",
1721
"VITE_POSTHOG_DEBUG",
18-
"VITE_SUPPORT_EMAIL",
19-
"ENABLE_EXPERIMENTAL_COREPACK",
22+
"VITE_POSTHOG_HOST",
23+
"VITE_POSTHOG_KEY",
2024
"VITE_SENTRY_DSN",
2125
"VITE_SENTRY_ENVIRONMENT",
22-
"VITE_SENTRY_SEND_DEFAULT_PII",
23-
"VITE_SENTRY_TRACES_SAMPLE_RATE",
2426
"VITE_SENTRY_PROFILES_SAMPLE_RATE",
25-
"VITE_SENTRY_REPLAYS_SESSION_SAMPLE_RATE",
2627
"VITE_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE",
27-
"VITE_APP_VERSION"
28+
"VITE_SENTRY_REPLAYS_SESSION_SAMPLE_RATE",
29+
"VITE_SENTRY_SEND_DEFAULT_PII",
30+
"VITE_SENTRY_TRACES_SAMPLE_RATE",
31+
"VITE_SESSION_RECORDER_KEY",
32+
"VITE_SPACE_BASE_PATH",
33+
"VITE_SPACE_BASE_URL",
34+
"VITE_SUPPORT_EMAIL",
35+
"VITE_WEB_BASE_PATH",
36+
"VITE_WEB_BASE_URL",
37+
"VITE_WEBSITE_URL"
2838
],
29-
"globalDependencies": ["pnpm-lock.yaml", "pnpm-workspace.yaml", ".npmrc"],
39+
"remoteCache": {
40+
"enabled": false
41+
},
3042
"tasks": {
3143
"build": {
3244
"dependsOn": ["^build"],
33-
"outputs": ["dist/**", "build/**"]
45+
"inputs": ["$TURBO_DEFAULT$", ".env*"],
46+
"outputs": ["dist/**", "build/**", ".react-router/**"]
3447
},
3548
"build-storybook": {
3649
"dependsOn": ["^build"],
3750
"outputs": ["storybook-static/**"]
3851
},
39-
"dev": {
52+
"check": {
53+
"dependsOn": ["check:format", "check:lint", "check:types"]
54+
},
55+
"check:format": {
56+
"inputs": ["$TURBO_DEFAULT$"],
57+
"outputs": []
58+
},
59+
"check:lint": {
4060
"dependsOn": ["^build"],
41-
"cache": false,
42-
"persistent": true
61+
"inputs": ["$TURBO_DEFAULT$", "!**/*.md"],
62+
"outputs": []
4363
},
4464
"check:types": {
4565
"dependsOn": ["^build"],
66+
"inputs": ["$TURBO_DEFAULT$", "!**/*.md"],
67+
"outputs": []
68+
},
69+
"clean": {
4670
"cache": false
4771
},
48-
"lint": {
72+
"dev": {
4973
"cache": false,
50-
"inputs": ["**/*.{js,ts,tsx,mjs,jsx}", "!**/node_modules/**", "!**/build/**", "!**/dist/**"]
74+
"dependsOn": ["^build"],
75+
"persistent": true
5176
},
52-
"check:lint": {
53-
"dependsOn": ["lint"],
77+
"fix": {
5478
"cache": false,
55-
"inputs": ["**/*.{js,ts,tsx,mjs,jsx}", "!**/build/**", "!**/dist/**"]
79+
"dependsOn": ["fix:format", "fix:lint"]
5680
},
57-
"check:format": {
58-
"cache": false
59-
},
60-
"check": {
61-
"dependsOn": ["check:format", "check:lint", "check:types"],
81+
"fix:format": {
6282
"cache": false
6383
},
6484
"fix:lint": {
6585
"cache": false
6686
},
67-
"fix:format": {
68-
"cache": false
69-
},
70-
"fix": {
71-
"dependsOn": ["fix:format", "fix:lint"],
87+
"start": {
7288
"cache": false
7389
},
7490
"test": {
7591
"dependsOn": ["^build"],
7692
"outputs": []
77-
},
78-
"start": {
79-
"cache": false
80-
},
81-
"clean": {
82-
"cache": false
8393
}
8494
}
8595
}

0 commit comments

Comments
 (0)