Skip to content
Merged
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
24 changes: 0 additions & 24 deletions .github/workflows/ci-hermes-client-api-types.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: JS/TS checks
name: Turbo test
on:
pull_request:
paths:
Expand Down Expand Up @@ -31,13 +31,5 @@ jobs:
name: Install pnpm
with:
run_install: true
- name: Build
run: pnpm exec lerna run build
- name: Test
run: pnpm exec lerna run test
- name: Lint
run: pnpm exec lerna run lint
- name: Generate ABIs
run: pnpm exec lerna run generate-abi
- name: Check ABIs
run: pnpm exec lerna run check-abi
run: pnpm turbo test --ui stream
2 changes: 1 addition & 1 deletion .github/workflows/publish-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ jobs:
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: pnpm exec lerna run build --no-private
- run: pnpm turbo build
- run: pnpm exec lerna publish from-package --no-private --no-git-tag-version --yes
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ __pycache__
.vercel
.direnv
.next
.turbo/
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pnpm-lock.yaml
patches/
.turbo/

# These apps have their own prettier config that uses a later version of
# prettier
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.node
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ USER pyth

FROM builder-base AS builder
ARG package
RUN pnpm exec lerna run build --scope="$package" --include-dependencies
RUN pnpm turbo build --filter $package
RUN pnpm deploy --filter $package --prod /srv/$package


Expand Down
50 changes: 35 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,41 @@ Integration tests run in Tilt (via the `tilt ci` command). The Tilt CI workflow

### Typescript Monorepo

All of the typescript / javascript packages in this repository are part of a lerna monorepo.
This setup allows each package to reference the current version of the others.
You can install dependencies using `pnpm i` from the repository root.
You can build all of the packages using `pnpm exec lerna run build` and test with `pnpm exec lerna run test`.

Lerna has some common failure modes that you may encounter:

1. `pnpm i` fails with a typescript compilation error about a missing package.
This error likely means that the failing package has a `prepare` entry compiling the typescript in its `package.json`.
Fix this error by moving that logic to the `prepublishOnly` entry.
2. The software builds locally but fails in CI, or vice-versa.
This error likely means that some local build caches need to be cleaned.
The build error may not indicate that this is a caching issue, e.g., it may appear that the packages are being built in the wrong order.
Delete `node_modules/`, `lib/` and `tsconfig.tsbuildinfo` from each package's subdirectory. then try again.
3. `pnpm i` fails due to wrong node version. Make sure to be using `v18`. Node version `v21` is not supported and known to cause issues.
All of the typescript / javascript packages in this repository are part of a
[turborepo](https://turbo.build/repo/docs) monorepo.

#### Setting up

If you use nix and direnv, just cd to the project directory and `direnv allow`.

If you use nix but not direnv, just cd to the project directory and enter a nix
development shell with `nix develop`.

If you don't use nix at all, then install the required system packages:

- [Node.js](https://nodejs.org/en) -- match the version to `.nvmrc`; you can use
[nvm](https://github.com/nvm-sh/nvm) to manage your Node.js version.
- [pnpm](https://pnpm.io/) -- match the version to the version specified in
`package.json`; you can experiment with
[corepack](https://nodejs.org/api/corepack.html) to manage your pnpm version
for you.

#### Common tasks

The following tasks are the most common ways to interact with the monorepo.
Thanks to [turborepo](https://turbo.build/repo/docs), these tasks will
coordinate building any needed dependencies, and task execution will be cached
and will only re-run as necessary. For any of the following tasks, you can pass
[any valid `turbo run` option](https://turbo.build/repo/docs/reference/run)
after `--`, for instance you could run `pnpm test -- --concurrency 2`.

- `pnpm test`: Run all unit tests, integration tests, linting, and format
checks, as well as whatever other code checks any packages support.
- `pnpm fix`: Run auto fixes, including reformatting code and auto-fixing lint
rules where possible.
- `pnpm start:dev`: Start all development servers in parallel.
- `pnpm start:prod`: Run production builds and start production mode servers in
parallel.

## Audit / Feature Status

Expand Down
11 changes: 4 additions & 7 deletions apps/api-reference/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,14 @@
},
"scripts": {
"build": "next build",
"fix": "pnpm fix:lint && pnpm fix:format",
"fix:format": "prettier --write .",
"fix:lint": "eslint --fix .",
"pull:env": "VERCEL_ORG_ID=team_BKQrg3JJFLxZyTqpuYtIY0rj VERCEL_PROJECT_ID=prj_gbljYVzp0m5EpCuOF6nZpM4WMFM6 vercel env pull",
"start:dev": "next dev",
"start:prod": "next start",
"test": "tsc && jest",
"pull:env": "[ $VERCEL ] || VERCEL_ORG_ID=team_BKQrg3JJFLxZyTqpuYtIY0rj VERCEL_PROJECT_ID=prj_gbljYVzp0m5EpCuOF6nZpM4WMFM6 vercel env pull",
"start:dev": "next dev --port 3002",
"start:prod": "next start --port 3002",
"test:format": "jest --selectProjects format",
"test:lint": "jest --selectProjects lint",
"test:types": "tsc",
"test:unit": "jest --selectProjects unit --passWithNoTests"
"test:types": "tsc"
},
"dependencies": {
"@amplitude/analytics-browser": "^2.9.0",
Expand Down
24 changes: 24 additions & 0 deletions apps/api-reference/turbo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "https://turbo.build/schema.json",
"extends": ["//"],
"tasks": {
"build": {
"dependsOn": ["pull:env", "^build"],
"outputs": [".next/**", "!.next/cache/**"]
},
"pull:env": {
"outputs": [".env.local"],
"cache": false
},
"start:dev": {
"dependsOn": ["pull:env"],
"persistent": true,
"cache": false
},
"start:prod": {
"dependsOn": ["build"],
"persistent": true,
"cache": false
}
}
}
2 changes: 2 additions & 0 deletions apps/hermes/client/js/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
lib/
src/zodSchemas.ts
schema.json
14 changes: 6 additions & 8 deletions apps/hermes/client/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@
"access": "public"
},
"scripts": {
"test": "jest --testPathIgnorePatterns=.*.e2e.test.ts --passWithNoTests",
"test:e2e": "jest --testPathPattern=.*.e2e.test.ts",
"build": "tsc",
"generate-hermes-api-types": "openapi-zod-client https://hermes.pyth.network/docs/openapi.json --output src/zodSchemas.ts && prettier --write src/zodSchemas.ts",
"check-hermes-api-types": "git diff --exit-code src/zodSchemas.ts",
"build:typescript": "tsc",
"build:schemas": "openapi-zod-client ./schema.json --output src/zodSchemas.ts",
"pull:schema": "curl -o schema.json -z schema.json https://hermes.pyth.network/docs/openapi.json",
"example": "pnpm run build && node lib/examples/HermesClient.js",
"format": "prettier --write \"src/**/*.ts\"",
"lint": "eslint src/",
"prepublishOnly": "pnpm run build && pnpm test && pnpm run lint",
"preversion": "pnpm run lint",
"test:lint": "eslint src/",
"prepublishOnly": "pnpm run build && pnpm run test:lint",
"preversion": "pnpm run test:lint",
"version": "pnpm run format && git add -A src"
},
"keywords": [
Expand Down
Loading
Loading