mcdev 4.1.10 → 4.1.12
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/.github/ISSUE_TEMPLATE/bug.yml +2 -0
- package/README.md +5 -5
- package/boilerplate/files/.vscode/settings.json +10 -9
- package/boilerplate/forcedUpdates.json +4 -0
- package/docs/dist/documentation.md +14 -0
- package/lib/Retriever.js +2 -1
- package/lib/metadataTypes/Script.js +33 -16
- package/lib/util/init.git.js +1 -1
- package/lib/util/init.js +1 -1
- package/lib/util/util.js +5 -2
- package/package.json +3 -3
- package/test/mockRoot/.mcdevrc.json +1 -1
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.
|
|
126
|
+
When completed run `mcdev --version` and it will show you which version you installed (e.g. `4.1.12`).
|
|
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.
|
|
280
|
+
npm install -g mcdev@4.1.12
|
|
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.
|
|
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.12)!
|
|
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
|
|
|
@@ -1505,7 +1505,7 @@ Assuming you cloned Accenture SFMC DevTools into `C:\repos\sfmc-devtools\` (or `
|
|
|
1505
1505
|
|
|
1506
1506
|
This should tell npm to create a symlink to your cloned local directory, allowing you to see updates you make in your mcdev repo instantly.
|
|
1507
1507
|
|
|
1508
|
-
To test your new **global** developer setup, run `mcdev --version` in CLI which should return the current version (e.g. `4.1.
|
|
1508
|
+
To test your new **global** developer setup, run `mcdev --version` in CLI which should return the current version (e.g. `4.1.12`). Then, go into your mcdev repo and update the version with the suffix `-dev`, e.g. to `4.1.12-dev` and then run `mcdev --version` again to verify that your change propagates instantly.
|
|
1509
1509
|
|
|
1510
1510
|
> **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"`
|
|
1511
1511
|
> To run the local version you need to prepend "npx" before your commands, e.g. `npx mcdev --version`
|
|
@@ -1543,7 +1543,7 @@ The following explains how you _could_ install it locally for certain edge cases
|
|
|
1543
1543
|
4. Afterwards, install Accenture SFMC DevTools by running `npm install --save-dev mcdev`
|
|
1544
1544
|
- If you get an error, please see the below troubleshooting section.
|
|
1545
1545
|
|
|
1546
|
-
When completed run `mcdev --version` and it will show you which version you installed (e.g. `4.1.
|
|
1546
|
+
When completed run `mcdev --version` and it will show you which version you installed (e.g. `4.1.12`).
|
|
1547
1547
|
|
|
1548
1548
|
### 9.3. NPM Scripts
|
|
1549
1549
|
|
|
@@ -12,22 +12,23 @@
|
|
|
12
12
|
"tsconfig.json": "tsconfig.*.json",
|
|
13
13
|
"package.json": "package-lock.json, yarn.lock",
|
|
14
14
|
"*-doc.md": "${capture}-meta.json",
|
|
15
|
+
"*-meta.amp": "${capture}-meta.json",
|
|
16
|
+
"*-meta.html": "${capture}-meta.json",
|
|
17
|
+
"*-meta.sql": "${capture}-meta.json",
|
|
18
|
+
"*-meta.ssjs": "${capture}-meta.json",
|
|
15
19
|
"*.asset-asset-meta.html": "${dirname}.asset-asset-meta.json",
|
|
16
20
|
"*.asset-message-meta.html": "${dirname}.asset-message-meta.json",
|
|
17
|
-
"*.html": "${capture}.asset-code-meta.json",
|
|
18
21
|
"*.css": "${capture}.asset-code-meta.json",
|
|
19
22
|
"*.docx": "${capture}.asset-document-meta.json",
|
|
23
|
+
"*.eps": "${capture}.asset-image-meta.json",
|
|
24
|
+
"*.gif": "${capture}.asset-image-meta.json",
|
|
25
|
+
"*.html": "${capture}.asset-code-meta.json",
|
|
20
26
|
"*.ics": "${capture}.asset-document-meta.json",
|
|
21
|
-
"*.pdf": "${capture}.asset-document-meta.json",
|
|
22
|
-
"*.jpg": "${capture}.asset-image-meta.json",
|
|
23
27
|
"*.jpeg": "${capture}.asset-image-meta.json",
|
|
28
|
+
"*.jpg": "${capture}.asset-image-meta.json",
|
|
29
|
+
"*.pdf": "${capture}.asset-document-meta.json",
|
|
24
30
|
"*.png": "${capture}.asset-image-meta.json",
|
|
25
|
-
"*.
|
|
26
|
-
"*.eps": "${capture}.asset-image-meta.json",
|
|
27
|
-
"*-meta.sql": "${capture}-meta.json",
|
|
28
|
-
"*-meta.ssjs": "${capture}-meta.json",
|
|
29
|
-
"*-meta.amp": "${capture}-meta.json",
|
|
30
|
-
"*-meta.html": "${capture}-meta.json"
|
|
31
|
+
"*.txt": "${capture}.asset-textfile-meta.json"
|
|
31
32
|
},
|
|
32
33
|
"editor.codeActionsOnSave": {
|
|
33
34
|
"source.fixAll.eslint": true
|
|
@@ -4105,6 +4105,7 @@ Script MetadataType
|
|
|
4105
4105
|
* [.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#Script.buildTemplateForNested) ⇒ <code>Promise.<Array.<Array.<string>>></code>
|
|
4106
4106
|
* [._buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode)](#Script._buildForNested) ⇒ <code>Promise.<Array.<Array.<string>>></code>
|
|
4107
4107
|
* [.parseMetadata(metadata)](#Script.parseMetadata) ⇒ <code>TYPE.CodeExtractItem</code>
|
|
4108
|
+
* [.prepExtractedCode(metadataScript, metadataName)](#Script.prepExtractedCode) ⇒ <code>Object</code>
|
|
4108
4109
|
* [.getFilesToCommit(keyArr)](#Script.getFilesToCommit) ⇒ <code>Array.<string></code>
|
|
4109
4110
|
|
|
4110
4111
|
<a name="Script.retrieve"></a>
|
|
@@ -4276,6 +4277,19 @@ Splits the script metadata into two parts and parses in a standard manner
|
|
|
4276
4277
|
| --- | --- | --- |
|
|
4277
4278
|
| metadata | <code>TYPE.ScriptItem</code> | a single script activity definition |
|
|
4278
4279
|
|
|
4280
|
+
<a name="Script.prepExtractedCode"></a>
|
|
4281
|
+
|
|
4282
|
+
### Script.prepExtractedCode(metadataScript, metadataName) ⇒ <code>Object</code>
|
|
4283
|
+
helper for [parseMetadata](parseMetadata) and [_buildForNested](_buildForNested)
|
|
4284
|
+
|
|
4285
|
+
**Kind**: static method of [<code>Script</code>](#Script)
|
|
4286
|
+
**Returns**: <code>Object</code> - returns found extension and file content
|
|
4287
|
+
|
|
4288
|
+
| Param | Type | Description |
|
|
4289
|
+
| --- | --- | --- |
|
|
4290
|
+
| metadataScript | <code>string</code> | the code of the file |
|
|
4291
|
+
| metadataName | <code>string</code> | the name of the metadata |
|
|
4292
|
+
|
|
4279
4293
|
<a name="Script.getFilesToCommit"></a>
|
|
4280
4294
|
|
|
4281
4295
|
### Script.getFilesToCommit(keyArr) ⇒ <code>Array.<string></code>
|
package/lib/Retriever.js
CHANGED
|
@@ -100,7 +100,8 @@ class Retriever {
|
|
|
100
100
|
} else {
|
|
101
101
|
let cacheResult = null;
|
|
102
102
|
if (
|
|
103
|
-
|
|
103
|
+
(typeKeyMap[metadataType].length > 1 ||
|
|
104
|
+
typeKeyMap[metadataType][0] !== null) &&
|
|
104
105
|
(dependencies.includes(type) || dependencies.includes(metadataType))
|
|
105
106
|
) {
|
|
106
107
|
// if we have a key-list and the type is a dependency, we need to cache the whole type
|
|
@@ -214,6 +214,11 @@ class Script extends MetadataType {
|
|
|
214
214
|
) {
|
|
215
215
|
// get SSJS from filesystem
|
|
216
216
|
let code = await this._mergeCode(metadata, templateDir, templateName);
|
|
217
|
+
// try to remove script tags and decide on file extension (html/ssjs)
|
|
218
|
+
const file = Script.prepExtractedCode(code, metadata.name);
|
|
219
|
+
const fileExt = file.fileExt;
|
|
220
|
+
code = fileExt === 'ssjs' ? file.code.replace(/^\n/, '') : file.code;
|
|
221
|
+
// apply templating
|
|
217
222
|
try {
|
|
218
223
|
if (mode === 'definition') {
|
|
219
224
|
// replace template variables with their values
|
|
@@ -241,13 +246,13 @@ class Script extends MetadataType {
|
|
|
241
246
|
File.writeToFile(
|
|
242
247
|
[targetDir, this.definition.type],
|
|
243
248
|
fileName + '.' + this.definition.type + '-meta',
|
|
244
|
-
|
|
249
|
+
fileExt,
|
|
245
250
|
code
|
|
246
251
|
);
|
|
247
252
|
nestedFilePaths.push([
|
|
248
253
|
targetDir,
|
|
249
254
|
this.definition.type,
|
|
250
|
-
fileName + '.' + this.definition.type + '-meta.
|
|
255
|
+
fileName + '.' + this.definition.type + '-meta.' + fileExt,
|
|
251
256
|
]);
|
|
252
257
|
}
|
|
253
258
|
return nestedFilePaths;
|
|
@@ -266,30 +271,42 @@ class Script extends MetadataType {
|
|
|
266
271
|
// extract SSJS
|
|
267
272
|
const codeArr = [];
|
|
268
273
|
// keep between tags
|
|
274
|
+
const { fileExt, code } = Script.prepExtractedCode(metadata.script, metadata.name);
|
|
275
|
+
delete metadata.script;
|
|
276
|
+
codeArr.push({
|
|
277
|
+
subFolder: null,
|
|
278
|
+
fileName: metadata.key,
|
|
279
|
+
fileExt: fileExt,
|
|
280
|
+
content: code,
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
return { json: metadata, codeArr: codeArr, subFolder: null };
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* helper for {@link parseMetadata} and {@link _buildForNested}
|
|
287
|
+
*
|
|
288
|
+
* @param {string} metadataScript the code of the file
|
|
289
|
+
* @param {string} metadataName the name of the metadata
|
|
290
|
+
* @returns {{fileExt:string,code:string}} returns found extension and file content
|
|
291
|
+
*/
|
|
292
|
+
static prepExtractedCode(metadataScript, metadataName) {
|
|
269
293
|
const regex = /<\s*script .*?>(.+?)<\s*\/script>/gms;
|
|
270
|
-
let
|
|
294
|
+
let code;
|
|
271
295
|
let fileExt;
|
|
272
|
-
const regexMatches = regex.exec(
|
|
296
|
+
const regexMatches = regex.exec(metadataScript);
|
|
273
297
|
if (regexMatches?.length > 1) {
|
|
274
|
-
|
|
298
|
+
code = regexMatches[1];
|
|
275
299
|
fileExt = 'ssjs';
|
|
276
300
|
} else {
|
|
277
|
-
|
|
301
|
+
code = metadataScript;
|
|
278
302
|
fileExt = 'html';
|
|
279
303
|
Util.logger.warn(
|
|
280
|
-
` - Could not find script tags, saving code in ${
|
|
304
|
+
` - Could not find script tags, saving code in ${metadataName}.script-meta.html instead of as SSJS file.`
|
|
281
305
|
);
|
|
282
306
|
}
|
|
283
|
-
|
|
284
|
-
codeArr.push({
|
|
285
|
-
subFolder: null,
|
|
286
|
-
fileName: metadata.key,
|
|
287
|
-
fileExt: fileExt,
|
|
288
|
-
content: ssjs,
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
return { json: metadata, codeArr: codeArr, subFolder: null };
|
|
307
|
+
return { fileExt, code };
|
|
292
308
|
}
|
|
309
|
+
|
|
293
310
|
/**
|
|
294
311
|
* should return only the json for all but asset, query and script that are saved as multiple files
|
|
295
312
|
* additionally, the documentation for dataExtension and automation should be returned
|
package/lib/util/init.git.js
CHANGED
|
@@ -110,7 +110,7 @@ const Init = {
|
|
|
110
110
|
},
|
|
111
111
|
]);
|
|
112
112
|
}
|
|
113
|
-
if (skipInteraction
|
|
113
|
+
if (skipInteraction?.gitPush === 'true' || responses?.gitPush) {
|
|
114
114
|
Util.execSync('git', ['push', '-u', 'origin', 'master']);
|
|
115
115
|
}
|
|
116
116
|
} else if (remoteBranchesExist === true) {
|
package/lib/util/init.js
CHANGED
|
@@ -202,7 +202,7 @@ const Init = {
|
|
|
202
202
|
},
|
|
203
203
|
]);
|
|
204
204
|
}
|
|
205
|
-
if (skipInteraction
|
|
205
|
+
if (skipInteraction?.downloadBUs === 'true' || responses?.initialRetrieveAll) {
|
|
206
206
|
Util.execSync('mcdev', ['retrieve', bu]);
|
|
207
207
|
|
|
208
208
|
if (gitStatus === 'init') {
|
package/lib/util/util.js
CHANGED
|
@@ -130,6 +130,7 @@ const Util = {
|
|
|
130
130
|
* @returns {void}
|
|
131
131
|
*/
|
|
132
132
|
signalFatalError() {
|
|
133
|
+
Util.logger.debug('Util.signalFataError() sets process.exitCode = 1');
|
|
133
134
|
process.exitCode = 1;
|
|
134
135
|
},
|
|
135
136
|
/**
|
|
@@ -497,7 +498,10 @@ function startLogger() {
|
|
|
497
498
|
*/
|
|
498
499
|
errorStack: function (ex, message) {
|
|
499
500
|
if (message) {
|
|
500
|
-
|
|
501
|
+
// ! this method only sets exitCode=1 if message-param was set
|
|
502
|
+
// if not, then this method purely outputs debug information and should not change the exitCode
|
|
503
|
+
winstonError(message + ': ' + ex.message);
|
|
504
|
+
Util.signalFatalError();
|
|
501
505
|
}
|
|
502
506
|
let stack;
|
|
503
507
|
/* eslint-disable unicorn/prefer-ternary */
|
|
@@ -513,7 +517,6 @@ function startLogger() {
|
|
|
513
517
|
}
|
|
514
518
|
/* eslint-enable unicorn/prefer-ternary */
|
|
515
519
|
myWinston.debug(stack);
|
|
516
|
-
Util.signalFatalError();
|
|
517
520
|
},
|
|
518
521
|
/**
|
|
519
522
|
* errors should cause surrounding applications to take notice
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcdev",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.12",
|
|
4
4
|
"description": "Accenture Salesforce Marketing Cloud DevTools",
|
|
5
5
|
"author": "Accenture: joern.berkefeld, douglas.midgley, robert.zimmermann, maciej.barnas",
|
|
6
6
|
"license": "MIT",
|
|
@@ -64,10 +64,10 @@
|
|
|
64
64
|
"assert": "2.0.0",
|
|
65
65
|
"axios-mock-adapter": "1.21.2",
|
|
66
66
|
"chai": "4.3.6",
|
|
67
|
-
"eslint": "8.
|
|
67
|
+
"eslint": "8.27.0",
|
|
68
68
|
"eslint-config-prettier": "8.5.0",
|
|
69
69
|
"eslint-config-ssjs": "1.1.11",
|
|
70
|
-
"eslint-plugin-jsdoc": "39.
|
|
70
|
+
"eslint-plugin-jsdoc": "39.6.2",
|
|
71
71
|
"eslint-plugin-mocha": "10.1.0",
|
|
72
72
|
"eslint-plugin-prettier": "4.2.1",
|
|
73
73
|
"eslint-plugin-unicorn": "44.0.2",
|