Skip to content

Commit

Permalink
Try parseArgs fallback for Bun
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Oct 9, 2023
1 parent 192b687 commit c4cebe8
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 46 deletions.
1 change: 0 additions & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1
- run: git apply bun-compat.diff
- run: bun install
- run: bun run build
- run: bun link
Expand Down
42 changes: 0 additions & 42 deletions bun-compat.diff

This file was deleted.

9 changes: 8 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"dependencies": {
"@ericcornelissen/bash-parser": "^0.5.2",
"@npmcli/map-workspaces": "^3.0.4",
"@pkgjs/parseargs": "0.11.0",
"@pnpm/logger": "5.0.0",
"@pnpm/workspace.pkgs-graph": "2.0.7",
"@snyk/github-codeowners": "^1.1.0",
Expand Down Expand Up @@ -74,6 +75,7 @@
"@types/minimist": "1.2.3",
"@types/node": "20.8.3",
"@types/npmcli__map-workspaces": "3.0.2",
"@types/pkgjs__parseargs": "0.10.1",
"@types/webpack": "5.28.3",
"@typescript-eslint/eslint-plugin": "6.7.4",
"@typescript-eslint/parser": "6.7.4",
Expand Down
2 changes: 1 addition & 1 deletion scripts/create-new-plugin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'node:fs/promises';
import path from 'node:path';
import { parseArgs } from 'node:util';
import { parseArgs } from '../src/util/parseArgs.js';

const {
values: { name },
Expand Down
2 changes: 1 addition & 1 deletion src/util/cli-arguments.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { parseArgs } from 'node:util';
import { parseArgs } from './parseArgs.js';

export const helpText = `✂️ Find unused files, dependencies and exports in your JavaScript and TypeScript projects
Expand Down
8 changes: 8 additions & 0 deletions src/util/parseArgs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
let parseArgs: typeof import('node:util').parseArgs;
try {
parseArgs = (await import('node:util')).parseArgs;
} catch (error) {
// @ts-expect-error Almost compatible, let's use the built-in types
parseArgs = (await import('@pkgjs/parseargs')).parseArgs;
}
export { parseArgs };

0 comments on commit c4cebe8

Please sign in to comment.