@oclif/core 1.0.1 → 1.0.5
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 +28 -0
- package/README.md +59 -3
- package/lib/command.js +1 -2
- package/lib/help/util.js +2 -2
- package/lib/interfaces/parser.d.ts +3 -3
- package/lib/parser/parse.d.ts +1 -1
- package/lib/settings.d.ts +0 -4
- package/package.json +42 -40
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,34 @@
|
|
|
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.0.5](https://github.com/oclif/core/compare/v1.0.4...v1.0.5) (2021-12-01)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* bump deps ([#306](https://github.com/oclif/core/issues/306)) ([52ee252](https://github.com/oclif/core/commit/52ee25247836b80d1d0c39f8f4793049a6ccbde7))
|
|
11
|
+
|
|
12
|
+
### [1.0.4](https://github.com/oclif/core/compare/v1.0.3...v1.0.4) (2021-11-18)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* resolve typescript compilation errors ([#290](https://github.com/oclif/core/issues/290)) ([7079932](https://github.com/oclif/core/commit/70799324b19e36c3cff5618de49083c68d0d9fc6))
|
|
18
|
+
|
|
19
|
+
### [1.0.3](https://github.com/oclif/core/compare/v1.0.2...v1.0.3) (2021-11-08)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* remove module lodash.template in favor of lodash ([#286](https://github.com/oclif/core/issues/286)) ([caaff0b](https://github.com/oclif/core/commit/caaff0b4918ab2e01bc01cad2c0d8158c2fcc1c5))
|
|
25
|
+
|
|
26
|
+
### [1.0.2](https://github.com/oclif/core/compare/v1.0.1...v1.0.2) (2021-10-13)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* remove ability to enable json flag globally ([#272](https://github.com/oclif/core/issues/272)) ([3c754e7](https://github.com/oclif/core/commit/3c754e7eee04ef078ff4ab08849191e6a5779ee0))
|
|
32
|
+
|
|
5
33
|
### [1.0.1](https://github.com/oclif/core/compare/v1.0.0...v1.0.1) (2021-10-08)
|
|
6
34
|
|
|
7
35
|
|
package/README.md
CHANGED
|
@@ -4,8 +4,64 @@
|
|
|
4
4
|
base library for oclif CLIs
|
|
5
5
|
|
|
6
6
|
[](https://npmjs.org/package/@oclif/core)
|
|
7
|
-
[](https://circleci.com/gh/oclif/core/tree/main)
|
|
8
8
|
[](https://npmjs.org/package/@oclif/core)
|
|
9
|
-
[](https://github.com/oclif/core/blob/
|
|
9
|
+
[](https://github.com/oclif/core/blob/main/package.json)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
Usage
|
|
13
|
+
=====
|
|
14
|
+
|
|
15
|
+
Without the generator, you can create a simple CLI like this:
|
|
16
|
+
|
|
17
|
+
**TypeScript**
|
|
18
|
+
```js
|
|
19
|
+
#!/usr/bin/env ts-node
|
|
20
|
+
|
|
21
|
+
import * as fs from 'fs'
|
|
22
|
+
import {Command, flags} from '@oclif/core'
|
|
23
|
+
|
|
24
|
+
class LS extends Command {
|
|
25
|
+
static flags = {
|
|
26
|
+
version: flags.version(),
|
|
27
|
+
help: flags.help(),
|
|
28
|
+
// run with --dir= or -d=
|
|
29
|
+
dir: flags.string({
|
|
30
|
+
char: 'd',
|
|
31
|
+
default: process.cwd(),
|
|
32
|
+
}),
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async run() {
|
|
36
|
+
const {flags} = this.parse(LS)
|
|
37
|
+
let files = fs.readdirSync(flags.dir)
|
|
38
|
+
for (let f of files) {
|
|
39
|
+
this.log(f)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
LS.run()
|
|
45
|
+
.catch(require('@oclif/core/handle'))
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Then run either of these with:
|
|
49
|
+
|
|
50
|
+
```sh-session
|
|
51
|
+
$ ./myscript
|
|
52
|
+
...files in current dir...
|
|
53
|
+
$ ./myscript --dir foobar
|
|
54
|
+
...files in ./foobar...
|
|
55
|
+
$ ./myscript --version
|
|
56
|
+
myscript/0.0.0 darwin-x64 node-v9.5.0
|
|
57
|
+
$ ./myscript --help
|
|
58
|
+
USAGE
|
|
59
|
+
$ @oclif/core
|
|
60
|
+
|
|
61
|
+
OPTIONS
|
|
62
|
+
-d, --dir=dir [default: /Users/jdickey/src/github.com/oclif/core]
|
|
63
|
+
--help show CLI help
|
|
64
|
+
--version show CLI version
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
See the [generator](https://github.com/oclif/oclif) for all the options you can pass to the command.
|
package/lib/command.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const url_1 = require("url");
|
|
4
|
-
const settings_1 = require("./settings");
|
|
5
4
|
const util_1 = require("util");
|
|
6
5
|
const cli_ux_1 = require("cli-ux");
|
|
7
6
|
const config_1 = require("./config");
|
|
@@ -38,7 +37,7 @@ class Command {
|
|
|
38
37
|
return this._flags;
|
|
39
38
|
}
|
|
40
39
|
static set flags(flags) {
|
|
41
|
-
this._flags = this.enableJsonFlag
|
|
40
|
+
this._flags = this.enableJsonFlag ? Object.assign({}, Command.globalFlags, flags) : flags;
|
|
42
41
|
}
|
|
43
42
|
get ctor() {
|
|
44
43
|
return this.constructor;
|
package/lib/help/util.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.standardizeIDFromArgv = exports.toConfiguredId = exports.toStandardizedId = exports.template = exports.loadHelpClass = void 0;
|
|
4
|
-
const
|
|
4
|
+
const _ = require("lodash");
|
|
5
5
|
const _1 = require(".");
|
|
6
6
|
const module_loader_1 = require("../module-loader");
|
|
7
7
|
function extractClass(exported) {
|
|
@@ -24,7 +24,7 @@ async function loadHelpClass(config) {
|
|
|
24
24
|
exports.loadHelpClass = loadHelpClass;
|
|
25
25
|
function template(context) {
|
|
26
26
|
function render(t) {
|
|
27
|
-
return
|
|
27
|
+
return _.template(t)(context);
|
|
28
28
|
}
|
|
29
29
|
return render;
|
|
30
30
|
}
|
|
@@ -40,13 +40,13 @@ export interface CLIParseErrorOptions {
|
|
|
40
40
|
output?: ParserOutput<any, any>;
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
export declare type OutputArgs
|
|
44
|
-
[
|
|
43
|
+
export declare type OutputArgs = {
|
|
44
|
+
[name: string]: any;
|
|
45
45
|
};
|
|
46
46
|
export declare type OutputFlags<T extends ParserInput['flags']> = {
|
|
47
47
|
[P in keyof T]: any;
|
|
48
48
|
};
|
|
49
|
-
export declare type ParserOutput<TFlags extends OutputFlags<any>, TArgs extends OutputArgs
|
|
49
|
+
export declare type ParserOutput<TFlags extends OutputFlags<any>, TArgs extends OutputArgs> = {
|
|
50
50
|
flags: TFlags & {
|
|
51
51
|
json: boolean | undefined;
|
|
52
52
|
};
|
package/lib/parser/parse.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ParserInput, OutputFlags, ParsingToken, OutputArgs } from '../interfaces';
|
|
2
|
-
export declare class Parser<T extends ParserInput, TFlags extends OutputFlags<T['flags']>, TArgs extends OutputArgs
|
|
2
|
+
export declare class Parser<T extends ParserInput, TFlags extends OutputFlags<T['flags']>, TArgs extends OutputArgs> {
|
|
3
3
|
private readonly input;
|
|
4
4
|
private readonly argv;
|
|
5
5
|
private readonly raw;
|
package/lib/settings.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,67 +1,69 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oclif/core",
|
|
3
3
|
"description": "base library for oclif CLIs",
|
|
4
|
-
"version": "1.0.
|
|
5
|
-
"author": "
|
|
4
|
+
"version": "1.0.5",
|
|
5
|
+
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/oclif/core/issues",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@oclif/linewrap": "^1.0.0",
|
|
9
|
-
"chalk": "^4.1.
|
|
10
|
-
"clean-stack": "^3.0.
|
|
11
|
-
"cli-ux": "^
|
|
12
|
-
"debug": "^4.
|
|
13
|
-
"fs-extra": "^9.0
|
|
9
|
+
"chalk": "^4.1.2",
|
|
10
|
+
"clean-stack": "^3.0.1",
|
|
11
|
+
"cli-ux": "^6.0.1",
|
|
12
|
+
"debug": "^4.3.3",
|
|
13
|
+
"fs-extra": "^9.1.0",
|
|
14
14
|
"get-package-type": "^0.1.0",
|
|
15
|
-
"globby": "^11.0.
|
|
15
|
+
"globby": "^11.0.4",
|
|
16
16
|
"indent-string": "^4.0.0",
|
|
17
|
-
"is-wsl": "^2.
|
|
18
|
-
"lodash
|
|
19
|
-
"semver": "^7.3.
|
|
20
|
-
"string-width": "^4.2.
|
|
21
|
-
"strip-ansi": "^6.0.
|
|
22
|
-
"tslib": "^2.
|
|
17
|
+
"is-wsl": "^2.2.0",
|
|
18
|
+
"lodash": "^4.17.21",
|
|
19
|
+
"semver": "^7.3.5",
|
|
20
|
+
"string-width": "^4.2.3",
|
|
21
|
+
"strip-ansi": "^6.0.1",
|
|
22
|
+
"tslib": "^2.3.1",
|
|
23
23
|
"widest-line": "^3.1.0",
|
|
24
24
|
"wrap-ansi": "^7.0.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@commitlint/config-conventional": "^12.1.
|
|
28
|
-
"@oclif/plugin-help": "^
|
|
29
|
-
"@oclif/plugin-
|
|
30
|
-
"@oclif/
|
|
31
|
-
"@
|
|
32
|
-
"@types/chai": "^
|
|
33
|
-
"@types/chai-as-promised": "^7.1.3",
|
|
27
|
+
"@commitlint/config-conventional": "^12.1.4",
|
|
28
|
+
"@oclif/plugin-help": "^5.1.4",
|
|
29
|
+
"@oclif/plugin-plugins": "^2.0.2",
|
|
30
|
+
"@oclif/test": "^1.2.8",
|
|
31
|
+
"@types/chai": "^4.2.22",
|
|
32
|
+
"@types/chai-as-promised": "^7.1.4",
|
|
34
33
|
"@types/clean-stack": "^2.1.1",
|
|
35
|
-
"@types/fs-extra": "^9.0.
|
|
34
|
+
"@types/fs-extra": "^9.0.13",
|
|
36
35
|
"@types/indent-string": "^4.0.1",
|
|
37
|
-
"@types/lodash": "^4.14.
|
|
38
|
-
"@types/lodash.template": "^4.
|
|
39
|
-
"@types/mocha": "^8.
|
|
36
|
+
"@types/lodash": "^4.14.177",
|
|
37
|
+
"@types/lodash.template": "^4.5.0",
|
|
38
|
+
"@types/mocha": "^8.2.3",
|
|
40
39
|
"@types/nock": "^11.1.0",
|
|
41
|
-
"@types/node": "^15.
|
|
42
|
-
"@types/node-notifier": "^8.0.
|
|
40
|
+
"@types/node": "^15.14.9",
|
|
41
|
+
"@types/node-notifier": "^8.0.1",
|
|
43
42
|
"@types/proxyquire": "^1.3.28",
|
|
44
43
|
"@types/read-pkg": "^5.1.0",
|
|
45
|
-
"@types/semver": "^7.3.
|
|
44
|
+
"@types/semver": "^7.3.9",
|
|
46
45
|
"@types/strip-ansi": "^5.2.1",
|
|
47
46
|
"@types/wrap-ansi": "^3.0.0",
|
|
48
|
-
"chai": "^4.
|
|
47
|
+
"chai": "^4.3.4",
|
|
49
48
|
"chai-as-promised": "^7.1.1",
|
|
50
|
-
"commitlint": "^12.1.
|
|
51
|
-
"eslint": "^7.
|
|
49
|
+
"commitlint": "^12.1.4",
|
|
50
|
+
"eslint": "^7.32.0",
|
|
52
51
|
"eslint-config-oclif": "^4.0.0",
|
|
53
52
|
"eslint-config-oclif-typescript": "^1.0.2",
|
|
54
|
-
"fancy-test": "^1.4.
|
|
55
|
-
"globby": "^11.0.
|
|
53
|
+
"fancy-test": "^1.4.10",
|
|
54
|
+
"globby": "^11.0.4",
|
|
56
55
|
"husky": "6",
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"proxyquire": "^2.1.0",
|
|
56
|
+
"mocha": "^8.4.0",
|
|
57
|
+
"nock": "^13.2.1",
|
|
58
|
+
"proxyquire": "^2.1.3",
|
|
61
59
|
"shx": "^0.3.3",
|
|
62
|
-
"sinon": "^11.1.
|
|
63
|
-
"ts-node": "^9.
|
|
64
|
-
"typescript": "4.
|
|
60
|
+
"sinon": "^11.1.2",
|
|
61
|
+
"ts-node": "^9.1.1",
|
|
62
|
+
"typescript": "4.5.2"
|
|
63
|
+
},
|
|
64
|
+
"resolutions": {
|
|
65
|
+
"@oclif/command": "1.8.6",
|
|
66
|
+
"@oclif/parser": "3.8.6"
|
|
65
67
|
},
|
|
66
68
|
"engines": {
|
|
67
69
|
"node": ">=12.0.0"
|