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

Feat/migrate to pnpn #1188

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from
26 changes: 19 additions & 7 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,20 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: "npm"
cache: "pnpm"
cache-dependency-path: '**/pnpm-lock.yaml'

- name: Install dependencies
run: npm ci
run: pnpm install

e2e:
needs: initial-checks
Expand All @@ -52,17 +58,23 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: "npm"
cache: "pnpm"
cache-dependency-path: '**/pnpm-lock.yaml'

- name: Cache Playwright browsers
uses: actions/cache@v3
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-playwright-

Expand All @@ -80,16 +92,16 @@ jobs:
shell: bash

- name: Install dependencies
run: npm ci
run: pnpm install

- name: Install Playwright browsers
run: npx playwright install --with-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'

- name: Seed database
run: |
npm run db:migrate
npm run db:seed
pnpm db:migrate
pnpm db:seed

- name: Run Playwright tests
id: playwright-tests
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,25 @@ jobs:
- name: Checkout source code
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'npm'
cache: 'pnpm'

- name: Install dependencies
run: npm ci
run: pnpm i

- name: Run ESLint
run: npm run lint
run: pnpm lint

- name: Run Prettier
run: npm run prettier
run: pnpm prettier

- name: Check for uncommitted changes
run: |
Expand Down
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ FROM base AS deps
RUN apk add --no-cache libc6-compat curl
WORKDIR /app

# Install pnpm
RUN npm install -g pnpm

# Install dependencies based on the preferred package manager
COPY package.json package-lock.json* ./
RUN npm ci
COPY package.json pnpm-lock.yaml* ./
RUN pnpm install --frozen-lockfile

# Rebuild the source code only when needed
FROM base AS builder
Expand All @@ -29,7 +32,7 @@ RUN --mount=type=secret,id=SENTRY_AUTH_TOKEN \
--mount=type=secret,id=DATABASE_URL \
export SENTRY_AUTH_TOKEN=$(cat /run/secrets/SENTRY_AUTH_TOKEN) && \
export DATABASE_URL=$(cat /run/secrets/DATABASE_URL) && \
npm run build
pnpm build

# Production image, copy all the files and run next
FROM base AS runner
Expand Down
2 changes: 1 addition & 1 deletion E2E Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ To run the end-to-end tests using Playwright, you need to configure your environ
First, you need to add your E2E test user to your locally running database. Do this by running the following script if you haven't already:

```bash
npm run db:seed
pnpm db:seed
```

This will create a user and session for your E2E tests. Details of the E2E user created can be seen in `drizzle/seedE2E.ts`.
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ We have a fantastic community growing on Discord. Click [here](https://discord.g
4. Install dependencies with:

```bash
npm install
pnpm install
```

- If you have any issues installing dependencies, check your node version against that defined in the `.nvmrc`. If you're using `nvm`, you can run `nvm use` before installing dependencies.
Expand All @@ -48,23 +48,23 @@ For a more detailed guide on setting them up [go to the Environment Variables se
6. Setup the tables in the database with Drizzle by running:

```bash
npm run db:migrate
pnpm db:migrate
```

The full command can be seen in our [package.json](/package.json#16) file.

7. Seed the database with some mock data by running:

```bash
npm run db:seed
pnpm db:seed
```

The full command can be seen in our [package.json](/package.json#19) file.

8. Finally, run the development server:

```bash
npm run dev
pnpm dev
```

After completion of the above commands, navigate to [http://localhost:3000](http://localhost:3000) in your browser to see the result.
Expand Down
Loading
Loading