Skip to content

Commit bf8f43e

Browse files
Merge pull request #504 from Accenture/develop
4.1.5
2 parents 56a0e9a + e3b1593 commit bf8f43e

File tree

12 files changed

+117
-241
lines changed

12 files changed

+117
-241
lines changed

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ body:
3939
label: Version
4040
description: What version of our software are you running? (mcdev --version)
4141
options:
42+
- 4.1.5
4243
- 4.1.4
4344
- 4.1.3
4445
- 4.1.2

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ If you experience issues installing Accenture SFMC DevTools, please check out th
123123
1. Install Accenture SFMC DevTools by running `npm install -g mcdev` (prefix with `sudo` on MacOS)
124124
- If you get an error, please see the below troubleshooting section.
125125

126-
When completed run `mcdev --version` and it will show you which version you installed (e.g. `4.1.4`).
126+
When completed run `mcdev --version` and it will show you which version you installed (e.g. `4.1.5`).
127127

128128
> **_Side note for proud nerds_:**
129129
>
@@ -277,10 +277,10 @@ _Note: Regardless of which tag or branch you install_
277277
**Install specific version (using a version tag on npm):**
278278

279279
```bash
280-
npm install -g mcdev@4.1.4
280+
npm install -g mcdev@4.1.5
281281
```
282282

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.4)!
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)!
284284

285285
> **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`.
286286
@@ -476,7 +476,7 @@ Example url: `https://mcg123abcysykllg-0321cbs8bbt64.auth.marketingcloudapis.com
476476
> You can run this command without the interactive wizard asking questions using the `--skipInteraction` (or short`--yes`/`--y`) flag. In this case, you need to provide a few values in the command:
477477
>
478478
> ```bash
479-
> mcdev init --y.credentialsName "yourCustomCredentialName" --y.client_id "yourClientIdHere" --y.client_secret "yourClientSecretHere" --y.auth_url "https://yourTenantSubdomainHere.auth.marketingcloudapis.com/" --y.gitRemoteUrl "https://my.git.server.com/myrepo.git" --y.account_id 00000000
479+
> mcdev init --y.credentialName "yourCustomCredentialName" --y.client_id "yourClientIdHere" --y.client_secret "yourClientSecretHere" --y.auth_url "https://yourTenantSubdomainHere.auth.marketingcloudapis.com/" --y.gitRemoteUrl "https://my.git.server.com/myrepo.git" --y.account_id 00000000 --y.backupBUs "yes" --y.gitPush "yes"
480480
> ```
481481
482482
#### 6.1.2. upgrade
@@ -1493,7 +1493,7 @@ Assuming you cloned Accenture SFMC DevTools into `C:\repos\sfmc-devtools\` (or `
14931493
14941494
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.
14951495
1496-
To test your new **global** developer setup, run `mcdev --version` in CLI which should return the current version (e.g. `4.1.4`). Then, go into your mcdev repo and update the version with the suffix `-dev`, e.g. to `4.1.4-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.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.
14971497
14981498
> **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"`
14991499
> 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
15311531
4. Afterwards, install Accenture SFMC DevTools by running `npm install --save-dev mcdev`
15321532
- If you get an error, please see the below troubleshooting section.
15331533
1534-
When completed run `mcdev --version` and it will show you which version you installed (e.g. `4.1.4`).
1534+
When completed run `mcdev --version` and it will show you which version you installed (e.g. `4.1.5`).
15351535
15361536
### 9.3. NPM Scripts
15371537

docs/dist/documentation.md

Lines changed: 62 additions & 166 deletions
Large diffs are not rendered by default.

