mcdev 4.1.3 → 4.1.5
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/.github/dependabot.yml +1 -1
- package/.github/workflows/code-analysis.yml +2 -2
- package/.github/workflows/npm-publish.yml +4 -4
- package/README.md +6 -6
- package/docs/dist/documentation.md +123 -166
- package/lib/Retriever.js +8 -2
- package/lib/cli.js +1 -1
- package/lib/index.js +5 -16
- package/lib/metadataTypes/Asset.js +17 -9
- package/lib/metadataTypes/Automation.js +23 -12
- package/lib/metadataTypes/ContentArea.js +20 -7
- package/lib/metadataTypes/DataExtension.js +30 -12
- package/lib/metadataTypes/Email.js +1 -14
- package/lib/metadataTypes/EmailSendDefinition.js +2 -13
- package/lib/metadataTypes/MetadataType.js +26 -0
- package/lib/metadataTypes/Query.js +1 -12
- package/lib/metadataTypes/Script.js +1 -11
- package/lib/metadataTypes/TriggeredSendDefinition.js +2 -13
- package/lib/metadataTypes/definitions/Automation.definition.js +1 -0
- package/lib/metadataTypes/definitions/ContentArea.definition.js +1 -0
- package/lib/metadataTypes/definitions/DataExtension.definition.js +1 -0
- package/lib/metadataTypes/definitions/Email.definition.js +1 -0
- package/lib/metadataTypes/definitions/EmailSendDefinition.definition.js +1 -0
- package/lib/metadataTypes/definitions/Query.definition.js +1 -0
- package/lib/metadataTypes/definitions/Script.definition.js +1 -0
- package/lib/metadataTypes/definitions/TriggeredSendDefinition.definition.js +1 -0
- package/lib/util/cli.js +10 -11
- package/lib/util/devops.js +2 -2
- package/lib/util/init.git.js +12 -13
- package/lib/util/init.js +13 -21
- package/package.json +3 -3
- package/test/mockRoot/.mcdevrc.json +1 -1
package/lib/util/init.git.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
const TYPE = require('../../types/mcdev.d');
|
|
2
|
+
// const TYPE = require('../../types/mcdev.d');
|
|
3
3
|
const File = require('./file');
|
|
4
4
|
const inquirer = require('inquirer');
|
|
5
5
|
const Util = require('./util');
|
|
@@ -14,10 +14,9 @@ const Init = {
|
|
|
14
14
|
/**
|
|
15
15
|
* check if git repo exists and otherwise create one
|
|
16
16
|
*
|
|
17
|
-
* @param {TYPE.skipInteraction} [skipInteraction] signals what to insert automatically for things usually asked via wizard
|
|
18
17
|
* @returns {Promise.<{status: string, repoName: string}>} success flag
|
|
19
18
|
*/
|
|
20
|
-
async initGitRepo(
|
|
19
|
+
async initGitRepo() {
|
|
21
20
|
const result = { status: null, repoName: null };
|
|
22
21
|
// check if git is installed (https://www.npmjs.com/package/command-exists)
|
|
23
22
|
if (!commandExists.sync('git')) {
|
|
@@ -65,10 +64,10 @@ const Init = {
|
|
|
65
64
|
}
|
|
66
65
|
|
|
67
66
|
// offer to update local user.name and user.email
|
|
68
|
-
await this._updateGitConfigUser(
|
|
67
|
+
await this._updateGitConfigUser();
|
|
69
68
|
if (newRepoInitialized) {
|
|
70
69
|
// offer to insert git remote url now
|
|
71
|
-
result.repoName = await this._addGitRemote(
|
|
70
|
+
result.repoName = await this._addGitRemote();
|
|
72
71
|
}
|
|
73
72
|
|
|
74
73
|
Util.logger.info('✔️ Git initialization done.');
|
|
@@ -78,10 +77,10 @@ const Init = {
|
|
|
78
77
|
/**
|
|
79
78
|
* offer to push the new repo straight to the server
|
|
80
79
|
*
|
|
81
|
-
* @param {boolean | TYPE.skipInteraction} [skipInteraction] signals what to insert automatically for things usually asked via wizard
|
|
82
80
|
* @returns {void}
|
|
83
81
|
*/
|
|
84
|
-
async gitPush(
|
|
82
|
+
async gitPush() {
|
|
83
|
+
const skipInteraction = Util.skipInteraction;
|
|
85
84
|
const gitRemotes = (await git.getRemotes(true)).filter((item) => item.name === 'origin');
|
|
86
85
|
if (gitRemotes.length && gitRemotes[0].refs.push) {
|
|
87
86
|
// check if remote repo is still empty (otherwise to risky to blindly push)
|
|
@@ -101,7 +100,7 @@ const Init = {
|
|
|
101
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.`
|
|
102
101
|
);
|
|
103
102
|
let responses;
|
|
104
|
-
if (!skipInteraction) {
|
|
103
|
+
if (!skipInteraction || !skipInteraction.gitPush !== 'yes') {
|
|
105
104
|
responses = await inquirer.prompt([
|
|
106
105
|
{
|
|
107
106
|
type: 'confirm',
|
|
@@ -111,7 +110,7 @@ const Init = {
|
|
|
111
110
|
},
|
|
112
111
|
]);
|
|
113
112
|
}
|
|
114
|
-
if (skipInteraction || responses.gitPush) {
|
|
113
|
+
if (skipInteraction.gitPush === 'yes' || responses.gitPush) {
|
|
115
114
|
Util.execSync('git', ['push', '-u', 'origin', 'master']);
|
|
116
115
|
}
|
|
117
116
|
} else if (remoteBranchesExist === true) {
|
|
@@ -124,10 +123,10 @@ const Init = {
|
|
|
124
123
|
/**
|
|
125
124
|
* offers to add the git remote origin
|
|
126
125
|
*
|
|
127
|
-
* @param {TYPE.skipInteraction} [skipInteraction] signals what to insert automatically for things usually asked via wizard
|
|
128
126
|
* @returns {string} repo name (optionally)
|
|
129
127
|
*/
|
|
130
|
-
async _addGitRemote(
|
|
128
|
+
async _addGitRemote() {
|
|
129
|
+
const skipInteraction = Util.skipInteraction;
|
|
131
130
|
// #1 ask if the user wants to do it now
|
|
132
131
|
let responses;
|
|
133
132
|
if (!skipInteraction) {
|
|
@@ -177,10 +176,10 @@ const Init = {
|
|
|
177
176
|
/**
|
|
178
177
|
* checks global config and ask to config the user info and then store it locally
|
|
179
178
|
*
|
|
180
|
-
* @param {boolean | TYPE.skipInteraction} [skipInteraction] signals what to insert automatically for things usually asked via wizard
|
|
181
179
|
* @returns {void}
|
|
182
180
|
*/
|
|
183
|
-
async _updateGitConfigUser(
|
|
181
|
+
async _updateGitConfigUser() {
|
|
182
|
+
const skipInteraction = Util.skipInteraction;
|
|
184
183
|
const gitUser = (await this._getGitConfigUser()) || {};
|
|
185
184
|
Util.logger.info(
|
|
186
185
|
`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:`
|
package/lib/util/init.js
CHANGED
|
@@ -19,10 +19,10 @@ const Init = {
|
|
|
19
19
|
*
|
|
20
20
|
* @param {TYPE.Mcdevrc} properties config file's json
|
|
21
21
|
* @param {string} credentialName identifying name of the installed package / project
|
|
22
|
-
* @param {TYPE.skipInteraction} [skipInteraction] signals what to insert automatically for things usually asked via wizard
|
|
23
22
|
* @returns {Promise.<void>} -
|
|
24
23
|
*/
|
|
25
|
-
async initProject(properties, credentialName
|
|
24
|
+
async initProject(properties, credentialName) {
|
|
25
|
+
const skipInteraction = Util.skipInteraction;
|
|
26
26
|
if (!properties) {
|
|
27
27
|
// try to get cached properties because we return null in case of a crucial error
|
|
28
28
|
properties = config.properties;
|
|
@@ -42,11 +42,7 @@ const Init = {
|
|
|
42
42
|
do {
|
|
43
43
|
error = false;
|
|
44
44
|
try {
|
|
45
|
-
const success = await Cli.updateCredential(
|
|
46
|
-
properties,
|
|
47
|
-
credentialName,
|
|
48
|
-
skipInteraction
|
|
49
|
-
);
|
|
45
|
+
const success = await Cli.updateCredential(properties, credentialName);
|
|
50
46
|
if (success) {
|
|
51
47
|
Util.logger.info(`✔️ Credential '${credentialName}' updated.`);
|
|
52
48
|
} else {
|
|
@@ -72,11 +68,7 @@ const Init = {
|
|
|
72
68
|
do {
|
|
73
69
|
error = false;
|
|
74
70
|
try {
|
|
75
|
-
const success = await Cli.updateCredential(
|
|
76
|
-
properties,
|
|
77
|
-
badCredName,
|
|
78
|
-
skipInteraction
|
|
79
|
-
);
|
|
71
|
+
const success = await Cli.updateCredential(properties, badCredName);
|
|
80
72
|
if (success) {
|
|
81
73
|
Util.logger.info(`✔️ Credential '${badCredName}' updated.`);
|
|
82
74
|
} else {
|
|
@@ -128,10 +120,10 @@ const Init = {
|
|
|
128
120
|
}
|
|
129
121
|
let credentialName;
|
|
130
122
|
if (skipInteraction || responses.isAddCredential) {
|
|
131
|
-
credentialName = await Cli.addExtraCredential(properties
|
|
123
|
+
credentialName = await Cli.addExtraCredential(properties);
|
|
132
124
|
}
|
|
133
125
|
if (credentialName) {
|
|
134
|
-
await this._downloadAllBUs(`${credentialName}/*`, 'update'
|
|
126
|
+
await this._downloadAllBUs(`${credentialName}/*`, 'update');
|
|
135
127
|
}
|
|
136
128
|
}
|
|
137
129
|
} else {
|
|
@@ -139,7 +131,7 @@ const Init = {
|
|
|
139
131
|
// assuming it's the first time this command is run for this project
|
|
140
132
|
|
|
141
133
|
// initialize git repo
|
|
142
|
-
const initGit = await InitGit.initGitRepo(
|
|
134
|
+
const initGit = await InitGit.initGitRepo();
|
|
143
135
|
if (initGit.status === 'error') {
|
|
144
136
|
return;
|
|
145
137
|
}
|
|
@@ -152,7 +144,7 @@ const Init = {
|
|
|
152
144
|
}
|
|
153
145
|
|
|
154
146
|
// ask for credentials and create mcdev config
|
|
155
|
-
status = await Cli.initMcdevConfig(
|
|
147
|
+
status = await Cli.initMcdevConfig();
|
|
156
148
|
if (!status) {
|
|
157
149
|
return;
|
|
158
150
|
}
|
|
@@ -169,7 +161,7 @@ const Init = {
|
|
|
169
161
|
await this._downloadAllBUs('"*"', initGit.status);
|
|
170
162
|
|
|
171
163
|
// backup to server
|
|
172
|
-
await InitGit.gitPush(
|
|
164
|
+
await InitGit.gitPush();
|
|
173
165
|
|
|
174
166
|
// all done
|
|
175
167
|
Util.logger.info('You are now ready to work with Accenture SFMC DevTools!');
|
|
@@ -183,12 +175,12 @@ const Init = {
|
|
|
183
175
|
*
|
|
184
176
|
* @param {string} bu cred/bu or cred/* or *
|
|
185
177
|
* @param {string} gitStatus signals what state the git repo is in
|
|
186
|
-
* @param {boolean | TYPE.skipInteraction} [skipInteraction] signals what to insert automatically for things usually asked via wizard
|
|
187
178
|
* @returns {Promise.<void>} -
|
|
188
179
|
*/
|
|
189
|
-
async _downloadAllBUs(bu, gitStatus
|
|
180
|
+
async _downloadAllBUs(bu, gitStatus) {
|
|
181
|
+
const skipInteraction = Util.skipInteraction;
|
|
190
182
|
let responses;
|
|
191
|
-
if (!skipInteraction) {
|
|
183
|
+
if (!skipInteraction || skipInteraction.backupBUs !== 'yes') {
|
|
192
184
|
responses = await inquirer.prompt([
|
|
193
185
|
{
|
|
194
186
|
type: 'confirm',
|
|
@@ -198,7 +190,7 @@ const Init = {
|
|
|
198
190
|
},
|
|
199
191
|
]);
|
|
200
192
|
}
|
|
201
|
-
if (skipInteraction || responses.initialRetrieveAll) {
|
|
193
|
+
if (skipInteraction.backupBUs === 'yes' || responses.initialRetrieveAll) {
|
|
202
194
|
Util.execSync('mcdev', ['retrieve', bu]);
|
|
203
195
|
|
|
204
196
|
if (gitStatus === 'init') {
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcdev",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.5",
|
|
4
4
|
"description": "Accenture Salesforce Marketing Cloud DevTools",
|
|
5
|
-
"author": "joern.berkefeld, douglas.midgley, robert.zimmermann, maciej.barnas",
|
|
5
|
+
"author": "Accenture: joern.berkefeld, douglas.midgley, robert.zimmermann, maciej.barnas",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"eslint": "8.26.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.4.0",
|
|
71
71
|
"eslint-plugin-mocha": "10.1.0",
|
|
72
72
|
"eslint-plugin-prettier": "4.2.1",
|
|
73
73
|
"eslint-plugin-unicorn": "44.0.2",
|