Skip to content

Commit

Permalink
feat: move to pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
capJavert committed Feb 11, 2025
1 parent 5df218a commit f9c20e0
Show file tree
Hide file tree
Showing 28 changed files with 9,530 additions and 13,143 deletions.
18 changes: 10 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@ orbs:
jobs:
build:
docker:
- image: cimg/node:20.12
- image: cimg/node:22.13
steps:
- checkout
- restore_cache:
key: dependency-v3-cache-{{ checksum "package-lock.json" }}
key: dependency-v4-cache-{{ checksum "pnpm-lock.yaml" }}
- run:
name: Install dependencies
command: npm install
command: |
sudo npm install -g [email protected]
pnpm install
- run:
name: Build
command: npm run build
- save_cache:
key: dependency-v3-cache-{{ checksum "package-lock.json" }}
key: dependency-v4-cache-{{ checksum "pnpm-lock.yaml" }}
paths:
- ./node_modules
- persist_to_workspace:
Expand All @@ -28,7 +30,7 @@ jobs:
test:
resource_class: large
docker:
- image: cimg/node:20.12
- image: cimg/node:22.13
- image: postgres:17-alpine
environment:
POSTGRES_DB: api_test
Expand All @@ -38,7 +40,7 @@ jobs:
steps:
- checkout
- restore_cache:
key: dependency-v3-cache-{{ checksum "package-lock.json" }}
key: dependency-v4-cache-{{ checksum "pnpm-lock.yaml" }}
- run:
name: Wait for PostgreSQL
command: |
Expand Down Expand Up @@ -88,7 +90,7 @@ jobs:
registry-url: us.gcr.io
pulumi_preview:
docker:
- image: cimg/node:20.12
- image: cimg/node:22.13
steps:
- checkout
- pulumi/login
Expand All @@ -103,7 +105,7 @@ jobs:
pulumi_up:
circleci_ip_ranges: true
docker:
- image: cimg/node:20.12
- image: cimg/node:22.13
environment:
USE_GKE_GCLOUD_AUTH_PLUGIN: 'True'
steps:
Expand Down
2 changes: 1 addition & 1 deletion .infra/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.12
22.13
2 changes: 1 addition & 1 deletion .infra/Pulumi.adhoc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ config:
api:env:
accessSecret: topsecret
analyticsUrl: http://localhost:3000
validLanguagesFeatureKey: valid_languages
cioReportingWebhookSecret: topsecret
cioWebhookSecret: topsecret
commentsPrefix: http://webapp.local.com:5002
Expand Down Expand Up @@ -85,6 +84,7 @@ config:
typeormUsername: postgres
tz: UTC
urlPrefix: http://api.local.com
validLanguagesFeatureKey: valid_languages
api:k8s:
namespace: local
api:temporal:
Expand Down
5 changes: 4 additions & 1 deletion .infra/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
name: api
runtime: nodejs
runtime:
name: nodejs
options:
packagemanager: pnpm
description: Infrastructure for daily-api
16 changes: 8 additions & 8 deletions .infra/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion .infra/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"name": "api",
"scripts": {
"prepare": "corepack enable || true"
},
"devDependencies": {
"@types/node": "20.12.x"
"@types/node": "22.13.x"
},
"dependencies": {
"@dailydotdev/pulumi-common": "^2.4.6",
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.12
22.13
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20-bookworm-slim
FROM node:22.13-bookworm-slim
RUN apt-get update \
&& apt-get install -y ca-certificates dumb-init \
&& rm -rf /var/lib/apt/lists/*
Expand All @@ -8,11 +8,13 @@ WORKDIR /opt/app

COPY .npmrc .
COPY package.json .
COPY package-lock.json .
COPY pnpm-lock.yaml .
COPY patches patches
COPY queries queries

RUN npm i --only=prod
RUN npm install -g [email protected]

RUN pnpm install --frozen-lockfile

COPY build .

Expand Down
7 changes: 5 additions & 2 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ WORKDIR /opt/app

COPY .npmrc .
COPY package.json .
COPY package-lock.json .
COPY pnpm-lock.yaml .
COPY patches patches
COPY queries queries

RUN npm install -g [email protected]

RUN npm i -g nodemon
RUN npm i

RUN pnpm install --frozen-lockfile

COPY . .

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ along with other very useful endpoints.
## Stack

- Node v20 (a `.nvmrc` is presented for [nvm](https://github.com/nvm-sh/nvm) users).
- NPM for managing dependencies.
- pnpm for managing dependencies.
- Fastify as the web framework
- Apollo for GraphQL
- Typeorm as a database layer
Expand Down
4 changes: 2 additions & 2 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ docker_build(
sync('./src', '/opt/app/src'),
sync('./bin', '/opt/app/bin'),
run(
'npm i',
trigger=['./package.json', './package-lock.json']
'pnpm install',
trigger=['./package.json', './pnpm-lock.yaml']
)
])

Expand Down
2 changes: 1 addition & 1 deletion bin/addShortIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ interface Row {
});
await new Promise((resolve, reject) => {
resStream.on('error', reject);
resStream.on('end', resolve);
resStream.on('end', () => resolve(true));
});
})();
2 changes: 1 addition & 1 deletion bin/addWelcomePosts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ import { createSquadWelcomePost } from '../src/common';

await new Promise((resolve, reject) => {
resStream.on('error', reject);
resStream.on('end', resolve);
resStream.on('end', () => resolve(true));
});
})();
2 changes: 1 addition & 1 deletion bin/allocateDigestExperiment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ import pino from 'pino';

reject(error);
});
personalizedDigestStream.on('end', resolve);
personalizedDigestStream.on('end', () => resolve(true));
});
await allocationClient.waitForSend();

Expand Down
2 changes: 1 addition & 1 deletion bin/commentMarkdownToHTML.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ interface Row {
});
await new Promise((resolve, reject) => {
resStream.on('error', reject);
resStream.on('end', resolve);
resStream.on('end', () => resolve(true));
});
})();
2 changes: 1 addition & 1 deletion bin/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const runInQueueStream = async <T>(

await new Promise((resolve, reject) => {
stream.on('error', reject);
stream.on('end', resolve);
stream.on('end', () => resolve(true));
});
await insertQueue.drained();
console.log('update finished with a total of: ', insertCount);
Expand Down
2 changes: 1 addition & 1 deletion bin/insertCodeSnippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const main = async () => {

await new Promise((resolve, reject) => {
stream.on('error', reject);
stream.on('end', resolve);
stream.on('end', () => resolve(true));
});
await downloadQueue.drained();

Expand Down
2 changes: 1 addition & 1 deletion bin/insertMissingAlerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const QUEUE_CONCURRENCY = 1;

await new Promise((resolve, reject) => {
stream.on('error', reject);
stream.on('end', resolve);
stream.on('end', () => resolve(true));
});
await insertQueue.drained();
console.log('insertion finished with a total of: ', insertCount);
Expand Down
2 changes: 1 addition & 1 deletion bin/mutePublicSquadNotifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const QUEUE_CONCURRENCY = 100;

await new Promise((resolve, reject) => {
stream.on('error', reject);
stream.on('end', resolve);
stream.on('end', () => resolve(true));
});

await insertQueue.drained();
Expand Down
2 changes: 1 addition & 1 deletion bin/syncMembersCount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const QUEUE_CONCURRENCY = 1;

await new Promise((resolve, reject) => {
stream.on('error', reject);
stream.on('end', resolve);
stream.on('end', () => resolve(true));
});
await insertQueue.drained();
console.log('update finished with a total of: ', insertCount);
Expand Down
2 changes: 1 addition & 1 deletion bin/syncSourceFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const QUEUE_CONCURRENCY = 1;

await new Promise((resolve, reject) => {
stream.on('error', reject);
stream.on('end', resolve);
stream.on('end', () => resolve(true));
});
await insertQueue.drained();
console.log('update finished with a total of: ', insertCount);
Expand Down
2 changes: 1 addition & 1 deletion bin/updateUserFeedSettingsFeedback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const QUEUE_CONCURRENCY = 1;

await new Promise((resolve, reject) => {
stream.on('error', reject);
stream.on('end', resolve);
stream.on('end', () => resolve(true));
});
await insertQueue.drained();
console.log('update finished with a total of: ', insertCount);
Expand Down
Loading

0 comments on commit f9c20e0

Please sign in to comment.