diff --git a/BUCK b/BUCK new file mode 100644 index 0000000000..a5a7e28df0 --- /dev/null +++ b/BUCK @@ -0,0 +1,9 @@ +load("@toolchains//workspace-pnpm:macros.bzl", "pnpm_workspace") + +pnpm_workspace( + name = "workspace", + child_packages = [ + "//core/api:package.json" + ], + visibility = ["PUBLIC"], +) diff --git a/core/api/BUCK b/core/api/BUCK index 14cc5c51b5..8dc515c0cb 100644 --- a/core/api/BUCK +++ b/core/api/BUCK @@ -1,14 +1,12 @@ -load("@toolchains//simple-pnpm:macros.bzl", "build_node_modules", "npm_bin") -load("@toolchains//workspace-pnpm:macros.bzl", "tsc_build") +load("@toolchains//workspace-pnpm:macros.bzl", "build_node_modules", "tsc_build") -build_node_modules( - name = "node_modules", +export_file( + name = "package.json", + visibility = ["PUBLIC"], ) -npm_bin( - name = "tsc_bin", - bin_name = "tsc", - visibility = ["PUBLIC"], +build_node_modules( + name = "node_modules", ) filegroup( diff --git a/core/api/package.json b/core/api/package.json index 12cf3c5ea8..a44a71aff8 100644 --- a/core/api/package.json +++ b/core/api/package.json @@ -1,5 +1,5 @@ { - "name": "galoy", + "name": "api", "scripts": { "tsc-check-noimplicitany": "tsc --noEmit -p tsconfig.no-implicit-any.json", "tsc-check": "tsc --noEmit -p tsconfig.d.json && tsc --noEmit", diff --git a/package.json b/package.json new file mode 100644 index 0000000000..857b8548cf --- /dev/null +++ b/package.json @@ -0,0 +1,16 @@ +{ + "name": "si", + "version": "1.0.0", + "description": "galoy monorepo", + "scripts": { + "preinstall": "npx only-allow pnpm", + "nodev": "node -v", + "whichnode": "which node" + }, + "engines": { + "node": "20", + "pnpm": "8" + }, + "packageManager": "pnpm@8.7.6" +} + diff --git a/core/api/pnpm-lock.yaml b/pnpm-lock.yaml similarity index 96% rename from core/api/pnpm-lock.yaml rename to pnpm-lock.yaml index be3911542b..22822584b8 100644 --- a/core/api/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,476 +4,475 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false -overrides: - protobufjs: 7.2.5 - http-cache-semantics: 4.1.1 - import-in-the-middle: 1.4.2 - -dependencies: - '@google-cloud/storage': - specifier: ^7.1.0 - version: 7.1.0 - '@grpc/grpc-js': - specifier: ^1.9.3 - version: 1.9.5 - '@grpc/proto-loader': - specifier: ^0.7.9 - version: 0.7.10 - '@opentelemetry/api': - specifier: ^1.6.0 - version: 1.6.0 - '@opentelemetry/core': - specifier: ^1.17.0 - version: 1.17.0(@opentelemetry/api@1.6.0) - '@opentelemetry/exporter-trace-otlp-http': - specifier: ^0.43.0 - version: 0.43.0(@opentelemetry/api@1.6.0) - '@opentelemetry/instrumentation': - specifier: ^0.43.0 - version: 0.43.0(@opentelemetry/api@1.6.0) - '@opentelemetry/instrumentation-graphql': - specifier: ^0.35.1 - version: 0.35.1(@opentelemetry/api@1.6.0) - '@opentelemetry/instrumentation-grpc': - specifier: ^0.43.0 - version: 0.43.0(@opentelemetry/api@1.6.0) - '@opentelemetry/instrumentation-http': - specifier: ^0.43.0 - version: 0.43.0(@opentelemetry/api@1.6.0) - '@opentelemetry/instrumentation-ioredis': - specifier: ^0.35.1 - version: 0.35.1(@opentelemetry/api@1.6.0) - '@opentelemetry/instrumentation-mongodb': - specifier: ^0.37.0 - version: 0.37.0(@opentelemetry/api@1.6.0) - '@opentelemetry/instrumentation-net': - specifier: ^0.32.1 - version: 0.32.1(@opentelemetry/api@1.6.0) - '@opentelemetry/resources': - specifier: ^1.17.0 - version: 1.17.0(@opentelemetry/api@1.6.0) - '@opentelemetry/sdk-trace-base': - specifier: ^1.17.0 - version: 1.17.0(@opentelemetry/api@1.6.0) - '@opentelemetry/sdk-trace-node': - specifier: ^1.17.0 - version: 1.17.0(@opentelemetry/api@1.6.0) - '@opentelemetry/semantic-conventions': - specifier: ^1.17.0 - version: 1.17.0 - '@ory/client': - specifier: ^1.2.6 - version: 1.2.10 - '@t3-oss/env-core': - specifier: ^0.6.1 - version: 0.6.1(typescript@5.2.2)(zod@3.22.4) - ajv: - specifier: ^8.12.0 - version: 8.12.0 - apollo-server-core: - specifier: ^3.12.1 - version: 3.12.1(graphql@16.8.1) - apollo-server-errors: - specifier: ^3.3.1 - version: 3.3.1(graphql@16.8.1) - apollo-server-express: - specifier: ^3.12.1 - version: 3.12.1(express@4.18.2)(graphql@16.8.1) - axios: - specifier: ^1.5.0 - version: 1.5.1 - basic-auth: - specifier: ^2.0.1 - version: 2.0.1 - bip32: - specifier: ^4.0.0 - version: 4.0.0 - bitcoin-cli-ts: - specifier: ^24.0.3 - version: 24.1.0 - bitcoinjs-lib: - specifier: ^6.1.4 - version: 6.1.5 - body-parser: - specifier: ^1.20.1 - version: 1.20.2 - cookie: - specifier: ^0.5.0 - version: 0.5.0 - cookie-parser: - specifier: ^1.4.6 - version: 1.4.6 - cors: - specifier: ^2.8.5 - version: 2.8.5 - csv-writer: - specifier: ^1.6.0 - version: 1.6.0 - dataloader: - specifier: ^2.2.2 - version: 2.2.2 - dedent: - specifier: ^1.5.1 - version: 1.5.1 - express: - specifier: ^4.18.2 - version: 4.18.2 - express-jwt: - specifier: ^8.4.1 - version: 8.4.1 - firebase-admin: - specifier: ^11.9.0 - version: 11.11.0 - google-protobuf: - specifier: ^3.21.2 - version: 3.21.2 - graphql: - specifier: ^16.8.1 - version: 16.8.1 - graphql-middleware: - specifier: ^6.1.33 - version: 6.1.35(graphql@16.8.1) - graphql-query-complexity: - specifier: ^0.12.0 - version: 0.12.0(graphql@16.8.1) - graphql-query-complexity-apollo-plugin: - specifier: ^1.0.2 - version: 1.0.2(apollo-server-core@3.12.1)(graphql-query-complexity@0.12.0)(graphql@16.8.1) - graphql-redis-subscriptions: - specifier: ^2.6.0 - version: 2.6.0(graphql-subscriptions@2.0.0) - graphql-relay: - specifier: ^0.10.0 - version: 0.10.0(graphql@16.8.1) - graphql-shield: - specifier: ^7.6.4 - version: 7.6.5(graphql-middleware@6.1.35)(graphql@16.8.1) - graphql-tools: - specifier: ^9.0.0 - version: 9.0.0(graphql-ws@5.14.1)(graphql@16.8.1)(react@18.2.0)(subscriptions-transport-ws@0.11.0) - graphql-ws: - specifier: ^5.13.1 - version: 5.14.1(graphql@16.8.1) - gt3-server-node-express-sdk: - specifier: https://github.com/GaloyMoney/gt3-server-node-express-bypass#master - version: github.com/GaloyMoney/gt3-server-node-express-bypass/6559a1a39ef408de3aefa6321934c831edac001e - i18n: - specifier: ^0.15.1 - version: 0.15.1 - invoices: - specifier: ^3.0.0 - version: 3.0.0 - ioredis: - specifier: ^5.3.2 - version: 5.3.2 - ioredis-cache: - specifier: ^2.0.0 - version: 2.0.0 - ipaddr.js: - specifier: ^2.1.0 - version: 2.1.0 - js-yaml: - specifier: ^4.1.0 - version: 4.1.0 - jsonwebtoken: - specifier: ^9.0.2 - version: 9.0.2 - jwks-rsa: - specifier: ^3.0.1 - version: 3.0.1 - knex: - specifier: ^2.5.1 - version: 2.5.1(pg@8.11.3) - libphonenumber-js: - specifier: ^1.10.44 - version: 1.10.46 - lightning: - specifier: ^9.13.3 - version: 9.14.0 - ln-service: - specifier: ^56.13.0 - version: 56.14.0 - lodash.debounce: - specifier: ^4.0.8 - version: 4.0.8 - lodash.groupby: - specifier: ^4.6.0 - version: 4.6.0 - lodash.map: - specifier: ^4.6.0 - version: 4.6.0 - lodash.mapvalues: - specifier: ^4.6.0 - version: 4.6.0 - lodash.mergewith: - specifier: ^4.6.2 - version: 4.6.2 - lodash.sortby: - specifier: ^4.7.0 - version: 4.7.0 - lodash.sumby: - specifier: ^4.6.0 - version: 4.6.0 - medici: - specifier: ^6.2.0 - version: 6.2.0 - mongoose: - specifier: ~7.5.1 - version: 7.5.4 - node-cache: - specifier: ^5.1.2 - version: 5.1.2 - pg: - specifier: ^8.11.3 - version: 8.11.3 - pino: - specifier: 8.15.1 - version: 8.15.1 - pino-http: - specifier: ^8.5.0 - version: 8.5.0 - prom-client: - specifier: ^14.2.0 - version: 14.2.0 - rate-limiter-flexible: - specifier: ^3.0.0 - version: 3.0.0 - redlock: - specifier: ^5.0.0-beta.2 - version: 5.0.0-beta.2 - set-cookie-parser: - specifier: ^2.6.0 - version: 2.6.0 - subscriptions-transport-ws: - specifier: ^0.11.0 - version: 0.11.0(graphql@16.8.1) - svix: - specifier: ^1.12.0 - version: 1.13.0 - twilio: - specifier: ^4.17.0 - version: 4.18.1 - uuid-by-string: - specifier: ^4.0.0 - version: 4.0.0 - ws: - specifier: ^8.14.1 - version: 8.14.2 - zod: - specifier: ^3.22.3 - version: 3.22.4 - -devDependencies: - '@apollo/client': - specifier: 3.8.3 - version: 3.8.3(graphql-ws@5.14.1)(graphql@16.8.1)(react@18.2.0)(subscriptions-transport-ws@0.11.0) - '@apollo/rover': - specifier: ^0.18.1 - version: 0.18.1 - '@babel/core': - specifier: ^7.22.20 - version: 7.23.0 - '@babel/preset-env': - specifier: ^7.22.20 - version: 7.22.20(@babel/core@7.23.0) - '@graphql-tools/jest-transform': - specifier: ^2.0.0 - version: 2.0.0(graphql@16.8.1) - '@jest/test-sequencer': - specifier: ^29.7.0 - version: 29.7.0 - '@swc/core': - specifier: 1.3.85 - version: 1.3.85 - '@swc/jest': - specifier: ^0.2.29 - version: 0.2.29(@swc/core@1.3.85) - '@types/babel__core': - specifier: ^7.20.2 - version: 7.20.2 - '@types/babel__preset-env': - specifier: ^7.9.3 - version: 7.9.3 - '@types/basic-auth': - specifier: ^1.1.4 - version: 1.1.4 - '@types/cookie': - specifier: ^0.5.2 - version: 0.5.2 - '@types/cookie-parser': - specifier: ^1.4.4 - version: 1.4.4 - '@types/dedent': - specifier: ^0.7.0 - version: 0.7.0 - '@types/eslint': - specifier: ^8.44.2 - version: 8.44.3 - '@types/express': - specifier: ^4.17.15 - version: 4.17.18 - '@types/google-protobuf': - specifier: ^3.15.6 - version: 3.15.7 - '@types/i18n': - specifier: ^0.13.5 - version: 0.13.6 - '@types/jest': - specifier: ^29.5.5 - version: 29.5.5 - '@types/js-yaml': - specifier: ^4.0.6 - version: 4.0.6 - '@types/jsonwebtoken': - specifier: ^9.0.3 - version: 9.0.3 - '@types/lodash.debounce': - specifier: ^4.0.7 - version: 4.0.7 - '@types/lodash.difference': - specifier: ^4.5.6 - version: 4.5.7 - '@types/lodash.find': - specifier: ^4.6.6 - version: 4.6.7 - '@types/lodash.groupby': - specifier: ^4.6.6 - version: 4.6.7 - '@types/lodash.map': - specifier: ^4.6.13 - version: 4.6.13 - '@types/lodash.mapvalues': - specifier: ^4.6.6 - version: 4.6.7 - '@types/lodash.mergewith': - specifier: ^4.6.7 - version: 4.6.7 - '@types/lodash.sortby': - specifier: ^4.7.6 - version: 4.7.7 - '@types/lodash.sumby': - specifier: ^4.6.6 - version: 4.6.7 - '@types/migrate-mongo': - specifier: ^10.0.0 - version: 10.0.2 - '@types/node': - specifier: ^20.6.2 - version: 20.8.2 - '@types/node-jose': - specifier: ^1.1.10 - version: 1.1.11 - '@types/nodemon': - specifier: ^1.19.2 - version: 1.19.3 - '@types/react': - specifier: ^18.2.21 - version: 18.2.25 - '@types/set-cookie-parser': - specifier: ^2.4.2 - version: 2.4.4 - '@typescript-eslint/eslint-plugin': - specifier: ^6.7.0 - version: 6.7.4(@typescript-eslint/parser@6.7.4)(eslint@8.50.0)(typescript@5.2.2) - '@typescript-eslint/parser': - specifier: ^6.7.2 - version: 6.7.4(eslint@8.50.0)(typescript@5.2.2) - '@xascode/tscpaths': - specifier: 0.1.4 - version: 0.1.4 - axios-mock-adapter: - specifier: ^1.22.0 - version: 1.22.0(axios@1.5.1) - eslint: - specifier: ^8.49.0 - version: 8.50.0 - eslint-config-prettier: - specifier: ^9.0.0 - version: 9.0.0(eslint@8.50.0) - eslint-plugin-import: - specifier: ^2.28.1 - version: 2.28.1(@typescript-eslint/parser@6.7.4)(eslint@8.50.0) - eslint-plugin-jest: - specifier: ^27.4.0 - version: 27.4.2(@typescript-eslint/eslint-plugin@6.7.4)(eslint@8.50.0)(jest@29.7.0)(typescript@5.2.2) - eslint-plugin-prettier: - specifier: ^5.0.0 - version: 5.0.0(@types/eslint@8.44.3)(eslint-config-prettier@9.0.0)(eslint@8.50.0)(prettier@3.0.3) - graphql-subscriptions: - specifier: ^2.0.0 - version: 2.0.0(graphql@16.8.1) - grpc-tools: - specifier: ^1.12.4 - version: 1.12.4 - grpc_tools_node_protoc_ts: - specifier: ^5.3.3 - version: 5.3.3 - jest: - specifier: ^29.7.0 - version: 29.7.0(@types/node@20.8.2)(ts-node@10.9.1) - jest-junit: - specifier: ^16.0.0 - version: 16.0.0 - jest_workaround: - specifier: ^0.79.19 - version: 0.79.19(@swc/core@1.3.85)(@swc/jest@0.2.29) - lodash.difference: - specifier: ^4.5.0 - version: 4.5.0 - lodash.find: - specifier: ^4.6.0 - version: 4.6.0 - madge: - specifier: ^6.1.0 - version: 6.1.0(typescript@5.2.2) - migrate-mongo: - specifier: ^10.0.0 - version: 10.0.0(mongodb@5.9.0) - node-jose: - specifier: ^2.2.0 - version: 2.2.0 - nodemon: - specifier: ^3.0.1 - version: 3.0.1 - otplib: - specifier: ^12.0.1 - version: 12.0.1 - pino-pretty: - specifier: ^10.2.0 - version: 10.2.3 - prettier: - specifier: ^3.0.3 - version: 3.0.3 - protoc-gen-js: - specifier: ^3.21.2 - version: 3.21.2 - react: - specifier: ^18.2.0 - version: 18.2.0 - spectaql: - specifier: ^2.3.0 - version: 2.3.0 - tiny-secp256k1: - specifier: ^2.2.3 - version: 2.2.3 - tree-kill: - specifier: ^1.2.2 - version: 1.2.2 - ts-node: - specifier: ^10.9.1 - version: 10.9.1(@swc/core@1.3.85)(@types/node@20.8.2)(typescript@5.2.2) - ts-node-dev: - specifier: ^2.0.0 - version: 2.0.0(@swc/core@1.3.85)(@types/node@20.8.2)(typescript@5.2.2) - tsconfig-paths: - specifier: ^4.2.0 - version: 4.2.0 - typescript: - specifier: ^5.2.2 - version: 5.2.2 - zen-observable-ts: - specifier: ^1.1.0 - version: 1.1.0 +importers: + + .: {} + + core/api: + dependencies: + '@google-cloud/storage': + specifier: ^7.1.0 + version: 7.2.0 + '@grpc/grpc-js': + specifier: ^1.9.3 + version: 1.9.5 + '@grpc/proto-loader': + specifier: ^0.7.9 + version: 0.7.10 + '@opentelemetry/api': + specifier: ^1.6.0 + version: 1.6.0 + '@opentelemetry/core': + specifier: ^1.17.0 + version: 1.17.0(@opentelemetry/api@1.6.0) + '@opentelemetry/exporter-trace-otlp-http': + specifier: ^0.43.0 + version: 0.43.0(@opentelemetry/api@1.6.0) + '@opentelemetry/instrumentation': + specifier: ^0.43.0 + version: 0.43.0(@opentelemetry/api@1.6.0) + '@opentelemetry/instrumentation-graphql': + specifier: ^0.35.1 + version: 0.35.1(@opentelemetry/api@1.6.0) + '@opentelemetry/instrumentation-grpc': + specifier: ^0.43.0 + version: 0.43.0(@opentelemetry/api@1.6.0) + '@opentelemetry/instrumentation-http': + specifier: ^0.43.0 + version: 0.43.0(@opentelemetry/api@1.6.0) + '@opentelemetry/instrumentation-ioredis': + specifier: ^0.35.1 + version: 0.35.1(@opentelemetry/api@1.6.0) + '@opentelemetry/instrumentation-mongodb': + specifier: ^0.37.0 + version: 0.37.0(@opentelemetry/api@1.6.0) + '@opentelemetry/instrumentation-net': + specifier: ^0.32.1 + version: 0.32.1(@opentelemetry/api@1.6.0) + '@opentelemetry/resources': + specifier: ^1.17.0 + version: 1.17.0(@opentelemetry/api@1.6.0) + '@opentelemetry/sdk-trace-base': + specifier: ^1.17.0 + version: 1.17.0(@opentelemetry/api@1.6.0) + '@opentelemetry/sdk-trace-node': + specifier: ^1.17.0 + version: 1.17.0(@opentelemetry/api@1.6.0) + '@opentelemetry/semantic-conventions': + specifier: ^1.17.0 + version: 1.17.0 + '@ory/client': + specifier: ^1.2.6 + version: 1.2.11 + '@t3-oss/env-core': + specifier: ^0.6.1 + version: 0.6.1(typescript@5.2.2)(zod@3.22.4) + ajv: + specifier: ^8.12.0 + version: 8.12.0 + apollo-server-core: + specifier: ^3.12.1 + version: 3.12.1(graphql@16.8.1) + apollo-server-errors: + specifier: ^3.3.1 + version: 3.3.1(graphql@16.8.1) + apollo-server-express: + specifier: ^3.12.1 + version: 3.12.1(express@4.18.2)(graphql@16.8.1) + axios: + specifier: ^1.5.0 + version: 1.5.1 + basic-auth: + specifier: ^2.0.1 + version: 2.0.1 + bip32: + specifier: ^4.0.0 + version: 4.0.0 + bitcoin-cli-ts: + specifier: ^24.0.3 + version: 24.1.0 + bitcoinjs-lib: + specifier: ^6.1.4 + version: 6.1.5 + body-parser: + specifier: ^1.20.1 + version: 1.20.2 + cookie: + specifier: ^0.5.0 + version: 0.5.0 + cookie-parser: + specifier: ^1.4.6 + version: 1.4.6 + cors: + specifier: ^2.8.5 + version: 2.8.5 + csv-writer: + specifier: ^1.6.0 + version: 1.6.0 + dataloader: + specifier: ^2.2.2 + version: 2.2.2 + dedent: + specifier: ^1.5.1 + version: 1.5.1 + express: + specifier: ^4.18.2 + version: 4.18.2 + express-jwt: + specifier: ^8.4.1 + version: 8.4.1 + firebase-admin: + specifier: ^11.9.0 + version: 11.11.0 + google-protobuf: + specifier: ^3.21.2 + version: 3.21.2 + graphql: + specifier: ^16.8.1 + version: 16.8.1 + graphql-middleware: + specifier: ^6.1.33 + version: 6.1.35(graphql@16.8.1) + graphql-query-complexity: + specifier: ^0.12.0 + version: 0.12.0(graphql@16.8.1) + graphql-query-complexity-apollo-plugin: + specifier: ^1.0.2 + version: 1.0.2(apollo-server-core@3.12.1)(graphql-query-complexity@0.12.0)(graphql@16.8.1) + graphql-redis-subscriptions: + specifier: ^2.6.0 + version: 2.6.0(graphql-subscriptions@2.0.0) + graphql-relay: + specifier: ^0.10.0 + version: 0.10.0(graphql@16.8.1) + graphql-shield: + specifier: ^7.6.4 + version: 7.6.5(graphql-middleware@6.1.35)(graphql@16.8.1) + graphql-tools: + specifier: ^9.0.0 + version: 9.0.0(graphql-ws@5.14.1)(graphql@16.8.1)(react@18.2.0)(subscriptions-transport-ws@0.11.0) + graphql-ws: + specifier: ^5.13.1 + version: 5.14.1(graphql@16.8.1) + gt3-server-node-express-sdk: + specifier: https://github.com/GaloyMoney/gt3-server-node-express-bypass#master + version: github.com/GaloyMoney/gt3-server-node-express-bypass/6559a1a39ef408de3aefa6321934c831edac001e + i18n: + specifier: ^0.15.1 + version: 0.15.1 + invoices: + specifier: ^3.0.0 + version: 3.0.0 + ioredis: + specifier: ^5.3.2 + version: 5.3.2 + ioredis-cache: + specifier: ^2.0.0 + version: 2.0.0 + ipaddr.js: + specifier: ^2.1.0 + version: 2.1.0 + js-yaml: + specifier: ^4.1.0 + version: 4.1.0 + jsonwebtoken: + specifier: ^9.0.2 + version: 9.0.2 + jwks-rsa: + specifier: ^3.0.1 + version: 3.1.0 + knex: + specifier: ^2.5.1 + version: 2.5.1(pg@8.11.3) + libphonenumber-js: + specifier: ^1.10.44 + version: 1.10.47 + lightning: + specifier: ^9.13.3 + version: 9.14.0 + ln-service: + specifier: ^56.13.0 + version: 56.14.0 + lodash.debounce: + specifier: ^4.0.8 + version: 4.0.8 + lodash.groupby: + specifier: ^4.6.0 + version: 4.6.0 + lodash.map: + specifier: ^4.6.0 + version: 4.6.0 + lodash.mapvalues: + specifier: ^4.6.0 + version: 4.6.0 + lodash.mergewith: + specifier: ^4.6.2 + version: 4.6.2 + lodash.sortby: + specifier: ^4.7.0 + version: 4.7.0 + lodash.sumby: + specifier: ^4.6.0 + version: 4.6.0 + medici: + specifier: ^6.2.0 + version: 6.2.0 + mongoose: + specifier: ~7.5.1 + version: 7.5.4 + node-cache: + specifier: ^5.1.2 + version: 5.1.2 + pg: + specifier: ^8.11.3 + version: 8.11.3 + pino: + specifier: 8.15.1 + version: 8.15.1 + pino-http: + specifier: ^8.5.0 + version: 8.5.0 + prom-client: + specifier: ^14.2.0 + version: 14.2.0 + rate-limiter-flexible: + specifier: ^3.0.0 + version: 3.0.0 + redlock: + specifier: ^5.0.0-beta.2 + version: 5.0.0-beta.2 + set-cookie-parser: + specifier: ^2.6.0 + version: 2.6.0 + subscriptions-transport-ws: + specifier: ^0.11.0 + version: 0.11.0(graphql@16.8.1) + svix: + specifier: ^1.12.0 + version: 1.13.0 + twilio: + specifier: ^4.17.0 + version: 4.18.1 + uuid-by-string: + specifier: ^4.0.0 + version: 4.0.0 + ws: + specifier: ^8.14.1 + version: 8.14.2 + zod: + specifier: ^3.22.3 + version: 3.22.4 + devDependencies: + '@apollo/client': + specifier: 3.8.3 + version: 3.8.3(graphql-ws@5.14.1)(graphql@16.8.1)(react@18.2.0)(subscriptions-transport-ws@0.11.0) + '@apollo/rover': + specifier: ^0.18.1 + version: 0.18.1 + '@babel/core': + specifier: ^7.22.20 + version: 7.23.0 + '@babel/preset-env': + specifier: ^7.22.20 + version: 7.22.20(@babel/core@7.23.0) + '@graphql-tools/jest-transform': + specifier: ^2.0.0 + version: 2.0.0(graphql@16.8.1) + '@jest/test-sequencer': + specifier: ^29.7.0 + version: 29.7.0 + '@swc/core': + specifier: 1.3.85 + version: 1.3.85 + '@swc/jest': + specifier: ^0.2.29 + version: 0.2.29(@swc/core@1.3.85) + '@types/babel__core': + specifier: ^7.20.2 + version: 7.20.2 + '@types/babel__preset-env': + specifier: ^7.9.3 + version: 7.9.3 + '@types/basic-auth': + specifier: ^1.1.4 + version: 1.1.4 + '@types/cookie': + specifier: ^0.5.2 + version: 0.5.2 + '@types/cookie-parser': + specifier: ^1.4.4 + version: 1.4.4 + '@types/dedent': + specifier: ^0.7.0 + version: 0.7.0 + '@types/eslint': + specifier: ^8.44.2 + version: 8.44.3 + '@types/express': + specifier: ^4.17.15 + version: 4.17.18 + '@types/google-protobuf': + specifier: ^3.15.6 + version: 3.15.7 + '@types/i18n': + specifier: ^0.13.5 + version: 0.13.6 + '@types/jest': + specifier: ^29.5.5 + version: 29.5.5 + '@types/js-yaml': + specifier: ^4.0.6 + version: 4.0.6 + '@types/jsonwebtoken': + specifier: ^9.0.3 + version: 9.0.3 + '@types/lodash.debounce': + specifier: ^4.0.7 + version: 4.0.7 + '@types/lodash.difference': + specifier: ^4.5.6 + version: 4.5.7 + '@types/lodash.find': + specifier: ^4.6.6 + version: 4.6.7 + '@types/lodash.groupby': + specifier: ^4.6.6 + version: 4.6.7 + '@types/lodash.map': + specifier: ^4.6.13 + version: 4.6.13 + '@types/lodash.mapvalues': + specifier: ^4.6.6 + version: 4.6.7 + '@types/lodash.mergewith': + specifier: ^4.6.7 + version: 4.6.7 + '@types/lodash.sortby': + specifier: ^4.7.6 + version: 4.7.7 + '@types/lodash.sumby': + specifier: ^4.6.6 + version: 4.6.7 + '@types/migrate-mongo': + specifier: ^10.0.0 + version: 10.0.2 + '@types/node': + specifier: ^20.6.2 + version: 20.8.2 + '@types/node-jose': + specifier: ^1.1.10 + version: 1.1.11 + '@types/nodemon': + specifier: ^1.19.2 + version: 1.19.3 + '@types/react': + specifier: ^18.2.21 + version: 18.2.25 + '@types/set-cookie-parser': + specifier: ^2.4.2 + version: 2.4.4 + '@typescript-eslint/eslint-plugin': + specifier: ^6.7.0 + version: 6.7.4(@typescript-eslint/parser@6.7.4)(eslint@8.50.0)(typescript@5.2.2) + '@typescript-eslint/parser': + specifier: ^6.7.2 + version: 6.7.4(eslint@8.50.0)(typescript@5.2.2) + '@xascode/tscpaths': + specifier: 0.1.4 + version: 0.1.4 + axios-mock-adapter: + specifier: ^1.22.0 + version: 1.22.0(axios@1.5.1) + eslint: + specifier: ^8.49.0 + version: 8.50.0 + eslint-config-prettier: + specifier: ^9.0.0 + version: 9.0.0(eslint@8.50.0) + eslint-plugin-import: + specifier: ^2.28.1 + version: 2.28.1(@typescript-eslint/parser@6.7.4)(eslint@8.50.0) + eslint-plugin-jest: + specifier: ^27.4.0 + version: 27.4.2(@typescript-eslint/eslint-plugin@6.7.4)(eslint@8.50.0)(jest@29.7.0)(typescript@5.2.2) + eslint-plugin-prettier: + specifier: ^5.0.0 + version: 5.0.0(@types/eslint@8.44.3)(eslint-config-prettier@9.0.0)(eslint@8.50.0)(prettier@3.0.3) + graphql-subscriptions: + specifier: ^2.0.0 + version: 2.0.0(graphql@16.8.1) + grpc-tools: + specifier: ^1.12.4 + version: 1.12.4 + grpc_tools_node_protoc_ts: + specifier: ^5.3.3 + version: 5.3.3 + jest: + specifier: ^29.7.0 + version: 29.7.0(@types/node@20.8.2)(ts-node@10.9.1) + jest-junit: + specifier: ^16.0.0 + version: 16.0.0 + jest_workaround: + specifier: ^0.79.19 + version: 0.79.19(@swc/core@1.3.85)(@swc/jest@0.2.29) + lodash.difference: + specifier: ^4.5.0 + version: 4.5.0 + lodash.find: + specifier: ^4.6.0 + version: 4.6.0 + madge: + specifier: ^6.1.0 + version: 6.1.0(typescript@5.2.2) + migrate-mongo: + specifier: ^10.0.0 + version: 10.0.0(mongodb@5.9.0) + node-jose: + specifier: ^2.2.0 + version: 2.2.0 + nodemon: + specifier: ^3.0.1 + version: 3.0.1 + otplib: + specifier: ^12.0.1 + version: 12.0.1 + pino-pretty: + specifier: ^10.2.0 + version: 10.2.3 + prettier: + specifier: ^3.0.3 + version: 3.0.3 + protoc-gen-js: + specifier: ^3.21.2 + version: 3.21.2 + react: + specifier: ^18.2.0 + version: 18.2.0 + spectaql: + specifier: ^2.3.0 + version: 2.3.0 + tiny-secp256k1: + specifier: ^2.2.3 + version: 2.2.3 + tree-kill: + specifier: ^1.2.2 + version: 1.2.2 + ts-node: + specifier: ^10.9.1 + version: 10.9.1(@swc/core@1.3.85)(@types/node@20.8.2)(typescript@5.2.2) + ts-node-dev: + specifier: ^2.0.0 + version: 2.0.0(@swc/core@1.3.85)(@types/node@20.8.2)(typescript@5.2.2) + tsconfig-paths: + specifier: ^4.2.0 + version: 4.2.0 + typescript: + specifier: ^5.2.2 + version: 5.2.2 + zen-observable-ts: + specifier: ^1.1.0 + version: 1.1.0 packages: @@ -1946,7 +1945,7 @@ packages: ajv: 6.12.6 debug: 4.3.4 espree: 9.6.1 - globals: 13.22.0 + globals: 13.23.0 ignore: 5.2.4 import-fresh: 3.3.0 js-yaml: 4.1.0 @@ -2115,8 +2114,8 @@ packages: dev: false optional: true - /@google-cloud/storage@7.1.0: - resolution: {integrity: sha512-kAtniePZT5Ms9wayYcbT44H+1jwkYvRaA+E3IGnmBLG+aGwMTM0q9Xn0CCIez4D8toeBYczNkhQsQfRT1TDy7A==} + /@google-cloud/storage@7.2.0: + resolution: {integrity: sha512-g3j/LoGPydCo5MUfWS1GupBjjPmesKWIo6dH8kUWiVMBmvSG4dpwXVL1NvG1DZTkJSiyjvqRWi9lHJxRfxWbsw==} engines: {node: '>=14'} dependencies: '@google-cloud/paginator': 5.0.0 @@ -2299,7 +2298,7 @@ packages: graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 dependencies: graphql: 16.8.1 - tslib: 2.6.2 + tslib: 2.4.1 dev: false /@graphql-tools/utils@9.2.1(graphql@16.8.1): @@ -2561,7 +2560,7 @@ packages: slash: 3.0.0 string-length: 4.0.2 strip-ansi: 6.0.1 - v8-to-istanbul: 9.1.2 + v8-to-istanbul: 9.1.3 transitivePeerDependencies: - supports-color dev: true @@ -3059,8 +3058,8 @@ packages: engines: {node: '>=14'} dev: false - /@ory/client@1.2.10: - resolution: {integrity: sha512-BcbHrKifOom1nPhF3GPmIY619IioGyHHbyeSFb5AgcIa0PI1z4XPLkjDrXlckrx01c3fHxY2stzwJDEAavPrqA==} + /@ory/client@1.2.11: + resolution: {integrity: sha512-eqsVhlKlbSa2DB81NEqGZ0+HywpCumhubyQOXRJ3gIb8uRyDcWYzlIMYc7FFtcZa37alFjIGxR8lgRWsxBBbtQ==} dependencies: axios: 0.21.4 transitivePeerDependencies: @@ -4961,7 +4960,7 @@ packages: hasBin: true dependencies: caniuse-lite: 1.0.30001546 - electron-to-chromium: 1.4.542 + electron-to-chromium: 1.4.543 node-releases: 2.0.13 update-browserslist-db: 1.0.13(browserslist@4.22.1) dev: true @@ -5074,7 +5073,7 @@ packages: dependencies: clone-response: 1.0.2 get-stream: 3.0.0 - http-cache-semantics: 4.1.1 + http-cache-semantics: 3.8.1 keyv: 3.0.0 lowercase-keys: 1.0.0 normalize-url: 2.0.1 @@ -5262,7 +5261,6 @@ packages: /clone@1.0.4: resolution: {integrity: sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==} engines: {node: '>=0.8'} - requiresBuild: true dev: true /clone@2.1.2: @@ -5707,7 +5705,6 @@ packages: /defaults@1.0.4: resolution: {integrity: sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==} - requiresBuild: true dependencies: clone: 1.0.4 dev: true @@ -6096,8 +6093,8 @@ packages: /ee-first@1.1.1: resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} - /electron-to-chromium@1.4.542: - resolution: {integrity: sha512-6+cpa00G09N3sfh2joln4VUXHquWrOFx3FLZqiVQvl45+zS9DskDBTPvob+BhvFRmTBkyDSk0vvLMMRo/qc6mQ==} + /electron-to-chromium@1.4.543: + resolution: {integrity: sha512-t2ZP4AcGE0iKCCQCBx/K2426crYdxD3YU6l0uK2EO3FZH0pbC4pFz/sZm2ruZsND6hQBTcDWWlo/MLpiOdif5g==} dev: true /emittery@0.13.1: @@ -6451,7 +6448,7 @@ packages: file-entry-cache: 6.0.1 find-up: 5.0.0 glob-parent: 6.0.2 - globals: 13.22.0 + globals: 13.23.0 graphemer: 1.4.0 ignore: 5.2.4 imurmurhash: 0.1.4 @@ -6923,7 +6920,7 @@ packages: '@firebase/database-types': 0.10.4 '@types/node': 20.8.2 jsonwebtoken: 9.0.2 - jwks-rsa: 3.0.1 + jwks-rsa: 3.1.0 node-forge: 1.3.1 uuid: 9.0.1 optionalDependencies: @@ -7317,8 +7314,8 @@ packages: engines: {node: '>=4'} dev: true - /globals@13.22.0: - resolution: {integrity: sha512-H1Ddc/PbZHTDVJSnj8kWptIRSD6AM3pK+mKytuIVF4uoBV7rshFlhhvA58ceJ5wp3Er58w6zj7bykMpYXt3ETw==} + /globals@13.23.0: + resolution: {integrity: sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==} engines: {node: '>=8'} dependencies: type-fest: 0.20.2 @@ -7426,8 +7423,8 @@ packages: node-fetch: 2.7.0 object-hash: 3.0.0 proto3-json-serializer: 1.1.1 - protobufjs: 7.2.5 - protobufjs-cli: 1.1.1(protobufjs@7.2.5) + protobufjs: 7.2.4 + protobufjs-cli: 1.1.1(protobufjs@7.2.4) retry-request: 5.0.2 transitivePeerDependencies: - encoding @@ -7985,8 +7982,8 @@ packages: parse-cache-control: 1.0.1 dev: true - /http-cache-semantics@4.1.1: - resolution: {integrity: sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==} + /http-cache-semantics@3.8.1: + resolution: {integrity: sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w==} dev: true /http-errors@1.6.3: @@ -9213,8 +9210,8 @@ packages: safe-buffer: 5.2.1 dev: false - /jwks-rsa@3.0.1: - resolution: {integrity: sha512-UUOZ0CVReK1QVU3rbi9bC7N5/le8ziUj0A2ef1Q0M7OPD2KvjEYizptqIxGIo6fSLYDkqBrazILS18tYuRc8gw==} + /jwks-rsa@3.1.0: + resolution: {integrity: sha512-v7nqlfezb9YfHHzYII3ef2a2j1XnGeSE/bK3WfumaYCqONAIstJbrEGapz4kadScZzEt7zYCN7bucj8C0Mv/Rg==} engines: {node: '>=14'} dependencies: '@types/express': 4.17.18 @@ -9346,8 +9343,8 @@ packages: type-check: 0.4.0 dev: true - /libphonenumber-js@1.10.46: - resolution: {integrity: sha512-xJqWqMV5hM/6vWj68yqUejkzM9KkYjWFfqimVL4QG4dS5Rij2EXWus/s248x4zUpXeX2gwbLBzQW+aPqUitxIg==} + /libphonenumber-js@1.10.47: + resolution: {integrity: sha512-b4t7VQDV29xx/ni+58yl9KWPGjnDLDXCeCTLrD4V8vDpObXZRZBrg7uX/HWZ7YXiJKqdBDGgc+barUUTNB6Slw==} dev: false /liftup@3.0.1: @@ -9794,7 +9791,6 @@ packages: /memory-pager@1.5.0: resolution: {integrity: sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==} - requiresBuild: true /merge-descriptors@1.0.1: resolution: {integrity: sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==} @@ -10873,7 +10869,7 @@ packages: pump: 3.0.0 readable-stream: 4.4.2 secure-json-parse: 2.7.0 - sonic-boom: 3.5.0 + sonic-boom: 3.6.0 strip-json-comments: 3.1.1 dev: true @@ -10894,7 +10890,7 @@ packages: quick-format-unescaped: 4.0.4 real-require: 0.2.0 safe-stable-stringify: 2.4.3 - sonic-boom: 3.5.0 + sonic-boom: 3.6.0 thread-stream: 2.4.1 dev: false @@ -11126,13 +11122,13 @@ packages: dev: false optional: true - /protobufjs-cli@1.1.1(protobufjs@7.2.5): + /protobufjs-cli@1.1.1(protobufjs@7.2.4): resolution: {integrity: sha512-VPWMgIcRNyQwWUv8OLPyGQ/0lQY/QTQAVN5fh+XzfDwsVw1FZ2L3DM/bcBf8WPiRz2tNpaov9lPZfNcmNo6LXA==} engines: {node: '>=12.0.0'} hasBin: true requiresBuild: true peerDependencies: - protobufjs: 7.2.5 + protobufjs: ^7.0.0 dependencies: chalk: 4.1.2 escodegen: 1.14.3 @@ -11141,13 +11137,33 @@ packages: glob: 8.1.0 jsdoc: 4.0.2 minimist: 1.2.8 - protobufjs: 7.2.5 + protobufjs: 7.2.4 semver: 7.5.4 tmp: 0.2.1 uglify-js: 3.17.4 dev: false optional: true + /protobufjs@7.2.4: + resolution: {integrity: sha512-AT+RJgD2sH8phPmCf7OUZR8xGdcJRga4+1cOaXJ64hvcSkVhNcRHOwIxUatPH15+nj59WAGTDv3LSGZPEQbJaQ==} + engines: {node: '>=12.0.0'} + requiresBuild: true + dependencies: + '@protobufjs/aspromise': 1.1.2 + '@protobufjs/base64': 1.1.2 + '@protobufjs/codegen': 2.0.4 + '@protobufjs/eventemitter': 1.1.0 + '@protobufjs/fetch': 1.1.0 + '@protobufjs/float': 1.0.2 + '@protobufjs/inquire': 1.1.0 + '@protobufjs/path': 1.1.2 + '@protobufjs/pool': 1.1.0 + '@protobufjs/utf8': 1.1.0 + '@types/node': 20.8.2 + long: 5.2.3 + dev: false + optional: true + /protobufjs@7.2.5: resolution: {integrity: sha512-gGXRSXvxQ7UiPgfw8gevrfRWcTlSbOFg+p/N+JVJEK5VhueL2miT6qTymqAmjr1Q5WbOCyJbyrk6JfWKwlFn6A==} engines: {node: '>=12.0.0'} @@ -11695,8 +11711,8 @@ packages: commander: 2.20.3 dev: true - /sass@1.68.0: - resolution: {integrity: sha512-Lmj9lM/fef0nQswm1J2HJcEsBUba4wgNx2fea6yJHODREoMFnwRpZydBnX/RjyXw2REIwdkbqE4hrTo4qfDBUA==} + /sass@1.69.0: + resolution: {integrity: sha512-l3bbFpfTOGgQZCLU/gvm1lbsQ5mC/WnLz3djL2v4WCJBDrWm58PO+jgngcGRNnKUh6wSsdm50YaovTqskZ0xDQ==} engines: {node: '>=14.0.0'} hasBin: true dependencies: @@ -11886,8 +11902,8 @@ packages: ip: 2.0.0 smart-buffer: 4.2.0 - /sonic-boom@3.5.0: - resolution: {integrity: sha512-02A0wEmj4d3aEIW/Sp6LMP1dNcG5cYmQPjhgtytIXa9tNmFZx3ragUPFmyBdgdM0yJJVSWwlLLEVHgrYfA0wtQ==} + /sonic-boom@3.6.0: + resolution: {integrity: sha512-5Rs7m4IO/mW1WHouC6q6PGJsXO6hSAduwB3ltTsKaDU0Bd7sc5QEUK/jF0YL583g3BG7QV0Dg0rQNZrwZhY6Xg==} dependencies: atomic-sleep: 1.0.0 @@ -11942,7 +11958,6 @@ packages: /sparse-bitfield@3.0.3: resolution: {integrity: sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==} - requiresBuild: true dependencies: memory-pager: 1.5.0 @@ -11983,7 +11998,7 @@ packages: marked: 4.3.0 microfiber: 2.1.0 postcss: 8.4.31 - sass: 1.68.0 + sass: 1.69.0 sync-request: 6.1.0 tmp: 0.2.1 transitivePeerDependencies: @@ -13000,8 +13015,8 @@ packages: resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} dev: true - /v8-to-istanbul@9.1.2: - resolution: {integrity: sha512-ZGBe7VAivuuoQXTeckpbYKTdtjXGcm3ZUHXC0PAk0CzFyuYvwi73a58iEKI3GkGD1c3EHc+EgfR1w5pgbfzJlQ==} + /v8-to-istanbul@9.1.3: + resolution: {integrity: sha512-9lDD+EVI2fjFsMWXc6dy5JJzBsVTcQ2fVkfBvncZ6xJWG9wtBhOldG+mHkSL0+V1K/xgZz0JDO5UT5hFwHUghg==} engines: {node: '>=10.12.0'} dependencies: '@jridgewell/trace-mapping': 0.3.19 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 0000000000..ef0c4175d2 --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,3 @@ +--- +packages: + - core/api diff --git a/toolchains/simple-pnpm/macros.bzl b/toolchains/simple-pnpm/macros.bzl index 0ef97c2e39..b23ca9ea18 100644 --- a/toolchains/simple-pnpm/macros.bzl +++ b/toolchains/simple-pnpm/macros.bzl @@ -62,12 +62,9 @@ def npm_bin_impl(ctx: AnalysisContext) -> list[[DefaultInfo, RunInfo, TemplatePl simple_pnpm_toolchain.build_npm_bin[DefaultInfo].default_outputs, "--bin-out-path", exe.as_output(), - ) - - cmd.add([ ctx.attrs.node_modules, bin_name, - ]) + ) ctx.actions.run(cmd, category = "build_npm_bin", identifier = bin_name) diff --git a/toolchains/workspace-pnpm/BUCK b/toolchains/workspace-pnpm/BUCK index 4c7b26c53c..9585abe885 100644 --- a/toolchains/workspace-pnpm/BUCK +++ b/toolchains/workspace-pnpm/BUCK @@ -1,3 +1,13 @@ +export_file( + name = "build_node_modules.py", + visibility = ["PUBLIC"], +) + +export_file( + name = "build_npm_bin.py", + visibility = ["PUBLIC"], +) + export_file( name = "prepare_build_context.py", visibility = ["PUBLIC"], diff --git a/toolchains/workspace-pnpm/build_node_modules.py b/toolchains/workspace-pnpm/build_node_modules.py new file mode 100644 index 0000000000..4d624066e8 --- /dev/null +++ b/toolchains/workspace-pnpm/build_node_modules.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python3 +""" +Installs package node modules via Pnpm and Turbo. +""" +import argparse +import os +import shutil +import subprocess +import sys +import tempfile + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument( + "--package-dir", + help="Path to the workspace member package", + ) + parser.add_argument( + "--turbo-bin", + required=True, + help="Path to `turbo` binary", + ) + parser.add_argument( + "--prod-only", + action="store_true", + help="Only install production node modules", + ) + parser.add_argument( + "out_path", + help="Path to output tree of `node_modules`", + ) + + args = parser.parse_args() + + with tempfile.TemporaryDirectory() as tempdir: + # `turbo prune` is pretty keen on the `--out-dir` being a sub-directory + # of the workspace root, so we're going to create a symlink under the + # `buck-out` directory which links back to the `tempdir`, only for the + # `turbo prune` call. + turbo_out_path = os.path.join(os.path.dirname(args.out_path), "tmp") + os.symlink( + tempdir, + turbo_out_path, + ) + + turbo_cmd = [ + args.turbo_bin, + "prune", + "--out-dir", + turbo_out_path, + "--docker", + ] + + scope = os.path.basename(args.package_dir) + + turbo_cmd.append("--scope") + turbo_cmd.append(scope) + + turbo_exit_code = subprocess.call(turbo_cmd) + + # Clean up the temporary symlink + os.unlink(turbo_out_path) + + if turbo_exit_code != 0: + print(f"Failed to successfully run: {turbo_cmd}") + sys.exit(1) + + shutil.copy( + os.path.join(tempdir, "pnpm-lock.yaml"), + os.path.join(tempdir, "json", "pnpm-lock.yaml"), + ) + shutil.copytree( + os.path.join(tempdir, "json"), + args.out_path, + symlinks=True, + ) + + pnpm_cmd = ["pnpm", "install", "--frozen-lockfile"] + if args.prod_only: + pnpm_cmd.append("--prod") + + pnpm_exit_code = subprocess.call(pnpm_cmd, cwd=args.out_path) + + sys.exit(pnpm_exit_code) + diff --git a/toolchains/workspace-pnpm/build_npm_bin.py b/toolchains/workspace-pnpm/build_npm_bin.py new file mode 100644 index 0000000000..c50cf0e20b --- /dev/null +++ b/toolchains/workspace-pnpm/build_npm_bin.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 +""" +Builds a portable, standalone npm binary. +""" +import argparse +import os +import stat + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument( + "--bin-out-path", + help="Path to output binary script", + ) + parser.add_argument( + "--package-dir", + help="Path to the workspace member package", + ) + parser.add_argument( + "node_modules", + help="Path to `node_modules`", + ) + parser.add_argument( + "bin", + help="The binary to create from `node_modules`", + ) + + args = parser.parse_args() + + bins_path = os.path.join( + os.path.abspath(args.node_modules), + args.package_dir, + "node_modules", + ".bin", + ) + + bin = os.path.join(bins_path, args.bin) + path = [bins_path] + + content = [ + "#!/usr/bin/env sh", + "export PATH=\"{}:$PATH\"".format(":".join(path)), + "exec {} $@".format(bin), + ] + + with open(args.bin_out_path, "w") as f: + f.write("\n".join(content)) + + os.chmod( + args.bin_out_path, + stat.S_IRUSR + | stat.S_IXUSR + | stat.S_IRGRP + | stat.S_IXGRP + | stat.S_IROTH + | stat.S_IXOTH, + ) + + diff --git a/toolchains/workspace-pnpm/macros.bzl b/toolchains/workspace-pnpm/macros.bzl index da7b4c8590..65c70fd360 100644 --- a/toolchains/workspace-pnpm/macros.bzl +++ b/toolchains/workspace-pnpm/macros.bzl @@ -1,9 +1,170 @@ -# move to workspace toolchain -load("@toolchains//simple-pnpm:macros.bzl", "npm_bin") +load( + "@prelude//:artifacts.bzl", + "ArtifactGroupInfo", +) load("@prelude//python:toolchain.bzl", "PythonToolchainInfo",) load(":toolchain.bzl", "WorkspacePnpmToolchainInfo",) +def npm_bin_impl(ctx: AnalysisContext) -> list[[DefaultInfo, RunInfo, TemplatePlaceholderInfo]]: + bin_name = ctx.attrs.bin_name or ctx.attrs.name + + exe = ctx.actions.declare_output(bin_name) + + workspace_pnpm_toolchain = ctx.attrs._workspace_pnpm_toolchain[WorkspacePnpmToolchainInfo] + + cmd = cmd_args( + ctx.attrs._python_toolchain[PythonToolchainInfo].interpreter, + workspace_pnpm_toolchain.build_npm_bin[DefaultInfo].default_outputs, + "--bin-out-path", + exe.as_output(), + "--package-dir", + ctx.label.package, + ctx.attrs.node_modules, + bin_name + ) + + ctx.actions.run(cmd, category = "build_npm_bin", identifier = bin_name) + + return [ + DefaultInfo(default_output = exe), + RunInfo(exe), + TemplatePlaceholderInfo( + keyed_variables = { + "exe": exe, + }, + ), + ] + +_npm_bin = rule( + impl = npm_bin_impl, + attrs = { + "bin_name": attrs.option( + attrs.string(), + default = None, + doc = """Node module bin name (default: attrs.name).""", + ), + "node_modules": attrs.source( + doc = """Target which builds `node_modules`.""", + ), + "_python_toolchain": attrs.toolchain_dep( + default = "toolchains//:python", + providers = [PythonToolchainInfo], + ), + "_workspace_pnpm_toolchain": attrs.toolchain_dep( + default = "toolchains//:workspace_pnpm", + providers = [WorkspacePnpmToolchainInfo], + ), + }, +) + +def npm_bin( + node_modules = ":node_modules", + **kwargs): + _npm_bin( + node_modules = node_modules, + **kwargs, + ) + +def pnpm_workspace_impl(ctx: AnalysisContext) -> list[[DefaultInfo, ArtifactGroupInfo]]: + out = ctx.actions.declare_output("pnpm-lock.yaml") + + output = ctx.actions.copy_file(out, ctx.attrs.pnpm_lock) + ctx.actions.write_json("member-packages.json", ctx.attrs.child_packages) + + return [ + DefaultInfo(default_output = output), + ArtifactGroupInfo(artifacts = [ctx.attrs.root_package] + ctx.attrs.child_packages), + ] + +def pnpm_workspace(**kwargs): + pnpm_lock = "pnpm-lock.yaml" + root_package = "package.json" + if not rule_exists(root_package): + native.export_file( + name = root_package + ) + workspace_def = "pnpm-workspace.yaml" + _pnpm_workspace( + root_package = ":{}".format(root_package), + workspace_def = workspace_def, + pnpm_lock = pnpm_lock, + **kwargs, + ) + +_pnpm_workspace = rule( + impl = pnpm_workspace_impl, + attrs = { + "workspace_def": attrs.source( + doc = """pnpm-workspace.yaml source.""", + ), + "root_package": attrs.source( + doc = """Workspace root package.json source.""", + ), + "pnpm_lock": attrs.source( + doc = """Pnpm lock file.""", + ), + "child_packages": attrs.list( + attrs.source(), + default = [], + doc = """List of package.json files to track.""", + ), + }, +) + +def build_node_modules_impl(ctx: AnalysisContext) -> list[DefaultInfo]: + out = ctx.actions.declare_output("root", dir = True) + + pnpm_toolchain = ctx.attrs._workspace_pnpm_toolchain[WorkspacePnpmToolchainInfo] + package_dir = cmd_args(ctx.label.package).relative_to(ctx.label.cell_root) + + cmd = cmd_args( + ctx.attrs._python_toolchain[PythonToolchainInfo].interpreter, + pnpm_toolchain.build_node_modules[DefaultInfo].default_outputs, + "--turbo-bin", + ctx.attrs.turbo_bin[RunInfo], + ) + + cmd.add("--package-dir") + cmd.add(package_dir) + + if ctx.attrs.prod_only: + cmd.add("--prod-only") + + cmd.add(out.as_output()) + cmd.hidden([ctx.attrs.workspace]) + + ctx.actions.run(cmd, category = "pnpm", identifier = "install " + ctx.label.package) + + return [DefaultInfo(default_output = out)] + +build_node_modules = rule( + impl = build_node_modules_impl, + attrs = { + "turbo_bin": attrs.dep( + providers = [RunInfo], + default = "//shim/custom-third-party/node/turbo:turbo_bin", + doc = """Turbo dependency.""", + ), + "workspace": attrs.source( + default = "//:workspace", + doc = """Workspace root files""", + ), + "prod_only": attrs.bool( + default = False, + doc = "Only install production dependencies" + ), + "_python_toolchain": attrs.toolchain_dep( + default = "toolchains//:python", + providers = [PythonToolchainInfo], + ), + "_workspace_pnpm_toolchain": attrs.toolchain_dep( + default = "toolchains//:workspace_pnpm", + providers = [WorkspacePnpmToolchainInfo], + ), + }, +) + def tsc_build_impl(ctx: AnalysisContext) -> list[DefaultInfo]: build_context = prepare_build_context(ctx) diff --git a/toolchains/workspace-pnpm/prepare_build_context.py b/toolchains/workspace-pnpm/prepare_build_context.py index be3a43040a..9aa98f7b94 100644 --- a/toolchains/workspace-pnpm/prepare_build_context.py +++ b/toolchains/workspace-pnpm/prepare_build_context.py @@ -38,10 +38,7 @@ # Copy node_modules prunned tree into tempdir shutil.copytree( args.node_modules_path, - # Move to root dir when we add the pnpm-workspace.yml to root and - # build from there - # root_dir, - package_dir, + root_dir, symlinks=True, ) diff --git a/toolchains/workspace-pnpm/toolchain.bzl b/toolchains/workspace-pnpm/toolchain.bzl index 01263cecb2..23b660a948 100644 --- a/toolchains/workspace-pnpm/toolchain.bzl +++ b/toolchains/workspace-pnpm/toolchain.bzl @@ -1,4 +1,6 @@ WorkspacePnpmToolchainInfo = provider(fields = [ + "build_node_modules", + "build_npm_bin", "prepare_build_context", "compile_typescript", ]) @@ -10,6 +12,8 @@ def workspace_pnpm_toolchain_impl(ctx) -> list[[DefaultInfo, WorkspacePnpmToolch return [ DefaultInfo(), WorkspacePnpmToolchainInfo( + build_node_modules = ctx.attrs._build_node_modules, + build_npm_bin = ctx.attrs._build_npm_bin, prepare_build_context = ctx.attrs._prepare_build_context, compile_typescript = ctx.attrs._compile_typescript, ) @@ -18,6 +22,12 @@ def workspace_pnpm_toolchain_impl(ctx) -> list[[DefaultInfo, WorkspacePnpmToolch workspace_pnpm_toolchain = rule( impl = workspace_pnpm_toolchain_impl, attrs = { + "_build_node_modules": attrs.dep( + default = "toolchains//workspace-pnpm:build_node_modules.py", + ), + "_build_npm_bin": attrs.dep( + default = "toolchains//workspace-pnpm:build_npm_bin.py", + ), "_prepare_build_context": attrs.dep( default = "toolchains//workspace-pnpm:prepare_build_context.py", ),