Skip to content

Commit 55ef36c

Browse files
committed
Update latent references
1 parent ec07318 commit 55ef36c

File tree

7 files changed

+55
-67
lines changed

7 files changed

+55
-67
lines changed

CONTRIBUTING.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ We have various `scripts` to aid with maintaining and contributing to this repos
214214

215215
```js
216216
/*
217-
* Run this script (from root directory): npx babel-node scripts/format
217+
* Run this script (from root directory): corepack pnpm node scripts/format.mjs
218218
*
219219
* This runs `prettier` on all applicable files, FORCES using the same version
220220
* as the CI uses to check if the files have been formatted.
@@ -239,7 +239,17 @@ If the `ASSIGNMENT` environment variable is set, only _that_ exercise is tested.
239239
For example, if you only want to lint `two-fer`, you may, depending on your environment use:
240240

241241
```shell
242-
ASSIGNMENT=two-fer npx babel-node scripts/lint
242+
ASSIGNMENT=practice/two-fer corepack pnpm node scripts/lint.mjs
243+
```
244+
245+
Note: on Windows, if you're not in a POSIX style command line, you can use `cross-env` to make this work:
246+
247+
```shell
248+
# if installed globally
249+
cross-env ASSIGNMENT=practice/two-fer corepack pnpm node scripts/lint.mjs
250+
251+
# otherwise
252+
corepack pnpm dlx cross-env ASSIGNMENT=practice/two-fer node scripts/lint.mjs
243253
```
244254

245255
#### `test`

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Configlet](https://github.com/exercism/javascript/actions/workflows/configlet.yml/badge.svg)](https://github.com/exercism/javascript/actions/workflows/configlet.yml) [![javascript / main](https://github.com/exercism/javascript/workflows/javascript%20/%20main/badge.svg)](https://github.com/exercism/javascript/actions?query=workflow%3A%22javascript+%2F+main%22)
44

5-
> [!IMPORTANT]
5+
> [!IMPORTANT]
66
> We 💙 our community but **this repository does not accept community contributions at this time**.<br>
77
> There are no active maintainers to review PRs.<br>
88
> Please read this [community blog post][freeing-maintainers] for details.
@@ -48,21 +48,25 @@ This runs `jest` tests for all sample solutions.
4848
This _does not_ use the regular way to run `jest`, because the example solution files must be renamed to be imported correctly into the test files.
4949

5050
```shell
51-
npx babel-node scripts/test
51+
corepack pnpm node scripts/test.mjs
5252
```
5353

5454
If the `ASSIGNMENT` environment variable is set, only _that_ exercise is tested.
5555
For example, if you only want to test the `example.js` for the practice exercise `two-fer`, you may, depending on your environment, use:
5656

5757
```shell
58-
ASSIGNMENT=practice/two-fer npx babel-node scripts/test
58+
ASSIGNMENT=practice/two-fer corepack pnpm node scripts/test.mjs
5959
```
6060

6161
> Running on Windows? Depending on your shell, environment variables are set differently.
6262
> You can use `cross-env` to normalize this. The following should work across environments:
6363
>
6464
> ```bash
65-
> npx cross-env ASSIGNMENT=practice/two-fer babel-node scripts/test
65+
> # if installed globally
66+
> cross-env ASSIGNMENT=practice/two-fer corepack pnpm node scripts/test.mjs
67+
>
68+
> # otherwise
69+
> corepack pnpm dlx cross-env ASSIGNMENT=practice/two-fer node scripts/test.mjs
6670
> ```
6771
6872
## Related repositories

exercise-package.json

Lines changed: 0 additions & 37 deletions
This file was deleted.

reference/implementing-a-concept-exercise.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@ github/exercism
4747
| |── config.json
4848
| |── design.md
4949
| └── exemplar.js
50-
├── .eslintrc
5150
├── .gitignore
5251
├── babel.config.js
52+
├── eslint.config.mjs
5353
├── global.d.ts (only if there are complex types required)
54+
├── jest.config.js
5455
├── &lt;slug&gt;.js
5556
├── &lt;slug&gt;.spec.js
5657
├── package.json
@@ -64,9 +65,10 @@ The configuration files may be copied from another exercise. We aim to keep thes
6465
> [!WARNING]
6566
> Just like with _practice_ exercises, we will provide a script for you to run. This script needs to be updated from its v2 version, which has not yet been done.
6667
67-
- `.eslintrc`
6868
- `.gitignore`
6969
- `babel.config.js`
70+
- `eslint.config.mjs`
71+
- `jest.config.js`
7072
- `package.json`
7173
- `yarn.lock`
7274

scripts/checksum.mjs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,20 +99,25 @@ function checksumAll(filename, rootFileName = filename) {
9999
`Checking integrity of ${filename} in all ${_assignments.length} exercises`,
100100
);
101101

102-
_assignments.forEach((assignment) =>
103-
checksumAssignment(assignment, filename, rootFileName, expectedSha),
104-
);
102+
_assignments.forEach((assignment) => {
103+
checksumAssignment(assignment, filename, rootFileName, expectedSha);
104+
});
105105
}
106106

107107
registerExitHandler();
108108
createExercisePackageJson(true);
109109

110110
checksumAll('package.json', 'exercise-package.json');
111111

112-
['.eslintrc', '.npmrc', 'babel.config.js', 'LICENSE', '.gitignore'].forEach(
113-
(fileToCheck) => {
114-
checksumAll(fileToCheck);
115-
},
116-
);
112+
[
113+
'.gitignore',
114+
'.npmrc',
115+
'babel.config.js',
116+
'eslint.config.mjs',
117+
'jest.config.js',
118+
'LICENSE',
119+
].forEach((fileToCheck) => {
120+
checksumAll(fileToCheck);
121+
});
117122

118123
echo('All files passed the checksum test');

scripts/ci-check.mjs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ if (!envIsThruthy('SKIP_STUB', false)) {
4747

4848
if (noStubs.length > 0) {
4949
echo(`[FAILURE] ${noStubs.length} missing a stub`);
50-
noStubs.forEach((stub) => echo(`${stub} is missing a stub file`));
50+
noStubs.forEach((stub) => {
51+
echo(`${stub} is missing a stub file`);
52+
});
5153
exit(-1);
5254
} else {
5355
echo('[SUCCES] All stubs are present');
@@ -61,15 +63,15 @@ if (!envIsThruthy('SKIP_INTEGRITY', false)) {
6163
// TODO: be able to pass in any amount of exercises at once
6264
if (exercises.length >= 8) {
6365
const checkResult = exec(
64-
`npx babel-node ${join('scripts', 'checksum')}`,
66+
`corepack pnpm node ${join('scripts', 'checksum.mjs')}`,
6567
).code;
6668

6769
if (checkResult !== 0) {
6870
exit(checkResult);
6971
}
7072

7173
const nameCheckResult = exec(
72-
`npx babel-node ${join('scripts', 'name-check')}`,
74+
`corepack pnpm node ${join('scripts', 'name-check.mjs')}`,
7375
).code;
7476

7577
if (nameCheckResult !== 0) {
@@ -80,15 +82,15 @@ if (!envIsThruthy('SKIP_INTEGRITY', false)) {
8082
env['ASSIGNMENT'] = exercise;
8183

8284
const checkResult = exec(
83-
`npx babel-node ${join('scripts', 'checksum')}`,
85+
`corepack pnpm node ${join('scripts', 'checksum.mjs')}`,
8486
).code;
8587

8688
if (checkResult !== 0) {
8789
exit(checkResult);
8890
}
8991

9092
const nameCheckResult = exec(
91-
`npx babel-node ${join('scripts', 'name-check')}`,
93+
`corepack pnpm node ${join('scripts', 'name-check.mjs')}`,
9294
).code;
9395

9496
if (nameCheckResult !== 0) {
@@ -98,15 +100,15 @@ if (!envIsThruthy('SKIP_INTEGRITY', false)) {
98100
}
99101

100102
const nameUniqResult = exec(
101-
`npx babel-node ${join('scripts', 'name-uniq')}`,
103+
`corepack pnpm node ${join('scripts', 'name-uniq.mjs')}`,
102104
).code;
103105

104106
if (nameUniqResult !== 0) {
105107
exit(nameUniqResult);
106108
}
107109

108110
const directoryResult = exec(
109-
`npx babel-node ${join('scripts', 'directory-check')}`,
111+
`corepack pnpm node ${join('scripts', 'directory-check.mjs')}`,
110112
).code;
111113

112114
if (directoryResult !== 0) {
@@ -135,7 +137,9 @@ exercises.forEach(prepare);
135137

136138
env['CLEANUP'] = true;
137139

138-
const checkResult = exec(`npx babel-node ${join('scripts', 'lint')}`).code;
139-
if (checkResult != 0) {
140+
const checkResult = exec(
141+
`corepack pnpm node ${join('scripts', 'lint.mjs')}`,
142+
).code;
143+
if (checkResult !== 0) {
140144
exit(checkResult);
141145
}

scripts/sync.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import shell from 'shelljs';
2121
import * as helpers from './helpers.mjs';
2222
import path from 'node:path';
2323

24-
const assignment = shell.env['ASSIGNMENT'];
24+
const assignmentFromEnv = shell.env['ASSIGNMENT'];
2525

2626
function copyConfigForAssignment(assignment) {
2727
const destination = path.join('exercises', assignment);
@@ -82,13 +82,13 @@ function getCurrentPackageJson(assignmentPackageFilename) {
8282
helpers.registerExitHandler();
8383
helpers.createExercisePackageJson(false);
8484

85-
if (assignment) {
86-
if (!helpers.assertAssignment(assignment)) {
85+
if (assignmentFromEnv) {
86+
if (!helpers.assertAssignment(assignmentFromEnv)) {
8787
shell.exit(1);
8888
}
8989

90-
shell.echo('Syncing ' + assignment + '...');
91-
copyConfigForAssignment(assignment);
90+
shell.echo('Syncing ' + assignmentFromEnv + '...');
91+
copyConfigForAssignment(assignmentFromEnv);
9292
} else {
9393
shell.echo('Syncing all assignments...');
9494
helpers.assignments.forEach((assignment) => {

0 commit comments

Comments
 (0)