Switch from yarn to pnpm

This commit is contained in:
ajnart
2023-11-09 03:43:04 +01:00
parent 694acafe21
commit f8a5de2727
12 changed files with 9641 additions and 13773 deletions

View File

@@ -26,46 +26,41 @@ env:
jobs:
# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
yarn_install_and_build:
install-build:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Setup
uses: actions/setup-node@v3
- name: Checkout
uses: actions/checkout@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
id: yarn-cache
name: Setup pnpm cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-yarn-
${{ runner.os }}-pnpm-store-
- name: Restore NextJS cache
uses: actions/cache@v3
with:
# See here for caching with `yarn` https://github.com/actions/cache/blob/main/examples.md#node---yarn or you can leverage caching with actions/setup-node https://github.com/actions/setup-node
path: |
${{ github.workspace }}/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- name: Install dependencies
run: pnpm install
- run: yarn install --immutable
- run: yarn turbo build
- run: pnpm turbo build
- name: Docker meta
id: meta

View File

@@ -36,46 +36,43 @@ permissions:
jobs:
# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
yarn_install_and_build_dev:
install-build:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
pull-requests: write
steps:
- name: Setup
uses: actions/setup-node@v3
- name: Checkout
uses: actions/checkout@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
id: yarn-cache
name: Setup pnpm cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-yarn-
${{ runner.os }}-pnpm-store-
- name: Restore next build
uses: actions/cache@v3
id: restore-build-cache
env:
cache-name: cache-next-build
with:
path: .next/cache
key: ${{ runner.os }}-build-${{ env.cache-name }}
- name: Install dependencies
run: pnpm install
- run: yarn install --immutable
- run: pnpm turbo build
- run: yarn turbo build
- run: yarn test:coverage
- run: pnpm test:coverage
- name: Report coverage
if: always()

17
.gitignore vendored
View File

@@ -21,8 +21,6 @@
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env
@@ -40,16 +38,6 @@ yarn-error.log*
storybook-static
data/configs
# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
# Yarn v2
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
#envfiles
.env
@@ -63,4 +51,7 @@ database/*.sqlite
WILL_BE_OVERWRITTEN.sqlite
# IDE
.idea/*
.idea/*
# pnpm
.pnp.*

4
.vscode/launch.json vendored
View File

@@ -5,7 +5,7 @@
"name": "Next.js: debug server-side",
"type": "node-terminal",
"request": "launch",
"command": "yarn dev"
"command": "pnpm dev"
},
{
"name": "Next.js: debug client-side",
@@ -17,7 +17,7 @@
"name": "Next.js: debug full stack",
"type": "node-terminal",
"request": "launch",
"command": "yarn dev",
"command": "pnpm dev",
"serverReadyAction": {
"pattern": "started server on .+, url: (https?://.+)",
"uriFormat": "%s",

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +0,0 @@
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-3.6.0.cjs

View File

@@ -61,7 +61,7 @@ A good bug report shouldn't leave others needing to chase you up for more inform
- Collect information about the bug:
- Stack trace (Traceback)
- OS, Platform and Version (Windows, Linux, macOS, x86, ARM)
- Version of yarn, nodejs, docker, npm, next, depending on what seems relevant.
- Version of pnpm, nodejs, docker, npm, next, depending on what seems relevant.
- Possibly your input and the output
- Can you reliably reproduce the issue? And can you also reproduce it with older versions?

View File

@@ -11,7 +11,7 @@ ENV NODE_OPTIONS '--no-experimental-fetch'
COPY next.config.js ./
COPY public ./public
COPY package.json ./temp_package.json
COPY yarn.lock ./temp_yarn.lock
COPY pnpm-lock.yaml ./temp_pnpm-lock.yaml
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY .next/standalone ./
@@ -27,7 +27,7 @@ RUN apt-get update -y && apt-get install -y openssl wget
# Required for migration
RUN mv node_modules _node_modules
RUN rm package.json
RUN yarn add typescript ts-node dotenv drizzle-orm@0.28.6 better-sqlite3@8.6.0 @types/better-sqlite3
RUN pnpm add typescript ts-node dotenv drizzle-orm@0.28.6 better-sqlite3@8.6.0 @types/better-sqlite3
RUN mv node_modules node_modules_migrate
RUN mv _node_modules node_modules

9578
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,7 @@ export NEXTAUTH_URL_INTERNAL="http://$HOSTNAME:7575"
mv node_modules _node_modules
mv node_modules_migrate node_modules
echo "Migrating database..."
yarn ts-node src/migrate.ts & PID=$!
pnpm ts-node src/migrate.ts & PID=$!
# Wait for migration to finish
wait $PID
@@ -17,7 +17,7 @@ cp /app/node_modules/better-sqlite3/build/Release/better_sqlite3.node /app/_node
mv node_modules node_modules_migrate
mv _node_modules node_modules
cp ./temp_package.json package.json
cp ./temp_yarn.lock yarn.lock
cp ./tepm_pnpm-lock.yaml pnpm-lock.yaml
echo "Starting production server..."
node /app/server.js

View File

@@ -11,7 +11,7 @@ export default defineConfig({
provider: 'v8',
reporter: ['html', 'json-summary', 'json'],
all: true,
exclude: ['.next/', '.yarn/', 'data/'],
exclude: ['.next/', 'data/'],
},
setupFiles: ['./tests/setupVitest.ts'],
exclude: [...configDefaults.exclude, '.next'],

12816
yarn.lock

File diff suppressed because it is too large Load Diff