@provartesting/provardx-cli 0.0.3 → 0.0.4

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.
Files changed (65) hide show
  1. package/README.md +5 -0
  2. package/lib/Utility/errorCode.js +1 -2
  3. package/lib/Utility/errorCode.js.map +1 -1
  4. package/lib/Utility/errorHandler.d.ts +1 -1
  5. package/lib/Utility/errorHandler.js +2 -7
  6. package/lib/Utility/errorHandler.js.map +1 -1
  7. package/lib/Utility/fileSupport.js +5 -36
  8. package/lib/Utility/fileSupport.js.map +1 -1
  9. package/lib/Utility/jsonSupport.js +4 -11
  10. package/lib/Utility/jsonSupport.js.map +1 -1
  11. package/lib/Utility/propertyFileValidator.d.ts +1 -1
  12. package/lib/Utility/propertyFileValidator.js +26 -44
  13. package/lib/Utility/propertyFileValidator.js.map +1 -1
  14. package/lib/Utility/provarConfig.d.ts +1 -1
  15. package/lib/Utility/provarConfig.js +3 -7
  16. package/lib/Utility/provarConfig.js.map +1 -1
  17. package/lib/Utility/sfProvarCommandResult.d.ts +1 -1
  18. package/lib/Utility/sfProvarCommandResult.js +1 -5
  19. package/lib/Utility/sfProvarCommandResult.js.map +1 -1
  20. package/lib/Utility/stringSupport.js +2 -7
  21. package/lib/Utility/stringSupport.js.map +1 -1
  22. package/lib/commands/{sf/provar → provar}/config/generate.d.ts +3 -3
  23. package/lib/commands/provar/config/generate.js +70 -0
  24. package/lib/commands/provar/config/generate.js.map +1 -0
  25. package/lib/commands/{sf/provar → provar}/config/get.d.ts +1 -1
  26. package/lib/commands/provar/config/get.js +74 -0
  27. package/lib/commands/provar/config/get.js.map +1 -0
  28. package/lib/commands/{sf/provar → provar}/config/load.d.ts +2 -2
  29. package/lib/commands/provar/config/load.js +55 -0
  30. package/lib/commands/provar/config/load.js.map +1 -0
  31. package/lib/commands/{sf/provar → provar}/config/set.d.ts +1 -1
  32. package/lib/commands/provar/config/set.js +85 -0
  33. package/lib/commands/provar/config/set.js.map +1 -0
  34. package/lib/commands/{sf/provar → provar}/config/validate.d.ts +1 -1
  35. package/lib/commands/provar/config/validate.js +31 -0
  36. package/lib/commands/provar/config/validate.js.map +1 -0
  37. package/lib/constants/commandConstants.d.ts +5 -5
  38. package/lib/constants/commandConstants.js +7 -10
  39. package/lib/constants/commandConstants.js.map +1 -1
  40. package/lib/constants/errorMessages.js +2 -5
  41. package/lib/constants/errorMessages.js.map +1 -1
  42. package/lib/constants/propertyFileContent.d.ts +24 -0
  43. package/lib/constants/propertyFileContent.js +25 -0
  44. package/lib/constants/propertyFileContent.js.map +1 -0
  45. package/lib/constants/propertyFileSchema.d.ts +7 -0
  46. package/lib/constants/propertyFileSchema.js +9 -4
  47. package/lib/constants/propertyFileSchema.js.map +1 -1
  48. package/messages/sf.provar.config.generate.md +3 -3
  49. package/messages/sf.provar.config.get.md +3 -3
  50. package/messages/sf.provar.config.load.md +3 -3
  51. package/messages/sf.provar.config.set.md +3 -3
  52. package/messages/sf.provar.config.validate.md +3 -3
  53. package/oclif.manifest.json +176 -74
  54. package/package.json +26 -44
  55. package/lib/commands/sf/provar/config/generate.js +0 -102
  56. package/lib/commands/sf/provar/config/generate.js.map +0 -1
  57. package/lib/commands/sf/provar/config/get.js +0 -106
  58. package/lib/commands/sf/provar/config/get.js.map +0 -1
  59. package/lib/commands/sf/provar/config/load.js +0 -87
  60. package/lib/commands/sf/provar/config/load.js.map +0 -1
  61. package/lib/commands/sf/provar/config/set.js +0 -117
  62. package/lib/commands/sf/provar/config/set.js.map +0 -1
  63. package/lib/commands/sf/provar/config/validate.js +0 -40
  64. package/lib/commands/sf/provar/config/validate.js.map +0 -1
  65. package/lib/constants/propertyFileContent.json +0 -24
