Skip to content

Add Turborepo configuration and scripts for improved monorepo management #13951

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
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
16 changes: 14 additions & 2 deletions .github/workflows/algolia-index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,23 @@ jobs:
- run: yarn install --frozen-lockfile
if: steps.cache.outputs.cache-hit != 'true'

# Setup Turbo cache with better cache keys for builds
- name: Setup Turbo cache
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-algolia-${{ hashFiles('**/package.json', '**/turbo.json', '**/next.config.*', '**/tsconfig.json', 'docs/**', 'includes/**', 'platform-includes/**', 'develop-docs/**') }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-algolia-${{ hashFiles('**/package.json', '**/turbo.json', '**/next.config.*', '**/tsconfig.json') }}-
${{ runner.os }}-turbo-algolia-
${{ runner.os }}-turbo-build-
${{ runner.os }}-turbo-

# bun seems to be the most straightforward way to run a TypeScript script
# without introducing another dependency like ts-node or tsx for everyone else

- name: Build index for user docs
run: yarn build && bun ./scripts/algolia.ts
run: yarn turbo run build && bun ./scripts/algolia.ts
if: steps.filter.outputs.docs == 'true'
env:
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
Expand All @@ -52,7 +64,7 @@ jobs:
NEXT_PUBLIC_SENTRY_DSN: https://examplePublicKey@o0.ingest.sentry.io/0

- name: Build index for developer docs
run: yarn build:developer-docs && bun ./scripts/algolia.ts
run: yarn turbo run build:developer-docs && bun ./scripts/algolia.ts
if: steps.filter.outputs.dev-docs == 'true'
env:
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/lint-404s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,24 @@ jobs:
- run: yarn install --frozen-lockfile
if: steps.cache.outputs.cache-hit != 'true'

- run: yarn build
# Setup Turbo cache with better cache keys for builds
- name: Setup Turbo cache
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-build-${{ hashFiles('**/package.json', '**/turbo.json', '**/next.config.*', '**/tsconfig.json', 'docs/**', 'includes/**', 'platform-includes/**', 'develop-docs/**') }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-build-${{ hashFiles('**/package.json', '**/turbo.json', '**/next.config.*', '**/tsconfig.json') }}-
${{ runner.os }}-turbo-build-
${{ runner.os }}-turbo-

- run: yarn turbo run build
if: steps.filter.outputs.docs == 'true'
env:
SENTRY_DSN: https://examplePublicKey@o0.ingest.sentry.io/0
NEXT_PUBLIC_SENTRY_DSN: https://examplePublicKey@o0.ingest.sentry.io/0

- run: yarn build:developer-docs
- run: yarn turbo run build:developer-docs
if: steps.filter.outputs.dev-docs == 'true'
env:
SENTRY_DSN: https://examplePublicKey@o0.ingest.sentry.io/0
Expand Down
38 changes: 31 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,28 @@ jobs:
with:
path: ${{ github.workspace }}/node_modules
key: node-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}

- run: yarn install --frozen-lockfile
if: steps.cache.outputs.cache-hit != 'true'

# Additional checks
- run: yarn lint:ts
- run: yarn lint:docs
# Setup Turbo cache with better cache keys
- name: Setup Turbo cache
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-lint-${{ hashFiles('**/package.json', '**/turbo.json', '**/.eslintrc*', '**/tsconfig.json') }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-lint-${{ hashFiles('**/package.json', '**/turbo.json', '**/.eslintrc*', '**/tsconfig.json') }}-
${{ runner.os }}-turbo-lint-
${{ runner.os }}-turbo-

# Additional checks using Turbo
- run: yarn turbo run lint:ts
- run: yarn turbo run lint:docs

# Run automatic fixes (run prettier apart from eslint to also fix mdx files)
- run: yarn lint:prettier:fix
- run: yarn lint:eslint:fix
# Run automatic fixes using Turbo (run prettier apart from eslint to also fix mdx files)
- run: yarn turbo run lint:prettier:fix
- run: yarn turbo run lint:eslint:fix

# Check (and error) for dirty working tree for forks
# Reason being we need a different token to auto commit changes and
Expand Down Expand Up @@ -73,5 +85,17 @@ jobs:
key: node-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- run: yarn install --frozen-lockfile
if: steps.cache.outputs.cache-hit != 'true'

# Setup Turbo cache with better cache keys
- name: Setup Turbo cache
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-test-${{ hashFiles('**/package.json', '**/turbo.json', '**/*.{ts,tsx,js,jsx}', '**/tsconfig.json') }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-test-${{ hashFiles('**/package.json', '**/turbo.json', '**/*.{ts,tsx,js,jsx}', '**/tsconfig.json') }}-
${{ runner.os }}-turbo-test-
${{ runner.os }}-turbo-

- name: Run Tests
run: yarn test
run: yarn turbo run test
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,7 @@ public/mdx-images/*
# yalc
.yalc
yalc.lock

# turborepo
.turbo
.turborc
7 changes: 5 additions & 2 deletions apps/changelog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"author": "getsentry",
"license": "FSL-1.1-Apache-2.0",
"private": true,
"packageManager": "yarn@1.22.22",
"scripts": {
"dev": "next dev",
"build": "prisma generate && next build",
Expand Down Expand Up @@ -65,7 +66,9 @@
"extends": "../../package.json"
},
"resolutions": {
"@types/react": "npm:types-react@19.0.0-rc.1",
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.1"
"@sentry/core": "9.27.0",
"@sentry/types": "9.27.0",
"@sentry/nextjs": "9.27.0",
"@sentry/node": "9.27.0"
}
}
3 changes: 1 addition & 2 deletions apps/changelog/src/instrumentation-client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as SentryCore from '@sentry/core';
import * as Sentry from '@sentry/nextjs';
import * as Spotlight from '@spotlightjs/spotlight';

Expand All @@ -10,7 +9,7 @@ Sentry.init({
replaysSessionSampleRate: 0.1,
integrations: [
Sentry.replayIntegration(),
SentryCore.thirdPartyErrorFilterIntegration({
Sentry.thirdPartyErrorFilterIntegration({
filterKeys: ['sentry-changelog'],
behaviour: 'apply-tag-if-contains-third-party-frames',
}),
Expand Down
12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"url": "https://github.com/getsentry/sentry-docs/issues"
},
"private": true,
"packageManager": "yarn@1.22.22",
"workspaces": [
"./apps/*"
],
Expand All @@ -32,7 +33,11 @@
"sidecar": "yarn spotlight-sidecar",
"test": "vitest",
"test:ci": "vitest run",
"enforce-redirects": "node ./scripts/no-vercel-json-redirects.mjs"
"enforce-redirects": "node ./scripts/no-vercel-json-redirects.mjs",
"turbo:dev": "turbo run dev",
"turbo:build": "turbo run build",
"turbo:lint": "turbo run lint",
"turbo:test": "turbo run test"
},
"dependencies": {
"@ariakit/react": "^0.4.5",
Expand Down Expand Up @@ -124,12 +129,17 @@
"prettier": "^3.2.4",
"tailwindcss": "^3.4.1",
"ts-node": "^10.9.1",
"turbo": "^2.5.4",
"typescript": "^5",
"vite-tsconfig-paths": "^5.0.1",
"vitest": "^3.0.7",
"ws": "^8.17.1"
},
"resolutions": {
"@sentry/core": "9.27.0",
"@sentry/types": "9.27.0",
"@sentry/nextjs": "9.27.0",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hrm why wasnt nextjs already in here? i think this package.json is actually for the main docs site?

"@sentry/node": "9.27.0",
"dompurify": "3.2.4",
"@types/dompurify": "3.0.5"
},
Expand Down
3 changes: 3 additions & 0 deletions src/instrumentation-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ Sentry.init({
],
});

// Required for navigation instrumentation
export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;

if (process.env.NODE_ENV === 'development') {
Spotlight.init({
showClearEventsButton: true,
Expand Down
183 changes: 183 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
{
"$schema": "https://turbo.build/schema.json",
"tasks": {
"build": {
"dependsOn": [
"^build"
],
"outputs": [
".next/**",
"!.next/cache/**",
"dist/**"
],
"env": [
"NODE_ENV",
"NEXT_PUBLIC_*",
"SENTRY_DSN",
"CI",
"CODECOV_TOKEN",
"VERCEL_URL",
"OPENAPI_LOCAL_PATH",
"GATSBY_ENV",
"GATSBY_HIDE_SANDBOX",
"ESBUILD_BINARY_PATH",
"ALGOLIA_APP_ID",
"ALGOLIA_API_KEY",
"DOCS_INDEX_NAME",
"DEVELOP_DOCS_INDEX_NAME",
"ALOGOLIA_SKIP_ON_ERROR",
"GOOGLE_CLIENT_ID",
"GOOGLE_CLIENT_SECRET",
"GOOGLE_PROJECT_ID",
"GOOGLE_CLIENT_EMAIL",
"GOOGLE_PRIVATE_KEY",
"GOOGLE_BUCKET_NAME"
]
},
"build:developer-docs": {
"dependsOn": [
"^build"
],
"outputs": [
".next/**",
"!.next/cache/**",
"dist/**"
],
"env": [
"NODE_ENV",
"NEXT_PUBLIC_*",
"SENTRY_DSN",
"CI",
"CODECOV_TOKEN",
"VERCEL_URL",
"OPENAPI_LOCAL_PATH",
"GATSBY_ENV",
"GATSBY_HIDE_SANDBOX",
"ESBUILD_BINARY_PATH",
"ALGOLIA_APP_ID",
"ALGOLIA_API_KEY",
"DOCS_INDEX_NAME",
"DEVELOP_DOCS_INDEX_NAME",
"ALOGOLIA_SKIP_ON_ERROR",
"GOOGLE_CLIENT_ID",
"GOOGLE_CLIENT_SECRET",
"GOOGLE_PROJECT_ID",
"GOOGLE_CLIENT_EMAIL",
"GOOGLE_PRIVATE_KEY",
"GOOGLE_BUCKET_NAME"
]
},
"dev": {
"cache": false,
"persistent": true,
"env": [
"NODE_ENV",
"NEXT_PUBLIC_*",
"SENTRY_DSN",
"VERCEL_URL",
"OPENAPI_LOCAL_PATH",
"GATSBY_ENV",
"GATSBY_HIDE_SANDBOX",
"GOOGLE_CLIENT_ID",
"GOOGLE_CLIENT_SECRET",
"GOOGLE_PROJECT_ID",
"GOOGLE_CLIENT_EMAIL",
"GOOGLE_PRIVATE_KEY",
"GOOGLE_BUCKET_NAME"
]
},
"dev:developer-docs": {
"cache": false,
"persistent": true,
"env": [
"NODE_ENV",
"NEXT_PUBLIC_*",
"SENTRY_DSN",
"VERCEL_URL",
"OPENAPI_LOCAL_PATH",
"GATSBY_ENV",
"GATSBY_HIDE_SANDBOX",
"GOOGLE_CLIENT_ID",
"GOOGLE_CLIENT_SECRET",
"GOOGLE_PROJECT_ID",
"GOOGLE_CLIENT_EMAIL",
"GOOGLE_PRIVATE_KEY",
"GOOGLE_BUCKET_NAME"
]
},
"start": {
"dependsOn": [
"build"
],
"cache": false,
"persistent": true
},
"lint": {
"outputs": []
},
"lint:ts": {
"outputs": []
},
"lint:docs": {
"outputs": []
},
"lint:eslint": {
"outputs": []
},
"lint:eslint:fix": {
"cache": false,
"outputs": []
},
"lint:prettier": {
"outputs": []
},
"lint:prettier:fix": {
"cache": false,
"outputs": []
},
"lint:fix": {
"cache": false,
"outputs": []
},
"test": {
"dependsOn": [
"^build"
],
"outputs": [
"coverage/**"
],
"inputs": [
"src/**/*.{ts,tsx,js,jsx}",
"test/**/*.{ts,tsx,js,jsx}",
"**/*.test.*",
"**/*.spec.*"
],
"env": [
"NODE_ENV"
]
},
"test:ci": {
"dependsOn": [
"^build"
],
"outputs": [
"coverage/**"
],
"inputs": [
"src/**/*.{ts,tsx,js,jsx}",
"test/**/*.{ts,tsx,js,jsx}",
"**/*.test.*",
"**/*.spec.*"
],
"env": [
"NODE_ENV"
]
},
"enforce-redirects": {
"cache": false
},
"migrate:dev": {
"cache": false
}
}
}
Loading
Loading