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

chore: use corepack and yarn v4 #441

Merged
merged 1 commit into from
Nov 27, 2023
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
4 changes: 3 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-20
FROM mcr.microsoft.com/devcontainers/javascript-node:20

RUN corepack enable
8 changes: 6 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
"build": {
"dockerfile": "Dockerfile"
},
"extensions": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"],
"postCreateCommand": "yarn install",
"customizations": {
"vscode": {
"extensions": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"]
}
},
"onCreateCommand": "yarn install",
"remoteUser": "node"
}
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ updates:
- package-ecosystem: github-actions
directory: '/'
schedule:
interval: monthly
interval: weekly
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# waiting on: https://github.com/actions/setup-node/issues/531
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
- run: yarn install --frozen-lockfile
- run: yarn install --immutable
- run: yarn format:check
- run: yarn lint
build:
Expand Down
12 changes: 9 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,14 @@ typings/
# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity
# Yarn
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# dotenv environment variables file
.env
Expand Down Expand Up @@ -88,4 +94,4 @@ typings/
.dynamodb/

# Output directory
build
build
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
9 changes: 4 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ WORKDIR /usr/src/app
ADD package.json .
ADD yarn.lock .

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

ADD tsconfig.json .
ADD src/ ./src/
Expand All @@ -22,7 +20,8 @@ WORKDIR /usr/src/app
ADD package.json .
ADD yarn.lock .

RUN yarn install --frozen-lockfile --production
RUN corepack enable
RUN yarn install --immutable

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

Expand Down
15 changes: 15 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
pre-commit:
parallel: true
skip:
- merge
- rebase
commands:
eslint_prettier:
glob: '*.{js,ts,jsx,tsx,cjs,cts,mjs,mts}'
run: node_modules/.bin/eslint --fix {staged_files} && node_modules/.bin/prettier --write {staged_files}
stage_fixed: true

prettier:
glob: '*.{html,json,yaml,yml}'
run: node_modules/.bin/prettier --write {staged_files}
stage_fixed: true
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "build/index.js",
"author": "",
"license": "",
"packageManager": "[email protected]+sha256.825003a0f561ad09a3b1ac4a3b3ea6207af2796d54f62a9420520915721f5186",
"scripts": {
"dev": "ts-node-dev src/index.ts",
"start": "NODE_ENV=production node build/index.js",
Expand All @@ -18,6 +19,7 @@
"@nihalgonsalves/esconfig": "^0.6.9",
"@types/node": "20",
"eslint": "^8.54.0",
"lefthook": "^1.5.4",
"prettier": "^3.1.0",
"ts-node-dev": "^2.0.0",
"typescript": "^5.2.2"
Expand Down
Loading