@suitegeezus/suitecloud-cli 3.1.6-4 → 3.1.6-6
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/DELTA.md +1 -1
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/CLI.js +9 -8
- package/src/commands/Command.js +1 -1
- package/src/core/CommandActionExecutor.js +5 -4
package/DELTA.md
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
- `customflag` option available on any command including in interactive
|
|
18
18
|
- `customoptions` option available on any command including in interactive
|
|
19
19
|
- `debug` option available on any command including in interactive
|
|
20
|
-
- `
|
|
20
|
+
- `runhooks` option available on any command including in interactive
|
|
21
21
|
|
|
22
22
|
<p align="left"><a href="#"><img width="250" src="resources/Netsuite-logo-ocean-150-bg.png"></a></p>
|
|
23
23
|
|
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ Read the full list of prerequisites in [SuiteCloud CLI for Node.js Installation
|
|
|
21
21
|
## Supported Versions
|
|
22
22
|
This is a fork of `@oracle/suitecloud-cli`. It supports older command lines but with a new binary `sdf`.
|
|
23
23
|
|
|
24
|
-
It is enhanced for easier customizing via hooks. See [./DELTA.md
|
|
24
|
+
It is enhanced for easier customizing via hooks. See [DELTA.md](./DELTA.md) for more
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
## Installation
|
package/package.json
CHANGED
package/src/CLI.js
CHANGED
|
@@ -91,21 +91,22 @@ const UBIQUITOUS_OPTIONS = {
|
|
|
91
91
|
"defaultOption": false,
|
|
92
92
|
"disableInIntegrationMode": false
|
|
93
93
|
},
|
|
94
|
-
"
|
|
95
|
-
"name": "
|
|
96
|
-
"option": "
|
|
94
|
+
"runhooks": {
|
|
95
|
+
"name": "runhooks",
|
|
96
|
+
"option": "runhooks",
|
|
97
97
|
"description": "Skip hook execution. Usage:\n" + [
|
|
98
|
-
'"--
|
|
99
|
-
'"--
|
|
100
|
-
'"--
|
|
101
|
-
'"--
|
|
98
|
+
'"--runhooks all" (run all -- default)',
|
|
99
|
+
'"--runhooks pre" (run beforeExecuting only)',
|
|
100
|
+
'"--runhooks post" (run onCompleted/onError)',
|
|
101
|
+
'"--runhooks quiet" (same as all but if you are creating interactions you can use this as a clue to avoid interactions)',
|
|
102
|
+
'"--runhooks none" (run nothing)'
|
|
102
103
|
].join('\n'),
|
|
103
104
|
"allowInteractive":true,
|
|
104
105
|
"forceinclude": true,
|
|
105
106
|
"mandatory": false,
|
|
106
107
|
"type": "SINGLE",
|
|
107
108
|
"usage": "\"pre|post|all|none\"",
|
|
108
|
-
"defaultOption": "
|
|
109
|
+
"defaultOption": "all",
|
|
109
110
|
"disableInIntegrationMode": false
|
|
110
111
|
}
|
|
111
112
|
};
|
package/src/commands/Command.js
CHANGED
|
@@ -53,7 +53,8 @@ module.exports = class CommandActionExecutor {
|
|
|
53
53
|
let commandUserExtension;
|
|
54
54
|
const commandName = context.commandName;
|
|
55
55
|
const debugFilePath = this._getDebugFilePath(context.arguments.debug, commandName);
|
|
56
|
-
|
|
56
|
+
/** @type {'pre'|'post'|'quiet'|'none'|'all'} */
|
|
57
|
+
const runHooks = context.arguments.runhooks;
|
|
57
58
|
try {
|
|
58
59
|
const commandMetadata = this._commandsMetadataService.getCommandMetadataByName(commandName);
|
|
59
60
|
if (context.arguments.config) {
|
|
@@ -148,7 +149,7 @@ module.exports = class CommandActionExecutor {
|
|
|
148
149
|
process.env[ENV_VARS.SUITECLOUD_EXE] = this._binaryName;
|
|
149
150
|
// this might modified but we need the user's hooks to take advantage of their current values
|
|
150
151
|
process.env[ENV_VARS.SUITECLOUD_AUTHID] = authId;
|
|
151
|
-
const skipPre =
|
|
152
|
+
const skipPre = runHooks === 'post' || runHooks === 'none';
|
|
152
153
|
this._dumpDebugFile(debugFilePath, undefined, 'FIRST', runInInteractiveMode, skipPre);
|
|
153
154
|
this._dumpDebugFile(debugFilePath, 'beforeExecuting', beforeExecutingOptions, runInInteractiveMode, skipPre);
|
|
154
155
|
const beforeExecutingOutput = skipPre
|
|
@@ -180,7 +181,7 @@ module.exports = class CommandActionExecutor {
|
|
|
180
181
|
// command execution
|
|
181
182
|
// src/commands/Command.js, run(inputParams) => execution flow for all commands
|
|
182
183
|
const actionResult = await command.run(overriddenArguments);
|
|
183
|
-
const skipPost =
|
|
184
|
+
const skipPost = runHooks === 'pre' || runHooks === 'none';
|
|
184
185
|
|
|
185
186
|
if (context.runInInteractiveMode) {
|
|
186
187
|
// generate non-interactive equivalent
|
|
@@ -202,7 +203,7 @@ module.exports = class CommandActionExecutor {
|
|
|
202
203
|
|
|
203
204
|
} catch (error) {
|
|
204
205
|
let errorMessage = this._logGenericError(error);
|
|
205
|
-
const skipPostHooksCatch =
|
|
206
|
+
const skipPostHooksCatch = runHooks === 'pre' || runHooks === 'none';
|
|
206
207
|
if (commandUserExtension && commandUserExtension.onError) {
|
|
207
208
|
// run onError(error) from suitecloud.config.js
|
|
208
209
|
this._dumpDebugFile(debugFilePath, 'onError', error, context.runInInteractiveMode, skipPostHooksCatch);
|