@@ -1,14 +1,14 @@
1
1
  # summary
2
2
 
3
- Setting different properties inside dx-properties.json
3
+ Sets a property in the loaded properties file.
4
4
 
5
5
  # description
6
6
 
7
- Setting different properties inside dx-properties.json loaded under .sf/config.json file
7
+ Sets a property in the loaded properties file.
8
8
 
9
9
  # examples
10
10
 
11
- - sets the provided properties with resp. values as key=value in properties.json
11
+ - Sets a property in the loaded properties file with resp. values
12
12
 
13
13
  <%= config.bin %> <%= command.id %> 'key'='value'
14
14
 
@@ -1,14 +1,14 @@
1
1
  # summary
2
2
 
3
- Validate the loaded provardx-properties.json against schema.
3
+ Checks if the loaded properties file has all the required properties set.
4
4
 
5
5
  # description
6
6
 
7
- Validating provardx-properties.json against the schema for all the needed properties with their expected values.
7
+ Checks if the loaded properties file has all the required properties set.
8
8
 
9
9
  # examples
10
10
 
11
- - Validate the loaded provardx-properties.json loaded under environment variables :
11
+ - Checks if the loaded properties file has all the required properties set
12
12
 
13
13
  <%= config.bin %> <%= command.id %>'
14
14
 
