Comparing version 10.1.3 to 11.0.0
@@ -1,2 +0,5 @@ | ||
import {PackageJson} from 'type-fest'; | ||
import type { | ||
CamelCasedProperties, | ||
PackageJson, | ||
} from 'type-fest'; | ||
@@ -15,3 +18,3 @@ export type FlagType = 'string' | 'boolean' | 'number'; | ||
export interface Flag<Type extends FlagType, Default, IsMultiple = false> { | ||
export type Flag<Type extends FlagType, Default, IsMultiple = false> = { | ||
readonly type?: Type; | ||
@@ -22,3 +25,3 @@ readonly alias?: string; | ||
readonly isMultiple?: IsMultiple; | ||
} | ||
}; | ||
@@ -31,3 +34,3 @@ type StringFlag = Flag<'string', string> | Flag<'string', string[], true>; | ||
export interface Options<Flags extends AnyFlags> { | ||
export type Options<Flags extends AnyFlags> = { | ||
/** | ||
@@ -219,3 +222,3 @@ Pass in [`import.meta`](https://nodejs.org/dist/latest/docs/api/esm.html#esm_import_meta). This is used to find the correct package.json file. | ||
readonly allowUnknownFlags?: boolean; | ||
} | ||
}; | ||
@@ -244,3 +247,3 @@ type TypedFlag<Flag extends AnyFlag> = | ||
export interface Result<Flags extends AnyFlags> { | ||
export type Result<Flags extends AnyFlags> = { | ||
/** | ||
@@ -254,3 +257,3 @@ Non-flag arguments. | ||
*/ | ||
flags: TypedFlags<Flags> & Record<string, unknown>; | ||
flags: CamelCasedProperties<TypedFlags<Flags>> & Record<string, unknown>; | ||
@@ -283,3 +286,3 @@ /** | ||
showVersion: () => void; | ||
} | ||
}; | ||
/** | ||
@@ -286,0 +289,0 @@ @param helpMessage - Shortcut for the `help` option. |
17
index.js
@@ -85,3 +85,3 @@ import {dirname} from 'node:path'; | ||
flag.type = flag.type ? `${flag.type}-array` : 'array'; | ||
flag.default = flag.default || []; | ||
flag.default = flag.default ?? []; | ||
delete flag.isMultiple; | ||
@@ -111,3 +111,3 @@ } | ||
if (!(options.importMeta && options.importMeta.url)) { | ||
if (!options.importMeta?.url) { | ||
throw new TypeError('The `importMeta` option is required. Its value must be `import.meta`.'); | ||
@@ -152,2 +152,13 @@ } | ||
// Add --help and --version to known flags if autoHelp or autoVersion are set | ||
if (!options.allowUnknownFlags) { | ||
if (options.autoHelp && !parserOptions.help) { | ||
parserOptions.help = {type: 'boolean'}; | ||
} | ||
if (options.autoVersion && !parserOptions.version) { | ||
parserOptions.version = {type: 'boolean'}; | ||
} | ||
} | ||
parserOptions = buildParserOptions(parserOptions); | ||
@@ -171,3 +182,3 @@ | ||
const argv = parseArguments(options.argv, parserOptions); | ||
let help = redent(trimNewlines((options.help || '').replace(/\t+\n*$/, '')), 2); | ||
let help = redent(trimNewlines((options.help ?? '').replace(/\t+\n*$/, '')), 2); | ||
@@ -174,0 +185,0 @@ normalizePackageData(package_); |
{ | ||
"name": "meow", | ||
"version": "10.1.3", | ||
"version": "11.0.0", | ||
"description": "CLI app helper", | ||
@@ -14,5 +14,8 @@ "license": "MIT", | ||
"type": "module", | ||
"exports": "./index.js", | ||
"exports": { | ||
"types": "./index.d.ts", | ||
"default": "./index.js" | ||
}, | ||
"engines": { | ||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0" | ||
"node": ">=14.16" | ||
}, | ||
@@ -47,21 +50,21 @@ "scripts": { | ||
"@types/minimist": "^1.2.2", | ||
"camelcase-keys": "^7.0.0", | ||
"decamelize": "^5.0.0", | ||
"camelcase-keys": "^8.0.2", | ||
"decamelize": "^6.0.0", | ||
"decamelize-keys": "^1.1.0", | ||
"hard-rejection": "^2.1.0", | ||
"minimist-options": "4.1.0", | ||
"normalize-package-data": "^3.0.2", | ||
"read-pkg-up": "^8.0.0", | ||
"normalize-package-data": "^4.0.1", | ||
"read-pkg-up": "^9.1.0", | ||
"redent": "^4.0.0", | ||
"trim-newlines": "^4.0.2", | ||
"type-fest": "^1.2.2", | ||
"yargs-parser": "^20.2.9" | ||
"type-fest": "^3.1.0", | ||
"yargs-parser": "^21.1.1" | ||
}, | ||
"devDependencies": { | ||
"ava": "^3.15.0", | ||
"ava": "^4.3.3", | ||
"execa": "^6.1.0", | ||
"indent-string": "^5.0.0", | ||
"read-pkg": "^7.1.0", | ||
"tsd": "^0.20.0", | ||
"xo": "^0.48.0" | ||
"tsd": "^0.24.1", | ||
"xo": "^0.52.4" | ||
}, | ||
@@ -68,0 +71,0 @@ "xo": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25292
458
+ Addedcamelcase@7.0.1(transitive)
+ Addedcamelcase-keys@8.0.2(transitive)
+ Addeddecamelize@6.0.0(transitive)
+ Addedfind-up@6.3.0(transitive)
+ Addedhosted-git-info@5.2.1(transitive)
+ Addedlocate-path@7.2.0(transitive)
+ Addedlru-cache@7.18.3(transitive)
+ Addednormalize-package-data@4.0.1(transitive)
+ Addedp-limit@4.0.0(transitive)
+ Addedp-locate@6.0.0(transitive)
+ Addedpath-exists@5.0.0(transitive)
+ Addedquick-lru@6.1.2(transitive)
+ Addedread-pkg@7.1.0(transitive)
+ Addedread-pkg-up@9.1.0(transitive)
+ Addedtype-fest@2.19.03.13.1(transitive)
+ Addedyargs-parser@21.1.1(transitive)
+ Addedyocto-queue@1.1.1(transitive)
- Removedcamelcase@6.3.0(transitive)
- Removedcamelcase-keys@7.0.2(transitive)
- Removeddecamelize@5.0.1(transitive)
- Removedfind-up@5.0.0(transitive)
- Removedlocate-path@6.0.0(transitive)
- Removedp-limit@3.1.0(transitive)
- Removedp-locate@5.0.0(transitive)
- Removedpath-exists@4.0.0(transitive)
- Removedquick-lru@5.1.1(transitive)
- Removedread-pkg@6.0.0(transitive)
- Removedread-pkg-up@8.0.0(transitive)
- Removedtype-fest@1.4.0(transitive)
- Removedyargs-parser@20.2.9(transitive)
- Removedyocto-queue@0.1.0(transitive)
Updatedcamelcase-keys@^8.0.2
Updateddecamelize@^6.0.0
Updatedread-pkg-up@^9.1.0
Updatedtype-fest@^3.1.0
Updatedyargs-parser@^21.1.1