Skip to content

Commit 484aea8

Browse files
migrate to yarn v4
1 parent 023edd1 commit 484aea8

File tree

14 files changed

+16223
-10558
lines changed

14 files changed

+16223
-10558
lines changed

.dockerignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ packages/web/.next
1010
**/node_modules
1111
**/.env.local
1212
**/.sentryclirc
13-
**/.env.sentry-build-plugin
13+
**/.env.sentry-build-plugin
14+
.yarn
15+
!.yarn/releases

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,10 @@ dist
153153

154154
# if you are NOT using Zero-installs, then:
155155
# comment the following lines
156-
!.yarn/cache
156+
# !.yarn/cache
157157

158158
# and uncomment the following lines
159-
# .pnp.*
159+
.pnp.*
160160

161161
# End of https://www.toptal.com/developers/gitignore/api/yarn,node
162162

.yarn/releases/yarn-4.7.0.cjs

Lines changed: 935 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
enableGlobalCache: false
2+
nodeLinker: node-modules
3+
yarnPath: .yarn/releases/yarn-4.7.0.cjs

Dockerfile

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,17 @@ RUN CGO_ENABLED=0 GOOS=linux go build -o /cmd/ ./cmd/...
2828
FROM node-alpine AS shared-libs-builder
2929
WORKDIR /app
3030

31-
COPY package.json yarn.lock* ./
31+
COPY package.json yarn.lock* .yarnrc.yml ./
32+
COPY .yarn ./.yarn
3233
COPY ./packages/db ./packages/db
3334
COPY ./packages/schemas ./packages/schemas
3435
COPY ./packages/crypto ./packages/crypto
3536
COPY ./packages/error ./packages/error
36-
RUN yarn workspace @sourcebot/db install --frozen-lockfile
37-
RUN yarn workspace @sourcebot/schemas install --frozen-lockfile
38-
RUN yarn workspace @sourcebot/crypto install --frozen-lockfile
39-
RUN yarn workspace @sourcebot/error install --frozen-lockfile
37+
38+
RUN yarn workspace @sourcebot/db install
39+
RUN yarn workspace @sourcebot/schemas install
40+
RUN yarn workspace @sourcebot/crypto install
41+
RUN yarn workspace @sourcebot/error install
4042
# ------------------------------------
4143

4244
# ------ Build Web ------
@@ -58,7 +60,8 @@ ENV NEXT_PUBLIC_SENTRY_WEBAPP_DSN=$SENTRY_WEBAPP_DSN
5860
RUN apk add --no-cache libc6-compat
5961
WORKDIR /app
6062

61-
COPY package.json yarn.lock* ./
63+
COPY package.json yarn.lock* .yarnrc.yml ./
64+
COPY .yarn ./.yarn
6265
COPY ./packages/web ./packages/web
6366
COPY --from=shared-libs-builder /app/node_modules ./node_modules
6467
COPY --from=shared-libs-builder /app/packages/db ./packages/db
@@ -67,9 +70,7 @@ COPY --from=shared-libs-builder /app/packages/crypto ./packages/crypto
6770
COPY --from=shared-libs-builder /app/packages/error ./packages/error
6871

6972
# Fixes arm64 timeouts
70-
RUN yarn config set registry https://registry.npmjs.org/
71-
RUN yarn config set network-timeout 1200000
72-
RUN yarn workspace @sourcebot/web install --frozen-lockfile
73+
RUN yarn workspace @sourcebot/web install
7374

7475
ENV NEXT_TELEMETRY_DISABLED=1
7576
RUN yarn workspace @sourcebot/web build
@@ -81,15 +82,16 @@ FROM node-alpine AS backend-builder
8182
ENV SKIP_ENV_VALIDATION=1
8283
WORKDIR /app
8384