@@ -1,143 +1,245 @@
1
1
  {
2
- "version": "0.0.3",
3
2
  "commands": {
4
- "sf:provar:config:generate": {
5
- "id": "sf:provar:config:generate",
6
- "summary": "Summary of a command.",
7
- "description": "Generate a boilerplate property file.",
8
- "strict": true,
9
- "pluginName": "@provartesting/provardx-cli",
10
- "pluginAlias": "@provartesting/provardx-cli",
11
- "pluginType": "core",
3
+ "provar:config:generate": {
12
4
  "aliases": [],
5
+ "args": {},
6
+ "description": "Generates a boilerplate ProvarDX properties file.",
13
7
  "examples": [
14
- "Generates the boiler plate properties.json at the given path :\n<%= config.bin %> <%= command.id %> --properties-file 'propertiesFile path'"
8
+ "Generates a boilerplate ProvarDX properties file at the given path :\n<%= config.bin %> <%= command.id %> --properties-file 'propertiesFile path'"
15
9
  ],
16
10
  "flags": {
17
11
  "json": {
18
- "name": "json",
19
- "type": "boolean",
20
12
  "description": "Format output as json.",
21
13
  "helpGroup": "GLOBAL",
22
- "allowNo": false
14
+ "name": "json",
15
+ "allowNo": false,
16
+ "type": "boolean"
23
17
  },
24
18
  "properties-file": {
25
- "name": "properties-file",
26
- "type": "option",
27
19
  "char": "p",
28
- "summary": "Provardx-properties file path.",
20
+ "name": "properties-file",
29
21
  "required": true,
30
- "multiple": false
22
+ "summary": "Provardx-properties file path.",
23
+ "hasDynamicHelp": false,
24
+ "multiple": false,
25
+ "type": "option"
31
26
  },
32
27
  "no-prompt": {
33
- "name": "no-prompt",
34
- "type": "boolean",
35
28
  "char": "n",
29
+ "name": "no-prompt",
36
30
  "summary": "Don't prompt to confirm overwriting of the properties file if it already exists and overwrite it by default.",
37
- "allowNo": false
31
+ "allowNo": false,
32
+ "type": "boolean"
38
33
  }
39
34
  },
40
- "args": {}
41
- },
42
- "sf:provar:config:get": {
43
- "id": "sf:provar:config:get",
44
- "summary": "getting values for different properties inside dx properties.json",
45
- "description": "Getting values for different properties inside PROPERTIES_FILE_PATH loaded under .sf/config.json file",
46
- "strict": false,
47
- "pluginName": "@provartesting/provardx-cli",
35
+ "hasDynamicHelp": false,
36
+ "hiddenAliases": [],
37
+ "id": "provar:config:generate",
48
38
  "pluginAlias": "@provartesting/provardx-cli",
39
+ "pluginName": "@provartesting/provardx-cli",
49
40
  "pluginType": "core",
41
+ "strict": true,
42
+ "summary": "Generates a boilerplate ProvarDX properties file.",
43
+ "enableJsonFlag": true,
44
+ "isESM": true,
45
+ "relativePath": [
46
+ "lib",
47
+ "commands",
48
+ "provar",
49
+ "config",
50
+ "generate.js"
51
+ ],
52
+ "aliasPermutations": [],
53
+ "permutations": [
54
+ "provar:config:generate",
55
+ "config:provar:generate",
56
+ "config:generate:provar",
57
+ "provar:generate:config",
58
+ "generate:provar:config",
59
+ "generate:config:provar"
60
+ ]
61
+ },
62
+ "provar:config:get": {
50
63
  "aliases": [],
64
+ "args": {},
65
+ "description": "Retrieves a value from the loaded properties file.",
51
66
  "examples": [
52
- "gets the value for the provided property as a key from properties.json loaded inside config.json\n<%= config.bin %> <%= command.id %> 'key'"
67
+ "Retrieves a value from the loaded properties file\n<%= config.bin %> <%= command.id %> 'key'"
53
68
  ],
54
69
  "flags": {
55
70
  "json": {
56
- "name": "json",
57
- "type": "boolean",
58
71
  "description": "Format output as json.",
59
72
  "helpGroup": "GLOBAL",
60
- "allowNo": false
73
+ "name": "json",
74
+ "allowNo": false,
75
+ "type": "boolean"
61
76
  }
62
77
  },
63
- "args": {}
64
- },
65
- "sf:provar:config:load": {
66
- "id": "sf:provar:config:load",
67
- "summary": "Loading provardx-properties.json into system environment variables.",
68
- "description": "Loading after internally validating the provardx-properties.json file generated via config generate command",
69
- "strict": true,
70
- "pluginName": "@provartesting/provardx-cli",
78
+ "hasDynamicHelp": false,
79
+ "hiddenAliases": [],
80
+ "id": "provar:config:get",
71
81
  "pluginAlias": "@provartesting/provardx-cli",
82
+ "pluginName": "@provartesting/provardx-cli",
72
83
  "pluginType": "core",
84
+ "strict": false,
85
+ "summary": "Retrieves a value from the loaded properties file.",
86
+ "enableJsonFlag": true,
87
+ "isESM": true,
88
+ "relativePath": [
89
+ "lib",
90
+ "commands",
91
+ "provar",
92
+ "config",
93
+ "get.js"
94
+ ],
95
+ "aliasPermutations": [],
96
+ "permutations": [
97
+ "provar:config:get",
98
+ "config:provar:get",
99
+ "config:get:provar",
100
+ "provar:get:config",
101
+ "get:provar:config",
102
+ "get:config:provar"
103
+ ]
104
+ },
105
+ "provar:config:load": {
73
106
  "aliases": [],
107
+ "args": {},
108
+ "description": "Validates and loads a ProvarDX properties file for later use.",
74
109
  "examples": [
75
- "loads the properties.json at the given path\n<%= config.bin %> <%= command.id %> --properties-file 'propertiesFile path'"
110
+ "Validates and loads a ProvarDX properties file for later use at the given path\n<%= config.bin %> <%= command.id %> --properties-file 'propertiesFile path'"
76
111
  ],
77
112
  "flags": {
78
113
  "json": {
79
- "name": "json",
80
- "type": "boolean",
81
114
  "description": "Format output as json.",
82
115
  "helpGroup": "GLOBAL",
83
- "allowNo": false
116
+ "name": "json",
117
+ "allowNo": false,
118
+ "type": "boolean"
84
119
  },
85
120
  "properties-file": {
86
- "name": "properties-file",
87
- "type": "option",
88
121
  "char": "p",
89
- "summary": "Path of the properties file to be loaded.",
122
+ "name": "properties-file",
90
123
  "required": true,
91
- "multiple": false
124
+ "summary": "Path of the properties file to be loaded.",
125
+ "hasDynamicHelp": false,
126
+ "multiple": false,
127
+ "type": "option"
92
128
  }
93
129
  },
94
- "args": {}
95
- },
96
- "sf:provar:config:set": {
97
- "id": "sf:provar:config:set",
98
- "summary": "Setting different properties inside dx-properties.json",
99
- "description": "Setting different properties inside dx-properties.json loaded under .sf/config.json file",
100
- "strict": false,
101
- "pluginName": "@provartesting/provardx-cli",
130
+ "hasDynamicHelp": false,
131
+ "hiddenAliases": [],
132
+ "id": "provar:config:load",
102
133
  "pluginAlias": "@provartesting/provardx-cli",
134
+ "pluginName": "@provartesting/provardx-cli",
103
135
  "pluginType": "core",
136
+ "strict": true,
137
+ "summary": "Validates and loads a ProvarDX properties file for later use.",
138
+ "enableJsonFlag": true,
139
+ "isESM": true,
140
+ "relativePath": [
141
+ "lib",
142
+ "commands",
143
+ "provar",
144
+ "config",
145
+ "load.js"
146
+ ],
147
+ "aliasPermutations": [],
148
+ "permutations": [
149
+ "provar:config:load",
150
+ "config:provar:load",
151
+ "config:load:provar",
152
+ "provar:load:config",
153
+ "load:provar:config",
154
+ "load:config:provar"
155
+ ]
156
+ },
157
+ "provar:config:set": {
104
158
  "aliases": [],
159
+ "args": {},
160
+ "description": "Sets a property in the loaded properties file.",
105
161
  "examples": [
106
- "sets the provided properties with resp. values as key=value in properties.json\n<%= config.bin %> <%= command.id %> 'key'='value'"
162
+ "Sets a property in the loaded properties file with resp. values\n<%= config.bin %> <%= command.id %> 'key'='value'"
107
163
  ],
108
164
  "flags": {
109
165
  "json": {
110
- "name": "json",
111
- "type": "boolean",
112
166
  "description": "Format output as json.",
113
167
  "helpGroup": "GLOBAL",
114
- "allowNo": false
168
+ "name": "json",
169
+ "allowNo": false,
170
+ "type": "boolean"
115
171
  }
116
172
  },
117
- "args": {}
118
- },
119
- "sf:provar:config:validate": {
120
- "id": "sf:provar:config:validate",
121
- "summary": "Validate the loaded provardx-properties.json against schema.",
122
- "description": "Validating provardx-properties.json against the schema for all the needed properties with their expected values.",
123
- "strict": true,
124
- "pluginName": "@provartesting/provardx-cli",
173
+ "hasDynamicHelp": false,
174
+ "hiddenAliases": [],
175
+ "id": "provar:config:set",
125
176
  "pluginAlias": "@provartesting/provardx-cli",
177
+ "pluginName": "@provartesting/provardx-cli",
126
178
  "pluginType": "core",
179
+ "strict": false,
180
+ "summary": "Sets a property in the loaded properties file.",
181
+ "enableJsonFlag": true,
182
+ "isESM": true,
183
+ "relativePath": [
184
+ "lib",
185
+ "commands",
186
+ "provar",
187
+ "config",
188
+ "set.js"
189
+ ],
190
+ "aliasPermutations": [],
191
+ "permutations": [
192
+ "provar:config:set",
193
+ "config:provar:set",
194
+ "config:set:provar",
195
+ "provar:set:config",
196
+ "set:provar:config",
197
+ "set:config:provar"
198
+ ]
199
+ },
200
+ "provar:config:validate": {
127
201
  "aliases": [],
202
+ "args": {},
203
+ "description": "Checks if the loaded properties file has all the required properties set.",
128
204
  "examples": [
129
- "Validate the loaded provardx-properties.json loaded under environment variables :\n<%= config.bin %> <%= command.id %>'"
205
+ "Checks if the loaded properties file has all the required properties set\n<%= config.bin %> <%= command.id %>'"
130
206
  ],
131
207
  "flags": {
132
208
  "json": {
133
- "name": "json",
134
- "type": "boolean",
135
209
  "description": "Format output as json.",
136
210
  "helpGroup": "GLOBAL",
137
- "allowNo": false
211
+ "name": "json",
212
+ "allowNo": false,
213
+ "type": "boolean"
138
214
  }
139
215
  },
140
- "args": {}
216
+ "hasDynamicHelp": false,
217
+ "hiddenAliases": [],
218
+ "id": "provar:config:validate",
219
+ "pluginAlias": "@provartesting/provardx-cli",
220
+ "pluginName": "@provartesting/provardx-cli",
221
+ "pluginType": "core",
222
+ "strict": true,
223
+ "summary": "Checks if the loaded properties file has all the required properties set.",
224
+ "enableJsonFlag": true,
225
+ "isESM": true,
226
+ "relativePath": [
227
+ "lib",
228
+ "commands",
229
+ "provar",
230
+ "config",
231
+ "validate.js"
232
+ ],
233
+ "aliasPermutations": [],
234
+ "permutations": [
235
+ "provar:config:validate",
236
+ "config:provar:validate",
237
+ "config:validate:provar",
238
+ "provar:validate:config",
239
+ "validate:provar:config",
240
+ "validate:config:provar"
241
+ ]
141
242
  }
142
- }
243
+ },
244
+ "version": "0.0.4"
143
245
  }
