@madgex/fert 4.2.0 → 4.2.1

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/README.md CHANGED
@@ -190,6 +190,91 @@ Index all the files and their paths in the `dist` directory, and using a recursi
190
190
 
191
191
  The Asset Store API uses a multi-part form upload to PUT files in the client directory. Upload paths are respected, directories are created on the fly.
192
192
 
193
+ ## Configs
194
+
195
+ `fert configs`
196
+
197
+ A set of commands to help with publishing, downloading & referencing project configs.
198
+
199
+ **Usage**
200
+
201
+ `fert configs [root] --[query|download|publish] [env]`
202
+
203
+ | Option | Description |
204
+ | -------------------- | --------------------------------------------------------------------------------------- |
205
+ | --query [configName] | Describe known keys for a config, omit to list all known configs |
206
+ | --download <env> | Download known configs from the Configuration API for environment "dev" or "production" |
207
+ | --publish | Publish configs to Configuration API environment "dev" or "production" |
208
+
209
+ ### Example usage
210
+
211
+ Its assumed you're running from a branding repo in all examples
212
+
213
+ #### Review all known configs
214
+
215
+ ```bash
216
+ # fert configs --query
217
+
218
+ Fert v0.0.0-development
219
+
220
+ Available config schemas...
221
+ * JobSeekerDesignConfig
222
+ * JobSeekerSiteConfig
223
+ * jsfe-config
224
+ * webconfig
225
+ ...
226
+ ```
227
+
228
+ #### Review validation schema & default values for a config
229
+
230
+ ```bash
231
+ # fert configs --query JobBoardConfig.filesizeDefinitions
232
+
233
+ Fert v0.0.0-development
234
+
235
+ Getting schema description for config: JobBoardConfig.filesizeDefinitions...
236
+ {
237
+ "documents": {
238
+ "type": "number",
239
+ "flags": {
240
+ "description": "The definition in MBs of how large documents can be",
241
+ "default": 1
242
+ }
243
+ }
244
+ }
245
+
246
+ Configs default values:
247
+ {
248
+ "documents": 1
249
+ }
250
+ ```
251
+
252
+ #### Download known configs for the current client (specified in `fert.config.js`) from the Configuration API. This is intended as a one-time command to get the current config values in the repo
253
+
254
+ ```bash
255
+ # fert configs --download production
256
+
257
+ Fert v0.0.0-development
258
+ ✔ Downloading v6 configs...
259
+ Saving files...
260
+ - JobBoardConfig.applicationForm.json
261
+ - JobBoardConfig.articlesFilterByDate.json
262
+ - JobBoardConfig.careerpathCountryIso.json
263
+ - JobBoardConfig.careerpathGlobalRoleSettings.json
264
+ ...
265
+ ```
266
+
267
+ #### Publish all known, valid configs found in branding repos `./config/*` for the current client. In this scenario, there is only `./config/jsfe-config.json`
268
+
269
+ ```bash
270
+ # fert configs --publish production
271
+
272
+ Fert v0.0.0-development
273
+ ✔ Config validated: jsfe-config
274
+ ✔ Project configs applied to configuration-api.job.madgexhosting.net
275
+ upload
276
+ ```
277
+
193
278
  # Global options
194
279
 
195
280
  These options are available no matter the command used.
@@ -216,5 +301,3 @@ Here are the default npm scripts in a Fert-scaffolded project.
216
301
  ```
217
302
 
218
303
  Its expected that a Jenkins pipeline will run `fert publish` to send all built assets to the Asset Store API.
219
-
220
- .
@@ -77,25 +77,27 @@ const loadLocalConfigs = (fertConfig) => {
77
77
  const configs = {};
78
78
  const files = fs.readdirSync(dir);
79
79
 
80
- files.forEach((file) => {
81
- const filePath = path.join(dir, file);
82
-
83
- if (fs.statSync(filePath).isFile()) {
84
- const fileName = path.basename(file, path.extname(file));
85
-
86
- // Purge any existing cache of the file
87
- delete require.cache[filePath];
88
-
89
- try {
90
- configs[fileName] = {
91
- path: filePath,
92
- data: require(filePath),
93
- };
94
- } catch (err) {
95
- log.error(`Error loading config: ${err.message}`);
80
+ files
81
+ .filter((file) => file.endsWith('.json'))
82
+ .forEach((file) => {
83
+ const filePath = path.join(dir, file);
84
+
85
+ if (fs.statSync(filePath).isFile()) {
86
+ const fileName = path.basename(file, path.extname(file));
87
+
88
+ // Purge any existing cache of the file
89
+ delete require.cache[filePath];
90
+
91
+ try {
92
+ configs[fileName] = {
93
+ path: filePath,
94
+ data: require(filePath),
95
+ };
96
+ } catch (err) {
97
+ log.error(`Error loading config (${filePath}): ${err.message}`);
98
+ }
96
99
  }
97
- }
98
- });
100
+ });
99
101
 
100
102
  return configs;
101
103
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@madgex/fert",
3
- "version": "4.2.0",
3
+ "version": "4.2.1",
4
4
  "description": "Tool to help build the V6 branding",
5
5
  "bin": {
6
6
  "fert": "./bin/cli.js"
@@ -31,8 +31,8 @@
31
31
  "@hapi/inert": "^7.1.0",
32
32
  "@hapi/vision": "^7.0.3",
33
33
  "@hapipal/toys": "^4.0.0",
34
- "@madgex/config-api-sdk": "^1.0.12",
35
- "@madgex/design-system": "^9.1.8",
34
+ "@madgex/config-api-sdk": "^1.0.13",
35
+ "@madgex/design-system": "^9.1.9",
36
36
  "@private/header-footer-podlet-server": "github:wiley/madgex-header-footer-podlet",
37
37
  "axios": "^1.7.9",
38
38
  "cac": "^6.7.14",
@@ -30,7 +30,7 @@
30
30
  <div class="mds-branded-container mds-branded-container--1 mds-padding-b4 mds-padding-bottom-b5 mds-margin-bottom-b5">
31
31
  <h2 class="mds-font-s2">Branded Container</h2>
32
32
  <p class="mds-margin-bottom-b4">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
33
- <a href="#" draggable="false" class="mds-button mds-button--neutral mds-button--small">Lorem ipsum</a>
33
+ <a href="#" draggable="false" class="mds-button mds-button--small">Lorem ipsum</a>
34
34
  </div>
35
35
  </div>
36
36
  </div>