Skip to content

Commit

Permalink
fix: doctor PHANTOM_DEPS rule cannot works with node:* (#765)
Browse files Browse the repository at this point in the history
* fix: doctor PHANTOM_DEPS rule cannot works with node:

* ci: upgrade pnpm setup
  • Loading branch information
PeachScript authored Jul 12, 2024
1 parent 17e70a5 commit 02b8de6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
registry-url: 'https://registry.npmjs.org/'

- name: Install pnpm
uses: pnpm/action-setup@v2.2.4
uses: pnpm/action-setup@v4
with:
run_install: false

Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export function isFilePath(path: string) {
}

export function getPkgNameFromPath(p: string) {
return p.match(/^(?:@[a-z\d][\w-.]*\/)?[a-z\d][\w-.]*/i)?.[0];
return p.match(/^(?:@[a-z\d][\w-.]*\/|node:)?[a-z\d][\w-.]*/i)?.[0];
}

export const getDepPkgName = (name: string, packageJson: { name: string }) => {
Expand Down
3 changes: 3 additions & 0 deletions tests/fixtures/doctor/health/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// expect handle pkg name includes .
import 'hello.world';
import 'optional';

// expect pass for Node.js standard library
import 'node:fs';

0 comments on commit 02b8de6

Please sign in to comment.