Skip to content

Commit 9a4050b

Browse files
Switch to pnpm, ESLint 9, and helpful output (#852)
* Switch to pnpm, ESLint 9, and helpful output * Replace references of yarn with pnpm * Use published packages * Bump version of docker/build-push-action * Attempt to enable pnpm to read prettier version * Fix test * Try lts/* for .nvmrc * Fix tests * Fix unbound variable issue * Use pnpm list instead of why * Correctly clear cache using store prune * Attempt to fix formatting actions * Disable store prune for now * Prune dev dependencies * Make binaries executable hopefully * Log the .bin folder * idk? * Chown it then I guess? * Don't symlink executables * Attempt to own and execute as appuser * Okay later then * Remove all changes to ownership for now * Print executability * Log more things * Debug promise * Hopefully fix the slug issue * Try alternatives * Other alternatives * Don't cd into output * Correctly cd into directory when needed * Hopefully detect the docker run issue * Maybe chown will fix it? * With full path * Different ls options * Print ls in case of not executable * Fix typo * idk * Show whoami * Show whomai for real * Separate tests for jest bin file * Woops, fix that remnant * Ignore appuser for now * Show me that env * Re-enable appuser * Debug etc/passwd * Debug mounts * Make tmp executable for now * Also make this one executable temporarily * Collate layers * Try jest without corepack root * Ensure no tmpfs for tests if running in docker without exec * Woops, typo * Fix empty continuation * Probably fix issue with path? * Remove :exec flag * Make executable again * Print mount before tests * Always use bash please * Remove option :exec not supported by --mount * Hopefully make the tests work * Remove color from expected results (docker only) * Fix expected results for clock * Add npm test
1 parent 93f6cba commit 9a4050b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+7357
-9626
lines changed

.eslintignore

-18
This file was deleted.

.eslintrc.js

-8
This file was deleted.

.github/workflows/action-format.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,14 @@ jobs:
6060
git clone $HEAD_REPO .
6161
git checkout -b "$HEAD_REF" "origin/$HEAD_REF"
6262
63-
- name: Use Node.js LTS (18.x)
64-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
63+
- name: Use Node.js LTS (20.x)
64+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
6565
with:
66-
node-version: '18'
67-
- name: Install project development dependencies
68-
run: npm install --no-save
66+
node-version: 20.x
67+
- name: Enable pnpm
68+
run: |
69+
corepack enable pnpm
70+
corepack pnpm -v
6971
- name: 'Format code'
7072
run: ./bin/format.sh
7173

.github/workflows/ci.js.yml

+16-10
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@ jobs:
1212
runs-on: ubuntu-22.04
1313

1414
steps:
15-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
16-
- name: Use Node.js LTS (18.x)
17-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
15+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
16+
- name: Use Node.js LTS
17+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
1818
with:
19-
node-version: 18.x
19+
node-version-file: .nvmrc
2020

2121
- name: Install project dependencies
22-
run: yarn install --immutable
22+
run: |
23+
corepack enable pnpm
24+
corepack pnpm -v
25+
corepack pnpm install --frozen-lockfile
2326
2427
- name: Run exercism/javascript-test-runner ci precheck (lint code)
2528
run: bin/lint.sh
@@ -29,23 +32,26 @@ jobs:
2932

3033
strategy:
3134
matrix:
32-
node-version: [18.x]
35+
node-version: [20.x]
3336

3437
steps:
35-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
38+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
3639
- name: Use Node.js ${{ matrix.node-version }}
37-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
40+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
3841
with:
3942
node-version: ${{ matrix.node-version }}
4043

4144
- name: Install project dependencies
42-
run: yarn install --immutable
45+
run: |
46+
corepack enable pnpm
47+
corepack pnpm -v
48+
corepack pnpm install --frozen-lockfile
4349
4450
- name: Build the test-runner (using Node ${{ matrix.node-version }})
4551
run: bin/test.sh
4652

4753
- name: Set up Docker Buildx
48-
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db
54+
uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1
4955
with:
5056
install: true
5157

.github/workflows/pr.ci.js.yml

+15-9
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@ jobs:
1313
- name: Checkout PR
1414
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
1515

16-
- name: Use Node.js LTS (18.x)
17-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
16+
- name: Use Node.js LTS
17+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
1818
with:
19-
node-version: 18.x
19+
node-version-file: .nvmrc
2020

2121
- name: Install project dependencies
22-
run: yarn install --immutable
22+
run: |
23+
corepack enable pnpm
24+
corepack pnpm -v
25+
corepack pnpm install --frozen-lockfile
2326
2427
- name: Run exercism/javascript ci precheck (lint code)
2528
run: bin/lint.sh
@@ -29,25 +32,28 @@ jobs:
2932

3033
strategy:
3134
matrix:
32-
node-version: [18.x]
35+
node-version: [20.x]
3336

3437
steps:
3538
- name: Checkout PR
36-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
39+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
3740

3841
- name: Use Node.js ${{ matrix.node-version }}
39-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
42+
uses: actions/setup-node@v3
4043
with:
4144
node-version: ${{ matrix.node-version }}
4245

4346
- name: Install project dependencies
44-
run: yarn install --immutable
47+
run: |
48+
corepack enable pnpm
49+
corepack pnpm -v
50+
corepack pnpm install --frozen-lockfile
4551
4652
- name: Build the test-runner (using Node ${{ matrix.node-version }})
4753
run: bin/test.sh
4854

4955
- name: Set up Docker Buildx
50-
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db
56+
uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1
5157
with:
5258
install: true
5359

.github/workflows/verify-code-formatting.yml

+10
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,15 @@ jobs:
1212
- name: 'Checkout code'
1313
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
1414

15+
- name: Use Node.js LTS (20.x)
16+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
17+
with:
18+
node-version: 20.x
19+
20+
- name: Enable pnpm
21+
run: |
22+
corepack enable pnpm
23+
corepack pnpm -v
24+
1525
- name: 'Verify formatting of all files'
1626
run: ./bin/check-formatting.sh

.npmrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node-linker=hoisted
2+
symlink=false
3+
prefer-symlinked-executables=false

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lts/*

.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

-28
This file was deleted.

.yarn/releases/yarn-3.6.0.cjs

-874
This file was deleted.

.yarnrc.yml

-7
This file was deleted.

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## 5.0.0
4+
5+
- Update dependencies including core-js
6+
- Switch to pnpm
7+
- Rework `run.sh` for console friendly output
8+
- Use ESLint 9 (Flat Config)
9+
310
## 4.0.0
411

512
- Update dependencies including core-js

Dockerfile

+35-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
FROM node:18-bullseye-slim as runner
2-
# Node.js 18 (curently LTS)
3-
# Debian bullseye
1+
FROM node:20-bookworm-slim AS runner
2+
# Node.js 20 (curently LTS)
3+
# Debian bookwork
44

55
# fetch latest security updates
66
RUN set -ex; \
@@ -18,17 +18,41 @@ RUN adduser --disabled-password --gecos "" appuser
1818
WORKDIR /opt/test-runner
1919
COPY . .
2020

21+
# Install pnpm so it will be available read-only
22+
# https://github.com/nodejs/corepack/issues/183#issue-1379672431
23+
# https://github.com/nodejs/corepack/blob/bc13d40037d0b1bfd386e260ae741f55505b5c7c/tests/main.test.ts#L483
24+
RUN mkdir -p /idk/corepack
25+
ENV COREPACK_HOME=/idk/corepack
26+
27+
RUN set -ex; \
28+
corepack enable pnpm; \
29+
# corepack pack -o ./corepack.tgz; \
30+
# COREPACK_ENABLE_NETWORK=0 corepack install -g ./corepack.tgz;
31+
#
32+
# https://github.com/nodejs/corepack/pull/446#issue-2218976611
33+
corepack install; \
34+
corepack pnpm --version; \
35+
#
36+
# https://github.com/nodejs/corepack/issues/414#issuecomment-2096218732
37+
# https://github.com/nodejs/corepack/blob/bc13d40037d0b1bfd386e260ae741f55505b5c7c/sources/folderUtils.ts#L26-L31
38+
chmod 444 /idk/corepack/lastKnownGood.json; \
39+
chmod 555 /idk/corepack;
40+
2141
# Build the test runner
2242
RUN set -ex; \
2343
# install all the development modules (used for building)
24-
yarn plugin import workspace-tools; \
25-
yarn install; \
26-
yarn build; \
27-
rm -rf node_modules; \
28-
# install only the node_modules we need for production
29-
yarn workspaces focus --production; \
30-
# clean our yarn cache
31-
yarn cache clean;
44+
# corepack pnpm store prune; \
45+
corepack pnpm install; \
46+
corepack pnpm build; \
47+
corepack pnpm prune --prod;
48+
49+
# Disable network for corepack
50+
ENV COREPACK_ENABLE_NETWORK=0
51+
ENV COREPACK_ENABLE_STRICT=0
52+
53+
# Mark this as a docker run so we don't try to execute things in /tmp
54+
ENV TMP_MAY_BE_NON_EXEC=1
3255

56+
# Execute everything as the appuser
3357
USER appuser
3458
ENTRYPOINT [ "/opt/test-runner/bin/run.sh" ]

0 commit comments

Comments
 (0)