@madgex/fert 6.0.2 → 6.1.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/README.md +1 -1
- package/bin/cli.js +1 -0
- package/bin/commands/configs.js +1 -0
- package/bin/utils/configs.js +13 -2
- package/bin/utils/logging.js +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -212,7 +212,7 @@ Run for 1 service from the service folder:
|
|
|
212
212
|
| `--target` | Where to publish the `dist` directory assets.<br/>`dev` \| `production` (`string`) |
|
|
213
213
|
| `--dry-run` | Dry run, dont actually upload anything |
|
|
214
214
|
|
|
215
|
-
Send all files and directories created in the `dist` directory to either development or production versions of the Asset Store API. Files uploaded to the Asset Store API are available via a CloudFront-based CDN
|
|
215
|
+
Send all files and directories created in the `dist` directory to either development or production versions of the Asset Store API. Files uploaded to the Asset Store API are available via a CloudFront-based CDN
|
|
216
216
|
|
|
217
217
|
**Outline of implementation**
|
|
218
218
|
|
package/bin/cli.js
CHANGED
|
@@ -47,6 +47,7 @@ const run = () => {
|
|
|
47
47
|
'Download known configs from the Configuration API for environment "dev" or "production"',
|
|
48
48
|
)
|
|
49
49
|
.option('--query [configName]', 'Describe known keys for a config, omit to list all known configs')
|
|
50
|
+
.option('--skip-key-delete', 'Skip deleting keys not present in local config files on publish')
|
|
50
51
|
.action((...args) => configsCommand(...args));
|
|
51
52
|
|
|
52
53
|
cli
|
package/bin/commands/configs.js
CHANGED
package/bin/utils/configs.js
CHANGED
|
@@ -124,10 +124,16 @@ export async function loadLocalConfigs(workingDir) {
|
|
|
124
124
|
* @param {string} options.workingDir - required, Working dir for configs - should usually be 'root' where fert.config.js is
|
|
125
125
|
* @param {string} options.clientPropertyId - required, clientPropertyId
|
|
126
126
|
* @param {string} options.environment - default=production, clientPropertyId
|
|
127
|
+
* @param {boolean} [options.skipKeyDelete] - Whether to skip deleting keys not present in local files during publish
|
|
127
128
|
*
|
|
128
129
|
* @returns {Promise<boolean>} - Returns a promise that resolves to true if the update is successful.
|
|
129
130
|
*/
|
|
130
|
-
export async function updateProjectConfigs({
|
|
131
|
+
export async function updateProjectConfigs({
|
|
132
|
+
clientPropertyId,
|
|
133
|
+
workingDir,
|
|
134
|
+
environment = 'production',
|
|
135
|
+
skipKeyDelete = false,
|
|
136
|
+
} = {}) {
|
|
131
137
|
Hoek.assert(clientPropertyId, 'clientPropertyId is required');
|
|
132
138
|
Hoek.assert(workingDir, 'workingDir is required');
|
|
133
139
|
|
|
@@ -149,7 +155,12 @@ export async function updateProjectConfigs({ clientPropertyId, workingDir, envir
|
|
|
149
155
|
const { toRemove, toSet } = collateConfigs(api, localConfigs);
|
|
150
156
|
|
|
151
157
|
// Will throw on first failure
|
|
152
|
-
|
|
158
|
+
if (skipKeyDelete) {
|
|
159
|
+
log.warn('Skipping deleting config keys - can no longer ensure config parity!');
|
|
160
|
+
await setConfigs(api, toSet); // only set
|
|
161
|
+
} else {
|
|
162
|
+
await Promise.all([setConfigs(api, toSet), removeConfigs(api, toRemove)]);
|
|
163
|
+
}
|
|
153
164
|
|
|
154
165
|
const { host } = new URL(api.options.apiUrl);
|
|
155
166
|
log.info(``);
|
package/bin/utils/logging.js
CHANGED