Skip to content

Commit 958aa89

Browse files
chore: migrate to npm from yarn (#469)
1 parent e8a6ac9 commit 958aa89

20 files changed

+12218
-6197
lines changed

.cspell.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,11 @@
3636
"zizizi",
3737
"codecov"
3838
],
39-
"ignorePaths": ["package.json", "yarn.lock", "coverage", "*.log"]
39+
"ignorePaths": [
40+
"package.json",
41+
"yarn.lock",
42+
"coverage",
43+
"*.log",
44+
".gitignore"
45+
]
4046
}

.github/workflows/test.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ jobs:
1818
uses: actions/setup-node@v4
1919
with:
2020
node-version: lts/*
21-
cache: yarn
22-
- run: yarn --frozen-lockfile
23-
- run: yarn lint
21+
cache: npm
22+
- run: npm ci
23+
- run: npm run lint
2424
test:
2525
strategy:
2626
fail-fast: false
@@ -45,17 +45,17 @@ jobs:
4545
with:
4646
node-version: ${{ matrix.node-version }}
4747
architecture: ${{ steps.calculate_architecture.outputs.result }}
48-
cache: yarn
48+
cache: npm
4949
- name: Install dependencies
5050
run: |
51-
yarn upgrade typescript@^4 --ignore-engines
52-
yarn --frozen-lockfile
53-
if: matrix.node-version == '10.x' || matrix.node-version == '12.x' || matrix.node-version == '14.x' || matrix.node-version == '16.x' || matrix.node-version == '18.x'
51+
npm install -D typescript@^4 --ignore-scripts
52+
npm install --ignore-scripts
53+
if: matrix.node-version == '10.x' || matrix.node-version == '12.x' || matrix.node-version == '14.x'
5454
- name: Install dependencies
55-
run: yarn --frozen-lockfile
56-
if: matrix.node-version != '10.x'
55+
run: npm ci
56+
if: matrix.node-version != '10.x' && matrix.node-version != '12.x' && matrix.node-version != '14.x'
5757
- name: Run tests with coverage
58-
run: yarn test:coverage -- --ci
58+
run: npm run test:coverage -- --ci
5959
- uses: codecov/codecov-action@v5
6060
with:
6161
flags: integration

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
/.nyc_output
44
*.log
55
.eslintcache
6+
.cspellcache
67

78
# IDE
89
.idea
910
.vscode
1011

1112
.DS_Store
12-
package-lock.json
13+
yarn.lock

.husky/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.husky/pre-commit

100755100644
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/bin/sh
2-
. "$(dirname "$0")/_/husky.sh"
3-
4-
npx lint-staged
1+
npx --no-install lint-staged

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ enhanced-resolve will try to resolve requests containing `#` as path and as frag
152152
## Tests
153153

154154
```sh
155-
yarn test
155+
npm run test
156156
```
157157

158158
## Passing options from webpack

lib/CachedInputFileSystem.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ const runCallbacks = (callbacks, err, result) => {
5959
if (error) throw error;
6060
};
6161

62-
// eslint-disable-next-line jsdoc/no-restricted-syntax
62+
// eslint-disable-next-line jsdoc/reject-function-type
6363
/** @typedef {Function} EXPECTED_FUNCTION */
64-
// eslint-disable-next-line jsdoc/no-restricted-syntax
64+
// eslint-disable-next-line jsdoc/reject-any-type
6565
/** @typedef {any} EXPECTED_ANY */
6666

6767
class OperationMergerBackend {

lib/Resolver.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ const {
1717

1818
/** @typedef {import("./ResolverFactory").ResolveOptions} ResolveOptions */
1919

20+
/**
21+
* @typedef {object} KnownContext
22+
* @property {string[]=} environments environments
23+
*/
24+
25+
// eslint-disable-next-line jsdoc/reject-any-type
26+
/** @typedef {KnownContext & Record<any, any>} Context */
27+
2028
/** @typedef {Error & { details?: string }} ErrorWithDetail */
2129

2230
/** @typedef {(err: ErrorWithDetail | null, res?: string | false, req?: ResolveRequest) => void} ResolveCallback */
@@ -289,9 +297,6 @@ const {
289297
/** @typedef {JsonPrimitive | JsonObject | JsonArray} JsonValue */
290298
/** @typedef {{ [Key in string]?: JsonValue | undefined }} JsonObject */
291299

292-
// eslint-disable-next-line jsdoc/require-property
293-
/** @typedef {object} Context */
294-
295300
/**
296301
* @typedef {object} BaseResolveRequest
297302
* @property {string | false} path path
@@ -456,7 +461,7 @@ class Resolver {
456461
}
457462

458463
/**
459-
* @param {object} context context information object
464+
* @param {Context} context context information object
460465
* @param {string} path context path
461466
* @param {string} request request string
462467
* @returns {string | false} result
@@ -483,7 +488,7 @@ class Resolver {
483488
}
484489

485490
/**
486-
* @param {object} context context information object
491+
* @param {Context} context context information object
487492
* @param {string} path context path
488493
* @param {string} request request string
489494
* @param {ResolveContext} resolveContext resolve context

lib/SyncAsyncFileSystemDecorator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
/** @typedef {import("./Resolver").StringCallback} StringCallback */
1010
/** @typedef {import("./Resolver").SyncFileSystem} SyncFileSystem */
1111

12-
// eslint-disable-next-line jsdoc/no-restricted-syntax
12+
// eslint-disable-next-line jsdoc/reject-function-type
1313
/** @typedef {Function} SyncOrAsyncFunction */
14-
// eslint-disable-next-line jsdoc/no-restricted-syntax
14+
// eslint-disable-next-line jsdoc/reject-any-type
1515
/** @typedef {any} ResultOfSyncOrAsyncFunction */
1616

1717
/**

lib/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const memoize = require("./util/memoize");
1010
/** @typedef {import("./CachedInputFileSystem").BaseFileSystem} BaseFileSystem */
1111
/** @typedef {import("./PnpPlugin").PnpApiImpl} PnpApi */
1212
/** @typedef {import("./Resolver")} Resolver */
13+
/** @typedef {import("./Resolver").Context} Context */
1314
/** @typedef {import("./Resolver").FileSystem} FileSystem */
1415
/** @typedef {import("./Resolver").ResolveCallback} ResolveCallback */
1516
/** @typedef {import("./Resolver").ResolveContext} ResolveContext */
@@ -20,16 +21,16 @@ const memoize = require("./util/memoize");
2021

2122
/**
2223
* @typedef {{
23-
* (context: object, path: string, request: string, resolveContext: ResolveContext, callback: ResolveCallback): void;
24-
* (context: object, path: string, request: string, callback: ResolveCallback): void;
24+
* (context: Context, path: string, request: string, resolveContext: ResolveContext, callback: ResolveCallback): void;
25+
* (context: Context, path: string, request: string, callback: ResolveCallback): void;
2526
* (path: string, request: string, resolveContext: ResolveContext, callback: ResolveCallback): void;
2627
* (path: string, request: string, callback: ResolveCallback): void;
2728
* }} ResolveFunctionAsync
2829
*/
2930

3031
/**
3132
* @typedef {{
32-
* (context: object, path: string, request: string): string | false;
33+
* (context: Context, path: string, request: string): string | false;
3334
* (path: string, request: string): string | false;
3435
* }} ResolveFunction
3536
*/

0 commit comments

Comments
 (0)