-
Notifications
You must be signed in to change notification settings - Fork 231
chore: migrate npm to pnpm across CI, Docker, and scripts #555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
673c7f6
ee28793
e9daf93
62c3b86
a641fc9
e387a2c
e39f3b1
04cb64c
770eea2
5ccfb8e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "nostream": patch | ||
| --- | ||
|
|
||
| Migrate project tooling from npm to pnpm across CI workflows, Docker setup, hooks, and contributor commands. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #!/usr/bin/env sh | ||
| . "$(dirname -- "$0")/_/husky.sh" | ||
|
|
||
| npx --no -- commitlint --edit ${1} | ||
| pnpm exec commitlint --edit "${1}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| #!/usr/bin/env sh | ||
| . "$(dirname -- "$0")/_/husky.sh" | ||
|
|
||
| npm run lint | ||
| npm run build:check | ||
| npm run test:unit | ||
| pnpm run lint | ||
| pnpm run build:check | ||
| pnpm run test:unit |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,7 +43,8 @@ cd nostream | |
| Install dependencies (this also sets up Husky pre-commit hooks automatically): | ||
|
|
||
| ``` | ||
| npm install | ||
| corepack enable | ||
| pnpm install | ||
| ``` | ||
|
|
||
| > **Important:** Pre-commit hooks installed by Husky run linting and formatting checks on every | ||
|
|
@@ -96,7 +97,7 @@ SECRET=aaabbbccc...dddeeefff | |
| Run migrations (at least once and after pulling new changes): | ||
|
|
||
| ``` | ||
| NODE_OPTIONS="-r dotenv/config" npm run db:migrate | ||
| NODE_OPTIONS="-r dotenv/config" pnpm run db:migrate | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Anshumancanrock can you please try running this command? Do we need the node options env var since now we can pass .env files directly to node? |
||
| ``` | ||
|
|
||
| Create the `.nostr` folder and copy the default settings file: | ||
|
|
@@ -109,19 +110,19 @@ cp resources/default-settings.yaml .nostr/settings.yaml | |
| Start in development mode: | ||
|
|
||
| ``` | ||
| npm run dev | ||
| pnpm run dev | ||
| ``` | ||
|
|
||
| Or start in production mode: | ||
|
|
||
| ``` | ||
| npm run start | ||
| pnpm run start | ||
| ``` | ||
|
|
||
| To clean up build, coverage, and test reports: | ||
|
|
||
| ``` | ||
| npm run clean | ||
| pnpm run clean | ||
| ``` | ||
|
|
||
| ## Tests | ||
|
|
@@ -131,10 +132,10 @@ npm run clean | |
| Run code quality checks with Biome: | ||
|
|
||
| ``` | ||
| npm run lint | ||
| npm run lint:fix | ||
| npm run format | ||
| npm run format:check | ||
| pnpm run lint | ||
| pnpm run lint:fix | ||
| pnpm run format | ||
| pnpm run format:check | ||
| ``` | ||
|
|
||
| ### Unit tests | ||
|
|
@@ -148,19 +149,19 @@ cd /path/to/nostream | |
| Run unit tests: | ||
|
|
||
| ``` | ||
| npm run test:unit | ||
| pnpm run test:unit | ||
| ``` | ||
|
|
||
| Run unit tests in watch mode: | ||
|
|
||
| ``` | ||
| npm run test:unit:watch | ||
| pnpm run test:unit:watch | ||
| ``` | ||
|
|
||
| Get unit test coverage: | ||
|
|
||
| ``` | ||
| npm run cover:unit | ||
| pnpm run cover:unit | ||
| ``` | ||
|
|
||
| Open the unit test report: | ||
|
|
@@ -186,13 +187,13 @@ cd /path/to/nostream | |
| Run integration tests: | ||
|
|
||
| ``` | ||
| npm run docker:test:integration | ||
| pnpm run docker:test:integration | ||
| ``` | ||
|
|
||
| Get integration test coverage: | ||
|
|
||
| ``` | ||
| npm run docker:cover:integration | ||
| pnpm run docker:cover:integration | ||
| ``` | ||
|
|
||
| ### Integration tests (Standalone) | ||
|
|
@@ -222,7 +223,7 @@ DB_MAX_POOL_SIZE=2 | |
| Run the integration tests: | ||
|
|
||
| ``` | ||
| npm run test:integration | ||
| pnpm run test:integration | ||
| ``` | ||
|
|
||
| Open the integration test report: | ||
|
|
@@ -234,7 +235,7 @@ open .test-reports/integration/report.html | |
| Get integration test coverage: | ||
|
|
||
| ``` | ||
| npm run cover:integration | ||
| pnpm run cover:integration | ||
| ``` | ||
|
|
||
| Open the integration test coverage report: | ||
|
|
@@ -252,7 +253,7 @@ event flood (spam) attacks. This is used to verify relay resilience and prevent | |
|
|
||
| ```bash | ||
| # Simulates 5,000 idle "zombie" connections + 100 events/sec spam | ||
| npm run test:load -- --zombies 5000 --spam-rate 100 | ||
| pnpm run test:load --zombies 5000 --spam-rate 100 | ||
| ``` | ||
|
|
||
| ### Analyzing Memory (Heap Snapshots) | ||
|
|
@@ -299,10 +300,10 @@ To observe client and subscription counts in real-time during a test, you can in | |
| Run dead code and dependency analysis before opening a pull request: | ||
|
|
||
| ``` | ||
| npm run knip | ||
| pnpm run knip | ||
| ``` | ||
|
|
||
| `npm run lint` now runs Biome. | ||
| `pnpm run lint` now runs Biome. | ||
|
|
||
| ## Pull Request Process | ||
|
|
||
|
|
@@ -323,7 +324,7 @@ Every pull request that changes behavior, adds a feature, or fixes a bug **must | |
| To add a changeset: | ||
|
|
||
| ```bash | ||
| npx changeset | ||
| pnpm exec changeset | ||
| ``` | ||
|
|
||
| This interactive prompt will ask you to: | ||
|
|
@@ -338,7 +339,7 @@ If your PR **only** updates documentation, CI/CD configuration, or test coverage | |
| production source code untouched — an empty changeset is acceptable: | ||
|
|
||
| ```bash | ||
| npx changeset --empty | ||
| pnpm exec changeset --empty | ||
| ``` | ||
|
|
||
| Commit the generated `.changeset/*.md` file with your PR. This satisfies CI without producing a | ||
|
|
@@ -362,6 +363,6 @@ This applies to PRs that exclusively contain: | |
| Run Biome checks before opening a pull request: | ||
|
|
||
| ``` | ||
| npm run lint | ||
| npm run format:check | ||
| pnpm run lint | ||
| pnpm run format:check | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,13 +2,13 @@ FROM node:24-alpine AS build | |
|
|
||
| WORKDIR /build | ||
|
|
||
| COPY ["package.json", "package-lock.json", "./"] | ||
| COPY ["package.json", "pnpm-lock.yaml", "./"] | ||
|
|
||
| RUN npm install --quiet | ||
| RUN corepack enable && corepack prepare pnpm@10.33.0 --activate && pnpm install --frozen-lockfile --silent | ||
|
|
||
| COPY . . | ||
|
|
||
| RUN npm run build | ||
| RUN pnpm run build | ||
|
|
||
| FROM node:24-alpine | ||
|
|
||
|
|
@@ -24,8 +24,9 @@ RUN apk add --no-cache --update git | |
| ADD resources /app/resources | ||
|
|
||
| COPY --from=build /build/dist . | ||
| COPY --from=build /build/package.json /build/pnpm-lock.yaml ./ | ||
|
|
||
| RUN npm install --omit=dev --quiet | ||
| RUN corepack enable && corepack prepare pnpm@10.33.0 --activate && pnpm install --prod --frozen-lockfile --silent | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we make PNMP_VERSION an ARG and ENV var? |
||
|
|
||
| USER node:node | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think "run" isn't needed in most cases, we could probably drop it. Can you try running without run and see if it just works?