build: change to pnpm

This commit is contained in:
Anthony Berg 2024-02-03 22:13:35 +00:00
parent 3d8aba5577
commit 4e99a5456f
6 changed files with 1756 additions and 4540 deletions

View File

@ -1,6 +1,6 @@
.idea .idea
dist dist
node_modules node_modules
tsconfig.tsbuildinfo
npm-debug.log npm-debug.log
.env .env
*.md

3
.npmrc Normal file
View File

@ -0,0 +1,3 @@
node-linker=hoisted
shamefully-hoist=true
public-hoist-pattern[]=@sapphire/*

View File

@ -1,24 +1,28 @@
FROM node:20 FROM node:20 AS base
# PNPM
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
WORKDIR /opt/app COPY . /app
WORKDIR /app
ENV NODE_ENV=production ENV NODE_ENV=production
COPY --chown=node:node package.json . FROM base AS prod-deps
COPY --chown=node:node package-lock.json . RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
COPY --chown=node:node tsconfig.json .
COPY --chown=node:node prisma ./prisma/
RUN npm install FROM base AS build
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN pnpm run build
COPY . . FROM base
COPY --from=prod-deps /app/node_modules /app/node_modules
COPY --from=build /app/dist /app/dist
RUN npx prisma generate RUN pnpx prisma generate
RUN pnpm run build
RUN npm run build RUN chown node:node .
RUN chown node:node /opt/app/
USER node USER node
CMD [ "pnpm", "run", "start:migrate"]
CMD [ "npm", "run", "start:migrate"]

4522
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,10 +4,11 @@
"description": "A Discord bot for Animal Rights Advocates", "description": "A Discord bot for Animal Rights Advocates",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
"preinstall": "npx only-allow pnpm",
"build": "tsc", "build": "tsc",
"cleanBuild": "rm -rf ./dist && tsc", "cleanBuild": "rm -rf ./dist && tsc",
"start": "node dist/index.js", "start": "node dist/index.js",
"start:migrate": "prisma migrate deploy && npm run start" "start:migrate": "prisma migrate deploy && pnpm run start"
}, },
"imports": { "imports": {
"#utils/*": "./dist/utils/*.js" "#utils/*": "./dist/utils/*.js"
@ -28,6 +29,10 @@
"url": "https://github.com/veganhacktivists/arabot/issues" "url": "https://github.com/veganhacktivists/arabot/issues"
}, },
"homepage": "https://github.com/veganhacktivists/arabot#readme", "homepage": "https://github.com/veganhacktivists/arabot#readme",
"engines": {
"node": ">=20",
"pnpm": ">=8"
},
"dependencies": { "dependencies": {
"@prisma/client": "^5.7.1", "@prisma/client": "^5.7.1",
"@sapphire/discord.js-utilities": "^7.1.5", "@sapphire/discord.js-utilities": "^7.1.5",
@ -42,12 +47,12 @@
"@types/node": "^20.10.6", "@types/node": "^20.10.6",
"bullmq": "^5.1.1", "bullmq": "^5.1.1",
"discord.js": "^14.14.1", "discord.js": "^14.14.1",
"ioredis": "^5.3.2",
"redis": "^4.6.12", "redis": "^4.6.12",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "^5.3.3" "typescript": "^5.3.3"
}, },
"devDependencies": { "devDependencies": {
"@types/ioredis": "^5.0.0",
"@typescript-eslint/eslint-plugin": "^6.17.0", "@typescript-eslint/eslint-plugin": "^6.17.0",
"@typescript-eslint/parser": "^6.17.0", "@typescript-eslint/parser": "^6.17.0",
"eslint": "8.56.0", "eslint": "8.56.0",

1726
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff