Skip to content

Commit 817a02b

Browse files
committed
Only build stuff that requires Vercel env to build on Vercel
For many of our UI applications, in order to build the package, a number of environment variables must be present. The values for these env vars are stored in Vercel, however not everyone who contributes to this repository will have access to Vercel. This PR modifies the turbo config to not build those packages on `turbo build`. This is generally probably the right thing since we don't want those packages to build in Github Actions either, given the environment is not going to be present in GHA and so the builds would likely fail there too. After this PR, to build any packages that rely on Vercel environments, you will run `turbo build:vercelonly`. Running `turbo build` will build everything else and will exclude anything that depends on the Vercel env.
1 parent 74d1fc8 commit 817a02b

File tree

13 files changed

+33
-12
lines changed

13 files changed

+33
-12
lines changed

.github/workflows/ci-turbo-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ jobs:
3333
- name: Cache for Turbo
3434
uses: rharkor/caching-for-turbo@v1.5
3535
- name: Build
36-
run: pnpm build:ci
36+
run: pnpm run turbo build

.github/workflows/publish-js.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ jobs:
2626
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}"
2727
env:
2828
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
29-
- run: pnpm build:ci
29+
- run: pnpm run turbo build
3030
- run: pnpm run publish

apps/api-reference/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"node": "22"
88
},
99
"scripts": {
10-
"build": "next build",
10+
"build:vercelonly": "next build",
1111
"fix:format": "prettier --write .",
1212
"fix:lint": "eslint --fix . --max-warnings 0",
1313
"pull:env": "[ $CI ] || VERCEL_ORG_ID=team_BKQrg3JJFLxZyTqpuYtIY0rj VERCEL_PROJECT_ID=prj_gbljYVzp0m5EpCuOF6nZpM4WMFM6 vercel env pull",

apps/api-reference/turbo.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://turbo.build/schema.json",
33
"extends": ["//"],
44
"tasks": {
5-
"build": {
5+
"build:vercelonly": {
66
"env": [
77
"WALLETCONNECT_PROJECT_ID",
88
"AMPLITUDE_API_KEY",

apps/api-reference/vercel.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"$schema": "https://openapi.vercel.sh/vercel.json",
3-
"ignoreCommand": "../../vercel-ignore.sh"
3+
"ignoreCommand": "../../vercel-ignore.sh",
4+
"buildCommand": "turbo run build:vercelonly --filter @pythnetwork/api-reference"
45
}

apps/insights/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"node": "22"
88
},
99
"scripts": {
10-
"build": "next build",
10+
"build:vercelonly": "next build",
1111
"fix:format": "prettier --write .",
1212
"fix:lint:eslint": "eslint --fix .",
1313
"fix:lint:stylelint": "stylelint --fix 'src/**/*.scss'",

apps/insights/turbo.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://turbo.build/schema.json",
33
"extends": ["//"],
44
"tasks": {
5-
"build": {
5+
"build:vercelonly": {
66
"env": [
77
"VERCEL_ENV",
88
"GOOGLE_ANALYTICS_ID",

apps/insights/vercel.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"$schema": "https://openapi.vercel.sh/vercel.json",
3-
"ignoreCommand": "../../vercel-ignore.sh"
3+
"ignoreCommand": "../../vercel-ignore.sh",
4+
"buildCommand": "turbo run build:vercelonly --filter @pythnetwork/insights"
45
}

apps/staking/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"node": "22"
88
},
99
"scripts": {
10-
"build": "next build",
10+
"build:vercelonly": "next build",
1111
"fix:format": "prettier --write .",
1212
"fix:lint": "eslint --fix . --max-warnings 0",
1313
"pull:env": "[ $CI ] || VERCEL_ORG_ID=team_BKQrg3JJFLxZyTqpuYtIY0rj VERCEL_PROJECT_ID=prj_3TIYzlYYncZx7wRtfmzG2YUsNzKp vercel env pull",

apps/staking/turbo.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://turbo.build/schema.json",
33
"extends": ["//"],
44
"tasks": {
5-
"build": {
5+
"build:vercelonly": {
66
"env": [
77
"IP_ALLOWLIST",
88
"GOVERNANCE_ONLY_REGIONS",

apps/staking/vercel.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"$schema": "https://openapi.vercel.sh/vercel.json",
3-
"ignoreCommand": "../../vercel-ignore.sh"
3+
"ignoreCommand": "../../vercel-ignore.sh",
4+
"buildCommand": "turbo run build:vercelonly --filter @pythnetwork/staking"
45
}

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"pnpm": "^9.15.3"
88
},
99
"scripts": {
10-
"build:ci": "turbo build --filter=!./apps/api-reference --filter=!./apps/insights --filter=!./apps/staking",
1110
"fix:format": "prettier --write .",
1211
"install:modules": "[ $CI ] && true || pnpm install",
1312
"publish": "lerna publish from-package --no-private --no-git-tag-version --yes",

turbo.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,25 @@
7070
],
7171
"outputs": ["lib/**", "dist/**", ".next/**", "!.next/cache/**"]
7272
},
73+
"build:vercelonly": {
74+
"dependsOn": [
75+
"//#install:modules",
76+
"pull:env",
77+
"^build",
78+
"build:cjs",
79+
"build:esm"
80+
],
81+
"inputs": [
82+
"$TURBO_DEFAULT$",
83+
"!README.md",
84+
"!**/*.test.*",
85+
"!jest.config.js",
86+
"!eslint.config.js",
87+
"!prettier.config.js",
88+
"!vercel.json"
89+
],
90+
"outputs": ["lib/**", "dist/**", ".next/**", "!.next/cache/**"]
91+
},
7392
"build:cjs": {
7493
"dependsOn": ["//#install:modules"],
7594
"inputs": [

0 commit comments

Comments
 (0)