Skip to content

Commit f8b5dee

Browse files
committed
Fix cleanups
1 parent 55ef36c commit f8b5dee

File tree

8 files changed

+17
-21
lines changed

8 files changed

+17
-21
lines changed

reference/implementing-a-concept-exercise.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ github/exercism
5555
├── <slug>.js
5656
├── <slug>.spec.js
5757
├── package.json
58-
└── yarn.lock
58+
└── pnpm-lock.yaml
5959
</pre>
6060

6161
## Step 1: Add code files
@@ -70,7 +70,7 @@ The configuration files may be copied from another exercise. We aim to keep thes
7070
- `eslint.config.mjs`
7171
- `jest.config.js`
7272
- `package.json`
73-
- `yarn.lock`
73+
- `pnpm-lock.yaml`
7474

7575
The `package.json` file must be edited:
7676

scripts/ci-check.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ if (exercises.length === 1) {
3636
}
3737
}
3838

39-
registerExitHandler();
39+
registerExitHandler(false);
4040

4141
if (!envIsThruthy('SKIP_STUB', false)) {
4242
echo('\n==========\nEnsure stubs are present\n');

scripts/ci.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ if (exercises.length === 0) {
2929
exit(0);
3030
}
3131

32-
registerExitHandler();
32+
registerExitHandler(false);
3333

3434
env['PREPARE'] = false;
3535
env['CLEANUP'] = false;

scripts/helpers.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,9 @@ export function createExercisePackageJson(writeSha = false) {
186186
const packageJson = JSON.parse(packageFile);
187187

188188
// Filter out some unwanted packages and create package.json for exercises
189-
SKIP_PACKAGES_FOR_CHECKSUM.forEach(
190-
(pkg) => delete packageJson['devDependencies'][pkg],
191-
);
189+
SKIP_PACKAGES_FOR_CHECKSUM.forEach((pkg) => {
190+
delete packageJson['devDependencies'][pkg];
191+
});
192192

193193
const shellStr = new shell.ShellString(
194194
JSON.stringify(packageJson, undefined, 2) + '\n',
@@ -375,9 +375,9 @@ export function prepare(assignment) {
375375
}
376376
}
377377

378-
export function registerExitHandler() {
378+
export function registerExitHandler(forceCleanup = true) {
379379
function exitHandler(options, exitCode) {
380-
if (shouldCleanup()) {
380+
if (shouldCleanup() || forceCleanup) {
381381
cleanUp();
382382
}
383383

scripts/lint.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
shouldPrepare,
1818
} from './helpers.mjs';
1919

20-
registerExitHandler();
20+
registerExitHandler(false);
2121

2222
const assignment = exercises.length === 0 ? exercises[0] : undefined;
2323

scripts/pr-check.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ if (exercises.length === 0) {
6464
shell.exit(0);
6565
}
6666

67-
registerExitHandler();
67+
registerExitHandler(false);
6868

6969
if (!envIsThruthy('SKIP_STUB', false)) {
7070
shell.echo('\n==========\nEnsure stubs are present\n');
@@ -75,7 +75,9 @@ if (!envIsThruthy('SKIP_STUB', false)) {
7575

7676
if (noStubs.length > 0) {
7777
shell.echo(`[FAILURE] ${noStubs.length} missing a stub`);
78-
noStubs.forEach((stub) => shell.echo(`${stub} is missing a stub file`));
78+
noStubs.forEach((stub) => {
79+
shell.echo(`${stub} is missing a stub file`);
80+
});
7981
shell.exit(-1);
8082
} else {
8183
shell.echo('[SUCCES] All stubs are present');

scripts/pr.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ if (exercises.length === 0) {
6161
shell.exit(0);
6262
}
6363

64-
registerExitHandler();
64+
registerExitHandler(false);
6565

6666
shell.env['PREPARE'] = false;
6767
shell.env['CLEANUP'] = false;

scripts/sync.mjs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,9 @@
33
/**
44
* Run this script (from root directory):
55
*
6-
* $ corepack yarn sync
6+
* $ corepack pnpm scripts/sync.mjs
77
*
8-
* This script is used to copy the following files to all exercises and keep
9-
* them in sync:
10-
*
11-
* - .eslintrc
12-
* - babel.config.js
13-
* - package.json (modified version)
14-
* - .npmrc
8+
* This script is used to copy the required files.
159
*
1610
* There is a CI step which checks that package.json in root & exercises match
1711
* (see checksum script for more info).

0 commit comments

Comments
 (0)