Skip to content

Commit

Permalink
feat(pnpm): Switch to pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
n0th1ng-else committed Jun 22, 2024
1 parent 366c5af commit aae03e3
Show file tree
Hide file tree
Showing 15 changed files with 13,356 additions and 42,650 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ coverage
e2e
k8s
node_modules
dist
spmdb
spmlogs
HISTORY.md
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ coverage-e2e
coverage-unit
package.json
package-lock.json
pnpm-lock.yaml
8 changes: 5 additions & 3 deletions .github/actions/npm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ runs:
with:
node-version-file: ".nvmrc"

- name: Install npm dependencies
shell: bash
run: npm ci
- uses: pnpm/action-setup@v4
with:
version: 9
run_install: |
args: [--frozen-lockfile]
4 changes: 2 additions & 2 deletions .github/workflows/scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: ./.github/actions/npm

- name: Run tests
run: npm test
run: pnpm test

- name: Store test coverage results
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
uses: ./.github/actions/npm

- name: Run validation
run: npm run ${{ env.COMMAND }}
run: pnpm ${{ env.COMMAND }}

sonar-cloud:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npm run format -- .
pnpm run format -- .
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.15.0
20.14.0
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package.json
package-lock.json
pnpm-lock.yaml
tsconfig.json
.eslintignore
dist/
Expand Down
18 changes: 10 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20.15.0 AS builder
FROM node:20.14-slim AS builder

ENV NODE_ENV production

Expand All @@ -7,18 +7,19 @@ ARG APP_DIR=/usr/src/app/
RUN mkdir -p "$APP_DIR"
WORKDIR $APP_DIR

COPY package.json package-lock.json tsconfig.json $APP_DIR
RUN npm install -g pnpm@9
COPY package.json pnpm-lock.yaml tsconfig.json $APP_DIR
RUN npm pkg delete scripts.prepare
RUN npm ci && npm cache clean --force
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile

COPY ./assets $APP_DIR/assets
COPY ./certs $APP_DIR/certs
COPY ./video-temp $APP_DIR/video-temp
COPY ./src $APP_DIR/src

RUN npm run build
RUN pnpm run build

FROM node:20.51.0
FROM node:20.14-slim

EXPOSE 8080

Expand All @@ -36,15 +37,16 @@ ARG APP_DIR=/usr/src/app/
RUN mkdir -p "$APP_DIR"
WORKDIR $APP_DIR

RUN npm install -g pnpm@9
COPY --from=builder $APP_DIR/assets $APP_DIR/assets
COPY --from=builder $APP_DIR/video-temp $APP_DIR/video-temp
COPY --from=builder $APP_DIR/package.json $APP_DIR
COPY --from=builder $APP_DIR/package-lock.json $APP_DIR
COPY --from=builder $APP_DIR/pnpm-lock.yaml $APP_DIR
RUN npm pkg delete scripts.prepare
RUN npm ci --omit=dev && npm cache clean --force
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile

COPY --from=builder $APP_DIR/dist $APP_DIR/dist

USER node

CMD ["npm", "run", "cluster:js"]
CMD ["pnpm", "run", "cluster:js"]
8 changes: 4 additions & 4 deletions e2e/group.en.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ describe("[default language - english]", () => {
sendTelegramMessage(host, bot, tgMessage).then(() => {
expect(nock.pendingMocks()).toHaveLength(1);
nock.cleanAll();
return done && done();
return done?.();
});
});

Expand All @@ -717,7 +717,7 @@ describe("[default language - english]", () => {
sendTelegramMessage(host, bot, tgMessage).then(() => {
expect(nock.pendingMocks()).toHaveLength(1);
nock.cleanAll();
return done && done();
return done?.();
});
});

Expand All @@ -737,7 +737,7 @@ describe("[default language - english]", () => {
sendTelegramMessage(host, bot, tgMessage).then(() => {
expect(nock.pendingMocks()).toHaveLength(1);
nock.cleanAll();
return done && done();
return done?.();
});
});

Expand All @@ -757,7 +757,7 @@ describe("[default language - english]", () => {
sendTelegramMessage(host, bot, tgMessage).then(() => {
expect(nock.pendingMocks()).toHaveLength(1);
nock.cleanAll();
return done && done();
return done?.();
});
});

Expand Down
12 changes: 6 additions & 6 deletions e2e/group.ru.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ describe("[russian language]", () => {
sendTelegramMessage(host, bot, tgMessage).then(() => {
expect(nock.pendingMocks()).toHaveLength(1);
nock.cleanAll();
return done && done();
return done?.();
});
});

Expand All @@ -809,7 +809,7 @@ describe("[russian language]", () => {
sendTelegramMessage(host, bot, tgMessage).then(() => {
expect(nock.pendingMocks()).toHaveLength(1);
nock.cleanAll();
return done && done();
return done?.();
});
});

Expand All @@ -829,7 +829,7 @@ describe("[russian language]", () => {
sendTelegramMessage(host, bot, tgMessage).then(() => {
expect(nock.pendingMocks()).toHaveLength(1);
nock.cleanAll();
return done && done();
return done?.();
});
});

Expand All @@ -843,7 +843,7 @@ describe("[russian language]", () => {
sendTelegramMessage(host, bot, tgMessage).then(() => {
expect(nock.pendingMocks()).toHaveLength(1);
nock.cleanAll();
return done && done();
return done?.();
});
});

Expand All @@ -863,7 +863,7 @@ describe("[russian language]", () => {
sendTelegramMessage(host, bot, tgMessage).then(() => {
expect(nock.pendingMocks()).toHaveLength(1);
nock.cleanAll();
return done && done();
return done?.();
});
});

Expand All @@ -877,7 +877,7 @@ describe("[russian language]", () => {
sendTelegramMessage(host, bot, tgMessage).then(() => {
expect(nock.pendingMocks()).toHaveLength(1);
nock.cleanAll();
return done && done();
return done?.();
});
});

Expand Down
2 changes: 1 addition & 1 deletion e2e/scheduler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
InjectedFn,
} from "../src/testUtils/dependencies.js";
import { HealthDto, HealthSsl, HealthStatus } from "../src/server/types.js";
import { SpiedFunction } from "jest-mock";
import type { SpiedFunction } from "jest-mock";
import type { VoidPromise } from "../src/common/types.js";

jest.unstable_mockModule(
Expand Down
Loading

0 comments on commit aae03e3

Please sign in to comment.