Skip to content

Commit 2db1e30

Browse files
committed
fix(deps)update dependencies
1 parent 1fd2b10 commit 2db1e30

8 files changed

Lines changed: 753 additions & 3500 deletions

File tree

.eslintrc.js

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

.github/workflows/node.js.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
1+
# This workflow installs dependencies, runs lint, and executes tests on supported Node.js versions.
32

43
name: Node.js CI
54

@@ -15,30 +14,33 @@ jobs:
1514

1615
strategy:
1716
matrix:
18-
node-version: [14.x, 15.x, 16.x, 18.x]
17+
node-version: [22.13.0, 24.x]
1918

2019
steps:
21-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v4
2221
- name: Use Node.js ${{ matrix.node-version }}
23-
uses: actions/setup-node@v2
22+
uses: actions/setup-node@v4
2423
with:
2524
node-version: ${{ matrix.node-version }}
25+
cache: yarn
2626
- run: yarn
27+
- run: yarn lint
2728
- run: yarn test
2829

2930
windows:
3031
runs-on: windows-latest
3132

3233
strategy:
3334
matrix:
34-
node-version: [18.x]
35+
node-version: [22.13.0]
3536

3637
steps:
37-
- uses: actions/checkout@v2
38+
- uses: actions/checkout@v4
3839
- name: Use Node.js ${{ matrix.node-version }} with windows
39-
uses: actions/setup-node@v2
40+
uses: actions/setup-node@v4
4041
with:
4142
node-version: ${{ matrix.node-version }}
43+
cache: yarn
4244
- run: yarn
4345
- run: scripts\prepareTests.ps1
44-
- run: yarn jest --testTimeout 30000
46+
- run: yarn vitest run --testTimeout=30000

eslint.config.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const js = require('@eslint/js');
2+
3+
module.exports = [
4+
js.configs.recommended,
5+
{
6+
files: ['src/**/*.js', 'tests/**/*.js'],
7+
languageOptions: {
8+
ecmaVersion: 2020,
9+
sourceType: 'commonjs',
10+
globals: {
11+
afterEach: 'readonly',
12+
beforeEach: 'readonly',
13+
console: 'readonly',
14+
describe: 'readonly',
15+
expect: 'readonly',
16+
process: 'readonly',
17+
test: 'readonly',
18+
},
19+
},
20+
rules: {},
21+
},
22+
];

package.json

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"bin": "src/index.js",
66
"scripts": {
77
"lint": "eslint src tests",
8-
"test": "scripts/prepareTests.sh && jest tests",
9-
"jest": "jest tests"
8+
"test": "scripts/prepareTests.sh && vitest run",
9+
"vitest": "vitest run"
1010
},
1111
"contributors": [
1212
{
@@ -20,19 +20,20 @@
2020
],
2121
"dependencies": {
2222
"comment-json": "^4.2.3",
23-
"glob": "^7.1.6",
24-
"js-yaml": "^4.0.0",
25-
"minimatch": "^3.0.5",
23+
"fast-glob": "^3.3.3",
24+
"js-yaml": "^4.1.1",
25+
"minimatch": "^9.0.5",
2626
"minimist": "^1.2.5"
2727
},
2828
"devDependencies": {
29-
"eslint": "^7.7.0",
30-
"eslint-plugin-jest": "^23.20.0",
29+
"@eslint/js": "^10.0.1",
30+
"eslint": "^10.0.3",
3131
"exec-sh": "^0.3.4",
32-
"jest": "^26.4.0"
32+
"vite": "^8.0.1",
33+
"vitest": "^4.1.0"
3334
},
3435
"engines": {
35-
"node": ">=14.0.0"
36+
"node": ">=22.13.0"
3637
},
3738
"license": "MIT",
3839
"keywords": [
@@ -60,12 +61,5 @@
6061
"url": "https://github.com/eBayClassifiedsGroup/update-ts-references/issues"
6162
},
6263
"homepage": "https://github.com/eBayClassifiedsGroup/update-ts-references",
63-
"jest": {
64-
"verbose": true,
65-
"modulePathIgnorePatterns": [
66-
"<rootDir>/test-scenarios/",
67-
"<rootDir>/test-run/"
68-
]
69-
},
7064
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
7165
}