package/package.json CHANGED
@@ -1,51 +1,30 @@
1
1
  {
2
2
  "name": "@provartesting/provardx-cli",
3
3
  "description": "A plugin for the Salesforce CLI to orchestrate testing activities and report quality metrics to Provar Manager",
4
- "version": "0.0.3",
4
+ "version": "0.0.4",
5
5
  "license": "BSD-3-Clause",
6
6
  "dependencies": {
7
- "@oclif/core": "^2.11.8",
8
- "@salesforce/core": "^5.2.10",
9
- "@salesforce/kit": "^3.0.14",
10
- "@salesforce/sf-plugins-core": "^3.1.14",
11
- "mochawesome": "^7.1.3",
12
- "jsonschema": "^1.4.1",
13
- "tslib": "^2"
7
+ "@oclif/core": "^3.18.1",
8
+ "@salesforce/core": "^6.5.1",
9
+ "@salesforce/kit": "^3.0.15",
10
+ "@salesforce/sf-plugins-core": "^7.1.4",
11
+ "jsonschema": "^1.4.1"
14
12
  },
15
13
  "devDependencies": {
16
- "@salesforce/cli-plugins-testkit": "^5.0.2",
17
- "@salesforce/dev-config": "^4.0.1",
18
- "@salesforce/dev-scripts": "^5.7.0",
19
- "@salesforce/prettier-config": "^0.0.3",
20
- "@salesforce/ts-sinon": "^1.4.18",
21
- "@swc/core": "^1.3.19",
22
- "@types/chai": "^4.3.10",
23
- "@types/inquirer": "^9.0.3",
24
- "@types/mocha": "^10.0.4",
25
- "@typescript-eslint/eslint-plugin": "^5.62.0",
26
- "@typescript-eslint/parser": "^5.62.0",
27
- "chai": "^4.3.10",
28
- "eslint": "^8.50.0",
29
- "eslint-config-prettier": "^8.5.0",
30
- "eslint-config-salesforce": "^2.0.2",
31
- "eslint-config-salesforce-typescript": "^1.1.2",
32
- "eslint-plugin-import": "2.28.1",
33
- "eslint-plugin-jsdoc": "^46.4.6",
34
- "eslint-plugin-sf-plugin": "^1.16.2",
35
- "husky": "^7.0.4",
36
- "mocha": "^9.2.2",
37
- "nyc": "^15.1.0",
38
- "oclif": "^3.17.2",
39
- "prettier": "^2.8.8",
40
- "pretty-quick": "^3.1.3",
14
+ "@oclif/plugin-command-snapshot": "^5.0.2",
15
+ "@salesforce/cli-plugins-testkit": "^5.1.7",
16
+ "@salesforce/dev-scripts": "^8.3.0",
17
+ "eslint-plugin-sf-plugin": "^1.17.2",
18
+ "oclif": "^4.3.4",
41
19
  "shx": "0.3.4",
42
20
  "sinon": "10.0.0",
43
21
  "ts-node": "^10.9.1",
44
22
  "typescript": "^5.1.6",
45
- "wireit": "^0.14.0"
23
+ "wireit": "^0.14.0",
24
+ "mochawesome": "^7.1.3"
46
25
  },
47
26
  "engines": {
48
- "node": ">=16.0.0"
27
+ "node": ">=18.0.0"
49
28
  },
50
29
  "files": [
51
30
  "/lib",
@@ -55,13 +34,12 @@
55
34
  "keywords": [
56
35
  "force",
57
36
  "salesforce",
58
- "sfdx",
59
37
  "salesforcedx",
60
- "sfdx-plugin",
38
+ "sf",
61
39
  "sf-plugin",
62
- "sf"
40
+ "sfdx",
41
+ "sfdx-plugin"
63
42
  ],
64
- "main": "lib/index.js",
65
43
  "oclif": {
66
44
  "commands": "./lib/commands",
67
45
  "bin": "sf",
@@ -83,7 +61,8 @@
83
61
  }
84
62
  }
85
63
  }
