mcdev 4.1.5 → 4.1.6

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.
@@ -39,6 +39,7 @@ body:
39
39
  label: Version
40
40
  description: What version of our software are you running? (mcdev --version)
41
41
  options:
42
+ - 4.1.6
42
43
  - 4.1.5
43
44
  - 4.1.4
44
45
  - 4.1.3
package/README.md CHANGED
@@ -123,7 +123,7 @@ If you experience issues installing Accenture SFMC DevTools, please check out th
123
123
  1. Install Accenture SFMC DevTools by running `npm install -g mcdev` (prefix with `sudo` on MacOS)
124
124
  - If you get an error, please see the below troubleshooting section.
125
125
 
126
- When completed run `mcdev --version` and it will show you which version you installed (e.g. `4.1.5`).
126
+ When completed run `mcdev --version` and it will show you which version you installed (e.g. `4.1.6`).
127
127
 
128
128
  > **_Side note for proud nerds_:**
129
129
  >
@@ -277,10 +277,10 @@ _Note: Regardless of which tag or branch you install_
277
277
  **Install specific version (using a version tag on npm):**
278
278
 
279
279
  ```bash
280
- npm install -g mcdev@4.1.5
280
+ npm install -g mcdev@4.1.6
281
281
  ```
282
282
 
283
- **Warning**: When you used the above method to install Accenture SFMC DevTools for a specific version or tag, trying to [update Accenture SFMC DevTools](#updating-mcdev) might not download the most recently published official version but instead stay on the version or branch you previously selected (in the above examples: develop, 4.1.5)!
283
+ **Warning**: When you used the above method to install Accenture SFMC DevTools for a specific version or tag, trying to [update Accenture SFMC DevTools](#updating-mcdev) might not download the most recently published official version but instead stay on the version or branch you previously selected (in the above examples: develop, 4.1.6)!
284
284
 
285
285
  > **Note**: The version is currently _not_ updated on the developer branch until a new release is published. Hence, you will not see a change if you run `mcdev --version`.
286
286
 
@@ -1493,7 +1493,7 @@ Assuming you cloned Accenture SFMC DevTools into `C:\repos\sfmc-devtools\` (or `
1493
1493
 
1494
1494
  This should tell npm to create a symlink to your cloned local directoty, allowing you to see updates you make in your mcdev repo instantly.
1495
1495
 
1496
- To test your new **global** developer setup, run `mcdev --version` in CLI which should return the current version (e.g. `4.1.5`). Then, go into your mcdev repo and update the version with the suffix `-dev`, e.g. to `4.1.5-dev` and then run `mcdev --version` again to verify that your change propagates instantly.
1496
+ To test your new **global** developer setup, run `mcdev --version` in CLI which should return the current version (e.g. `4.1.6`). Then, go into your mcdev repo and update the version with the suffix `-dev`, e.g. to `4.1.6-dev` and then run `mcdev --version` again to verify that your change propagates instantly.
1497
1497
 
1498
1498
  > **Not recommended:** Alternatively, you can install it locally only by opening a terminal in your project directory and executing `npm install --save-dev "C:\repos\sfmc-devtools"`
1499
1499
  > To run the local version you need to prepend "npx" before your commands, e.g. `npx mcdev --version`
@@ -1531,7 +1531,7 @@ The following explains how you _could_ install it locally for certain edge cases
1531
1531
  4. Afterwards, install Accenture SFMC DevTools by running `npm install --save-dev mcdev`
1532
1532
  - If you get an error, please see the below troubleshooting section.
1533
1533
 
1534
- When completed run `mcdev --version` and it will show you which version you installed (e.g. `4.1.5`).
1534
+ When completed run `mcdev --version` and it will show you which version you installed (e.g. `4.1.6`).
1535
1535
 
1536
1536
  ### 9.3. NPM Scripts
1537
1537
 
@@ -4790,7 +4790,8 @@ CLI helper class
4790
4790
 
4791
4791
  * [Cli](#Cli)
4792
4792
  * [.initMcdevConfig()](#Cli.initMcdevConfig) ⇒ <code>Promise.&lt;boolean&gt;</code>
4793
- * [.addExtraCredential(properties)](#Cli.addExtraCredential) ⇒ <code>Promise.&lt;void&gt;</code>
4793
+ * [.addExtraCredential(properties)](#Cli.addExtraCredential) ⇒ <code>Promise.&lt;(boolean\|string)&gt;</code>
4794
+ * [.logExistingCredentials(properties)](#Cli.logExistingCredentials) ⇒ <code>void</code>
4794
4795
  * [.updateCredential(properties, credName)](#Cli.updateCredential) ⇒ <code>Promise.&lt;boolean&gt;</code>
4795
4796
  * [.getCredentialObject(properties, target, [isCredentialOnly], [allowAll])](#Cli.getCredentialObject) ⇒ <code>Promise.&lt;TYPE.BuObject&gt;</code>
4796
4797
  * [._selectBU(properties, [credential], [isCredentialOnly], [allowAll])](#Cli._selectBU) ⇒ <code>Promise.&lt;Array&gt;</code>
@@ -4810,11 +4811,22 @@ loads default config and adds first credential
4810
4811
  **Returns**: <code>Promise.&lt;boolean&gt;</code> - success of init
4811
4812
  <a name="Cli.addExtraCredential"></a>
4812
4813
 
4813
- ### Cli.addExtraCredential(properties) ⇒ <code>Promise.&lt;void&gt;</code>
4814
+ ### Cli.addExtraCredential(properties) ⇒ <code>Promise.&lt;(boolean\|string)&gt;</code>
4814
4815
  Extends template file for properties.json
4815
4816
 
4816
4817
  **Kind**: static method of [<code>Cli</code>](#Cli)
4817
- **Returns**: <code>Promise.&lt;void&gt;</code> - -
4818
+ **Returns**: <code>Promise.&lt;(boolean\|string)&gt;</code> - status
4819
+
4820
+ | Param | Type | Description |
4821
+ | --- | --- | --- |
4822
+ | properties | <code>TYPE.Mcdevrc</code> | config file's json |
4823
+
4824
+ <a name="Cli.logExistingCredentials"></a>
4825
+
4826
+ ### Cli.logExistingCredentials(properties) ⇒ <code>void</code>
4827
+ helper that logs to cli which credentials are already existing in our config file
4828
+
4829
+ **Kind**: static method of [<code>Cli</code>](#Cli)
4818
4830
 
4819
4831
  | Param | Type | Description |
4820
4832
  | --- | --- | --- |
package/lib/util/cli.js CHANGED
@@ -33,7 +33,7 @@ const Cli = {
33
33
  * Extends template file for properties.json
34
34
  *
35
35
  * @param {TYPE.Mcdevrc} properties config file's json
36
- * @returns {Promise.<void>} -
36
+ * @returns {Promise.<boolean | string>} status
37
37
  */
38
38
  async addExtraCredential(properties) {
39
39
  const skipInteraction = Util.skipInteraction;
@@ -41,21 +41,31 @@ const Cli = {
41
41
  // return null here to avoid seeing 2 error messages for the same issue
42
42
  return null;
43
43
  } else {
44
- Util.logger.info('Found the following credentials in your config file:');
45
- for (const cred in properties.credentials) {
46
- if (Object.prototype.hasOwnProperty.call(properties.credentials, cred)) {
47
- Util.logger.info(` - ${cred}`);
48
- }
49
- }
44
+ this.logExistingCredentials(properties);
50
45
  Util.logger.info('\nPlease enter your new credentials');
51
46
  if (skipInteraction && properties.credentials[skipInteraction.credentialName]) {
52
47
  Util.logger.error(
53
48
  `Credential '${skipInteraction.credentialName}' already existing. If you tried updating please provide run 'mcdev init ${skipInteraction.credentialName}'`
54
49
  );
50
+ return null;
55
51
  }
56
52
  return this._setCredential(properties, null);
57
53
  }
58
54
  },
55
+ /**
56
+ * helper that logs to cli which credentials are already existing in our config file
57
+ *
58
+ * @param {TYPE.Mcdevrc} properties config file's json
59
+ * @returns {void}
60
+ */
61
+ logExistingCredentials(properties) {
62
+ Util.logger.info('Found the following credentials in your config file:');
63
+ for (const cred in properties.credentials) {
64
+ if (Object.prototype.hasOwnProperty.call(properties.credentials, cred)) {
65
+ Util.logger.info(` - ${cred}`);
66
+ }
67
+ }
68
+ },
59
69
  /**
60
70
  * Extends template file for properties.json
61
71
  * update credentials
@@ -245,7 +255,7 @@ const Cli = {
245
255
  inputData = skipInteraction;
246
256
  } else {
247
257
  throw new Error(
248
- '--skipInteraction flag found but missing required input for client_id,client_secret,auth_url,account_id,credentialName'
258
+ '--skipInteraction flag found but not defined for all required inputs: client_id,client_secret,auth_url,account_id,credentialName'
249
259
  );
250
260
  }
251
261
  } else {
@@ -100,7 +100,7 @@ const Init = {
100
100
  `Your remote Git repository is still empty and ready to store your initial backup. Hint: This is the server version of the repo which you share with your team.`
101
101
  );
102
102
  let responses;
103
- if (!skipInteraction || !skipInteraction.gitPush !== 'yes') {
103
+ if (!skipInteraction) {
104
104
  responses = await inquirer.prompt([
105
105
  {
106
106
  type: 'confirm',
package/lib/util/init.js CHANGED
@@ -31,13 +31,19 @@ const Init = {
31
31
  if ((await File.pathExists(Util.configFileName)) && properties) {
32
32
  // config exists
33
33
  if (credentialName) {
34
- Util.logger.info(`Updating credential '${credentialName}'`);
35
34
  // update-credential mode
36
35
  if (!properties.credentials[credentialName]) {
37
- Util.logger.error(`Could not find credential '${credentialName}'`);
36
+ Util.logger.error(
37
+ `Could not update credential '${credentialName}' because it was not found in your config. Please check your spelling and try again.`
38
+ );
39
+ Cli.logExistingCredentials(properties);
40
+ if (skipInteraction) {
41
+ return;
42
+ }
38
43
  const response = await Cli._selectBU(properties, null, true);
39
44
  credentialName = response.credential;
40
45
  }
46
+ Util.logger.info(`Updating existing credential '${credentialName}'`);
41
47
  let error;
42
48
  do {
43
49
  error = false;
@@ -48,8 +54,14 @@ const Init = {
48
54
  } else {
49
55
  error = true;
50
56
  }
51
- } catch {
52
- error = true;
57
+ } catch (ex) {
58
+ if (skipInteraction) {
59
+ Util.logger.error(ex.message);
60
+ return;
61
+ } else {
62
+ // retry
63
+ error = true;
64
+ }
53
65
  }
54
66
  } while (error && !skipInteraction);
55
67
  Util.logger.debug('reloading config');
@@ -180,7 +192,7 @@ const Init = {
180
192
  async _downloadAllBUs(bu, gitStatus) {
181
193
  const skipInteraction = Util.skipInteraction;
182
194
  let responses;
183
- if (!skipInteraction || skipInteraction.backupBUs !== 'yes') {
195
+ if (!skipInteraction) {
184
196
  responses = await inquirer.prompt([
185
197
  {
186
198
  type: 'confirm',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcdev",
3
- "version": "4.1.5",
3
+ "version": "4.1.6",
4
4
  "description": "Accenture Salesforce Marketing Cloud DevTools",
5
5
  "author": "Accenture: joern.berkefeld, douglas.midgley, robert.zimmermann, maciej.barnas",
6
6
  "license": "MIT",
@@ -75,7 +75,7 @@
75
75
  "jsdoc-to-markdown": "7.1.1",
76
76
  "lint-staged": "13.0.3",
77
77
  "mocha": "10.1.0",
78
- "mock-fs": "5.1.4",
78
+ "mock-fs": "5.2.0",
79
79
  "npm-check": "6.0.1",
80
80
  "npm-run-all": "4.1.5",
81
81
  "prettier-eslint": "15.0.1"
@@ -63,5 +63,5 @@
63
63
  "triggeredSendDefinition"
64
64
  ]
65
65
  },
66
- "version": "4.1.5"
66
+ "version": "4.1.6"
67
67
  }