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

[PoC]: replaces yarn with pnpm #148

Open
wants to merge 2 commits 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
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ node_modules
npm-debug.log
README.md
.next
.next-env.d.ts
.git
.yarn/cache
34 changes: 16 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,27 @@ on: [pull_request]

jobs:
test:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2
- name: Setup node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'yarn'
cache-dependency-path: yarn.lock
- run: corepack enable && corepack prepare
cache: 'pnpm'
- name: Install dependencies
run: corepack enable && corepack prepare && pnpm install --frozen-lockfile

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

- name: Yarn cache
uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
- name: Run e2e with Cypress
uses: cypress-io/github-action@v5
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- run: yarn install --immutable
- run: yarn test
record: true
install: false
build: pnpm build
start: pnpm start
browser: chrome
wait-on: http://localhost:3000
config-file: cypress.config.ts
command-prefix: pnpm dlx
command: "pnpm test:e2e"
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ next-env.d.ts
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.log*

# local env files
.env*
Expand All @@ -39,8 +37,7 @@ yarn-error.log*
/cypress/screenshots
/cypress/videos

# Yarn
.yarn/*
# Package Managers
.pnp.*

# typescript
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint && yarn check-types
pnpm lint && pnpm check-types
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Install dependencies only when needed
FROM node:18.12.1-bullseye AS deps
WORKDIR /app
COPY .yarn ./.yarn
COPY package.json yarn.lock .yarnrc.yml ./
RUN yarn install --immutable
COPY package.json pnpm-lock.yaml ./
RUN corepack enable && corepack prepare
RUN pnpm install --frozen-lockfile --prod --ignore-scripts

# If using npm with a `package-lock.json` comment out above and use below instead
# COPY package.json package-lock.json ./
Expand All @@ -14,13 +14,14 @@ FROM node:18.12.1-bullseye AS builder
WORKDIR /app
COPY . .
COPY --from=deps /app/node_modules ./node_modules
RUN corepack enable && corepack prepare

# 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

RUN yarn build
RUN pnpm build

# Production image, copy all the files and run next
FROM node:18.12.1-bullseye AS runner
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,22 @@
"build": "next build",
"start": "next start",
"check-types": "tsc",
"test": "start-server-and-test 'yarn dev' 3000 'yarn cypress:run'",
"test": "start-server-and-test 'pnpm dev' 3000 'pnpm cypress:run'",
"test:e2e": "./node_modules/.bin/cypress run --headless --browser chrome",
"cypress:open": "cypress open",
"cypress:run": "cypress run",
"postinstall": "husky install"
},
"engines": {
"node": "~18"
},
"packageManager": "[email protected]",
"packageManager": "[email protected]",
"dependencies": {
"@artsy/fresnel": "6.1.0",
"@dnd-kit/core": "6.0.8",
"@dnd-kit/modifiers": "6.0.1",
"@dnd-kit/sortable": "7.0.2",
"@dnd-kit/utilities": "3.2.1",
"@egjs/react-flicking": "4.10.9",
"@mdx-js/loader": "2.3.0",
"@mdx-js/react": "2.3.0",
Expand Down Expand Up @@ -70,6 +72,6 @@
"typescript": "4.9.4"
},
"husky": {
"pre-commit": "yarn lint"
"pre-commit": "pnpm lint"
}
}
Loading