@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 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
@@ -93,6 +93,7 @@ export async function handlePublish({ workingDir, clientPropertyId }, api, optio
93
93
  workingDir,
94
94
  clientPropertyId,
95
95
  environment: options.publish,
96
+ skipKeyDelete: options.skipKeyDelete,
96
97
  });
97
98
  } catch (err) {
98
99
  log.debug(err);
@@ -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({ clientPropertyId, workingDir, environment = 'production' } = {}) {
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
- await Promise.all([setConfigs(api, toSet), removeConfigs(api, toRemove)]);
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(``);
@@ -13,6 +13,9 @@ export const log = {
13
13
  error: (...args) => {
14
14
  console.log(chalk.red.bold('✖'), ...args);
15
15
  },
16
+ warn: (...args) => {
17
+ console.log(chalk.yellow.bold('⚠'), ...args);
18
+ },
16
19
  debug: (...args) => {
17
20
  debugLog(...args);
18
21
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@madgex/fert",
3
- "version": "6.0.2",
3
+ "version": "6.1.0",
4
4
  "description": "Tool to help build the V6 branding",
5
5
  "bin": {
6
6
  "fert": "./bin/cli.js"