Skip to content
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
6 changes: 4 additions & 2 deletions .github/deployment/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ cd /var/www/sparked-next || exit
git pull origin main

# Install updated dependencies
yarn install
corepack enable
corepack prepare pnpm@9.15.4 --activate
pnpm install --frozen-lockfile

# Build the Next.js app
yarn build
pnpm build

# Restart the app with PM2
pm2 stop sparked-next
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
node-version: '22.14.0'

- name: Deploy with PM2
env:
Expand All @@ -34,12 +34,14 @@ jobs:
sshpass -p "$SERVER_PASSWORD" ssh -o StrictHostKeyChecking=no root@95.111.229.11 << 'EOF'
cd /var/www/sparked-next
git pull origin main
yarn install
yarn build
corepack enable
corepack prepare pnpm@9.15.4 --activate
pnpm install --frozen-lockfile
pnpm build
if pm2 list | grep -q sparked-next; then
pm2 restart sparked-next
else
pm2 start yarn --name sparked-next -- start
pm2 start pnpm --name sparked-next -- start
fi
pm2 save

Expand Down
28 changes: 12 additions & 16 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,42 +14,38 @@ jobs:

strategy:
matrix:
node-version: [22.x]
node-version: ['22.14.0']

steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 9.15.4
run_install: false

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v5
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
cache: 'pnpm'
cache-dependency-path: pnpm-lock.yaml

- name: Install dependencies
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile

- name: Set up environment variables
run: |
echo "MONGODB_URI=${{ secrets.MONGODB_URI }}" >> .env
echo "MONGODB_DB=sparked-next" >> .env

- name: Install Playwright Browsers
run: npx playwright install --with-deps
run: pnpm exec playwright install --with-deps

- name: Run Playwright Tests
run: npx playwright test
run: pnpm exec playwright test
env:
MONGODB_URI: ${{ secrets.MONGODB_URI }}
EMAIL_FROM: ${{ secrets.EMAIL_FROM }}
Expand Down
28 changes: 12 additions & 16 deletions .github/workflows/sanity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,27 @@ jobs:

strategy:
matrix:
node-version: [22.x]
node-version: ['22.14.0']

steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 9.15.4
run_install: false

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v5
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
cache: 'pnpm'
cache-dependency-path: pnpm-lock.yaml

- name: Install dependencies
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile

- name: Set up environment variables
run: |
Expand All @@ -48,11 +44,11 @@ jobs:
run: npx --yes oxlint@latest --deny-warnings

- name: Type check
run: yarn type-check
run: pnpm type-check

- name: Build
id: build
run: yarn build
run: pnpm build
env:
MONGODB_URI: ${{ secrets.MONGODB_URI }}
EMAIL_FROM: ${{ secrets.EMAIL_FROM }}
Expand Down
26 changes: 11 additions & 15 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,27 @@ jobs:

strategy:
matrix:
node-version: [22.x]
node-version: ['22.14.0']

steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 9.15.4
run_install: false

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v5
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
cache: 'pnpm'
cache-dependency-path: pnpm-lock.yaml

- name: Install dependencies
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile

- name: Run unit tests
run: yarn test
run: pnpm test
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ yarn-error.log*
next-env.d.ts
mongodb-realm

# lock files
package-lock.json
yarn.lock

# uploads
public/uploads/*
test-results
Expand Down
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22.14.0
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22.14.0
1 change: 0 additions & 1 deletion .yarnrc.yml

This file was deleted.

6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ Then create a Pull Request from here, we will take a look at it and merge it as

### Testing

`npm run test` or `yarn run test`
`pnpm test`

### linting

`npm run lint` or `yarn run lint`
`pnpm lint`

Before you make commit, make sure that the linting are passing, check with the eslintrc.yml to check the rules.

Expand All @@ -73,4 +73,4 @@ Before you make commit, make sure that the linting are passing, check with the e
We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/olivierjm/sparked-next/issues); it's that easy!

### License
By contributing, you agree that your contributions will be licensed under its MIT License.
By contributing, you agree that your contributions will be licensed under its MIT License.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ You can check out the deployed version below using one the following links.
Production: [sparkednext.app](https://sparkednext.app )
Staging: [sparked-app.onrender.com](https://sparked-app.onrender.com/)

**Note**: We only support Node^18
**Note**: This project is pinned to Node `22.14.0` and `pnpm` `9.x`.

# For Contributors

Expand All @@ -32,11 +32,11 @@ Clone the repo

Install dependencies

`yarn`
`corepack enable && pnpm install`

Run the application

`yarn run dev`
`pnpm dev`

# Using Docker

Expand Down Expand Up @@ -67,7 +67,7 @@ Before pushing anything to your fork, always

### linting

`yarn run lint`
`pnpm lint`

Before you make commit, make sure that lint is passing, check with the eslintrc.yml to check the rules.

Expand Down
13 changes: 8 additions & 5 deletions docker/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
FROM node:22 AS base
FROM node:22.14.0 AS base
WORKDIR /app

COPY package.json package-lock.json ./
RUN corepack enable && corepack prepare pnpm@9.15.4 --activate

RUN npm install
COPY package.json pnpm-lock.yaml ./

RUN pnpm install --frozen-lockfile

COPY . .

FROM node:22-alpine3.19 as release
FROM node:22.14.0-alpine as release
WORKDIR /app

COPY --from=base /app/node_modules ./node_modules
COPY --from=base /app/pnpm-lock.yaml ./pnpm-lock.yaml
COPY --from=base /app/package.json ./package.json
COPY --from=base /app/.next ./.next
COPY --from=base /app/src ./src
COPY --from=base /app .

EXPOSE 3000

CMD ["yarn", "dev"]
CMD ["pnpm", "dev"]
16 changes: 9 additions & 7 deletions docker/Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:22 AS base
FROM node:22.14.0 AS base
WORKDIR /app

# Install build dependencies
Expand All @@ -8,24 +8,26 @@ RUN apt-get update && apt-get install -y \
g++ \
&& rm -rf /var/lib/apt/lists/*

COPY package.json package-lock.json ./
RUN corepack enable && corepack prepare pnpm@9.15.4 --activate

COPY package.json pnpm-lock.yaml ./
COPY .env .env

# Install dependencies and rebuild native modules
RUN npm install
RUN pnpm install --frozen-lockfile

# Copy source files
COPY . .

# Build the application with production environment
RUN NODE_ENV=production npm run build
RUN NODE_ENV=production pnpm build

FROM node:22 as release
FROM node:22.14.0 as release
WORKDIR /app

# Copy necessary files
COPY --from=base /app/package.json ./package.json
COPY --from=base /app/package-lock.json ./package-lock.json
COPY --from=base /app/pnpm-lock.yaml ./pnpm-lock.yaml
COPY --from=base /app/.next ./.next
COPY --from=base /app/public ./public
COPY --from=base /app/node_modules ./node_modules
Expand All @@ -35,4 +37,4 @@ ENV NODE_ENV=production

EXPOSE 3000

CMD ["npm", "start"]
CMD ["pnpm", "start"]
Loading
Loading