86
- }
64
+ },
65
+ "flexibleTaxonomy": true
87
66
  },
88
67
  "scripts": {
89
68
  "build": "wireit",
@@ -147,9 +126,10 @@
147
126
  "output": []
148
127
  },
149
128
  "test:compile": {
150
- "command": "tsc -p \"./test\" --pretty ",
129
+ "command": "tsc -p \"./test\" --pretty",
151
130
  "files": [
152
- "test/**/*.ts"
131
+ "test/**/*.ts",
132
+ "**/tsconfig.json"
153
133
  ],
154
134
  "output": []
155
135
  },
@@ -204,5 +184,7 @@
204
184
  ],
205
185
  "output": []
206
186
  }
207
- }
208
- }
187
+ },
188
+ "exports": "./lib/index.js",
189
+ "type": "module"
190
+ }
@@ -1,102 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2024 Provar Limited.
4
- * All rights reserved.
5
- * Licensed under the BSD 3-Clause license.
6
- * For full license text, see LICENSE.md file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
- */
8
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- var desc = Object.getOwnPropertyDescriptor(m, k);
11
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
- desc = { enumerable: true, get: function() { return m[k]; } };
13
- }
14
- Object.defineProperty(o, k2, desc);
15
- }) : (function(o, m, k, k2) {
16
- if (k2 === undefined) k2 = k;
17
- o[k2] = m[k];
18
- }));
19
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
- Object.defineProperty(o, "default", { enumerable: true, value: v });
21
- }) : function(o, v) {
22
- o["default"] = v;
23
- });
24
- var __importStar = (this && this.__importStar) || function (mod) {
25
- if (mod && mod.__esModule) return mod;
26
- var result = {};
27
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
- __setModuleDefault(result, mod);
29
- return result;
30
- };
31
- var __importDefault = (this && this.__importDefault) || function (mod) {
32
- return (mod && mod.__esModule) ? mod : { "default": mod };
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- const fs = __importStar(require("fs"));
36
- const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
37
- const core_1 = require("@salesforce/core");
38
- const fileSupport_1 = require("../../../../Utility/fileSupport");
39
- const errorHandler_1 = __importDefault(require("../../../../Utility/errorHandler"));
40
- const sfProvarCommandResult_1 = require("../../../../Utility/sfProvarCommandResult");
41
- const errorMessages_1 = require("../../../../constants/errorMessages");
42
- /**
43
- * Generates the boiler plate provardx-properties.json
44
- *
45
- */
46
- core_1.Messages.importMessagesDirectory(__dirname);
47
- const messages = core_1.Messages.loadMessages('@provartesting/provardx-cli', 'sf.provar.config.generate');
48
- class SfProvarConfigGenerate extends sf_plugins_core_1.SfCommand {
49
- constructor() {
50
- super(...arguments);
51
- this.errorHandler = new errorHandler_1.default();
52
- }
53
- async run() {
54
- const { flags } = await this.parse(SfProvarConfigGenerate);
55
- const PropertiesFileName = flags['properties-file'];
56
- if ((0, fileSupport_1.getExtension)(PropertiesFileName) !== '.json') {
57
- this.errorHandler.addErrorsToList('INVALID_FILE_EXTENSION', 'Only the .json file extension is supported.');
58
- }
59
- else if (fs.existsSync(PropertiesFileName) && !flags['no-prompt']) {
60
- if (!(await this.confirm(messages.getMessage('PropertiesFileOverwritePromptConfirm')))) {
61
- this.errorHandler.addErrorsToList('GENERATE_OPERATION_DENIED', errorMessages_1.errorMessages.GENERATE_OPERATION_DENIED);
62
- }
63
- else {
64
- this.generatePropertiesFile(PropertiesFileName);
65
- }
66
- }
67
- else {
68
- this.generatePropertiesFile(PropertiesFileName);
69
- }
70
- return (0, sfProvarCommandResult_1.populateResult)(flags, this.errorHandler, messages, this.log.bind(this));
71
- }
72
- generatePropertiesFile(PropertiesFileName) {
73
- try {
74
- (0, fileSupport_1.generateFile)(PropertiesFileName);
75
- /* eslint-disable */
76
- }
77
- catch (error) {
78
- if (error.code === 'ENOENT') {
79
- this.errorHandler.addErrorsToList('INVALID_PATH', errorMessages_1.errorMessages.INVALID_PATH);
80
- }
81
- else if (error.code === 'EPERM' || error.code === 'EACCES') {
82
- this.errorHandler.addErrorsToList('INSUFFICIENT_PERMISSIONS', 'The user does not have permissions to create the file.');
83
- }
84
- }
85
- }
86
- }
87
- SfProvarConfigGenerate.summary = messages.getMessage('summary');
88
- SfProvarConfigGenerate.description = messages.getMessage('description');
89
- SfProvarConfigGenerate.examples = messages.getMessages('examples');
90
- SfProvarConfigGenerate.flags = {
91
- 'properties-file': sf_plugins_core_1.Flags.string({
92
- summary: messages.getMessage('flags.properties-file.summary'),
93
- char: 'p',
94
- required: true,
95
- }),
96
- 'no-prompt': sf_plugins_core_1.Flags.boolean({
97
- summary: messages.getMessage('flags.no-prompt.summary'),
98
- char: 'n',
99
- }),
100
- };
101
- exports.default = SfProvarConfigGenerate;
102
- //# sourceMappingURL=generate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../../../src/commands/sf/provar/config/generate.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,iEAA+D;AAC/D,2CAA4C;AAC5C,iEAA6E;AAC7E,oFAA4D;AAC5D,qFAAkG;AAClG,uEAAoE;AAEpE;;;GAGG;AAEH,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,6BAA6B,EAAE,2BAA2B,CAAC,CAAC;AAEnG,MAAqB,sBAAuB,SAAQ,2BAAgC;IAApF;;QAiBU,iBAAY,GAAiB,IAAI,sBAAY,EAAE,CAAC;IAoC1D,CAAC;IAlCQ,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAC3D,MAAM,kBAAkB,GAAG,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAEpD,IAAI,IAAA,0BAAY,EAAC,kBAAkB,CAAC,KAAK,OAAO,EAAE;YAChD,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,wBAAwB,EAAE,6CAA6C,CAAC,CAAC;SAC5G;aAAM,IAAI,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE;YACnE,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,sCAAsC,CAAC,CAAC,CAAC,EAAE;gBACtF,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,2BAA2B,EAAE,6BAAa,CAAC,yBAAyB,CAAC,CAAC;aACzG;iBAAM;gBACL,IAAI,CAAC,sBAAsB,CAAC,kBAAkB,CAAC,CAAC;aACjD;SACF;aAAM;YACL,IAAI,CAAC,sBAAsB,CAAC,kBAAkB,CAAC,CAAC;SACjD;QAED,OAAO,IAAA,sCAAc,EAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACjF,CAAC;IAEO,sBAAsB,CAAC,kBAA0B;QACvD,IAAI;YACF,IAAA,0BAAY,EAAC,kBAAkB,CAAC,CAAC;YACjC,oBAAoB;SACrB;QAAC,OAAO,KAAU,EAAE;YACnB,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE;gBAC3B,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,cAAc,EAAE,6BAAa,CAAC,YAAY,CAAC,CAAC;aAC/E;iBAAM,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE;gBAC5D,IAAI,CAAC,YAAY,CAAC,eAAe,CAC/B,0BAA0B,EAC1B,wDAAwD,CACzD,CAAC;aACH;SACF;IACH,CAAC;;AAnDsB,8BAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,AAAjC,CAAkC;AACzC,kCAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,AAArC,CAAsC;AACjD,+BAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,AAAnC,CAAoC;AAE5C,4BAAK,GAAG;IAC7B,iBAAiB,EAAE,uBAAK,CAAC,MAAM,CAAC;QAC9B,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,+BAA+B,CAAC;QAC7D,IAAI,EAAE,GAAG;QACT,QAAQ,EAAE,IAAI;KACf,CAAC;IACF,WAAW,EAAE,uBAAK,CAAC,OAAO,CAAC;QACzB,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,yBAAyB,CAAC;QACvD,IAAI,EAAE,GAAG;KACV,CAAC;CACH,AAV2B,CAU1B;kBAfiB,sBAAsB"}