Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

build(node): upgrade to Node.js v18 #185

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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: 5 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 7
- name: Build
run: yarn docker:build
run: pnpm docker:build
25 changes: 15 additions & 10 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions/setup-node@v3
with:
cache: pnpm
node-version: 16
node-version: 18
- name: Install
run: pnpm install
- name: Run
Expand All @@ -38,9 +38,9 @@ jobs:
uses: actions/setup-node@v3
with:
cache: pnpm
node-version: 16
node-version: 18
- name: Install
run: pnpm install
run: pnpm i --frozen-lockfile
- name: Run
run: pnpm test:type

Expand All @@ -58,12 +58,12 @@ jobs:
uses: actions/setup-node@v3
with:
cache: pnpm
node-version: 16
node-version: 18
- name: Install
run: |
pnpm install
pnpm i --frozen-lockfile
# https://github.com/swc-project/swc/discussions/4152
pnpm install @swc/core-linux-x64-gnu
pnpm i @swc/core-linux-x64-gnu
- name: Run
run: pnpm test:unit --coverage
- name: Cover
Expand Down Expand Up @@ -112,9 +112,12 @@ jobs:
uses: actions/setup-node@v3
with:
cache: pnpm
node-version: 16
node-version: 18
- name: Install
run: pnpm install --prod=false
run: |
pnpm i --frozen-lockfile --prod=false
# https://github.com/swc-project/swc/discussions/4152
pnpm i @swc/core-linux-x64-gnu
- name: Install Playwright browsers
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: |
Expand All @@ -127,8 +130,10 @@ jobs:
- name: Serve
run: pnpm start &
- name: Wait for server
# https://stackoverflow.com/a/50055449/2736233
run: timeout 30 bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/$0/$1; do sleep 1; done' localhost 3000
run: |
# https://stackoverflow.com/a/50055449/2736233
timeout 10s bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/$0/$1; do sleep 1; done' localhost 3000
sleep 10s
- name: Run
run: pnpm test:e2e
- name: Archive failed tests trace
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16-alpine
FROM node:18-alpine

# https://github.com/prisma/prisma/issues/16834#issuecomment-1355195025
RUN apk add --update --no-cache openssl1.1-compat
Expand All @@ -24,7 +24,7 @@ COPY . .

# https://pnpm.io/installation#using-corepack
RUN corepack enable
RUN corepack prepare pnpm@7.9.0 --activate
RUN corepack prepare pnpm@7.22.0 --activate

RUN pnpm i --frozen-lockfile --prod=false
RUN pnpm build
Expand Down
Binary file removed docs/_media/demo.gif
Binary file not shown.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
"private": true,
"type": "module",
"engines": {
"node": "16",
"npm": "8",
"pnpm": "7"
"node": "^18.12.1",
"pnpm": "^7.22.0"
},
"scripts": {
"build": "next build",
Expand Down
3 changes: 2 additions & 1 deletion scalingo.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
"repository": "https://github.com/betagouv/tell-me",
"success_url": "/",
"website": "https://www.tell-me.org",
"stack": "scalingo-20",
"env": {
"BUILDPACK_URL": {
"description": "Custom buildpack to support pnpm (don't change the default value).",
"value": "https://github.com/unfold/heroku-buildpack-pnpm"
"value": "https://github.com/unfold/heroku-buildpack-pnpm#main"
},
"NODE_ENV": {
"description": "Application environment (don't change the default value).",
Expand Down
1 change: 1 addition & 0 deletions scripts/ci/e2e/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -e

if [ ! -f "./.env" ]; then
cp ./.env.example ./.env
sed -i 's/NODE_ENV="development"/NODE_ENV="production"/' .env
fi

# https://betagouv.github.io/nexauth/#/initialize?id=development
Expand Down