lib/cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ yargs
8181
handler: (argv) => {
8282
Mcdev.setSkipInteraction(argv.skipInteraction);
8383
Mcdev.setLoggingLevel(argv);
84-
Mcdev.initProject(argv.credentialsName, argv.skipInteraction);
84+
Mcdev.initProject(argv.credentialsName);
8585
},
8686
})
8787
.command({

lib/index.js

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,10 @@ class Mcdev {
5050
into deploy directory
5151
* @param {string} [argv.filter] filter file paths that start with any
5252
* @param {TYPE.DeltaPkgItem[]} [argv.diffArr] list of files to include in delta package (skips git diff when provided)
53-
* @param {TYPE.skipInteraction} [argv.skipInteraction] allows to skip interactive wizard
5453
* @returns {Promise.<TYPE.DeltaPkgItem[]>} list of changed items
5554
*/
5655
static async createDeltaPkg(argv) {
5756
Util.logger.info('Create Delta Package ::');
58-
Mcdev.setSkipInteraction(argv.skipInteraction);
5957
const properties = await config.getProperties();
6058
if (!(await config.checkProperties(properties))) {
6159
return null;
@@ -65,12 +63,7 @@ class Mcdev {
6563
? // get source market and source BU from config
6664
DevOps.getDeltaList(properties, argv.range, true, argv.filter)
6765
: // If no custom filter was provided, use deployment marketLists & templating
68-
DevOps.buildDeltaDefinitions(
69-
properties,
70-
argv.range,
71-
argv.diffArr,
72-
argv.skipInteraction
73-
);
66+
DevOps.buildDeltaDefinitions(properties, argv.range, argv.diffArr);
7467
}
7568

7669
/**
@@ -90,17 +83,15 @@ class Mcdev {
9083
Cli.explainTypes();
9184
}
9285
/**
93-
* @param {boolean | TYPE.skipInteraction} [skipInteraction] signals what to insert automatically for things usually asked via wizard
9486
* @returns {Promise.<boolean>} success flag
9587
*/
96-
static async upgrade(skipInteraction) {
97-
Mcdev.setSkipInteraction(skipInteraction);
88+
static async upgrade() {
9889
const properties = await config.getProperties();
9990
if (!properties) {
10091
Util.logger.error('No config found. Please run mcdev init');
10192
return false;
10293
}
103-
if ((await InitGit.initGitRepo(skipInteraction)).status === 'error') {
94+
if ((await InitGit.initGitRepo()).status === 'error') {
10495
return false;
10596
}
10697

@@ -295,14 +286,12 @@ class Mcdev {
295286
* Creates template file for properties.json
296287
*
297288
* @param {string} [credentialsName] identifying name of the installed package / project
298-
* @param {boolean | TYPE.skipInteraction} [skipInteraction] signals what to insert automatically for things usually asked via wizard
299289
* @returns {Promise.<void>} -
300290
*/
301-
static async initProject(credentialsName, skipInteraction) {
291+
static async initProject(credentialsName) {
302292
Util.logger.info('mcdev:: Setting up project');
303-
Mcdev.setSkipInteraction(skipInteraction);
304293
const properties = await config.getProperties(!!credentialsName);
305-
await Init.initProject(properties, credentialsName, skipInteraction);
294+
await Init.initProject(properties, credentialsName);
306295
}
307296

308297
/**

lib/util/cli.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,25 @@ const Cli = {
1818
* used when initially setting up a project.
1919
* loads default config and adds first credential
2020
*
21-
* @param {TYPE.skipInteraction} [skipInteraction] signals what to insert automatically for things usually asked via wizard
2221
* @returns {Promise.<boolean>} success of init
2322
*/
24-
async initMcdevConfig(skipInteraction) {
23+
async initMcdevConfig() {
2524
Util.logger.info('-- Initialising server connection --');
2625
Util.logger.info('Please enter a name for your "Installed Package" credentials:');
2726
const propertiesTemplate = await config.getDefaultProperties();
2827
delete propertiesTemplate.credentials.default;
2928

3029
// wait for the interaction to finish or else an outer await will run before this is done
31-
return this._setCredential(propertiesTemplate, null, skipInteraction);
30+
return this._setCredential(propertiesTemplate, null);
3231
},
3332
/**
3433
* Extends template file for properties.json
3534
*
3635
* @param {TYPE.Mcdevrc} properties config file's json
37-
* @param {TYPE.skipInteraction} [skipInteraction] signals what to insert automatically for things usually asked via wizard
3836
* @returns {Promise.<void>} -
3937
*/
40-
async addExtraCredential(properties, skipInteraction) {
38+
async addExtraCredential(properties) {
39+
const skipInteraction = Util.skipInteraction;
4140
if (!(await config.checkProperties(properties))) {
4241
// return null here to avoid seeing 2 error messages for the same issue
4342
return null;
@@ -54,7 +53,7 @@ const Cli = {
5453
`Credential '${skipInteraction.credentialName}' already existing. If you tried updating please provide run 'mcdev init ${skipInteraction.credentialName}'`
5554
);
5655
}
57-
return this._setCredential(properties, null, skipInteraction);
56+
return this._setCredential(properties, null);
5857
}
5958
},
6059
/**
@@ -63,15 +62,15 @@ const Cli = {
6362
*
6463
* @param {TYPE.Mcdevrc} properties config file's json
6564
* @param {string} credName name of credential that needs updating
66-
* @param {TYPE.skipInteraction} [skipInteraction] signals what to insert automatically for things usually asked via wizard
6765
* @returns {Promise.<boolean>} success of update
6866
*/
69-
async updateCredential(properties, credName, skipInteraction) {
67+
async updateCredential(properties, credName) {
68+
const skipInteraction = Util.skipInteraction;
7069
if (credName) {
7170
if (!skipInteraction) {
7271
Util.logger.info(`Please enter the details for '${credName}'`);
7372
}
74-
return await this._setCredential(properties, credName, skipInteraction);
73+
return await this._setCredential(properties, credName);
7574
}
7675
},
7776
/**
@@ -226,10 +225,10 @@ const Cli = {
226225
*
227226
* @param {TYPE.Mcdevrc} properties from config file
228227
* @param {string} [credName] name of credential that needs updating
229-
* @param {TYPE.skipInteraction} [skipInteraction] signals what to insert automatically for things usually asked via wizard
230228
* @returns {Promise.<boolean | string>} success of refresh or credential name
231229
*/
232-
async _setCredential(properties, credName, skipInteraction) {
230+
async _setCredential(properties, credName) {
231+
const skipInteraction = Util.skipInteraction;
233232
// Get user input
234233
let credentialsGood = null;
235234
let inputData;

lib/util/devops.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,10 @@ const DevOps = {
249249
* @param {TYPE.Mcdevrc} properties project config file
250250
* @param {string} range git commit range
251251
* @param {TYPE.DeltaPkgItem[]} [diffArr] instead of running git diff the method can also get a list of files to process
252-
* @param {TYPE.SkipInteraction} [skipInteraction] allows to skip interactive wizard
253252
* @returns {Promise.<TYPE.DeltaPkgItem[]>} -
254253
*/
255-
async buildDeltaDefinitions(properties, range, diffArr, skipInteraction) {
254+
async buildDeltaDefinitions(properties, range, diffArr) {
255+
const skipInteraction = Util.skipInteraction;
256256
// check if sourceTargetMapping is valid
257257
if (
258258
!properties.options.deployment.sourceTargetMapping ||

lib/util/init.git.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
2-
const TYPE = require('../../types/mcdev.d');
2+
// const TYPE = require('../../types/mcdev.d');
33
const File = require('./file');
44
const inquirer = require('inquirer');
55
const Util = require('./util');
@@ -14,10 +14,9 @@ const Init = {
1414
/**
1515
* check if git repo exists and otherwise create one
1616
*
17-
* @param {TYPE.skipInteraction} [skipInteraction] signals what to insert automatically for things usually asked via wizard
1817
* @returns {Promise.<{status: string, repoName: string}>} success flag
1918
*/
20-
async initGitRepo(skipInteraction) {
19+
async initGitRepo() {
2120
const result = { status: null, repoName: null };
2221
// check if git is installed (https://www.npmjs.com/package/command-exists)
2322
if (!commandExists.sync('git')) {
@@ -65,10 +64,10 @@ const Init = {
6564
}
6665

6766
// offer to update local user.name and user.email
68-
await this._updateGitConfigUser(skipInteraction);
67+
await this._updateGitConfigUser();
6968
if (newRepoInitialized) {
7069
// offer to insert git remote url now
71-
result.repoName = await this._addGitRemote(skipInteraction);
70+
result.repoName = await this._addGitRemote();
7271
}
7372

7473
Util.logger.info('✔️ Git initialization done.');
@@ -78,10 +77,10 @@ const Init = {
7877
/**
7978
* offer to push the new repo straight to the server
8079
*
81-
* @param {boolean | TYPE.skipInteraction} [skipInteraction] signals what to insert automatically for things usually asked via wizard
8280
* @returns {void}
8381
*/
84-
async gitPush(skipInteraction) {
82+
async gitPush() {
83+
const skipInteraction = Util.skipInteraction;
8584
const gitRemotes = (await git.getRemotes(true)).filter((item) => item.name === 'origin');
8685
if (gitRemotes.length && gitRemotes[0].refs.push) {
8786
// check if remote repo is still empty (otherwise to risky to blindly push)
@@ -101,7 +100,7 @@ const Init = {
101100
`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.`
102101
);
103102
let responses;
104-
if (!skipInteraction) {
103+
if (!skipInteraction || !skipInteraction.gitPush !== 'yes') {
105104
responses = await inquirer.prompt([
106105
{
107106
type: 'confirm',
@@ -111,7 +110,7 @@ const Init = {
111110
},
112111
]);
113112
}
114-
if (skipInteraction || responses.gitPush) {
113+
if (skipInteraction.gitPush === 'yes' || responses.gitPush) {
115114
Util.execSync('git', ['push', '-u', 'origin', 'master']);
116115
}
117116
} else if (remoteBranchesExist === true) {
@@ -124,10 +123,10 @@ const Init = {
124123
/**
125124
* offers to add the git remote origin
126125
*
127-
* @param {TYPE.skipInteraction} [skipInteraction] signals what to insert automatically for things usually asked via wizard
128126
* @returns {string} repo name (optionally)
129127
*/
130-
async _addGitRemote(skipInteraction) {
128+
async _addGitRemote() {
129+
const skipInteraction = Util.skipInteraction;
131130
// #1 ask if the user wants to do it now
132131
let responses;
133132
if (!skipInteraction) {
@@ -177,10 +176,10 @@ const Init = {
177176
/**
178177
* checks global config and ask to config the user info and then store it locally
179178
*
180-
* @param {boolean | TYPE.skipInteraction} [skipInteraction] signals what to insert automatically for things usually asked via wizard
181179
* @returns {void}
182180
*/
183-
async _updateGitConfigUser(skipInteraction) {
181+
async _updateGitConfigUser() {
182+
const skipInteraction = Util.skipInteraction;
184183
const gitUser = (await this._getGitConfigUser()) || {};
185184
Util.logger.info(
186185
`Please confirm your Git user name & email. It should be in the format 'FirstName LastName' and 'your.email@accenture.com'. The current (potentially wrong) values are provided as default. If correct, confirm with ENTER, otherwise please update:`

0 commit comments

Comments
 (0)