From 53b9af59c6191c521d03892f16332b18900e9c02 Mon Sep 17 00:00:00 2001 From: Vasil Rangelov Date: Fri, 26 Jul 2024 15:43:51 +0300 Subject: [PATCH] Use "node:" prefixed imports everywhere, and bump the minimum nodejs version to the ones that support this. CI is updated accordingly. --- .github/workflows/ci.yml | 13 ++++++++++--- appveyor.yml | 2 -- index.js | 2 +- package.json | 3 +++ test/read-file-sync.test.js | 8 ++++---- test/read-file.test.js | 8 ++++---- test/write-file-sync.test.js | 8 ++++---- test/write-file.test.js | 8 ++++---- 8 files changed, 30 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d1b380e..03a9ea0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,12 +8,19 @@ jobs: test: strategy: matrix: - node: [10.x, 12.x, 14.x, 16.x] - runs-on: ubuntu-latest + node: [14.18.0, 14, 16.0.0, 16] + os: [ubuntu-latest, macOS-latest, windows-latest] + exclude: + # Node 14 is not available on macos anymore + - os: macos-latest + node-version: 14 + - os: macos-latest + node-version: 14.18.0 + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - run: npm install diff --git a/appveyor.yml b/appveyor.yml index 1f2b827..02d16fd 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,8 +2,6 @@ environment: matrix: # node.js - - nodejs_version: "10" - - nodejs_version: "12" - nodejs_version: "14" - nodejs_version: "16" diff --git a/index.js b/index.js index 0582868..63f4fcd 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,7 @@ let _fs try { _fs = require('graceful-fs') } catch (_) { - _fs = require('fs') + _fs = require('node:fs') } const universalify = require('universalify') const { stringify, stripBom } = require('./utils') diff --git a/package.json b/package.json index 4d01eb1..f83a820 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,9 @@ ], "author": "JP Richardson ", "license": "MIT", + "engines": { + "node": ">=14.18.0 <15 || >=16" + }, "dependencies": { "universalify": "^2.0.0" }, diff --git a/test/read-file-sync.test.js b/test/read-file-sync.test.js index 7cb60f7..0029d61 100644 --- a/test/read-file-sync.test.js +++ b/test/read-file-sync.test.js @@ -1,7 +1,7 @@ -const assert = require('assert') -const fs = require('fs') -const os = require('os') -const path = require('path') +const assert = require('node:assert') +const fs = require('node:fs') +const os = require('node:os') +const path = require('node:path') const rimraf = require('rimraf') const jf = require('../') diff --git a/test/read-file.test.js b/test/read-file.test.js index d2a5219..de59c05 100644 --- a/test/read-file.test.js +++ b/test/read-file.test.js @@ -1,7 +1,7 @@ -const assert = require('assert') -const fs = require('fs') -const os = require('os') -const path = require('path') +const assert = require('node:assert') +const fs = require('node:fs') +const os = require('node:os') +const path = require('node:path') const rimraf = require('rimraf') const jf = require('../') diff --git a/test/write-file-sync.test.js b/test/write-file-sync.test.js index fe7e835..96d5855 100644 --- a/test/write-file-sync.test.js +++ b/test/write-file-sync.test.js @@ -1,7 +1,7 @@ -const assert = require('assert') -const fs = require('fs') -const os = require('os') -const path = require('path') +const assert = require('node:assert') +const fs = require('node:fs') +const os = require('node:os') +const path = require('node:path') const rimraf = require('rimraf') const jf = require('../') diff --git a/test/write-file.test.js b/test/write-file.test.js index 4dbb4b5..c69e7a7 100644 --- a/test/write-file.test.js +++ b/test/write-file.test.js @@ -1,7 +1,7 @@ -const assert = require('assert') -const fs = require('fs') -const os = require('os') -const path = require('path') +const assert = require('node:assert') +const fs = require('node:fs') +const os = require('node:os') +const path = require('node:path') const rimraf = require('rimraf') const jf = require('../')