src/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env node
22

3-
/* eslint-disable no-console */
43
const minimist = require('minimist');
54
const { execute, defaultOptions } = require('./update-ts-references');
65

src/update-ts-references.js

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
const glob = require('glob');
1+
const fastGlob = require('fast-glob');
22
const path = require('path');
33
const fs = require('fs');
44
const yaml = require('js-yaml');
5-
const minimatch = require('minimatch');
5+
const { minimatch } = require('minimatch');
66
const {
77
parse,
88
stringify,
@@ -41,19 +41,7 @@ const getAllPackageJsons = async (workspaces, cwd) => {
4141
});
4242

4343
return Promise.all(
44-
workspaceGlobs.map(
45-
(workspace) =>
46-
new Promise((resolve, reject) => {
47-
glob(`${workspace}/${PACKAGE_JSON}`, { cwd }, (error, files) => {
48-
if (error) {
49-
reject(error);
50-
}
51-
resolve(files);
52-
});
53-
}),
54-
55-
[]
56-
)
44+
workspaceGlobs.map((workspace) => fastGlob(`${workspace}/${PACKAGE_JSON}`, { cwd, onlyFiles: true }))
5745
)
5846
.then((allPackages) =>
5947
allPackages.reduce(
@@ -216,7 +204,7 @@ const updateTsConfig = (
216204
if (createPathMappings)
217205
assert.deepEqual(JSON.parse(JSON.stringify(config?.compilerOptions?.paths ?? {})), paths);
218206
isEqual = true;
219-
} catch (e) {
207+
} catch {
220208
// ignore me
221209
}
222210
if (!isEqual) {
@@ -243,7 +231,7 @@ const updateTsConfig = (
243231
} catch (error) {
244232
console.error(`could not read ${tsconfigFilePath}`, error);
245233
if (strict)
246-
throw new Error('Expect always a tsconfig.json in the package directory while running in strict mode')
234+
throw new Error('Expect always a tsconfig.json in the package directory while running in strict mode', { cause: error })
247235
}
248236
};
249237

@@ -269,7 +257,6 @@ const execute = async ({
269257
...configurable
270258
}) => {
271259
let changesCount = 0;
272-
// eslint-disable-next-line no-console
273260
console.log('updating tsconfigs');
274261
const packageJson = require(path.join(cwd, PACKAGE_JSON));
275262

@@ -336,8 +323,6 @@ const execute = async ({
336323
console.log('packagesMap', packagesMap);
337324
}
338325

339-
let rootReferences = [];
340-
let rootPaths = [];
341326
let tsconfigMap = {}
342327
let jsconfigMap = {}
343328
const referencesMap = {}
@@ -416,14 +401,13 @@ const execute = async ({
416401
} else {
417402
const detectedJsConfig = jsconfigMap[packageName]?.detectedConfig
418403
if (!detectedJsConfig) {
419-
// eslint-disable-next-line no-console
420404
console.log(`NO ${configName === TSCONFIG_JSON ? configName : `${configName} nor ${TSCONFIG_JSON}`} for ${packageName}`);
421405
}
422406
}
423407
});
424408

425-
rootReferences = rootReferenceCandidates.filter(({ name }) => !referencedPackageNames.has(name));
426-
rootPaths = getPathsFromReferences(rootReferences, tsconfigMap, {}, ignorePathMappings)
409+
const rootReferences = rootReferenceCandidates.filter(({ name }) => !referencedPackageNames.has(name));
410+
const rootPaths = getPathsFromReferences(rootReferences, tsconfigMap, {}, ignorePathMappings)
427411

428412
if (verbose) {
429413
console.log('rootReferences', rootReferences);

vitest.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = {
2+
test: {
3+
environment: 'node',
4+
globals: true,
5+
include: ['tests/**/*.test.js'],
6+
exclude: ['test-run/**', 'test-scenarios/**'],
7+
},
8+
};

0 commit comments

Comments
 (0)