Skip to content

Commit 4fc3732

Browse files
authored
fix: adds support for node v24 (#993)
## Description It does 2 things: * imports R_OK via constants instead of direct import * replaces 23 node with 24 in CI ## Motivation and Context R_OK was removed from fs in nodejs 24 nodejs/node#49686 ## How Has This Been Tested? <!--- Please describe in detail how you tested your changes. --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> - [x] green ci ## Screenshots <!-- Only if appropriate - feel free to delete this section if it's not applicable --> ## Types of changes <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [x] Bug fix (non-breaking change which fixes an issue) - [ ] Documentation only change - [ ] Refactor (non-breaking change which fixes an issue without changing functionality) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Checklist <!--- Go over all the following points, and put an `x` in all the boxes that apply. --> <!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> - [x] 📖 - My change doesn't require a documentation update, or ... - it _does_ and I have updated it - [x] ⚖️ - The contribution will be subject to [The MIT license](https://github.com/sverweij/dependency-cruiser/blob/main/LICENSE), and I'm OK with that. - The contribution is my own original work. - I am ok with the stuff in [**CONTRIBUTING.md**](https://github.com/sverweij/dependency-cruiser/blob/main/.github/CONTRIBUTING.md).
1 parent 6ad4f12 commit 4fc3732

7 files changed

Lines changed: 18 additions & 12 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
workflow_dispatch:
99

1010
env:
11-
NODE_LATEST: 23.x
11+
NODE_LATEST: 24.x
1212
PLATFORM: ubuntu-latest
1313
CI: true
1414
# the LANG (used by the Intl API, which we use for some of the number
@@ -27,7 +27,7 @@ jobs:
2727
strategy:
2828
fail-fast: false
2929
matrix:
30-
node-version: [18.x, 23.x]
30+
node-version: [18.x, 24.x]
3131
platform: [ubuntu-latest]
3232
runs-on: ${{matrix.platform}}
3333
steps:

.github/workflows/prerelease.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: actions/checkout@v4
1515
- uses: actions/setup-node@v4
1616
with:
17-
node-version: 23.x
17+
node-version: 24.x
1818
registry-url: https://registry.npmjs.org
1919
- run: npm clean-install
2020
- run: npm publish --provenance --access public --tag beta

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: actions/checkout@v4
1515
- uses: actions/setup-node@v4
1616
with:
17-
node-version: 23.x
17+
node-version: 24.x
1818
registry-url: https://registry.npmjs.org
1919
- run: npm clean-install
2020
- run: npm publish --provenance --access public

src/cli/init-config/environment-helpers.mjs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import { readFileSync, readdirSync, accessSync, statSync, R_OK } from "node:fs";
1+
import {
2+
readFileSync,
3+
readdirSync,
4+
accessSync,
5+
statSync,
6+
constants,
7+
} from "node:fs";
28
import { join } from "node:path";
39
import { DEFAULT_CONFIG_FILE_NAME } from "../defaults.mjs";
410

@@ -31,7 +37,7 @@ export function readManifest(pManifestFileName = "./package.json") {
3137
*/
3238
export function fileExists(pFile) {
3339
try {
34-
accessSync(pFile, R_OK);
40+
accessSync(pFile, constants.R_OK);
3541
} catch (pError) {
3642
return false;
3743
}

src/cli/normalize-cli-options.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { accessSync, R_OK } from "node:fs";
1+
import { accessSync, constants } from "node:fs";
22
import { isAbsolute } from "node:path";
33
import {
44
RULES_FILE_NAME_SEARCH_ARRAY,
@@ -43,7 +43,7 @@ function normalizeConfigFileName(pCliOptions, pConfigWrapperName, pDefault) {
4343

4444
function fileExists(pFileName) {
4545
try {
46-
accessSync(pFileName, R_OK);
46+
accessSync(pFileName, constants.R_OK);
4747
return true;
4848
} catch (pError) {
4949
return false;

src/cli/utl/assert-file-existence.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { accessSync, R_OK } from "node:fs";
1+
import { accessSync, constants } from "node:fs";
22

33
export default function assertFileExistence(pDirectoryOrFile) {
44
try {
5-
accessSync(pDirectoryOrFile, R_OK);
5+
accessSync(pDirectoryOrFile, constants.R_OK);
66
} catch (pError) {
77
throw new Error(
88
`Can't open '${pDirectoryOrFile}' for reading. Does it exist?\n`,

src/extract/resolve/resolve-amd.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { accessSync, R_OK } from "node:fs";
1+
import { accessSync, constants } from "node:fs";
22
import { relative, join } from "node:path";
33
import memoize, { memoizeClear } from "memoize";
44
import { isBuiltin } from "./is-built-in.mjs";
55
import pathToPosix from "#utl/path-to-posix.mjs";
66

77
const fileExists = memoize((pFile) => {
88
try {
9-
accessSync(pFile, R_OK);
9+
accessSync(pFile, constants.R_OK);
1010
} catch (pError) {
1111
return false;
1212
}

0 commit comments

Comments
 (0)