84-
COPY package.json yarn.lock* ./
85+
COPY package.json yarn.lock* .yarnrc.yml ./
86+
COPY .yarn ./.yarn
8587
COPY ./schemas ./schemas
8688
COPY ./packages/backend ./packages/backend
8789
COPY --from=shared-libs-builder /app/node_modules ./node_modules
8890
COPY --from=shared-libs-builder /app/packages/db ./packages/db
8991
COPY --from=shared-libs-builder /app/packages/schemas ./packages/schemas
9092
COPY --from=shared-libs-builder /app/packages/crypto ./packages/crypto
9193
COPY --from=shared-libs-builder /app/packages/error ./packages/error
92-
RUN yarn workspace @sourcebot/backend install --frozen-lockfile
94+
RUN yarn workspace @sourcebot/backend install
9395
RUN yarn workspace @sourcebot/backend build
9496
ENV SKIP_ENV_VALIDATION=0
9597
# ------------------------------
@@ -129,6 +131,9 @@ ENV DOMAIN_SUB_PATH=/
129131
# Sourcebot collects anonymous usage data using [PostHog](https://posthog.com/). Uncomment this line to disable.
130132
# ENV SOURCEBOT_TELEMETRY_DISABLED=1
131133

134+
COPY package.json yarn.lock* .yarnrc.yml ./
135+
COPY .yarn ./.yarn
136+
132137
# Configure zoekt
133138
COPY vendor/zoekt/install-ctags-alpine.sh .
134139
RUN ./install-ctags-alpine.sh && rm install-ctags-alpine.sh

entrypoint.sh

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,21 @@ echo -e "\e[34m[Info] Sourcebot version: $SOURCEBOT_VERSION\e[0m"
66
# If we don't have a PostHog key, then we need to disable telemetry.
77
if [ -z "$POSTHOG_PAPIK" ]; then
88
echo -e "\e[33m[Warning] POSTHOG_PAPIK was not set. Setting SOURCEBOT_TELEMETRY_DISABLED.\e[0m"
9-
export SOURCEBOT_TELEMETRY_DISABLED=1
9+
export SOURCEBOT_TELEMETRY_DISABLED=true
10+
fi
11+
12+
if [ -n "$SOURCEBOT_TELEMETRY_DISABLED" ]; then
13+
# Validate that SOURCEBOT_TELEMETRY_DISABLED is either "true" or "false"
14+
if [ "$SOURCEBOT_TELEMETRY_DISABLED" != "true" ] && [ "$SOURCEBOT_TELEMETRY_DISABLED" != "false" ]; then
15+
echo -e "\e[31m[Error] SOURCEBOT_TELEMETRY_DISABLED must be either 'true' or 'false'. Got '$SOURCEBOT_TELEMETRY_DISABLED'\e[0m"
16+
exit 1
17+
fi
18+
else
19+
export SOURCEBOT_TELEMETRY_DISABLED=false
1020
fi
1121

1222
# Issue a info message about telemetry
13-
if [ ! -z "$SOURCEBOT_TELEMETRY_DISABLED" ]; then
23+
if [ "$SOURCEBOT_TELEMETRY_DISABLED" = "true" ]; then
1424
echo -e "\e[34m[Info] Disabling telemetry since SOURCEBOT_TELEMETRY_DISABLED was set.\e[0m"
1525
fi
1626

@@ -59,6 +69,11 @@ if [ -z "$AUTH_SECRET" ]; then
5969
set +a
6070
fi
6171

72+
if [ -z "$AUTH_URL" ]; then
73+
echo -e "\e[33m[Warning] AUTH_URL is not set.\e[0m"
74+
export AUTH_URL="http://localhost:3000"
75+
fi
76+
6277
# In order to detect if this is the first run, we create a `.installed` file in
6378
# the cache directory.
6479
FIRST_RUN_FILE="$DATA_CACHE_DIR/.installedv2"
@@ -69,7 +84,7 @@ if [ ! -f "$FIRST_RUN_FILE" ]; then
6984

