@oclif/core 1.13.6 → 1.13.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,27 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.13.9](https://github.com/oclif/core/compare/v1.13.8...v1.13.9) (2022-08-09)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * remove json flag if subclass overrides enableJsonFlag ([#467](https://github.com/oclif/core/issues/467)) ([05dd12a](https://github.com/oclif/core/commit/05dd12ad114f37d0512df2d89a8e51d0984fa3d4))
11
+
12
+ ### [1.13.8](https://github.com/oclif/core/compare/v1.13.7...v1.13.8) (2022-08-09)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * revert [#460](https://github.com/oclif/core/issues/460) ([#466](https://github.com/oclif/core/issues/466)) ([4c28acf](https://github.com/oclif/core/commit/4c28acfc2131eadbac423fa722b8cc0dc16a1b5b))
18
+
19
+ ### [1.13.7](https://github.com/oclif/core/compare/v1.13.6...v1.13.7) (2022-08-08)
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * types on custom flags ([#463](https://github.com/oclif/core/issues/463)) ([2728e23](https://github.com/oclif/core/commit/2728e2310406137e0356d039a90d321daafd6578))
25
+
5
26
  ### [1.13.6](https://github.com/oclif/core/compare/v1.13.5...v1.13.6) (2022-08-08)
6
27
 
7
28
 
package/lib/command.js CHANGED
@@ -48,10 +48,11 @@ class Command {
48
48
  this.globalFlags = jsonFlag;
49
49
  }
50
50
  else {
51
- // @ts-ignore
52
- delete this.globalFlags.json;
53
- // @ts-ignore
54
- delete this.flags.json;
51
+ // @ts-expect-error because this.globalFlags is typed as a plain object
52
+ delete this.globalFlags?.json;
53
+ this.flags = {}; // force the flags setter to run
54
+ // @ts-expect-error because this.flags is typed as a plain object
55
+ delete this.flags?.json;
55
56
  }
56
57
  }
57
58
  static get globalFlags() {
@@ -1,21 +1,43 @@
1
1
  /// <reference types="node" />
2
2
  import { URL } from 'url';
3
- import { Definition, OptionFlag, BooleanFlag } from '../interfaces';
3
+ import { Definition, OptionFlag, BooleanFlag, Default } from '../interfaces';
4
4
  export declare function build<T>(defaults: {
5
5
  parse: OptionFlag<T>['parse'];
6
6
  } & Partial<OptionFlag<T>>): Definition<T>;
7
7
  export declare function build(defaults: Partial<OptionFlag<string>>): Definition<string>;
8
8
  export declare function boolean<T = boolean>(options?: Partial<BooleanFlag<T>>): BooleanFlag<T>;
9
- export declare const integer: (opts?: {
9
+ export declare function integer(opts: Partial<OptionFlag<number>> & {
10
10
  min?: number;
11
11
  max?: number;
12
- } & Partial<OptionFlag<number>>) => OptionFlag<number | undefined>;
13
- export declare const directory: (opts?: {
12
+ } & ({
13
+ required: true;
14
+ } | {
15
+ default: Default<number>;
16
+ })): OptionFlag<number>;
17
+ export declare function integer(opts?: Partial<OptionFlag<number>> & {
18
+ min?: number;
19
+ max?: number;
20
+ }): OptionFlag<number | undefined>;
21
+ export declare function directory(opts: {
22
+ exists?: boolean;
23
+ } & Partial<OptionFlag<string>> & ({
24
+ required: true;
25
+ } | {
26
+ default: Default<string>;
27
+ })): OptionFlag<string>;
28
+ export declare function directory(opts?: {
29
+ exists?: boolean;
30
+ } & Partial<OptionFlag<string>>): OptionFlag<string | undefined>;
31
+ export declare function file(opts: {
14
32
  exists?: boolean;
15
- } & Partial<OptionFlag<string>>) => OptionFlag<string | undefined>;
16
- export declare const file: (opts?: {
33
+ } & Partial<OptionFlag<string>> & ({
34
+ required: true;
35
+ } | {
36
+ default: string;
37
+ })): OptionFlag<string>;
38
+ export declare function file(opts?: {
17
39
  exists?: boolean;
18
- } & Partial<OptionFlag<string>>) => OptionFlag<string | undefined>;
40
+ } & Partial<OptionFlag<string>>): OptionFlag<string | undefined>;
19
41
  /**
20
42
  * Initializes a string as a URL. Throws an error
21
43
  * if the string is not a valid URL.
@@ -26,7 +26,7 @@ function boolean(options = {}) {
26
26
  };
27
27
  }
28
28
  exports.boolean = boolean;
29
- const integer = (opts = {}) => {
29
+ function integer(opts = {}) {
30
30
  return build({
31
31
  ...opts,
32
32
  parse: async (input) => {
@@ -40,21 +40,21 @@ const integer = (opts = {}) => {
40
40
  return num;
41
41
  },
42
42
  })();
43
- };
43
+ }
44
44
  exports.integer = integer;
45
- const directory = (opts = {}) => {
45
+ function directory(opts = {}) {
46
46
  return build({
47
47
  ...opts,
48
48
  parse: async (input) => opts.exists ? dirExists(input) : input,
49
49
  })();
50
- };
50
+ }
51
51
  exports.directory = directory;
52
- const file = (opts = {}) => {
52
+ function file(opts = {}) {
53
53
  return build({
54
54
  ...opts,
55
55
  parse: async (input) => opts.exists ? fileExists(input) : input,
56
56
  })();
57
- };
57
+ }
58
58
  exports.file = file;
59
59
  /**
60
60
  * Initializes a string as a URL. Throws an error
@@ -8,12 +8,5 @@ export { flagUsages } from './help';
8
8
  export declare function parse<TFlags, GFlags, TArgs extends {
9
9
  [name: string]: string;
10
10
  }>(argv: string[], options: Input<TFlags, GFlags>): Promise<ParserOutput<TFlags, GFlags, TArgs>>;
11
- declare const boolean: typeof flags.boolean, integer: (opts?: {
12
- min?: number | undefined;
13
- max?: number | undefined;
14
- } & Partial<import("../interfaces").OptionFlag<number>>) => import("../interfaces").OptionFlag<number | undefined>, url: import("../interfaces").Definition<import("url").URL>, directory: (opts?: {
15
- exists?: boolean | undefined;
16
- } & Partial<import("../interfaces").OptionFlag<string>>) => import("../interfaces").OptionFlag<string | undefined>, file: (opts?: {
17
- exists?: boolean | undefined;
18
- } & Partial<import("../interfaces").OptionFlag<string>>) => import("../interfaces").OptionFlag<string | undefined>;
11
+ declare const boolean: typeof flags.boolean, integer: typeof flags.integer, url: import("../interfaces").Definition<import("url").URL>, directory: typeof flags.directory, file: typeof flags.file;
19
12
  export { boolean, integer, url, directory, file };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oclif/core",
3
3
  "description": "base library for oclif CLIs",
4
- "version": "1.13.6",
4
+ "version": "1.13.9",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/core/issues",
7
7
  "dependencies": {