@salesforce/sf-plugins-core 1.0.3 → 1.2.0
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 +49 -39
- package/LICENSE.txt +1 -1
- package/README.md +41 -1
- package/lib/deauthorizer.d.ts +4 -0
- package/lib/deauthorizer.js +5 -1
- package/lib/deployer.d.ts +2 -2
- package/lib/deployer.js +7 -7
- package/lib/exported.d.ts +2 -2
- package/lib/exported.js +6 -5
- package/lib/hooks.d.ts +6 -0
- package/lib/hooks.js +7 -4
- package/lib/sfCommand.d.ts +41 -3
- package/lib/sfCommand.js +52 -5
- package/lib/types/index.d.ts +5 -5
- package/lib/types/index.js +3 -3
- package/lib/util.d.ts +1 -15
- package/lib/util.js +4 -38
- package/lib/ux/base.d.ts +6 -0
- package/lib/ux/base.js +20 -0
- package/lib/ux/index.d.ts +5 -0
- package/lib/ux/index.js +21 -0
- package/lib/ux/progress.d.ts +48 -0
- package/lib/ux/progress.js +83 -0
- package/lib/ux/prompter.d.ts +22 -0
- package/lib/ux/prompter.js +52 -0
- package/lib/ux/spinner.d.ts +30 -0
- package/lib/ux/spinner.js +52 -0
- package/lib/ux/ux.d.ts +17 -0
- package/lib/ux/ux.js +30 -0
- package/package.json +19 -25
- package/lib/prompter.d.ts +0 -10
- package/lib/prompter.js +0 -21
package/CHANGELOG.md
CHANGED
|
@@ -2,145 +2,155 @@
|
|
|
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.2.0](https://github.com/salesforcecli/sf-plugins-core/compare/v1.1.0...v1.2.0) (2022-01-27)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- expose ux methods in SfCommand ([8e58a93](https://github.com/salesforcecli/sf-plugins-core/commit/8e58a93a942d5a0305a77a82e938f778c59fcd16))
|
|
10
|
+
|
|
11
|
+
## [1.1.0](https://github.com/salesforcecli/sf-plugins-core/compare/v1.0.5...v1.1.0) (2022-01-03)
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
- add spinner methods ([f209f8f](https://github.com/salesforcecli/sf-plugins-core/commit/f209f8f4e6736b9de91e37f865d66b5356e5abec))
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
- add status method ([9cf2069](https://github.com/salesforcecli/sf-plugins-core/commit/9cf20694d76e2509785b7c8faa4bd63ab190707e))
|
|
20
|
+
- make status a getter/setter ([441c55a](https://github.com/salesforcecli/sf-plugins-core/commit/441c55acd3d811664213e9801a8bcc270e3aca7b))
|
|
21
|
+
|
|
22
|
+
### [1.0.5](https://github.com/salesforcecli/sf-plugins-core/compare/v1.0.4...v1.0.5) (2021-12-16)
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
- bump dependencies ([4f78d8c](https://github.com/salesforcecli/sf-plugins-core/commit/4f78d8c940aab41bb406c45a9df98f686e626d28))
|
|
27
|
+
|
|
28
|
+
### [1.0.4](https://github.com/salesforcecli/sf-plugins-core/compare/v1.0.3...v1.0.4) (2021-10-13)
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
- bump module versions ([abdf5e3](https://github.com/salesforcecli/sf-plugins-core/commit/abdf5e37205b464a36393ca1887ce90a7c1ba302))
|
|
33
|
+
|
|
5
34
|
### [1.0.3](https://github.com/salesforcecli/sf-plugins-core/compare/v1.0.2...v1.0.3) (2021-10-12)
|
|
6
35
|
|
|
7
36
|
### [1.0.2](https://github.com/salesforcecli/sf-plugins-core/compare/v1.0.1...v1.0.2) (2021-10-11)
|
|
8
37
|
|
|
9
|
-
|
|
10
38
|
### Bug Fixes
|
|
11
39
|
|
|
12
|
-
|
|
40
|
+
- bump oclif and sfdx-core versions ([3d38a70](https://github.com/salesforcecli/sf-plugins-core/commit/3d38a70dcad79aa151529bf51d281f68fe92a3ce))
|
|
13
41
|
|
|
14
42
|
### [1.0.1](https://github.com/salesforcecli/sf-plugins-core/compare/v1.0.0...v1.0.1) (2021-10-06)
|
|
15
43
|
|
|
16
|
-
|
|
17
44
|
### Bug Fixes
|
|
18
45
|
|
|
19
|
-
|
|
46
|
+
- update inquirer ([067bbfb](https://github.com/salesforcecli/sf-plugins-core/commit/067bbfbbfcd271ae25260e6b83452093b1fe4deb))
|
|
20
47
|
|
|
21
48
|
## [1.0.0](https://github.com/salesforcecli/sf-plugins-core/compare/v0.0.28...v1.0.0) (2021-09-29)
|
|
22
49
|
|
|
23
50
|
### [0.0.28](https://github.com/salesforcecli/sf-plugins-core/compare/v0.0.27...v0.0.28) (2021-09-29)
|
|
24
51
|
|
|
25
|
-
|
|
26
52
|
### Bug Fixes
|
|
27
53
|
|
|
28
|
-
|
|
54
|
+
- allow empty message in logSensitive ([5b8edf5](https://github.com/salesforcecli/sf-plugins-core/commit/5b8edf509647887500d9e71b506939b3cc6945d9))
|
|
29
55
|
|
|
30
56
|
### [0.0.27](https://github.com/salesforcecli/sf-plugins-core/compare/v0.0.26...v0.0.27) (2021-09-29)
|
|
31
57
|
|
|
32
|
-
|
|
33
58
|
### Bug Fixes
|
|
34
59
|
|
|
35
|
-
|
|
60
|
+
- publish messages ([91a6aa6](https://github.com/salesforcecli/sf-plugins-core/commit/91a6aa6c396f9b33049407820d0b8bd9caaa30f4))
|
|
36
61
|
|
|
37
62
|
### [0.0.26](https://github.com/salesforcecli/sf-plugins-core/compare/v0.0.25...v0.0.26) (2021-09-29)
|
|
38
63
|
|
|
39
|
-
|
|
40
64
|
### Features
|
|
41
65
|
|
|
42
|
-
|
|
66
|
+
- logSensitive, capture warnings ([a8b3e76](https://github.com/salesforcecli/sf-plugins-core/commit/a8b3e76ff20806b136ee606797b84a70c8f5a528))
|
|
43
67
|
|
|
44
68
|
### [0.0.25](https://github.com/salesforcecli/sf-plugins-core/compare/v0.0.24...v0.0.25) (2021-09-21)
|
|
45
69
|
|
|
46
|
-
|
|
47
70
|
### Bug Fixes
|
|
48
71
|
|
|
49
|
-
|
|
72
|
+
- add envirnment type to env list ([8f020df](https://github.com/salesforcecli/sf-plugins-core/commit/8f020dfc8695be19a7fd1f4b811b8c2b8c321418))
|
|
50
73
|
|
|
51
74
|
### [0.0.24](https://github.com/salesforcecli/sf-plugins-core/compare/v0.0.23...v0.0.24) (2021-09-16)
|
|
52
75
|
|
|
53
|
-
|
|
54
76
|
### Bug Fixes
|
|
55
77
|
|
|
56
|
-
|
|
78
|
+
- allow null for EnvDisplay ([0868d3f](https://github.com/salesforcecli/sf-plugins-core/commit/0868d3f0ed23e28c53ce11cb447e41b9b0144ac1))
|
|
57
79
|
|
|
58
80
|
### [0.0.23](https://github.com/salesforcecli/sf-plugins-core/compare/v0.0.22...v0.0.23) (2021-09-15)
|
|
59
81
|
|
|
60
|
-
|
|
61
82
|
### Bug Fixes
|
|
62
83
|
|
|
63
|
-
|
|
84
|
+
- update to latest oclif/core and enable json flag ([b486ef1](https://github.com/salesforcecli/sf-plugins-core/commit/b486ef173b27ba465cc8fddf53e3a53d339f8734))
|
|
64
85
|
|
|
65
86
|
### [0.0.22](https://github.com/salesforcecli/sf-plugins-core/compare/v0.0.21...v0.0.22) (2021-09-15)
|
|
66
87
|
|
|
67
|
-
|
|
68
88
|
### Bug Fixes
|
|
69
89
|
|
|
70
|
-
|
|
90
|
+
- bump oclif/core ([c7a07f7](https://github.com/salesforcecli/sf-plugins-core/commit/c7a07f7671699197f3db93ec750e009eb9dfd56f))
|
|
71
91
|
|
|
72
92
|
### [0.0.21](https://github.com/salesforcecli/sf-plugins-core/compare/v0.0.20...v0.0.21) (2021-09-14)
|
|
73
93
|
|
|
74
|
-
|
|
75
94
|
### Bug Fixes
|
|
76
95
|
|
|
77
|
-
|
|
96
|
+
- move sf command to this repo ([968f80f](https://github.com/salesforcecli/sf-plugins-core/commit/968f80f0b8aecd0d47fe8d428c605117828f886f))
|
|
78
97
|
|
|
79
98
|
### [0.0.20](https://github.com/salesforcecli/sf-plugins-core/compare/v0.0.19...v0.0.20) (2021-09-14)
|
|
80
99
|
|
|
81
100
|
### [0.0.19](https://github.com/salesforcecli/sf-plugins-core/compare/v0.0.18...v0.0.19) (2021-09-13)
|
|
82
101
|
|
|
83
|
-
|
|
84
102
|
### Features
|
|
85
103
|
|
|
86
|
-
|
|
104
|
+
- add logout hook ([4a4d79b](https://github.com/salesforcecli/sf-plugins-core/commit/4a4d79bcd9f2017e70f75967bb0661ae3eb4aa4a))
|
|
87
105
|
|
|
88
106
|
### [0.0.18](https://github.com/salesforcecli/sf-plugins-core/compare/v0.0.17...v0.0.18) (2021-09-10)
|
|
89
107
|
|
|
90
|
-
|
|
91
108
|
### Bug Fixes
|
|
92
109
|
|
|
93
|
-
|
|
110
|
+
- missed export ([63086ae](https://github.com/salesforcecli/sf-plugins-core/commit/63086aee3dc26c6f674c0bad8054205ed3992597))
|
|
94
111
|
|
|
95
112
|
### [0.0.17](https://github.com/salesforcecli/sf-plugins-core/compare/v0.0.16...v0.0.17) (2021-09-10)
|
|
96
113
|
|
|
97
|
-
|
|
98
114
|
### Features
|
|
99
115
|
|
|
100
|
-
|
|
116
|
+
- add help section helper function ([379d14f](https://github.com/salesforcecli/sf-plugins-core/commit/379d14f45eedc46736f64bb5c37a7f906e235d4c))
|
|
101
117
|
|
|
102
118
|
### [0.0.16](https://github.com/salesforcecli/sf-plugins-core/compare/v0.0.15...v0.0.16) (2021-09-08)
|
|
103
119
|
|
|
104
|
-
|
|
105
120
|
### Bug Fixes
|
|
106
121
|
|
|
107
|
-
|
|
122
|
+
- bump oclif/core ([1cd3df6](https://github.com/salesforcecli/sf-plugins-core/commit/1cd3df66dde4d1e5386221e892aa01a7d504261c))
|
|
108
123
|
|
|
109
124
|
### [0.0.15](https://github.com/salesforcecli/sf-plugins-core/compare/v0.0.14...v0.0.15) (2021-08-31)
|
|
110
125
|
|
|
111
|
-
|
|
112
126
|
### Bug Fixes
|
|
113
127
|
|
|
114
|
-
|
|
115
|
-
|
|
128
|
+
- improve jsdocs ([e3e3784](https://github.com/salesforcecli/sf-plugins-core/commit/e3e3784954fc2d6b06f96459c824cf77795a9de9))
|
|
129
|
+
- improve jsdocs ([aefdd06](https://github.com/salesforcecli/sf-plugins-core/commit/aefdd06b164d413b3f3c4d51b36dea475efcc3ef))
|
|
116
130
|
|
|
117
131
|
### [0.0.14](https://github.com/salesforcecli/sf-plugins-core/compare/v0.0.13...v0.0.14) (2021-08-31)
|
|
118
132
|
|
|
119
|
-
|
|
120
133
|
### Bug Fixes
|
|
121
134
|
|
|
122
|
-
|
|
135
|
+
- improve env types ([e7a7c1d](https://github.com/salesforcecli/sf-plugins-core/commit/e7a7c1df001d02b60c31bcbe5abe4ab31d5faf8d))
|
|
123
136
|
|
|
124
137
|
### [0.0.13](https://github.com/salesforcecli/sf-plugins-core/compare/v0.0.12...v0.0.13) (2021-08-30)
|
|
125
138
|
|
|
126
|
-
|
|
127
139
|
### Bug Fixes
|
|
128
140
|
|
|
129
|
-
|
|
141
|
+
- update exports ([548ab46](https://github.com/salesforcecli/sf-plugins-core/commit/548ab4646bd1e2d79dbda0609551e6f805b69d09))
|
|
130
142
|
|
|
131
143
|
### [0.0.12](https://github.com/salesforcecli/sf-plugins-core/compare/v0.0.11...v0.0.12) (2021-08-30)
|
|
132
144
|
|
|
133
|
-
|
|
134
145
|
### Features
|
|
135
146
|
|
|
136
|
-
|
|
147
|
+
- support env display ([446af15](https://github.com/salesforcecli/sf-plugins-core/commit/446af15385ed57e7d5ebd40c4a4964b2bf326e16))
|
|
137
148
|
|
|
138
149
|
### [0.0.11](https://github.com/salesforcecli/sf-plugins-core/compare/v0.0.10...v0.0.11) (2021-08-30)
|
|
139
150
|
|
|
140
|
-
|
|
141
151
|
### Features
|
|
142
152
|
|
|
143
|
-
|
|
153
|
+
- rename to sf-plugins-core ([e51d6aa](https://github.com/salesforcecli/sf-plugins-core/commit/e51d6aa6879c085ae9efac990d6d406a79615088))
|
|
144
154
|
|
|
145
155
|
### [0.0.10](https://github.com/salesforcecli/sf-plugins-core/compare/v0.0.9...v0.0.10) (2021-08-10)
|
|
146
156
|
|
package/LICENSE.txt
CHANGED
package/README.md
CHANGED
|
@@ -2,4 +2,44 @@
|
|
|
2
2
|
|
|
3
3
|
# Description
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The @salesforce/sf-pluins-core provides utilities for writing [sf](https://github.com/salesforcecli/cli) plugins.
|
|
6
|
+
|
|
7
|
+
## SfCommand Abstract Class
|
|
8
|
+
|
|
9
|
+
The SfCommand abstract class extends [@oclif/core's Command class](https://github.com/oclif/core/blob/main/src/command.ts) for examples of how to build a definition.
|
|
10
|
+
) class and adds useful extensions to ease the development of commands for use in the Salesforce Unified CLI.
|
|
11
|
+
|
|
12
|
+
- SfCommand takes a generic type that defines the success JSON result
|
|
13
|
+
- Enable the json flag support by default
|
|
14
|
+
- Provides functions that help place success messages, warnings and errors into the correct location in JSON results
|
|
15
|
+
- Enables additional help sections to the standard oclif command help output
|
|
16
|
+
- Provides access to the [cli-ux cli actions](https://github.com/oclif/cli-ux#cliaction) via the public property `spinner` in SfCommand. This avoids having to import that interface from cli-ux.
|
|
17
|
+
|
|
18
|
+
## Sf Hooks
|
|
19
|
+
|
|
20
|
+
Interface that defines the well known Unified CLI command hooks.
|
|
21
|
+
SfHooks takes advantage of the [oclif hooks framework](https://oclif.io/docs/hooks), which provides a set of predefined events and the provides ability to define your own.
|
|
22
|
+
|
|
23
|
+
A hook has a name, say `sf:deploy` and to participate in the hook's run call, one creates a hook consumer, that registers itself using the name `sf:deploy`.
|
|
24
|
+
There can be more than one hook registered with the same name and when the hook is "run", oclif hook will run each registered hook consumer, collect all results and return those results to the caller.
|
|
25
|
+
|
|
26
|
+
- See [oclif hooks API docs](https://oclif.io/docs/hooks.ts) for a general description of hooks.
|
|
27
|
+
- See [SfHooks](src/hooks.ts) for current hook definitions available in Unified CLI.
|
|
28
|
+
- See Command [Deploy](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/main/src/commands/deploy.ts) for and example of how to run a hook (search for [SfHook](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/main/src/commands/deploy.ts).run in linked file).
|
|
29
|
+
- See [@salesforce/plugin-deploy-retrieve-metadataA#src/hooks/deploy.ts](https://github.com/salesforcecli/plugin-deploy-retrieve-metadata/blob/main/src/hooks/deploy.ts) as an example implementation of a hook consumer.
|
|
30
|
+
|
|
31
|
+
## Deployer Interface
|
|
32
|
+
|
|
33
|
+
Interface for deploying Deployables. See [@salesforce/plugin-deploy-retrieve-metadata#src/utils/metadataDeployer.ts](https://github.com/salesforcecli/plugin-deploy-retrieve-metadata/blob/main/src/utils/metadataDeployer.ts) as an example implementation.
|
|
34
|
+
|
|
35
|
+
## Deauthorizer Abstract Class
|
|
36
|
+
|
|
37
|
+
The Deauthorizer is an abstract class that is used to implement a concrete implementations of deauthorizing an environment.
|
|
38
|
+
|
|
39
|
+
## Prompter Class
|
|
40
|
+
|
|
41
|
+
A general purpose class that prompts a user for information. See [inquirer NPM Module](https://www.npmjs.com/package/inquirer) for more information.
|
|
42
|
+
|
|
43
|
+
## Flags
|
|
44
|
+
|
|
45
|
+
Flags is a convenience reference to [@oclif/core#Flags](https://github.com/oclif/core/blob/main/src/flags.ts)
|
package/lib/deauthorizer.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { JsonMap } from '@salesforce/ts-types';
|
|
2
|
+
/**
|
|
3
|
+
* The Deauthorizer is an abstract class that is used to implement a concrete implementations
|
|
4
|
+
* of deauthorizing an environment.
|
|
5
|
+
*/
|
|
2
6
|
export declare abstract class Deauthorizer<T = JsonMap> {
|
|
3
7
|
removeAll(): Promise<Deauthorizer.Result>;
|
|
4
8
|
/**
|
package/lib/deauthorizer.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Licensed under the BSD 3-Clause license.
|
|
6
6
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.Deauthorizer = void 0;
|
|
10
|
+
/**
|
|
11
|
+
* The Deauthorizer is an abstract class that is used to implement a concrete implementations
|
|
12
|
+
* of deauthorizing an environment.
|
|
13
|
+
*/
|
|
10
14
|
class Deauthorizer {
|
|
11
15
|
async removeAll() {
|
|
12
16
|
const result = {
|
package/lib/deployer.d.ts
CHANGED
|
@@ -9,12 +9,12 @@ export declare abstract class Deployable {
|
|
|
9
9
|
abstract getParent(): Deployer;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
* Interface for deploying
|
|
12
|
+
* Interface for deploying Deployables.
|
|
13
13
|
*/
|
|
14
14
|
export declare abstract class Deployer extends EventEmitter {
|
|
15
15
|
/**
|
|
16
16
|
* Deployables are individual pieces that can be deployed on their own. For example,
|
|
17
|
-
* each
|
|
17
|
+
* each package in a salesforce project is considered a deployable that can be deployed
|
|
18
18
|
* on its own.
|
|
19
19
|
*/
|
|
20
20
|
deployables: Deployable[];
|
package/lib/deployer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Licensed under the BSD 3-Clause license.
|
|
6
6
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
@@ -8,24 +8,24 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.Deployer = exports.Deployable = void 0;
|
|
10
10
|
const events_1 = require("events");
|
|
11
|
-
const
|
|
12
|
-
const
|
|
11
|
+
const core_1 = require("@oclif/core");
|
|
12
|
+
const ux_1 = require("./ux");
|
|
13
13
|
class Deployable {
|
|
14
14
|
}
|
|
15
15
|
exports.Deployable = Deployable;
|
|
16
16
|
/**
|
|
17
|
-
* Interface for deploying
|
|
17
|
+
* Interface for deploying Deployables.
|
|
18
18
|
*/
|
|
19
19
|
class Deployer extends events_1.EventEmitter {
|
|
20
20
|
constructor() {
|
|
21
21
|
super(...arguments);
|
|
22
22
|
/**
|
|
23
23
|
* Deployables are individual pieces that can be deployed on their own. For example,
|
|
24
|
-
* each
|
|
24
|
+
* each package in a salesforce project is considered a deployable that can be deployed
|
|
25
25
|
* on its own.
|
|
26
26
|
*/
|
|
27
27
|
this.deployables = [];
|
|
28
|
-
this.prompter = new
|
|
28
|
+
this.prompter = new ux_1.Prompter();
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Method for displaying deploy progress to the user
|
|
@@ -36,7 +36,7 @@ class Deployer extends events_1.EventEmitter {
|
|
|
36
36
|
* Log messages to the console
|
|
37
37
|
*/
|
|
38
38
|
log(msg, ...args) {
|
|
39
|
-
|
|
39
|
+
core_1.CliUx.ux.log(msg, ...args);
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Prompt user for additional information
|
package/lib/exported.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { toHelpSection } from './util';
|
|
2
2
|
export { Deployable, Deployer } from './deployer';
|
|
3
3
|
export { Deauthorizer } from './deauthorizer';
|
|
4
|
-
export { Prompter } from './
|
|
4
|
+
export { Progress, Prompter, generateTableChoices } from './ux';
|
|
5
5
|
export { SfHook } from './hooks';
|
|
6
6
|
export * from './types';
|
|
7
7
|
export { SfCommand, SfCommandInterface } from './sfCommand';
|
package/lib/exported.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Licensed under the BSD 3-Clause license.
|
|
6
6
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
@@ -16,17 +16,18 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.Flags = exports.SfCommand = exports.SfHook = exports.Prompter = exports.
|
|
19
|
+
exports.Flags = exports.SfCommand = exports.SfHook = exports.generateTableChoices = exports.Prompter = exports.Progress = exports.Deauthorizer = exports.Deployer = exports.Deployable = exports.toHelpSection = void 0;
|
|
20
20
|
var util_1 = require("./util");
|
|
21
|
-
Object.defineProperty(exports, "generateTableChoices", { enumerable: true, get: function () { return util_1.generateTableChoices; } });
|
|
22
21
|
Object.defineProperty(exports, "toHelpSection", { enumerable: true, get: function () { return util_1.toHelpSection; } });
|
|
23
22
|
var deployer_1 = require("./deployer");
|
|
24
23
|
Object.defineProperty(exports, "Deployable", { enumerable: true, get: function () { return deployer_1.Deployable; } });
|
|
25
24
|
Object.defineProperty(exports, "Deployer", { enumerable: true, get: function () { return deployer_1.Deployer; } });
|
|
26
25
|
var deauthorizer_1 = require("./deauthorizer");
|
|
27
26
|
Object.defineProperty(exports, "Deauthorizer", { enumerable: true, get: function () { return deauthorizer_1.Deauthorizer; } });
|
|
28
|
-
var
|
|
29
|
-
Object.defineProperty(exports, "
|
|
27
|
+
var ux_1 = require("./ux");
|
|
28
|
+
Object.defineProperty(exports, "Progress", { enumerable: true, get: function () { return ux_1.Progress; } });
|
|
29
|
+
Object.defineProperty(exports, "Prompter", { enumerable: true, get: function () { return ux_1.Prompter; } });
|
|
30
|
+
Object.defineProperty(exports, "generateTableChoices", { enumerable: true, get: function () { return ux_1.generateTableChoices; } });
|
|
30
31
|
var hooks_1 = require("./hooks");
|
|
31
32
|
Object.defineProperty(exports, "SfHook", { enumerable: true, get: function () { return hooks_1.SfHook; } });
|
|
32
33
|
__exportStar(require("./types"), exports);
|
package/lib/hooks.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ import { Hook, Hooks } from '@oclif/core/lib/interfaces/hooks';
|
|
|
3
3
|
import { Deployer } from './deployer';
|
|
4
4
|
import { EnvList, EnvDisplay, JsonObject, Deploy, Login, Logout } from './types';
|
|
5
5
|
import { Deauthorizer } from './deauthorizer';
|
|
6
|
+
/**
|
|
7
|
+
* Interface that defines the well known Unified CLI command hooks.
|
|
8
|
+
*/
|
|
6
9
|
interface SfHooks<T = unknown> extends Hooks {
|
|
7
10
|
'sf:env:list': EnvList.HookMeta<T & JsonObject>;
|
|
8
11
|
'sf:env:display': EnvDisplay.HookMeta<T & JsonObject>;
|
|
@@ -11,6 +14,9 @@ interface SfHooks<T = unknown> extends Hooks {
|
|
|
11
14
|
'sf:logout': Logout.HookMeta<T & Deauthorizer>;
|
|
12
15
|
}
|
|
13
16
|
declare type GenericHook<T extends keyof SfHooks, P> = Hook<T, SfHooks<P>>;
|
|
17
|
+
/**
|
|
18
|
+
* Class that provides a static method to run a well known hook.
|
|
19
|
+
*/
|
|
14
20
|
export declare class SfHook {
|
|
15
21
|
static run<T extends keyof SfHooks>(config: Config, hookName: T, options?: SfHooks[T]['options']): Promise<Hook.Result<SfHooks[T]['return']>>;
|
|
16
22
|
}
|
package/lib/hooks.js
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Licensed under the BSD 3-Clause license.
|
|
6
6
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.SfHook = void 0;
|
|
10
|
-
const cli_ux_1 = require("cli-ux");
|
|
11
10
|
const kit_1 = require("@salesforce/kit");
|
|
11
|
+
const core_1 = require("@oclif/core");
|
|
12
|
+
/**
|
|
13
|
+
* Class that provides a static method to run a well known hook.
|
|
14
|
+
*/
|
|
12
15
|
class SfHook {
|
|
13
16
|
static async run(config, hookName, options = {}) {
|
|
14
17
|
const timeout = kit_1.Duration.milliseconds(kit_1.env.getNumber('SF_HOOK_TIMEOUT_MS') || 5000);
|
|
15
18
|
const results = await config.runHook(hookName, options, timeout.milliseconds);
|
|
16
19
|
results.failures.forEach((failure) => {
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
core_1.CliUx.ux.debug(`Failed to run ${hookName} hook for ${failure.plugin.name}`);
|
|
21
|
+
core_1.CliUx.ux.debug(failure.error.toString());
|
|
19
22
|
});
|
|
20
23
|
return results;
|
|
21
24
|
}
|
package/lib/sfCommand.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { Command, HelpSection, Interfaces } from '@oclif/core';
|
|
1
|
+
import { CliUx, Command, Config, HelpSection, Interfaces } from '@oclif/core';
|
|
2
|
+
import { AnyJson } from '@salesforce/ts-types';
|
|
3
|
+
import { Progress, Prompter, Spinner, Ux } from './ux';
|
|
2
4
|
export interface SfCommandInterface extends Interfaces.Command {
|
|
3
5
|
configurationVariablesSection?: HelpSection;
|
|
4
6
|
envVariablesSection?: HelpSection;
|
|
@@ -9,15 +11,21 @@ export interface SfCommandInterface extends Interfaces.Command {
|
|
|
9
11
|
* output formatting. Extend this command and set specific properties
|
|
10
12
|
* to add help sections to the command's help output.
|
|
11
13
|
*
|
|
12
|
-
* @extends @oclif/command
|
|
13
|
-
* @see https://github.com/oclif/command
|
|
14
|
+
* @extends @oclif/core/command
|
|
15
|
+
* @see https://github.com/oclif/core/blob/main/src/command.ts
|
|
14
16
|
*/
|
|
15
17
|
export declare abstract class SfCommand<T> extends Command {
|
|
16
18
|
static enableJsonFlag: boolean;
|
|
17
19
|
static configurationVariablesSection?: HelpSection;
|
|
18
20
|
static envVariablesSection?: HelpSection;
|
|
19
21
|
static errorCodes?: HelpSection;
|
|
22
|
+
static tableFlags: typeof CliUx.Table.table.flags;
|
|
23
|
+
spinner: Spinner;
|
|
24
|
+
progress: Progress;
|
|
20
25
|
private warnings;
|
|
26
|
+
private ux;
|
|
27
|
+
private prompter;
|
|
28
|
+
constructor(argv: string[], config: Config);
|
|
21
29
|
/**
|
|
22
30
|
* Log warning to users. If --json is enabled, then the warning
|
|
23
31
|
* will be added to the json output under the warnings property.
|
|
@@ -28,6 +36,36 @@ export declare abstract class SfCommand<T> extends Command {
|
|
|
28
36
|
* logging to the console.
|
|
29
37
|
*/
|
|
30
38
|
logSensitive(msg?: string): void;
|
|
39
|
+
/**
|
|
40
|
+
* Display a table on the console. Will automatically be suppressed when --json flag is present.
|
|
41
|
+
*/
|
|
42
|
+
table<R extends Ux.Table.Data>(data: R[], columns: Ux.Table.Columns<R>, options?: Ux.Table.Options): void;
|
|
43
|
+
/**
|
|
44
|
+
* Log a stylized url to the console. Will automatically be suppressed when --json flag is present.
|
|
45
|
+
*/
|
|
46
|
+
url(text: string, uri: string, params?: {}): void;
|
|
47
|
+
/**
|
|
48
|
+
* Log stylized JSON to the console. Will automatically be suppressed when --json flag is present.
|
|
49
|
+
*/
|
|
50
|
+
styledJSON(obj: AnyJson): void;
|
|
51
|
+
/**
|
|
52
|
+
* Log stylized object to the console. Will automatically be suppressed when --json flag is present.
|
|
53
|
+
*/
|
|
54
|
+
styledObject(obj: AnyJson): void;
|
|
55
|
+
/**
|
|
56
|
+
* Prompt user for information. See https://www.npmjs.com/package/inquirer for more.
|
|
57
|
+
*
|
|
58
|
+
* This will NOT be automatically suppressed when the --json flag is present since we assume
|
|
59
|
+
* that any command that prompts the user for required information will not also support the --json flag.
|
|
60
|
+
*
|
|
61
|
+
* If you need to conditionally suppress prompts to support json output, then do the following:
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* if (!this.jsonEnabled()) {
|
|
65
|
+
* await this.prompt();
|
|
66
|
+
* }
|
|
67
|
+
*/
|
|
68
|
+
prompt<R = Prompter.Answers>(questions: Prompter.Questions<R>, initialAnswers?: Partial<R>): Promise<R>;
|
|
31
69
|
/**
|
|
32
70
|
* Wrap the command result into the standardized JSON structure.
|
|
33
71
|
*/
|
package/lib/sfCommand.js
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SfCommand = void 0;
|
|
4
4
|
/*
|
|
5
|
-
* Copyright (c)
|
|
5
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
6
6
|
* All rights reserved.
|
|
7
7
|
* Licensed under the BSD 3-Clause license.
|
|
8
8
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
9
|
*/
|
|
10
10
|
const core_1 = require("@oclif/core");
|
|
11
11
|
const core_2 = require("@salesforce/core");
|
|
12
|
+
const ux_1 = require("./ux");
|
|
12
13
|
core_2.Messages.importMessagesDirectory(__dirname);
|
|
13
14
|
const messages = core_2.Messages.loadMessages('@salesforce/sf-plugins-core', 'messages');
|
|
14
15
|
/**
|
|
@@ -16,13 +17,18 @@ const messages = core_2.Messages.loadMessages('@salesforce/sf-plugins-core', 'me
|
|
|
16
17
|
* output formatting. Extend this command and set specific properties
|
|
17
18
|
* to add help sections to the command's help output.
|
|
18
19
|
*
|
|
19
|
-
* @extends @oclif/command
|
|
20
|
-
* @see https://github.com/oclif/command
|
|
20
|
+
* @extends @oclif/core/command
|
|
21
|
+
* @see https://github.com/oclif/core/blob/main/src/command.ts
|
|
21
22
|
*/
|
|
22
23
|
class SfCommand extends core_1.Command {
|
|
23
|
-
constructor() {
|
|
24
|
-
super(
|
|
24
|
+
constructor(argv, config) {
|
|
25
|
+
super(argv, config);
|
|
25
26
|
this.warnings = [];
|
|
27
|
+
const outputEnabled = !this.jsonEnabled();
|
|
28
|
+
this.spinner = new ux_1.Spinner(outputEnabled);
|
|
29
|
+
this.progress = new ux_1.Progress(outputEnabled);
|
|
30
|
+
this.ux = new ux_1.Ux(outputEnabled);
|
|
31
|
+
this.prompter = new ux_1.Prompter();
|
|
26
32
|
}
|
|
27
33
|
/**
|
|
28
34
|
* Log warning to users. If --json is enabled, then the warning
|
|
@@ -41,6 +47,46 @@ class SfCommand extends core_1.Command {
|
|
|
41
47
|
this.warn(messages.getMessage('warning.security'));
|
|
42
48
|
this.log(msg);
|
|
43
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Display a table on the console. Will automatically be suppressed when --json flag is present.
|
|
52
|
+
*/
|
|
53
|
+
table(data, columns, options) {
|
|
54
|
+
this.ux.table(data, columns, options);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Log a stylized url to the console. Will automatically be suppressed when --json flag is present.
|
|
58
|
+
*/
|
|
59
|
+
url(text, uri, params = {}) {
|
|
60
|
+
this.ux.url(text, uri, params);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Log stylized JSON to the console. Will automatically be suppressed when --json flag is present.
|
|
64
|
+
*/
|
|
65
|
+
styledJSON(obj) {
|
|
66
|
+
this.ux.styledJSON(obj);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Log stylized object to the console. Will automatically be suppressed when --json flag is present.
|
|
70
|
+
*/
|
|
71
|
+
styledObject(obj) {
|
|
72
|
+
this.ux.styledObject(obj);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Prompt user for information. See https://www.npmjs.com/package/inquirer for more.
|
|
76
|
+
*
|
|
77
|
+
* This will NOT be automatically suppressed when the --json flag is present since we assume
|
|
78
|
+
* that any command that prompts the user for required information will not also support the --json flag.
|
|
79
|
+
*
|
|
80
|
+
* If you need to conditionally suppress prompts to support json output, then do the following:
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* if (!this.jsonEnabled()) {
|
|
84
|
+
* await this.prompt();
|
|
85
|
+
* }
|
|
86
|
+
*/
|
|
87
|
+
async prompt(questions, initialAnswers) {
|
|
88
|
+
return this.prompter.prompt(questions, initialAnswers);
|
|
89
|
+
}
|
|
44
90
|
/**
|
|
45
91
|
* Wrap the command result into the standardized JSON structure.
|
|
46
92
|
*/
|
|
@@ -68,4 +114,5 @@ class SfCommand extends core_1.Command {
|
|
|
68
114
|
}
|
|
69
115
|
exports.SfCommand = SfCommand;
|
|
70
116
|
SfCommand.enableJsonFlag = true;
|
|
117
|
+
SfCommand.tableFlags = core_1.CliUx.ux.table.flags;
|
|
71
118
|
//# sourceMappingURL=sfCommand.js.map
|
package/lib/types/index.d.ts
CHANGED
|
@@ -46,8 +46,8 @@ export declare namespace EnvDisplay {
|
|
|
46
46
|
/**
|
|
47
47
|
* By default `sf env list` will render a table with all the data provided by the hook.
|
|
48
48
|
* The columns of the table are derived from the keys of the provided data. These column
|
|
49
|
-
* headers are Title Cased for readability. To overwrite a column name
|
|
50
|
-
* property.
|
|
49
|
+
* headers are Title Cased for readability. To overwrite a column name specify it with
|
|
50
|
+
* the `keys` property.
|
|
51
51
|
*
|
|
52
52
|
* @example
|
|
53
53
|
* {
|
|
@@ -95,19 +95,19 @@ export declare namespace EnvList {
|
|
|
95
95
|
}
|
|
96
96
|
export declare namespace Deploy {
|
|
97
97
|
type HookMeta<T extends Deployer> = {
|
|
98
|
-
options:
|
|
98
|
+
options: Record<string, unknown>;
|
|
99
99
|
return: T[];
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
export declare namespace Login {
|
|
103
103
|
type HookMeta = {
|
|
104
|
-
options:
|
|
104
|
+
options: Record<string, unknown>;
|
|
105
105
|
return: void;
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
108
|
export declare namespace Logout {
|
|
109
109
|
type HookMeta<T extends Deauthorizer> = {
|
|
110
|
-
options:
|
|
110
|
+
options: Record<string, unknown>;
|
|
111
111
|
return: T;
|
|
112
112
|
};
|
|
113
113
|
}
|
package/lib/types/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Licensed under the BSD 3-Clause license.
|
|
6
6
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
@@ -10,8 +10,8 @@ exports.EnvList = void 0;
|
|
|
10
10
|
/**
|
|
11
11
|
* By default `sf env list` will render a table with all the data provided by the hook.
|
|
12
12
|
* The columns of the table are derived from the keys of the provided data. These column
|
|
13
|
-
* headers are Title Cased for readability. To overwrite a column name
|
|
14
|
-
* property.
|
|
13
|
+
* headers are Title Cased for readability. To overwrite a column name specify it with
|
|
14
|
+
* the `keys` property.
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
17
|
* {
|
package/lib/util.d.ts
CHANGED
|
@@ -1,19 +1,5 @@
|
|
|
1
|
-
import { ChoiceBase } from 'inquirer';
|
|
2
|
-
import { Dictionary, Nullable } from '@salesforce/ts-types';
|
|
3
1
|
import { HelpSection } from '@oclif/core';
|
|
4
|
-
import { OrgConfigProperties } from '@salesforce/core';
|
|
5
|
-
import { SfdxPropertyKeys } from '@salesforce/core';
|
|
6
|
-
import { EnvironmentVariable } from '@salesforce/core';
|
|
7
|
-
/**
|
|
8
|
-
* Generate a formatted table for list and checkbox prompts
|
|
9
|
-
*
|
|
10
|
-
* Each option should contain the same keys as specified in columns.
|
|
11
|
-
* For example,
|
|
12
|
-
* const columns = { name: 'Name', type: 'Type', path: 'Path' };
|
|
13
|
-
* const options = [{ name: 'foo', type: 'org', path: '/path/to/foo/' }];
|
|
14
|
-
* generateTableChoices(columns, options);
|
|
15
|
-
*/
|
|
16
|
-
export declare function generateTableChoices<T>(columns: Dictionary<string>, choices: Array<Dictionary<Nullable<string> | T>>, padForCheckbox?: boolean): ChoiceBase[];
|
|
2
|
+
import { OrgConfigProperties, SfdxPropertyKeys, EnvironmentVariable } from '@salesforce/core';
|
|
17
3
|
/**
|
|
18
4
|
* Function to build a help section for command help.
|
|
19
5
|
* Takes a string to be used as section header text and an array of enums
|
package/lib/util.js
CHANGED
|
@@ -1,47 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Licensed under the BSD 3-Clause license.
|
|
6
6
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.toHelpSection =
|
|
10
|
-
const inquirer_1 = require("inquirer");
|
|
11
|
-
const ts_types_1 = require("@salesforce/ts-types");
|
|
9
|
+
exports.toHelpSection = void 0;
|
|
12
10
|
const core_1 = require("@salesforce/core");
|
|
13
|
-
const core_2 = require("@salesforce/core");
|
|
14
|
-
const core_3 = require("@salesforce/core");
|
|
15
|
-
/**
|
|
16
|
-
* Generate a formatted table for list and checkbox prompts
|
|
17
|
-
*
|
|
18
|
-
* Each option should contain the same keys as specified in columns.
|
|
19
|
-
* For example,
|
|
20
|
-
* const columns = { name: 'Name', type: 'Type', path: 'Path' };
|
|
21
|
-
* const options = [{ name: 'foo', type: 'org', path: '/path/to/foo/' }];
|
|
22
|
-
* generateTableChoices(columns, options);
|
|
23
|
-
*/
|
|
24
|
-
function generateTableChoices(columns, choices,
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
26
|
-
padForCheckbox = true) {
|
|
27
|
-
const columnEntries = Object.entries(columns);
|
|
28
|
-
const columnLengths = columnEntries.map(([key, value]) => Math.max(ts_types_1.ensureString(value).length, ...choices.map((option) => ts_types_1.ensureString(option[key], `Type ${typeof option[key]} for ${key} in ${Object.keys(option).join(', ')}`)
|
|
29
|
-
.length)) + 1);
|
|
30
|
-
const choicesOptions = [
|
|
31
|
-
new inquirer_1.Separator(`${padForCheckbox ? ' '.repeat(2) : ''}${columnEntries
|
|
32
|
-
.map(([, value], index) => value === null || value === void 0 ? void 0 : value.padEnd(columnLengths[index], ' '))
|
|
33
|
-
.join('')}`),
|
|
34
|
-
];
|
|
35
|
-
for (const meta of choices) {
|
|
36
|
-
const name = columnEntries
|
|
37
|
-
.map(([key], index) => ts_types_1.ensureString(meta[key]).padEnd(columnLengths[index], ' '))
|
|
38
|
-
.join('');
|
|
39
|
-
const choice = { name, value: meta.value, short: ts_types_1.ensureString(meta.name) };
|
|
40
|
-
choicesOptions.push(choice);
|
|
41
|
-
}
|
|
42
|
-
return choicesOptions;
|
|
43
|
-
}
|
|
44
|
-
exports.generateTableChoices = generateTableChoices;
|
|
45
11
|
/**
|
|
46
12
|
* Function to build a help section for command help.
|
|
47
13
|
* Takes a string to be used as section header text and an array of enums
|
|
@@ -60,11 +26,11 @@ function toHelpSection(header, ...vars) {
|
|
|
60
26
|
if (orgConfig) {
|
|
61
27
|
return { name: orgConfig.key, description: orgConfig.description };
|
|
62
28
|
}
|
|
63
|
-
const sfdxProperty =
|
|
29
|
+
const sfdxProperty = core_1.SFDX_ALLOWED_PROPERTIES.find(({ key }) => key === v);
|
|
64
30
|
if (sfdxProperty) {
|
|
65
31
|
return { name: sfdxProperty.key.valueOf(), description: sfdxProperty.description };
|
|
66
32
|
}
|
|
67
|
-
const envVar = Object.entries(
|
|
33
|
+
const envVar = Object.entries(core_1.SUPPORTED_ENV_VARS).find(([k]) => k === v);
|
|
68
34
|
if (envVar) {
|
|
69
35
|
const [eKey, data] = envVar;
|
|
70
36
|
return { name: eKey, description: data.description };
|
package/lib/ux/base.d.ts
ADDED
package/lib/ux/base.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.UxBase = void 0;
|
|
10
|
+
class UxBase {
|
|
11
|
+
constructor(outputEnabled) {
|
|
12
|
+
this.outputEnabled = outputEnabled;
|
|
13
|
+
}
|
|
14
|
+
maybeNoop(fn) {
|
|
15
|
+
if (this.outputEnabled)
|
|
16
|
+
fn();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.UxBase = UxBase;
|
|
20
|
+
//# sourceMappingURL=base.js.map
|
package/lib/ux/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.Spinner = exports.generateTableChoices = exports.Prompter = exports.Progress = exports.Ux = exports.UxBase = void 0;
|
|
10
|
+
var base_1 = require("./base");
|
|
11
|
+
Object.defineProperty(exports, "UxBase", { enumerable: true, get: function () { return base_1.UxBase; } });
|
|
12
|
+
var ux_1 = require("./ux");
|
|
13
|
+
Object.defineProperty(exports, "Ux", { enumerable: true, get: function () { return ux_1.Ux; } });
|
|
14
|
+
var progress_1 = require("./progress");
|
|
15
|
+
Object.defineProperty(exports, "Progress", { enumerable: true, get: function () { return progress_1.Progress; } });
|
|
16
|
+
var prompter_1 = require("./prompter");
|
|
17
|
+
Object.defineProperty(exports, "Prompter", { enumerable: true, get: function () { return prompter_1.Prompter; } });
|
|
18
|
+
Object.defineProperty(exports, "generateTableChoices", { enumerable: true, get: function () { return prompter_1.generateTableChoices; } });
|
|
19
|
+
var spinner_1 = require("./spinner");
|
|
20
|
+
Object.defineProperty(exports, "Spinner", { enumerable: true, get: function () { return spinner_1.Spinner; } });
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { UxBase } from '.';
|
|
2
|
+
/**
|
|
3
|
+
* Class for display a progress bar to the console. Will automatically be suppressed if the --json flag is present.
|
|
4
|
+
*/
|
|
5
|
+
export declare class Progress extends UxBase {
|
|
6
|
+
private static DEFAULT_OPTIONS;
|
|
7
|
+
private bar;
|
|
8
|
+
private total;
|
|
9
|
+
constructor(outputEnabled: boolean);
|
|
10
|
+
/**
|
|
11
|
+
* Set the total number of expected components.
|
|
12
|
+
*/
|
|
13
|
+
setTotal(total: number): void;
|
|
14
|
+
/**
|
|
15
|
+
* Start the progress bar.
|
|
16
|
+
*/
|
|
17
|
+
start(total: number, payload?: Progress.Payload, options?: Partial<Progress.Options>): void;
|
|
18
|
+
/**
|
|
19
|
+
* Update the progress bar.
|
|
20
|
+
*/
|
|
21
|
+
update(num: number, payload?: {}): void;
|
|
22
|
+
/**
|
|
23
|
+
* Update the progress bar with the final number and stop it.
|
|
24
|
+
*/
|
|
25
|
+
finish(payload?: {}): void;
|
|
26
|
+
/**
|
|
27
|
+
* Stop the progress bar.
|
|
28
|
+
*/
|
|
29
|
+
stop(): void;
|
|
30
|
+
private _start;
|
|
31
|
+
}
|
|
32
|
+
export declare namespace Progress {
|
|
33
|
+
type Bar = {
|
|
34
|
+
start: (num: number, payload?: unknown) => void;
|
|
35
|
+
update: (num: number, payload?: unknown) => void;
|
|
36
|
+
updateTotal: (num: number) => void;
|
|
37
|
+
setTotal: (num: number) => void;
|
|
38
|
+
stop: () => void;
|
|
39
|
+
};
|
|
40
|
+
type Options = {
|
|
41
|
+
title: string;
|
|
42
|
+
format: string;
|
|
43
|
+
barCompleteChar: string;
|
|
44
|
+
barIncompleteChar: string;
|
|
45
|
+
linewrap: boolean;
|
|
46
|
+
};
|
|
47
|
+
type Payload = Record<string, unknown>;
|
|
48
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.Progress = void 0;
|
|
10
|
+
const util = require("util");
|
|
11
|
+
const core_1 = require("@oclif/core");
|
|
12
|
+
const kit_1 = require("@salesforce/kit");
|
|
13
|
+
const _1 = require(".");
|
|
14
|
+
/**
|
|
15
|
+
* Class for display a progress bar to the console. Will automatically be suppressed if the --json flag is present.
|
|
16
|
+
*/
|
|
17
|
+
class Progress extends _1.UxBase {
|
|
18
|
+
constructor(outputEnabled) {
|
|
19
|
+
super(outputEnabled);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Set the total number of expected components.
|
|
23
|
+
*/
|
|
24
|
+
setTotal(total) {
|
|
25
|
+
this.total = total;
|
|
26
|
+
this.bar.setTotal(total);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Start the progress bar.
|
|
30
|
+
*/
|
|
31
|
+
start(total, payload = {}, options = Progress.DEFAULT_OPTIONS) {
|
|
32
|
+
const opts = Object.assign(Progress.DEFAULT_OPTIONS, options);
|
|
33
|
+
opts.format = util.format(opts.format, opts.title);
|
|
34
|
+
this.bar = core_1.CliUx.ux.progress({
|
|
35
|
+
format: opts.format,
|
|
36
|
+
barCompleteChar: opts.barCompleteChar,
|
|
37
|
+
barIncompleteChar: opts.barIncompleteChar,
|
|
38
|
+
linewrap: opts.linewrap,
|
|
39
|
+
});
|
|
40
|
+
this.bar.setTotal(total);
|
|
41
|
+
// this.maybeNoop(() => startProgressBar(this.bar, total, payload));
|
|
42
|
+
this.maybeNoop(() => {
|
|
43
|
+
this._start(total, payload);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Update the progress bar.
|
|
48
|
+
*/
|
|
49
|
+
update(num, payload = {}) {
|
|
50
|
+
this.bar.update(num, payload);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Update the progress bar with the final number and stop it.
|
|
54
|
+
*/
|
|
55
|
+
finish(payload = {}) {
|
|
56
|
+
this.bar.update(this.total, payload);
|
|
57
|
+
this.bar.stop();
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Stop the progress bar.
|
|
61
|
+
*/
|
|
62
|
+
stop() {
|
|
63
|
+
this.bar.stop();
|
|
64
|
+
}
|
|
65
|
+
_start(total, payload = {}) {
|
|
66
|
+
const start = kit_1.once((bar, t, p = {}) => {
|
|
67
|
+
bar.start(t);
|
|
68
|
+
if (Object.keys(p).length) {
|
|
69
|
+
bar.update(0, p);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
start(this.bar, total, payload);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.Progress = Progress;
|
|
76
|
+
Progress.DEFAULT_OPTIONS = {
|
|
77
|
+
title: 'PROGRESS',
|
|
78
|
+
format: '%s | {bar} | {value}/{total} Components',
|
|
79
|
+
barCompleteChar: '\u2588',
|
|
80
|
+
barIncompleteChar: '\u2591',
|
|
81
|
+
linewrap: true,
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=progress.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { QuestionCollection, ChoiceBase } from 'inquirer';
|
|
2
|
+
import { Dictionary, Nullable } from '@salesforce/ts-types';
|
|
3
|
+
export declare class Prompter {
|
|
4
|
+
/**
|
|
5
|
+
* Prompt user for information. See https://www.npmjs.com/package/inquirer for more.
|
|
6
|
+
*/
|
|
7
|
+
prompt<T = Prompter.Answers>(questions: Prompter.Questions<T>, initialAnswers?: Partial<T>): Promise<T>;
|
|
8
|
+
}
|
|
9
|
+
export declare namespace Prompter {
|
|
10
|
+
type Answers<T = Record<string, unknown>> = T & Record<string, unknown>;
|
|
11
|
+
type Questions<T> = QuestionCollection<T>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Generate a formatted table for list and checkbox prompts
|
|
15
|
+
*
|
|
16
|
+
* Each option should contain the same keys as specified in columns.
|
|
17
|
+
* For example,
|
|
18
|
+
* const columns = { name: 'Name', type: 'Type', path: 'Path' };
|
|
19
|
+
* const options = [{ name: 'foo', type: 'org', path: '/path/to/foo/' }];
|
|
20
|
+
* generateTableChoices(columns, options);
|
|
21
|
+
*/
|
|
22
|
+
export declare function generateTableChoices<T>(columns: Dictionary<string>, choices: Array<Dictionary<Nullable<string> | T>>, padForCheckbox?: boolean): ChoiceBase[];
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.generateTableChoices = exports.Prompter = void 0;
|
|
10
|
+
const inquirer_1 = require("inquirer");
|
|
11
|
+
const ts_types_1 = require("@salesforce/ts-types");
|
|
12
|
+
class Prompter {
|
|
13
|
+
/**
|
|
14
|
+
* Prompt user for information. See https://www.npmjs.com/package/inquirer for more.
|
|
15
|
+
*/
|
|
16
|
+
async prompt(questions, initialAnswers) {
|
|
17
|
+
const answers = await inquirer_1.prompt(questions, initialAnswers);
|
|
18
|
+
return answers;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.Prompter = Prompter;
|
|
22
|
+
/**
|
|
23
|
+
* Generate a formatted table for list and checkbox prompts
|
|
24
|
+
*
|
|
25
|
+
* Each option should contain the same keys as specified in columns.
|
|
26
|
+
* For example,
|
|
27
|
+
* const columns = { name: 'Name', type: 'Type', path: 'Path' };
|
|
28
|
+
* const options = [{ name: 'foo', type: 'org', path: '/path/to/foo/' }];
|
|
29
|
+
* generateTableChoices(columns, options);
|
|
30
|
+
*/
|
|
31
|
+
function generateTableChoices(columns, choices,
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
33
|
+
padForCheckbox = true) {
|
|
34
|
+
const columnEntries = Object.entries(columns);
|
|
35
|
+
const columnLengths = columnEntries.map(([key, value]) => Math.max(ts_types_1.ensureString(value).length, ...choices.map((option) => ts_types_1.ensureString(option[key], `Type ${typeof option[key]} for ${key} in ${Object.keys(option).join(', ')}`)
|
|
36
|
+
.length)) + 1);
|
|
37
|
+
const choicesOptions = [
|
|
38
|
+
new inquirer_1.Separator(`${padForCheckbox ? ' '.repeat(2) : ''}${columnEntries
|
|
39
|
+
.map(([, value], index) => value === null || value === void 0 ? void 0 : value.padEnd(columnLengths[index], ' '))
|
|
40
|
+
.join('')}`),
|
|
41
|
+
];
|
|
42
|
+
for (const meta of choices) {
|
|
43
|
+
const name = columnEntries
|
|
44
|
+
.map(([key], index) => ts_types_1.ensureString(meta[key]).padEnd(columnLengths[index], ' '))
|
|
45
|
+
.join('');
|
|
46
|
+
const choice = { name, value: meta.value, short: ts_types_1.ensureString(meta.name) };
|
|
47
|
+
choicesOptions.push(choice);
|
|
48
|
+
}
|
|
49
|
+
return choicesOptions;
|
|
50
|
+
}
|
|
51
|
+
exports.generateTableChoices = generateTableChoices;
|
|
52
|
+
//# sourceMappingURL=prompter.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { UxBase } from '.';
|
|
2
|
+
/**
|
|
3
|
+
* This class is a light wrapper around CliUx.ux.action that allows us to
|
|
4
|
+
* automatically suppress any actions if `--json` flag is present.
|
|
5
|
+
*/
|
|
6
|
+
export declare class Spinner extends UxBase {
|
|
7
|
+
constructor(outputEnabled: boolean);
|
|
8
|
+
/**
|
|
9
|
+
* Start a spinner on the console.
|
|
10
|
+
*/
|
|
11
|
+
start(action: string, status?: string, opts?: {
|
|
12
|
+
stdout?: boolean;
|
|
13
|
+
}): void;
|
|
14
|
+
/**
|
|
15
|
+
* Stop the spinner on the console.
|
|
16
|
+
*/
|
|
17
|
+
stop(msg?: string): void;
|
|
18
|
+
/**
|
|
19
|
+
* Set the status of the current spinner.
|
|
20
|
+
*/
|
|
21
|
+
set status(status: string | undefined);
|
|
22
|
+
/**
|
|
23
|
+
* Get the status of the current spinner.
|
|
24
|
+
*/
|
|
25
|
+
get status(): string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Pause the spinner on the console.
|
|
28
|
+
*/
|
|
29
|
+
pause(fn: () => unknown, icon?: string): void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.Spinner = void 0;
|
|
10
|
+
const core_1 = require("@oclif/core");
|
|
11
|
+
const _1 = require(".");
|
|
12
|
+
/**
|
|
13
|
+
* This class is a light wrapper around CliUx.ux.action that allows us to
|
|
14
|
+
* automatically suppress any actions if `--json` flag is present.
|
|
15
|
+
*/
|
|
16
|
+
class Spinner extends _1.UxBase {
|
|
17
|
+
constructor(outputEnabled) {
|
|
18
|
+
super(outputEnabled);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Start a spinner on the console.
|
|
22
|
+
*/
|
|
23
|
+
start(action, status, opts) {
|
|
24
|
+
this.maybeNoop(() => core_1.CliUx.ux.action.start(action, status, opts));
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Stop the spinner on the console.
|
|
28
|
+
*/
|
|
29
|
+
stop(msg) {
|
|
30
|
+
this.maybeNoop(() => core_1.CliUx.ux.action.stop(msg));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Set the status of the current spinner.
|
|
34
|
+
*/
|
|
35
|
+
set status(status) {
|
|
36
|
+
core_1.CliUx.ux.action.status = status;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Get the status of the current spinner.
|
|
40
|
+
*/
|
|
41
|
+
get status() {
|
|
42
|
+
return core_1.CliUx.ux.action.status;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Pause the spinner on the console.
|
|
46
|
+
*/
|
|
47
|
+
pause(fn, icon) {
|
|
48
|
+
this.maybeNoop(() => core_1.CliUx.ux.action.pause(fn, icon));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.Spinner = Spinner;
|
|
52
|
+
//# sourceMappingURL=spinner.js.map
|
package/lib/ux/ux.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CliUx } from '@oclif/core';
|
|
2
|
+
import { AnyJson } from '@salesforce/ts-types';
|
|
3
|
+
import { UxBase } from './base';
|
|
4
|
+
export declare class Ux extends UxBase {
|
|
5
|
+
constructor(outputEnabled: boolean);
|
|
6
|
+
table<T extends Ux.Table.Data>(data: T[], columns: Ux.Table.Columns<T>, options?: Ux.Table.Options): void;
|
|
7
|
+
url(text: string, uri: string, params?: {}): void;
|
|
8
|
+
styledJSON(obj: AnyJson): void;
|
|
9
|
+
styledObject(obj: AnyJson): void;
|
|
10
|
+
}
|
|
11
|
+
export declare namespace Ux {
|
|
12
|
+
namespace Table {
|
|
13
|
+
type Data = Record<string, unknown>;
|
|
14
|
+
type Columns<T extends Data> = CliUx.Table.table.Columns<T>;
|
|
15
|
+
type Options = CliUx.Table.table.Options;
|
|
16
|
+
}
|
|
17
|
+
}
|
package/lib/ux/ux.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.Ux = void 0;
|
|
10
|
+
const core_1 = require("@oclif/core");
|
|
11
|
+
const base_1 = require("./base");
|
|
12
|
+
class Ux extends base_1.UxBase {
|
|
13
|
+
constructor(outputEnabled) {
|
|
14
|
+
super(outputEnabled);
|
|
15
|
+
}
|
|
16
|
+
table(data, columns, options) {
|
|
17
|
+
this.maybeNoop(() => core_1.CliUx.ux.table(data, columns, options));
|
|
18
|
+
}
|
|
19
|
+
url(text, uri, params = {}) {
|
|
20
|
+
this.maybeNoop(() => core_1.CliUx.ux.url(text, uri, params));
|
|
21
|
+
}
|
|
22
|
+
styledJSON(obj) {
|
|
23
|
+
this.maybeNoop(() => core_1.CliUx.ux.styledJSON(obj));
|
|
24
|
+
}
|
|
25
|
+
styledObject(obj) {
|
|
26
|
+
this.maybeNoop(() => core_1.CliUx.ux.styledObject(obj));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.Ux = Ux;
|
|
30
|
+
//# sourceMappingURL=ux.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/sf-plugins-core",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Utils for writing deploy and retrieve plugins",
|
|
5
5
|
"main": "lib/exported",
|
|
6
6
|
"types": "lib/exported.d.ts",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"build": "sf-build",
|
|
10
10
|
"ci-docs": "yarn sf-ci-docs",
|
|
11
11
|
"clean": "sf-clean",
|
|
12
|
-
"clean-all": "sf
|
|
12
|
+
"clean-all": "sf-clean all",
|
|
13
13
|
"compile": "sf-compile",
|
|
14
14
|
"docs": "sf-docs",
|
|
15
15
|
"format": "sf-format",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"lint-fix": "yarn sf-lint --fix",
|
|
18
18
|
"postcompile": "tsc -p test",
|
|
19
19
|
"prepack": "sf-prepack",
|
|
20
|
+
"prepare": "sf-install",
|
|
20
21
|
"pretest": "sf-compile-test",
|
|
21
22
|
"test": "sf-test"
|
|
22
23
|
},
|
|
@@ -30,48 +31,41 @@
|
|
|
30
31
|
"!lib/**/*.map",
|
|
31
32
|
"/messages"
|
|
32
33
|
],
|
|
33
|
-
"husky": {
|
|
34
|
-
"hooks": {
|
|
35
|
-
"commit-msg": "sf-husky-commit-msg",
|
|
36
|
-
"pre-commit": "sf-husky-pre-commit",
|
|
37
|
-
"pre-push": "sf-husky-pre-push"
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
34
|
"dependencies": {
|
|
41
|
-
"@oclif/core": "^1.0
|
|
42
|
-
"@salesforce/core": "
|
|
35
|
+
"@oclif/core": "^1.2.0",
|
|
36
|
+
"@salesforce/core": "3.7.3",
|
|
43
37
|
"@salesforce/kit": "^1.5.17",
|
|
44
38
|
"@salesforce/ts-types": "^1.5.20",
|
|
45
|
-
"cli-ux": "^5.6.3",
|
|
46
39
|
"inquirer": "^8.2.0"
|
|
47
40
|
},
|
|
48
41
|
"devDependencies": {
|
|
49
42
|
"@salesforce/dev-config": "^2.1.2",
|
|
50
|
-
"@salesforce/dev-scripts": "^0.
|
|
43
|
+
"@salesforce/dev-scripts": "^1.0.2",
|
|
51
44
|
"@salesforce/prettier-config": "^0.0.2",
|
|
52
45
|
"@salesforce/ts-sinon": "^1.2.3",
|
|
53
46
|
"@types/inquirer": "^8.1.3",
|
|
54
|
-
"@typescript-eslint/eslint-plugin": "^2.
|
|
55
|
-
"@typescript-eslint/parser": "^2.
|
|
47
|
+
"@typescript-eslint/eslint-plugin": "^4.2.0",
|
|
48
|
+
"@typescript-eslint/parser": "^4.2.0",
|
|
49
|
+
"chai": "^4.2.0",
|
|
56
50
|
"eslint": "^6.8.0",
|
|
57
51
|
"eslint-config-prettier": "^6.11.0",
|
|
58
|
-
"eslint-config-salesforce": "^0.1.
|
|
59
|
-
"eslint-config-salesforce-license": "^0.1.
|
|
60
|
-
"eslint-config-salesforce-typescript": "^0.
|
|
52
|
+
"eslint-config-salesforce": "^0.1.6",
|
|
53
|
+
"eslint-config-salesforce-license": "^0.1.6",
|
|
54
|
+
"eslint-config-salesforce-typescript": "^0.2.7",
|
|
61
55
|
"eslint-plugin-header": "^3.0.0",
|
|
62
56
|
"eslint-plugin-import": "^2.20.2",
|
|
63
57
|
"eslint-plugin-jsdoc": "^27.0.3",
|
|
64
58
|
"eslint-plugin-prettier": "^3.1.3",
|
|
65
|
-
"husky": "^
|
|
66
|
-
"mocha": "^
|
|
59
|
+
"husky": "^7.0.4",
|
|
60
|
+
"mocha": "^8.4.0",
|
|
67
61
|
"nyc": "^15.1.0",
|
|
68
62
|
"prettier": "^2.0.5",
|
|
69
|
-
"pretty-quick": "^
|
|
70
|
-
"shelljs": "0.8.
|
|
71
|
-
"sinon": "
|
|
63
|
+
"pretty-quick": "^3.1.0",
|
|
64
|
+
"shelljs": "0.8.5",
|
|
65
|
+
"sinon": "10.0.0",
|
|
72
66
|
"strip-ansi": "6.0.0",
|
|
73
|
-
"ts-node": "^
|
|
74
|
-
"typescript": "^4"
|
|
67
|
+
"ts-node": "^10.4.0",
|
|
68
|
+
"typescript": "^4.1.3"
|
|
75
69
|
},
|
|
76
70
|
"publishConfig": {
|
|
77
71
|
"access": "public"
|
package/lib/prompter.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { QuestionCollection } from 'inquirer';
|
|
2
|
-
export declare class Prompter {
|
|
3
|
-
/**
|
|
4
|
-
* Prompt user for information. See https://www.npmjs.com/package/inquirer for more.
|
|
5
|
-
*/
|
|
6
|
-
prompt<T = Prompter.Answers>(questions: QuestionCollection<T>, initialAnswers?: Partial<T>): Promise<T>;
|
|
7
|
-
}
|
|
8
|
-
export declare namespace Prompter {
|
|
9
|
-
type Answers<T = Record<string, unknown>> = T & Record<string, unknown>;
|
|
10
|
-
}
|
package/lib/prompter.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2021, salesforce.com, inc.
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
* Licensed under the BSD 3-Clause license.
|
|
6
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.Prompter = void 0;
|
|
10
|
-
const inquirer_1 = require("inquirer");
|
|
11
|
-
class Prompter {
|
|
12
|
-
/**
|
|
13
|
-
* Prompt user for information. See https://www.npmjs.com/package/inquirer for more.
|
|
14
|
-
*/
|
|
15
|
-
async prompt(questions, initialAnswers) {
|
|
16
|
-
const answers = await inquirer_1.prompt(questions, initialAnswers);
|
|
17
|
-
return answers;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.Prompter = Prompter;
|
|
21
|
-
//# sourceMappingURL=prompter.js.map
|