7085
# If this is our first run, send a `install` event to PostHog
7186
# (if telemetry is enabled)
72-
if [ -z "$SOURCEBOT_TELEMETRY_DISABLED" ]; then
87+
if [ "$SOURCEBOT_TELEMETRY_DISABLED" = "false" ]; then
7388
if ! ( curl -L --output /dev/null --silent --fail --header "Content-Type: application/json" -d '{
7489
"api_key": "'"$POSTHOG_PAPIK"'",
7590
"event": "install",
@@ -89,7 +104,7 @@ else
89104
if [ "$PREVIOUS_VERSION" != "$SOURCEBOT_VERSION" ]; then
90105
echo -e "\e[34m[Info] Upgraded from version $PREVIOUS_VERSION to $SOURCEBOT_VERSION\e[0m"
91106

92-
if [ -z "$SOURCEBOT_TELEMETRY_DISABLED" ]; then
107+
if [ "$SOURCEBOT_TELEMETRY_DISABLED" = "false" ]; then
93108
if ! ( curl -L --output /dev/null --silent --fail --header "Content-Type: application/json" -d '{
94109
"api_key": "'"$POSTHOG_PAPIK"'",
95110
"event": "upgrade",

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@
66
"scripts": {
77
"build": "cross-env SKIP_ENV_VALIDATION=1 yarn workspaces run build",
88
"test": "yarn workspaces run test",
9-
109
"dev": "yarn dev:prisma:migrate:dev && npm-run-all --print-label --parallel dev:zoekt dev:backend dev:web",
1110
"with-env": "cross-env PATH=\"$PWD/bin:$PATH\" dotenv -e .env.development -c --",
1211
"dev:zoekt": "yarn with-env zoekt-webserver -index .sourcebot/index -rpc",
1312
"dev:backend": "yarn with-env yarn workspace @sourcebot/backend dev:watch",
1413
"dev:web": "yarn with-env yarn workspace @sourcebot/web dev",
15-
1614
"dev:prisma:migrate:dev": "yarn with-env yarn workspace @sourcebot/db prisma:migrate:dev",
1715
"dev:prisma:studio": "yarn with-env yarn workspace @sourcebot/db prisma:studio",
1816
"dev:prisma:migrate:reset": "yarn with-env yarn workspace @sourcebot/db prisma:migrate:reset"
@@ -21,5 +19,6 @@
2119
"cross-env": "^7.0.3",
2220
"dotenv-cli": "^8.0.0",
2321
"npm-run-all": "^4.1.5"
24-
}
22+
},
23+
"packageManager": "yarn@4.7.0"
2524
}

packages/backend/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
"@types/argparse": "^2.0.16",
1515
"@types/micromatch": "^4.0.9",
1616
"@types/node": "^22.7.5",
17+
"cross-env": "^7.0.3",
1718
"json-schema-to-typescript": "^15.0.2",
1819
"tsc-watch": "^6.2.0",
1920
"tsx": "^4.19.1",
2021
"typescript": "^5.6.2",
21-
"cross-env": "^7.0.3",
2222
"vitest": "^2.1.9"
2323
},
2424
"dependencies": {
@@ -29,10 +29,10 @@
2929
"@sentry/cli": "^2.42.2",
3030
"@sentry/node": "^9.3.0",
3131
"@sentry/profiling-node": "^9.3.0",
32-
"@sourcebot/crypto": "^0.1.0",
33-
"@sourcebot/db": "^0.1.0",
34-
"@sourcebot/error": "^0.1.0",
35-
"@sourcebot/schemas": "^0.1.0",
32+
"@sourcebot/crypto": "workspace:*",
33+
"@sourcebot/db": "workspace:*",
34+
"@sourcebot/error": "workspace:*",
35+
"@sourcebot/schemas": "workspace:*",
3636
"@t3-oss/env-core": "^0.12.0",
3737
"@types/express": "^5.0.0",
3838
"ajv": "^8.17.1",

packages/crypto/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
},
1313
"devDependencies": {
1414
"@types/node": "^22.7.5",
15-
"typescript": "^5.7.3"
15+
"typescript": "^5.7.3"
1616
}
1717
}

packages/db/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@
66
"scripts": {
77
"build": "yarn prisma:generate && tsc",
88
"postinstall": "yarn build",
9-
109
"prisma:generate": "prisma generate",
1110
"prisma:generate:watch": "prisma generate --watch",
1211
"prisma:migrate:dev": "prisma migrate dev",
1312
"prisma:migrate:prod": "prisma migrate deploy",
1413
"prisma:migrate:reset": "prisma migrate reset",
1514
"prisma:db:push": "prisma db push",
1615
"prisma:studio": "prisma studio",
17-
1816
"tool:prisma": "tsx tools/runPrismaCommand.ts",
1917
"tool:run-script": "tsx tools/scriptRunner.ts"
2018
},

0 commit comments

Comments
 (0)