Skip to content

Commit d8d2b6d

Browse files
chore: use corepack and yarn v4 (#441)
1 parent 32325f1 commit d8d2b6d

File tree

10 files changed

+3755
-2215
lines changed

10 files changed

+3755
-2215
lines changed

.devcontainer/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-20
1+
FROM mcr.microsoft.com/devcontainers/javascript-node:20
2+
3+
RUN corepack enable

.devcontainer/devcontainer.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
"build": {
44
"dockerfile": "Dockerfile"
55
},
6-
"extensions": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"],
7-
"postCreateCommand": "yarn install",
6+
"customizations": {
7+
"vscode": {
8+
"extensions": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"]
9+
}
10+
},
11+
"onCreateCommand": "yarn install",
812
"remoteUser": "node"
913
}

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ updates:
1515
- package-ecosystem: github-actions
1616
directory: '/'
1717
schedule:
18-
interval: monthly
18+
interval: weekly

.github/workflows/build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ jobs:
55
runs-on: ubuntu-latest
66
steps:
77
- uses: actions/checkout@v4
8+
# waiting on: https://github.com/actions/setup-node/issues/531
9+
- run: corepack enable
810
- uses: actions/setup-node@v4
911
with:
1012
node-version: 20
1113
cache: yarn
12-
- run: yarn install --frozen-lockfile
14+
- run: yarn install --immutable
1315
- run: yarn format:check
1416
- run: yarn lint
1517
build:

.gitignore

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,14 @@ typings/
5959
# Output of 'npm pack'
6060
*.tgz
6161

62-
# Yarn Integrity file
63-
.yarn-integrity
62+
# Yarn
63+
.pnp.*
64+
.yarn/*
65+
!.yarn/patches
66+
!.yarn/plugins
67+
!.yarn/releases
68+
!.yarn/sdks
69+
!.yarn/versions
6470

6571
# dotenv environment variables file
6672
.env
@@ -88,4 +94,4 @@ typings/
8894
.dynamodb/
8995

9096
# Output directory
91-
build
97+
build

.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ WORKDIR /usr/src/app
55
ADD package.json .
66
ADD yarn.lock .
77

8-
# All the steps until here can be re-used in the second stage,
9-
# so the devDependencies are installed separately
10-
RUN yarn install --frozen-lockfile --production
11-
RUN yarn install --frozen-lockfile
8+
RUN corepack enable
9+
RUN yarn install --immutable
1210

1311
ADD tsconfig.json .
1412
ADD src/ ./src/
@@ -22,7 +20,8 @@ WORKDIR /usr/src/app
2220
ADD package.json .
2321
ADD yarn.lock .
2422

25-
RUN yarn install --frozen-lockfile --production
23+
RUN corepack enable
24+
RUN yarn install --immutable
2625

2726
COPY --from=builder /usr/src/app/build/ ./build/
2827

lefthook.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
pre-commit:
2+
parallel: true
3+
skip:
4+
- merge
5+
- rebase
6+
commands:
7+
eslint_prettier:
8+
glob: '*.{js,ts,jsx,tsx,cjs,cts,mjs,mts}'
9+
run: node_modules/.bin/eslint --fix {staged_files} && node_modules/.bin/prettier --write {staged_files}
10+
stage_fixed: true
11+
12+
prettier:
13+
glob: '*.{html,json,yaml,yml}'
14+
run: node_modules/.bin/prettier --write {staged_files}
15+
stage_fixed: true

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"main": "build/index.js",
66
"author": "",
77
"license": "",
8+
"packageManager": "yarn@4.0.2+sha256.825003a0f561ad09a3b1ac4a3b3ea6207af2796d54f62a9420520915721f5186",
89
"scripts": {
910
"dev": "ts-node-dev src/index.ts",
1011
"start": "NODE_ENV=production node build/index.js",
@@ -18,6 +19,7 @@
1819
"@nihalgonsalves/esconfig": "^0.6.9",
1920
"@types/node": "20",
2021
"eslint": "^8.54.0",
22+
"lefthook": "^1.5.4",
2123
"prettier": "^3.1.0",
2224
"ts-node-dev": "^2.0.0",
2325
"typescript": "^5.2.2"

0 commit comments

Comments
 (0)