diff --git a/.gitignore b/.gitignore index 17ad0f22..f8c15398 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ -# Created by https://www.toptal.com/developers/gitignore/api/yarn,node -# Edit at https://www.toptal.com/developers/gitignore?templates=yarn,node +# Created by https://www.toptal.com/developers/gitignore/api/node,yarn,turbo +# Edit at https://www.toptal.com/developers/gitignore?templates=node,yarn,turbo ### Node ### # Logs @@ -141,6 +141,10 @@ dist # SvelteKit build / generate output .svelte-kit +### Turbo ### +# Turborepo task cache +.turbo + ### yarn ### # https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored @@ -158,7 +162,7 @@ dist # and uncomment the following lines .pnp.* -# End of https://www.toptal.com/developers/gitignore/api/yarn,node +# End of https://www.toptal.com/developers/gitignore/api/node,yarn,turbo .sourcebot /bin diff --git a/Makefile b/Makefile index 538a4e5d..470f7795 100644 --- a/Makefile +++ b/Makefile @@ -20,22 +20,34 @@ clean: rm -rf \ bin \ node_modules \ + .turbo \ + packages/web/.turbo \ packages/web/node_modules \ packages/web/.next \ + packages/backend/.turbo \ packages/backend/dist \ packages/backend/node_modules \ + packages/db/.turbo \ packages/db/node_modules \ packages/db/dist \ + packages/schemas/.turbo \ packages/schemas/node_modules \ packages/schemas/dist \ + packages/crypto/.turbo \ packages/crypto/node_modules \ packages/crypto/dist \ packages/error/node_modules \ packages/error/dist \ + packages/mcp/.turbo \ packages/mcp/node_modules \ packages/mcp/dist \ + packages/shared/.turbo \ packages/shared/node_modules \ packages/shared/dist \ + packages/zoekt/.turbo \ + packages/zoekt/node_modules \ + packages/zoekt/dist \ + packages/zoekt/bin \ .sourcebot soft-reset: diff --git a/package.json b/package.json index c5909e76..5125c19c 100644 --- a/package.json +++ b/package.json @@ -4,15 +4,10 @@ "packages/*" ], "scripts": { - "build": "cross-env SKIP_ENV_VALIDATION=1 yarn workspaces foreach -A run build", + "build": "turbo build", "test": "yarn workspaces foreach -A run test", - "dev": "yarn dev:prisma:migrate:dev && npm-run-all --print-label --parallel dev:zoekt dev:backend dev:web watch:mcp watch:schemas", - "with-env": "cross-env PATH=\"$PWD/bin:$PATH\" dotenv -e .env.development -c --", - "dev:zoekt": "yarn with-env zoekt-webserver -index .sourcebot/index -rpc", - "dev:backend": "yarn with-env yarn workspace @sourcebot/backend dev:watch", - "dev:web": "yarn with-env yarn workspace @sourcebot/web dev", - "watch:mcp": "yarn workspace @sourcebot/mcp build:watch", - "watch:schemas": "yarn workspace @sourcebot/schemas watch", + "dev": "yarn with-env turbo dev zoekt:webserver", + "with-env": "cross-env PATH=\"$PROJECT_CWD/packages/zoekt/bin:$PATH\" dotenv -e .env.development -c --", "dev:prisma:migrate:dev": "yarn with-env yarn workspace @sourcebot/db prisma:migrate:dev", "dev:prisma:generate": "yarn with-env yarn workspace @sourcebot/db prisma:generate", "dev:prisma:studio": "yarn with-env yarn workspace @sourcebot/db prisma:studio", @@ -23,7 +18,8 @@ "devDependencies": { "cross-env": "^7.0.3", "dotenv-cli": "^8.0.0", - "npm-run-all": "^4.1.5" + "npm-run-all": "^4.1.5", + "turbo": "^2.5.8" }, "packageManager": "yarn@4.7.0", "resolutions": { diff --git a/packages/backend/package.json b/packages/backend/package.json index dade7893..cbdfc2d4 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -5,9 +5,8 @@ "main": "index.js", "type": "module", "scripts": { - "dev:watch": "tsc-watch --preserveWatchOutput --onSuccess \"yarn dev\"", - "dev": "node ./dist/index.js", - "build": "tsc", + "dev": "tsc-watch --preserveWatchOutput --onSuccess \"node ./dist/index.js\"", + "build": "cross-env SKIP_ENV_VALIDATION=1 tsc", "test": "cross-env SKIP_ENV_VALIDATION=1 vitest --config ./vitest.config.ts" }, "devDependencies": { diff --git a/packages/crypto/package.json b/packages/crypto/package.json index abccd406..c905a497 100644 --- a/packages/crypto/package.json +++ b/packages/crypto/package.json @@ -5,6 +5,7 @@ "private": true, "scripts": { "build": "tsc", + "dev": "tsc --watch", "postinstall": "yarn build" }, "dependencies": { diff --git a/packages/db/package.json b/packages/db/package.json index 8dc07d69..11236285 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -5,6 +5,7 @@ "private": true, "scripts": { "build": "yarn prisma:generate && tsc", + "dev": "yarn prisma:generate && tsc --watch", "postinstall": "yarn build", "prisma:generate": "prisma generate", "prisma:generate:watch": "prisma generate --watch", diff --git a/packages/logger/package.json b/packages/logger/package.json index 2e2279a3..e157e6a7 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -5,7 +5,8 @@ "type": "module", "private": true, "scripts": { - "build": "tsc", + "build": "cross-env SKIP_ENV_VALIDATION=1 tsc", + "dev": "cross-env SKIP_ENV_VALIDATION=1 tsc --watch", "postinstall": "yarn build" }, "dependencies": { diff --git a/packages/mcp/package.json b/packages/mcp/package.json index b11c8361..2fa9650d 100644 --- a/packages/mcp/package.json +++ b/packages/mcp/package.json @@ -6,8 +6,7 @@ "types": "dist/index.d.ts", "scripts": { "build": "tsc", - "dev": "node ./dist/index.js", - "build:watch": "tsc-watch --preserveWatchOutput" + "dev": "tsc-watch --preserveWatchOutput" }, "devDependencies": { "@types/express": "^5.0.1", diff --git a/packages/schemas/package.json b/packages/schemas/package.json index 632361fd..636fe127 100644 --- a/packages/schemas/package.json +++ b/packages/schemas/package.json @@ -4,8 +4,10 @@ "private": true, "scripts": { "build": "yarn generate && tsc", + "dev": "npm-run-all --parallel generate:watch tsc:watch", + "tsc:watch": "tsc --watch", "generate": "tsx tools/generate.ts", - "watch": "nodemon --watch ../../schemas -e json -x 'yarn generate'", + "generate:watch": "nodemon --watch ../../schemas -e json -x 'yarn generate'", "postinstall": "yarn build" }, "devDependencies": { @@ -13,6 +15,7 @@ "glob": "^11.0.1", "json-schema-to-typescript": "^15.0.4", "nodemon": "^3.1.10", + "npm-run-all": "^4.1.5", "tsx": "^4.19.2", "typescript": "^5.7.3" }, diff --git a/packages/shared/package.json b/packages/shared/package.json index 902a3485..8580e275 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -4,8 +4,9 @@ "type": "module", "private": true, "scripts": { - "build": "tsc", + "build": "cross-env SKIP_ENV_VALIDATION=1 tsc", "build:watch": "tsc-watch --preserveWatchOutput", + "dev": "tsc-watch --preserveWatchOutput", "postinstall": "yarn build" }, "dependencies": { @@ -22,6 +23,7 @@ "devDependencies": { "@types/micromatch": "^4.0.9", "@types/node": "^22.7.5", + "cross-env": "^7.0.3", "tsc-watch": "6.2.1", "typescript": "^5.7.3" }, diff --git a/packages/zoekt/.gitignore b/packages/zoekt/.gitignore new file mode 100644 index 00000000..7447f89a --- /dev/null +++ b/packages/zoekt/.gitignore @@ -0,0 +1 @@ +/bin \ No newline at end of file diff --git a/packages/zoekt/package.json b/packages/zoekt/package.json new file mode 100644 index 00000000..b0f2dd1e --- /dev/null +++ b/packages/zoekt/package.json @@ -0,0 +1,8 @@ +{ + "private": true, + "name": "zoekt", + "scripts": { + "build": "mkdir -p $PROJECT_CWD/packages/zoekt/bin/ && go build -C $PROJECT_CWD/vendor/zoekt -o $PROJECT_CWD/packages/zoekt/bin/ ./cmd/...", + "zoekt:webserver": "yarn build && ./bin/zoekt-webserver -index $PROJECT_CWD/.sourcebot/index -rpc" + } +} diff --git a/turbo.json b/turbo.json new file mode 100644 index 00000000..53ef74de --- /dev/null +++ b/turbo.json @@ -0,0 +1,26 @@ +{ + "$schema": "https://turborepo.com/schema.json", + "ui": "tui", + "tasks": { + "build": { + "dependsOn": [ + "^build" + ], + "outputs": [ + ".next/**", + "!.next/cache/**", + "dist/**", + "bin/**" + ] + }, + "zoekt:webserver": { + "persistent": true, + "cache": false + }, + "dev": { + "persistent": true, + "cache": false + } + }, + "envMode": "loose" +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 7fae191b..c412308e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7680,6 +7680,7 @@ __metadata: glob: "npm:^11.0.1" json-schema-to-typescript: "npm:^15.0.4" nodemon: "npm:^3.1.10" + npm-run-all: "npm:^4.1.5" tsx: "npm:^4.19.2" typescript: "npm:^5.7.3" languageName: unknown @@ -7697,6 +7698,7 @@ __metadata: "@types/micromatch": "npm:^4.0.9" "@types/node": "npm:^22.7.5" ajv: "npm:^8.17.1" + cross-env: "npm:^7.0.3" micromatch: "npm:^4.0.8" strip-json-comments: "npm:^5.0.1" tsc-watch: "npm:6.2.1" @@ -17837,6 +17839,7 @@ __metadata: cross-env: "npm:^7.0.3" dotenv-cli: "npm:^8.0.0" npm-run-all: "npm:^4.1.5" + turbo: "npm:^2.5.8" languageName: unknown linkType: soft @@ -19478,6 +19481,77 @@ __metadata: languageName: node linkType: hard +"turbo-darwin-64@npm:2.5.8": + version: 2.5.8 + resolution: "turbo-darwin-64@npm:2.5.8" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"turbo-darwin-arm64@npm:2.5.8": + version: 2.5.8 + resolution: "turbo-darwin-arm64@npm:2.5.8" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"turbo-linux-64@npm:2.5.8": + version: 2.5.8 + resolution: "turbo-linux-64@npm:2.5.8" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + +"turbo-linux-arm64@npm:2.5.8": + version: 2.5.8 + resolution: "turbo-linux-arm64@npm:2.5.8" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + +"turbo-windows-64@npm:2.5.8": + version: 2.5.8 + resolution: "turbo-windows-64@npm:2.5.8" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"turbo-windows-arm64@npm:2.5.8": + version: 2.5.8 + resolution: "turbo-windows-arm64@npm:2.5.8" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"turbo@npm:^2.5.8": + version: 2.5.8 + resolution: "turbo@npm:2.5.8" + dependencies: + turbo-darwin-64: "npm:2.5.8" + turbo-darwin-arm64: "npm:2.5.8" + turbo-linux-64: "npm:2.5.8" + turbo-linux-arm64: "npm:2.5.8" + turbo-windows-64: "npm:2.5.8" + turbo-windows-arm64: "npm:2.5.8" + dependenciesMeta: + turbo-darwin-64: + optional: true + turbo-darwin-arm64: + optional: true + turbo-linux-64: + optional: true + turbo-linux-arm64: + optional: true + turbo-windows-64: + optional: true + turbo-windows-arm64: + optional: true + bin: + turbo: bin/turbo + checksum: 10c0/34e8dc87fc2c5d63c3cd5aede9068c1123509d88f9bb99283ffec1687de6ad6df7ebfb83a5d348580afb3fdac53af479456e36938a1b6ed80fc1c3416c6dc3f3 + languageName: node + linkType: hard + "type-check@npm:^0.4.0, type-check@npm:~0.4.0": version: 0.4.0 resolution: "type-check@npm:0.4.0" @@ -20537,6 +20611,12 @@ __metadata: languageName: node linkType: hard +"zoekt@workspace:packages/zoekt": + version: 0.0.0-use.local + resolution: "zoekt@workspace:packages/zoekt" + languageName: unknown + linkType: soft + "zwitch@npm:^2.0.0, zwitch@npm:^2.0.4": version: 2.0.4 resolution: "zwitch@npm:2.0.4"