Skip to content

Commit 7b6a1ae

Browse files
Core-JS support & Yarn 3 (#694)
1 parent 01fefc5 commit 7b6a1ae

13 files changed

Lines changed: 7912 additions & 4731 deletions

File tree

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Format code'
1+
name: 'javascript-test-runner / format'
22

33
on:
44
issue_comment:
@@ -60,6 +60,12 @@ 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@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
65+
with:
66+
node-version: '18'
67+
- name: Install project development dependencies
68+
run: npm install --no-save
6369
- name: 'Format code'
6470
run: ./bin/format.sh
6571

.github/workflows/ci.js.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
node-version: 18.x
2020

2121
- name: Install project dependencies
22-
run: yarn install --frozen-lockfile --ignore-scripts
22+
run: yarn install --frozen-lockfile
2323

2424
- name: Run exercism/javascript-test-runner ci precheck (lint code)
2525
run: bin/lint.sh
@@ -39,7 +39,7 @@ jobs:
3939
node-version: ${{ matrix.node-version }}
4040

4141
- name: Install project dependencies
42-
run: yarn install --frozen-lockfile --ignore-scripts
42+
run: yarn install --frozen-lockfile
4343

4444
- name: Build the test-runner (using Node ${{ matrix.node-version }})
4545
run: bin/test.sh

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
node-version: 18.x
2020

2121
- name: Install project dependencies
22-
run: yarn install --frozen-lockfile --ignore-scripts
22+
run: yarn install --frozen-lockfile
2323

2424
- name: Run exercism/javascript ci precheck (lint code)
2525
run: bin/lint.sh
@@ -41,7 +41,7 @@ jobs:
4141
node-version: ${{ matrix.node-version }}
4242

4343
- name: Install project dependencies
44-
run: yarn install --frozen-lockfile --ignore-scripts
44+
run: yarn install --frozen-lockfile
4545

4646
- name: Build the test-runner (using Node ${{ matrix.node-version }})
4747
run: bin/test.sh

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
node_modules
22
dist
3+
.pnp.*
4+
.yarn/*
5+
!.yarn/patches
6+
!.yarn/plugins
7+
!.yarn/releases
8+
!.yarn/sdks
9+
!.yarn/versions
310

411
/numbers.js
512
/numbers.spec.js
@@ -23,4 +30,4 @@ yarn-error.log
2330
# Fixture development files
2431
/test/fixtures/**/node_modules
2532
/test/fixtures/**/package-lock.json
26-
/test/fixtures/**/results.json
33+
/test/fixtures/**/results.json

.yarn/releases/yarn-3.6.0.cjs

Lines changed: 874 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
nodeLinker: node-modules
2+
3+
yarnPath: .yarn/releases/yarn-3.6.0.cjs

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 4.0.0
4+
5+
- Update dependencies including core-js
6+
- Update Yarn to stable (3+)
7+
- Update bin/\* to use Yarn 3
8+
- Update package.json to use Yarn 3
9+
- Fix linting issues
10+
311
## 3.3.1
412

513
- Fix debug logging

bin/check-formatting.sh

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,51 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

3-
if [ -z "$EXERCISM_PRETTIER_VERSION" ]; then
4-
echo "Pulling prettier version from package.json"
5-
EXERCISM_PRETTIER_VERSION=$(yarn list --pattern prettier | grep -Po '.*\sprettier@\K.*')
3+
set -uo pipefail
4+
5+
if [ -z "${EXERCISM_PRETTIER_VERSION:-}" ]; then
6+
echo "[format] pulling prettier version from yarn.lock using sed"
7+
EXERCISM_PRETTIER_VERSION="$(yarn info prettier --json --name-only | sed -n -e 's/^"prettier@npm://' -e 's/"//p')"
8+
echo "[format] expected version is now ${EXERCISM_PRETTIER_VERSION:-}"
9+
fi
10+
11+
if [ -z "${EXERCISM_PRETTIER_VERSION:-}" ]; then
12+
echo "Version could not be pulled using sed" >&2
13+
echo "[format] pulling prettier version from yarn.lock using grep"
14+
EXERCISM_PRETTIER_VERSION="$(yarn info prettier --json --name-only | grep -Po '"prettier@npm:\K[^"]+')"
15+
echo "[format] expected version is now ${EXERCISM_PRETTIER_VERSION:-}"
616
fi
717

8-
if [ -z "$EXERCISM_PRETTIER_VERSION" ]; then
18+
if [ -z "${EXERCISM_PRETTIER_VERSION:-}" ]; then
19+
echo "Version could not be pulled using grep or sed" >&2
20+
echo ""
921
echo "---------------------------------------------------"
1022
echo "This script requires the EXERCISM_PRETTIER_VERSION variable to work."
1123
echo "Please see https://exercism.org/docs/building/markdown/style-guide for guidance."
1224
echo "---------------------------------------------------"
13-
echo "This is what yarn list reports:"
14-
echo "$(yarn list prettier)"
25+
echo "$(yarn -v)"
26+
echo ""
27+
echo "This is what yarn why reports:"
28+
echo "$ yarn why prettier"
29+
echo "$(yarn why prettier)"
30+
echo ""
31+
echo "And yarn info reports the following:"
32+
echo "$ yarn info prettier --name-only"
33+
echo "$(yarn info prettier --name-only)"
34+
echo ""
35+
echo "This is the version that can be extracted using grep:"
36+
echo "$ yarn info prettier --json --name-only | grep -Po '"prettier@npm:\K[^"]+'"
37+
echo "└─ $(yarn info prettier --json --name-only | grep -Po '"prettier@npm:\K[^"]+')"
1538
echo ""
16-
echo "This is the version that can be extracted:"
17-
echo "$(yarn list --pattern prettier | grep -Po '.*\sprettier@\K.*')"
39+
echo "This is the version that can be extracted using sed:"
40+
echo "$ yarn info prettier --json --name-only | sed -n -e 's/^"prettier@npm://' -e 's/"//p'"
41+
echo "└─ $(yarn info prettier --json --name-only | sed -n -e 's/^"prettier@npm://' -e 's/"//p')"
1842
echo ""
1943
echo "These files are found in the repo root:"
2044
echo "$(ls -p | grep -v /)"
2145
echo "---------------------------------------------------"
2246
exit 1
2347
else
24-
echo "Running format with prettier@$EXERCISM_PRETTIER_VERSION"
48+
echo "[format] running with prettier@$EXERCISM_PRETTIER_VERSION"
2549
fi
2650

27-
npx "prettier@$EXERCISM_PRETTIER_VERSION" --check "**/*.{js,jsx,ts,tsx,css,sass,scss,html,json,md,yml}"
51+
yarn dlx "prettier@$EXERCISM_PRETTIER_VERSION" --check "**/*.{js,jsx,ts,tsx,css,sass,scss,html,json,md,yml}"

bin/format.sh

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,51 @@
11
#!/usr/bin/env bash
22

3-
if [ -z "$EXERCISM_PRETTIER_VERSION" ]; then
4-
echo "Pulling prettier version from package.json"
5-
EXERCISM_PRETTIER_VERSION=$(yarn list --pattern prettier | grep -Po '.*\sprettier@\K.*')
3+
set -uo pipefail
4+
5+
if [ -z "${EXERCISM_PRETTIER_VERSION:-}" ]; then
6+
echo "[format] pulling prettier version from yarn.lock using sed"
7+
EXERCISM_PRETTIER_VERSION="$(yarn info prettier --json --name-only | sed -n -e 's/^"prettier@npm://' -e 's/"//p')"
8+
echo "[format] expected version is now ${EXERCISM_PRETTIER_VERSION:-}"
9+
fi
10+
11+
if [ -z "${EXERCISM_PRETTIER_VERSION:-}" ]; then
12+
echo "Version could not be pulled using sed" >&2
13+
echo "[format] pulling prettier version from yarn.lock using grep"
14+
EXERCISM_PRETTIER_VERSION="$(yarn info prettier --json --name-only | grep -Po '"prettier@npm:\K[^"]+')"
15+
echo "[format] expected version is now ${EXERCISM_PRETTIER_VERSION:-}"
616
fi
717

8-
if [ -z "$EXERCISM_PRETTIER_VERSION" ]; then
18+
if [ -z "${EXERCISM_PRETTIER_VERSION:-}" ]; then
19+
echo "Version could not be pulled using grep or sed" >&2
20+
echo ""
921
echo "---------------------------------------------------"
1022
echo "This script requires the EXERCISM_PRETTIER_VERSION variable to work."
1123
echo "Please see https://exercism.org/docs/building/markdown/style-guide for guidance."
1224
echo "---------------------------------------------------"
13-
echo "This is what yarn list reports:"
14-
echo "$(yarn list prettier)"
25+
echo "$(yarn -v)"
26+
echo ""
27+
echo "This is what yarn why reports:"
28+
echo "$ yarn why prettier"
29+
echo "$(yarn why prettier)"
30+
echo ""
31+
echo "And yarn info reports the following:"
32+
echo "$ yarn info prettier --name-only"
33+
echo "$(yarn info prettier --name-only)"
34+
echo ""
35+
echo "This is the version that can be extracted using grep:"
36+
echo "$ yarn info prettier --json --name-only | grep -Po '"prettier@npm:\K[^"]+'"
37+
echo "└─ $(yarn info prettier --json --name-only | grep -Po '"prettier@npm:\K[^"]+')"
1538
echo ""
16-
echo "This is the version that can be extracted:"
17-
echo "$(yarn list --pattern prettier | grep -Po '.*\sprettier@\K.*')"
39+
echo "This is the version that can be extracted using sed:"
40+
echo "$ yarn info prettier --json --name-only | sed -n -e 's/^"prettier@npm://' -e 's/"//p'"
41+
echo "└─ $(yarn info prettier --json --name-only | sed -n -e 's/^"prettier@npm://' -e 's/"//p')"
1842
echo ""
1943
echo "These files are found in the repo root:"
2044
echo "$(ls -p | grep -v /)"
2145
echo "---------------------------------------------------"
2246
exit 1
2347
else
24-
echo "Running format with prettier@$EXERCISM_PRETTIER_VERSION"
48+
echo "[format] running with prettier@$EXERCISM_PRETTIER_VERSION"
2549
fi
2650

27-
npx "prettier@$EXERCISM_PRETTIER_VERSION" --write "**/*.{js,jsx,ts,tsx,css,sass,scss,html,json,md,yml}"
51+
yarn dlx "prettier@$EXERCISM_PRETTIER_VERSION" --write "**/*.{js,jsx,ts,tsx,css,sass,scss,html,json,md,yml}"

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
1+
/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */
22
module.exports = {
33
preset: 'ts-jest',
44
testEnvironment: 'node',

0 commit comments

Comments
 (0)