Skip to content

Commit

Permalink
fix(build): update typescript / eslint / rollup deps fixing bundling …
Browse files Browse the repository at this point in the history
…of yargs (#2384)

build(node)!: require Node >= 16.15.1
  • Loading branch information
bcoe committed Jan 4, 2024
1 parent e517318 commit d92984d
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 44 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/ci.yaml
Expand Up @@ -13,13 +13,13 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [12, 14, 16]
node: [16, 18, 20]
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- run: npm install -g npm@7
- run: npm install -g npm@8
- run: node --version
- run: npm install --engine-strict
- run: npm test
Expand All @@ -29,21 +29,21 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
- run: npm install -g npm@7
node-version: 20
- run: npm install -g npm@8
- run: npm install
- run: npm test
esm:
runs-on: ubuntu-latest
strategy:
matrix:
node: [14]
node: [20]
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- run: npm install -g npm@7
- run: npm install -g npm@8
- run: node --version
- run: npm install --engine-strict
- run: npm run test:esm
Expand All @@ -53,8 +53,8 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14
- run: npm install -g npm@7
node-version: 20
- run: npm install -g npm@8
- run: npm install
- run: npm run compile
- uses: denoland/setup-deno@v1
Expand All @@ -69,8 +69,8 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 15
- run: npm install -g npm@7
node-version: 20
- run: npm install -g npm@8
- run: npm install
- run: npm test
- run: npm run coverage
5 changes: 2 additions & 3 deletions .github/workflows/release-please.yml
Expand Up @@ -12,16 +12,15 @@ jobs:

runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
- uses: google-github-actions/release-please-action@v4
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: node
package-name: yargs
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14
node-version: 20
- run: npm install npm@latest -g
- run: npm install
- run: npm run compile
Expand Down
2 changes: 1 addition & 1 deletion lib/argsert.ts
Expand Up @@ -16,7 +16,7 @@ export function argsert(
function parseArgs(): [
Pick<ParsedCommand, 'demanded' | 'optional'>,
any[],
number?
number?,
] {
return typeof arg1 === 'object'
? [{demanded: [], optional: []}, arg1, arg2 as number | undefined]
Expand Down
7 changes: 4 additions & 3 deletions lib/middleware.ts
Expand Up @@ -119,9 +119,10 @@ export function applyMiddleware(
}

export interface MiddlewareCallback {
(argv: Arguments, yargs: YargsInstance):
| Partial<Arguments>
| Promise<Partial<Arguments>>;
(
argv: Arguments,
yargs: YargsInstance
): Partial<Arguments> | Promise<Partial<Arguments>>;
}

export interface Middleware extends MiddlewareCallback {
Expand Down
8 changes: 4 additions & 4 deletions lib/usage.ts
Expand Up @@ -363,8 +363,8 @@ export function usage(yargs: YargsInstance, shim: PlatformShim) {
? '-'
: '--'
: sw.length > 1
? '--'
: '-') + sw
? '--'
: '-') + sw
);
}
})
Expand All @@ -373,8 +373,8 @@ export function usage(yargs: YargsInstance, shim: PlatformShim) {
isLongSwitch(sw1) === isLongSwitch(sw2)
? 0
: isLongSwitch(sw1)
? 1
: -1
? 1
: -1
)
.join(', ');

Expand Down
27 changes: 15 additions & 12 deletions lib/yargs-factory.ts
Expand Up @@ -1656,7 +1656,7 @@ export class YargsInstance {
| Exclude<DictionaryKeyof<Options>, DictionaryKeyof<Options, any[]>>
| 'default',
K extends keyof Options[T] & string = keyof Options[T] & string,
V extends ValueOf<Options[T]> = ValueOf<Options[T]>
V extends ValueOf<Options[T]> = ValueOf<Options[T]>,
>(
builder: (key: K, value: V, ...otherArgs: any[]) => YargsInstance,
type: T,
Expand All @@ -1678,7 +1678,7 @@ export class YargsInstance {
K extends keyof Options[T] & string = keyof Options[T] & string,
V extends ValueOf<ValueOf<Options[T]>> | ValueOf<ValueOf<Options[T]>>[] =
| ValueOf<ValueOf<Options[T]>>
| ValueOf<ValueOf<Options[T]>>[]
| ValueOf<ValueOf<Options[T]>>[],
>(
builder: (key: K, value: V, ...otherArgs: any[]) => YargsInstance,
type: T,
Expand All @@ -1700,7 +1700,7 @@ export class YargsInstance {
[kPopulateParserHintDictionary]<
T extends keyof Options,
K extends keyof Options[T],
V
V,
>(
builder: (key: K, value: V, ...otherArgs: any[]) => YargsInstance,
type: T,
Expand Down Expand Up @@ -1876,15 +1876,18 @@ export class YargsInstance {
// add all groups not set to local to preserved groups
Object.assign(
this.#preservedGroups,
Object.keys(this.#groups).reduce((acc, groupName) => {
const keys = this.#groups[groupName].filter(
key => !(key in localLookup)
);
if (keys.length > 0) {
acc[groupName] = keys;
}
return acc;
}, {} as Dictionary<string[]>)
Object.keys(this.#groups).reduce(
(acc, groupName) => {
const keys = this.#groups[groupName].filter(
key => !(key in localLookup)
);
if (keys.length > 0) {
acc[groupName] = keys;
}
return acc;
},
{} as Dictionary<string[]>
)
);
// groups can now be reset
this.#groups = {};
Expand Down
21 changes: 11 additions & 10 deletions package.json
Expand Up @@ -62,27 +62,28 @@
"yargs-parser": "^21.1.1"
},
"devDependencies": {
"@rollup/plugin-terser": "^0.4.4",
"@types/chai": "^4.2.11",
"@types/mocha": "^9.0.0",
"@types/node": "^18.0.0",
"c8": "^7.7.0",
"browserslist-generator": "^2.0.1",
"c8": "^9.0.0",
"chai": "^4.2.0",
"chalk": "^4.0.0",
"concurrently": "^7.6.0",
"coveralls": "^3.0.9",
"cpr": "^3.0.1",
"cross-env": "^7.0.2",
"cross-spawn": "^7.0.0",
"eslint": "^7.23.0",
"gts": "^3.0.0",
"eslint": "^8.56.0",
"eslint-plugin-prettier": "^5.1.2",
"gts": "^5.2.0",
"hashish": "0.0.4",
"mocha": "^9.0.0",
"rimraf": "^3.0.2",
"rollup": "^2.23.0",
"rollup-plugin-cleanup": "^3.1.1",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-ts": "^2.0.4",
"typescript": "^4.0.2",
"rollup": "^3.29.4",
"rollup-plugin-cleanup": "^3.2.1",
"rollup-plugin-ts": "^3.4.5",
"typescript": "^5.3.3",
"which": "^2.0.0",
"yargs-test-extends": "^1.0.1"
},
Expand Down Expand Up @@ -122,6 +123,6 @@
],
"license": "MIT",
"engines": {
"node": ">=12"
"node": ">=16.15.1"
}
}
2 changes: 1 addition & 1 deletion rollup.config.cjs
@@ -1,6 +1,6 @@
const cleanup = require('rollup-plugin-cleanup');
const ts = require('rollup-plugin-ts');
const {terser} = require('rollup-plugin-terser');
const terser = require('@rollup/plugin-terser');

const output = {
format: 'cjs',
Expand Down

0 comments on commit d92984d

Please sign in to comment.