@suitegeezus/suitecloud-cli 3.1.5 → 3.1.6-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/package.json +1 -1
- package/src/CLI.js +1 -1
- package/src/commands/account/setupci/AccountSetupCiAction.js +1 -1
- package/src/commands/file/list/ListFilesInputHandler.js +19 -8
- package/src/core/CommandActionExecutor.js +12 -4
- package/src/core/CommandRegistrationService.js +2 -1
- package/src/services/ProjectInfoService.js +6 -3
package/package.json
CHANGED
package/src/CLI.js
CHANGED
|
@@ -107,7 +107,7 @@ module.exports = class CLI {
|
|
|
107
107
|
_validateInteractive() {
|
|
108
108
|
let additionalAllowed = 0;
|
|
109
109
|
process.argv.forEach((arg)=>{
|
|
110
|
-
if( /\b(authid|project|config|debug)\b/.test(arg) ) additionalAllowed += 2;
|
|
110
|
+
if( /\b(authid|project|config|debug|skiphooks|folder)\b/.test(arg) ) additionalAllowed += 2;
|
|
111
111
|
});
|
|
112
112
|
if (process.argv.length > (4 + additionalAllowed) ) {
|
|
113
113
|
// There are more options apart from -i or --interactive
|
|
@@ -21,7 +21,7 @@ module.exports = class AccountSetupCiAction extends BaseAction {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
preExecute(params) {
|
|
24
|
-
this._projectInfoService.checkWorkingDirectoryContainsValidProject(this._commandMetadata.name);
|
|
24
|
+
this._projectInfoService.checkWorkingDirectoryContainsValidProject(this._commandMetadata.name, false);
|
|
25
25
|
|
|
26
26
|
if (params[OPTIONS.ACCOUNT]) {
|
|
27
27
|
params[OPTIONS.ACCOUNT] = params[OPTIONS.ACCOUNT].toUpperCase();
|
|
@@ -35,20 +35,31 @@ module.exports = class ListFilesInputHandler extends BaseInputHandler {
|
|
|
35
35
|
if (accountFileCabinetFolders.length === 0) {
|
|
36
36
|
throw NodeTranslationService.getMessage(ERRORS.NO_FOLDERS_FOUND);
|
|
37
37
|
}
|
|
38
|
-
const fileCabinetFolders = accountFileCabinetFolders.map((folderPath) => {
|
|
39
|
-
return {
|
|
40
|
-
name: folderPath,
|
|
41
|
-
value: folderPath,
|
|
42
|
-
};
|
|
43
|
-
});
|
|
44
38
|
|
|
39
|
+
const fileCabinetFolders = new Set();
|
|
40
|
+
fileCabinetFolders.add(SUITE_SCRIPTS_FOLDER);
|
|
41
|
+
let defaultValue = SUITE_SCRIPTS_FOLDER;
|
|
42
|
+
accountFileCabinetFolders.forEach((folderPath) => {
|
|
43
|
+
// only return folder that match the filter
|
|
44
|
+
if( folderPath === params.folder ) defaultValue = folderPath;
|
|
45
|
+
if(
|
|
46
|
+
(typeof params.folder === 'string' && folderPath.includes(params.folder)) ||
|
|
47
|
+
typeof params.folder !== 'string'
|
|
48
|
+
){
|
|
49
|
+
return fileCabinetFolders.add({
|
|
50
|
+
name: folderPath,
|
|
51
|
+
value: folderPath,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
if( fileCabinetFolders.has(defaultValue)) fileCabinetFolders.delete(defaultValue);
|
|
45
56
|
return prompt([
|
|
46
57
|
{
|
|
47
58
|
type: CommandUtils.INQUIRER_TYPES.LIST,
|
|
48
59
|
name: this._commandMetadata.options.folder.name,
|
|
49
60
|
message: NodeTranslationService.getMessage(SELECT_FOLDER),
|
|
50
|
-
default:
|
|
51
|
-
choices: fileCabinetFolders,
|
|
61
|
+
default: defaultValue,
|
|
62
|
+
choices: [...fileCabinetFolders],
|
|
52
63
|
},
|
|
53
64
|
]);
|
|
54
65
|
}
|
|
@@ -256,10 +256,18 @@ module.exports = class CommandActionExecutor {
|
|
|
256
256
|
// apply defaults first
|
|
257
257
|
if (options.hasOwnProperty(optionId)){
|
|
258
258
|
if(optionMeta?.mandatory) {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
259
|
+
switch(true){
|
|
260
|
+
case optionMeta?.type !== 'FLAG' && typeof optionMeta?.defaultOption === "boolean":
|
|
261
|
+
// don't set a value for boolean unless it is a FLAG type
|
|
262
|
+
break;
|
|
263
|
+
case (optionMeta?.type === "FLAG"):
|
|
264
|
+
optionValues[optionId] = Boolean(optionMeta.defaultOption)
|
|
265
|
+
break;
|
|
266
|
+
case !["undefined"].includes( typeof optionMeta?.defaultOption) && optionMeta?.type !== 'FLAG':
|
|
267
|
+
optionValues[optionId] = optionMeta.defaultOption;
|
|
268
|
+
break;
|
|
269
|
+
default:
|
|
270
|
+
break;
|
|
263
271
|
}
|
|
264
272
|
}
|
|
265
273
|
if(args.hasOwnProperty(optionId)) {
|
|
@@ -65,11 +65,12 @@ module.exports = class CommandRegistrationService {
|
|
|
65
65
|
|
|
66
66
|
_addInteractiveCommandOptions(commandSetup,options){
|
|
67
67
|
const filteredOptions = Object.entries(options).filter(([key,o])=>{
|
|
68
|
-
return ['authid','project','config','debug'].includes(o.name);
|
|
68
|
+
return ['authid','project','config','debug','skiphooks','folder'].includes(o.name);
|
|
69
69
|
});
|
|
70
70
|
filteredOptions.push(['interactive',{
|
|
71
71
|
"name": "interactive",
|
|
72
72
|
"option": "interactive",
|
|
73
|
+
"alias": "i",
|
|
73
74
|
"description": "Be interactive",
|
|
74
75
|
"mandatory": true,
|
|
75
76
|
"type": "FLAG",
|
|
@@ -19,6 +19,7 @@ const NodeTranslationService = require('./NodeTranslationService');
|
|
|
19
19
|
const xml2js = require('xml2js');
|
|
20
20
|
const assert = require('assert');
|
|
21
21
|
const { lineBreak } = require('../loggers/LoggerOsConstants');
|
|
22
|
+
const NodeConsoleLogger = require('../loggers/NodeConsoleLogger');
|
|
22
23
|
|
|
23
24
|
const MANIFEST_TAG_XML_PATH = '/manifest';
|
|
24
25
|
const PROJECT_TYPE_ATTRIBUTE = 'projecttype';
|
|
@@ -199,11 +200,13 @@ module.exports = class ProjectInfoService {
|
|
|
199
200
|
return this.isAccountCustomizationProject() || this.isSuiteAppProject();
|
|
200
201
|
}
|
|
201
202
|
|
|
202
|
-
checkWorkingDirectoryContainsValidProject(commandName) {
|
|
203
|
+
checkWorkingDirectoryContainsValidProject(commandName, doThrow=true) {
|
|
203
204
|
if (!FileUtils.exists(path.join(this._projectFolder, FILES.MANIFEST_XML))) {
|
|
204
205
|
const errorMessage = NodeTranslationService.getMessage(ERRORS.NOT_PROJECT_FOLDER, FILES.MANIFEST_XML, this._projectFolder, commandName)
|
|
205
|
-
|
|
206
|
-
|
|
206
|
+
if( doThrow) throw new CLIException(
|
|
207
|
+
errorMessage + lineBreak + NodeTranslationService.getMessage(ERRORS.SEE_PROJECT_STRUCTURE, INFO.PROJECT_STRUCTURE)
|
|
208
|
+
);
|
|
209
|
+
NodeConsoleLogger.warning(errorMessage);
|
|
207
210
|
}
|
|
208
211
|
}
|
|
209
212
|
};
|