Skip to content
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

Introduce PNPM as a package manager #154

Merged
merged 6 commits into from
Jan 27, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/audit/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ runs:
using: "composite"
steps:
- name: Audit project cd ${{ matrix.project }}
run: cd ${{ matrix.project }} && npm ci --no-audit && npm run audit -- --production
run: cd ${{ matrix.project }} && pnpm install && pnpm run audit --prod
shell: bash
20 changes: 18 additions & 2 deletions .github/workflows/github-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,17 @@ jobs:
working-directory: ${{ matrix.project }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/lint
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Run lint
uses: ./.github/workflows/lint

audit:
runs-on: ubuntu-22.04
Expand All @@ -37,11 +47,17 @@ jobs:
working-directory: ${{ matrix.project }}
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: ./.github/workflows/audit
cache: "pnpm"
- name: Run audit
uses: ./.github/workflows/audit

build:
runs-on: ubuntu-22.04
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint/action.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: "Lint"
description: "Runs a lint check on the innoverse next.js app"
description: "Runs a lint check on the innoverse next app"
runs:
using: "composite"
steps:
- name: Install node in cd ${{ matrix.project }}
run: cd ${{ matrix.project }} && npm ci && npm run lint
- name: Install node in ${{ matrix.project }}
run: cd ${{ matrix.project }} && pnpm install && pnpm run lint
shell: bash
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ echo ""
echo "Checking if commit message uses conventional commit format:"
echo "\033[1m<type>: <subject>\033[0m"
echo "\033[1m<type>(<scope>): <subject>\033[0m"
npm run commitlint ${1}
pnpm run commitlint ${1}
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"typescript.enablePromptUseWorkspaceTsdk": true,
"azureAutomation.directory.basePath": "",
"azureFunctions.deploySubpath": "functionapp",
"azureFunctions.postDeployTask": "npm install (functions)",
"azureFunctions.postDeployTask": "pnpm install (functions)",
"azureFunctions.projectLanguage": "TypeScript",
"azureFunctions.projectRuntime": "~3",
"debug.internalConsoleOptions": "neverOpen",
"azureFunctions.projectSubpath": "functionapp",
"azureFunctions.preDeployTask": "npm prune (functions)"
"azureFunctions.preDeployTask": "pnpm prune (functions)"
}
86 changes: 43 additions & 43 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "func",
"label": "func: host start",
"command": "host start",
"problemMatcher": "$func-node-watch",
"isBackground": true,
"dependsOn": "npm build (functions)",
"options": {
"cwd": "${workspaceFolder}/functionapp"
}
},
{
"type": "shell",
"label": "npm build (functions)",
"command": "npm run build",
"dependsOn": "npm install (functions)",
"problemMatcher": "$tsc",
"options": {
"cwd": "${workspaceFolder}/functionapp"
}
},
{
"type": "shell",
"label": "npm install (functions)",
"command": "npm install",
"options": {
"cwd": "${workspaceFolder}/functionapp"
}
},
{
"type": "shell",
"label": "npm prune (functions)",
"command": "npm prune --production",
"dependsOn": "npm build (functions)",
"problemMatcher": [],
"options": {
"cwd": "${workspaceFolder}/functionapp"
}
}
]
}
"version": "2.0.0",
"tasks": [
{
"type": "func",
"label": "func: host start",
"command": "host start",
"problemMatcher": "$func-node-watch",
"isBackground": true,
"dependsOn": "pnpm build (functions)",
"options": {
"cwd": "${workspaceFolder}/functionapp"
}
},
{
"type": "shell",
"label": "pnpm build (functions)",
"command": "pnpm run build",
"dependsOn": "pnpm install (functions)",
"problemMatcher": "$tsc",
"options": {
"cwd": "${workspaceFolder}/functionapp"
}
},
{
"type": "shell",
"label": "pnpm install (functions)",
"command": "pnpm install",
"options": {
"cwd": "${workspaceFolder}/functionapp"
}
},
{
"type": "shell",
"label": "pnpm prune (functions)",
"command": "pnpm prune --production",
"dependsOn": "pnpm build (functions)",
"problemMatcher": [],
"options": {
"cwd": "${workspaceFolder}/functionapp"
}
}
]
}
2 changes: 1 addition & 1 deletion CONTRIBUTING_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ If this is your first time starting InnoVerse, you should follow the [StartUp Gu

At first, please run

`npm run prepare`
`pnpm run prepare`

in the repository's root folder to set up our git hooks, which we use to enforce the [conventional commit message format](https://www.conventionalcommits.org/).

Expand Down
7 changes: 0 additions & 7 deletions app/.nsprc

This file was deleted.

28 changes: 16 additions & 12 deletions app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
ARG BUILDTIMESTAMP
ARG CI_COMMIT_SHA

# Install dependencies only when needed
FROM node:18-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.

WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm ci

# If using npm with a `package-lock.json` comment out above and use below instead
# COPY package.json package-lock.json ./
# RUN npm ci
COPY package.json pnpm-lock.yaml* ./
RUN npm install -g pnpm && pnpm install --frozen-lockfile

# Rebuild the source code only when needed
FROM node:18-alpine AS builder
ARG BUILDTIMESTAMP
ARG CI_COMMIT_SHA

# Install pnpm
RUN npm install -g pnpm

# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry during the build.
ENV NEXT_TELEMETRY_DISABLED 1

ENV NEXT_PUBLIC_BUILDTIMESTAMP ${BUILDTIMESTAMP}
ENV NEXT_PUBLIC_CI_COMMIT_SHA ${CI_COMMIT_SHA}

WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules

COPY . .

# Run Prisma migration
RUN npm run prisma generate --schema ./repository/db/prisma/schema.prisma
# RUN yarn run prisma db push
# RUN yarn run prisma migrate dev --name init
RUN pnpm run prisma generate --schema ./repository/db/prisma/schema.prisma
# RUN pnpm run prisma db push
# RUN pnpm run prisma migrate dev --name init

RUN npm run build
RUN pnpm run build

# Production image, copy all the files and run next
FROM node:18-alpine AS runner
ARG BUILDTIMESTAMP
ARG CI_COMMIT_SHA



ENV NEXT_PUBLIC_BUILDTIMESTAMP ${BUILDTIMESTAMP}
ENV NEXT_PUBLIC_CI_COMMIT_SHA ${CI_COMMIT_SHA}

Expand All @@ -55,6 +55,10 @@ WORKDIR /app
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

# Install pnpm
RUN npm install -g pnpm


# You only need to copy next.config.ts if you are NOT using the default configuration
COPY --from=builder /app/next.config.ts ./
COPY --from=builder /app/config ./config
Expand All @@ -79,5 +83,5 @@ EXPOSE 3000

ENV PORT 3000

CMD [ "npm", "run", "start:migrate:prod" ]

CMD [ "pnpm", "run", "start:migrate:prod" ]
Loading