Skip to content

Commit

Permalink
#38: merge develop
Browse files Browse the repository at this point in the history
  • Loading branch information
phjulia committed Jul 11, 2023
2 parents 5e43907 + 749f31b commit d0f8f4c
Show file tree
Hide file tree
Showing 69 changed files with 2,591 additions and 678 deletions.
8 changes: 4 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"env": {
"es6": true,
"node": true,
"mocha": true
"node": true
},
"extends": [
"eslint:recommended",
Expand Down Expand Up @@ -67,7 +66,6 @@
"unicorn/prefer-set-has": "off",
"unicorn/prefer-spread": "off",
"unicorn/prefer-string-replace-all": "error",
"unicorn/unicorn/no-lonely-if": "off",
"arrow-body-style": ["error", "as-needed"],
"curly": "error",
"no-console": "error",
Expand All @@ -84,6 +82,7 @@
}
}
],
"jsdoc/require-param-type": "error",
"jsdoc/tag-lines": ["warn", "any", { "startLines": 1 }],
"spaced-comment": ["warn", "always", { "block": { "exceptions": ["*"], "balanced": true } }]
},
Expand All @@ -103,7 +102,8 @@
"extends": ["plugin:mocha/recommended"],
"plugins": ["mocha"],
"rules": {
"mocha/no-mocha-arrows": "off"
"mocha/no-mocha-arrows": "off",
"mocha/no-pending-tests": "off"
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

## What changes did you make? (Give an overview)

...
- closes #1234

## Is there anything you'd like reviewers to focus on?
## Further details (optional)

...

Expand Down
1 change: 1 addition & 0 deletions .husky/post-checkout
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ if [[ ${PACKAGES[@]} ]]; then
done
echo "📦 Running npm install to update your dependencies..."
npm install
npm run lint:fix
else
echo "📦 All packages up-to-date. No need to run npm install."
fi
1 change: 1 addition & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ if [[ ${PACKAGES[@]} ]]; then
done
echo "📦 Running npm install to update your dependencies..."
npm install
npm run lint:fix
else
echo "📦 All packages up-to-date. No need to run npm install."
fi
506 changes: 346 additions & 160 deletions docs/dist/documentation.md

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions lib/Deployer.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class Deployer {
return buMultiMetadataTypeMap;
}
/**
* helper for {@link deploy}
* helper for {@link Deployer.deploy}
*
* @param {string} cred name of Credential
* @param {string} bu name of BU
Expand Down Expand Up @@ -215,10 +215,9 @@ class Deployer {
* @param {TYPE.SupportedMetadataTypes[]} [typeArr] limit deployment to given metadata type (can include subtype)
* @param {string[]} [keyArr] limit deployment to given metadata keys
* @param {boolean} [fromRetrieve] if true, no folders will be updated/created
* @param {boolean} [isRefresh] optional flag to indicate that triggeredSend should be refreshed after deployment of assets
* @returns {Promise.<TYPE.MultiMetadataTypeMap>} Promise of all deployed metadata
*/
async _deploy(typeArr, keyArr, fromRetrieve, isRefresh) {
async _deploy(typeArr, keyArr, fromRetrieve) {
if (await File.pathExists(this.deployDir)) {
/** @type {TYPE.MultiMetadataTypeMap} */
this.metadata = Deployer.readBUMetadata(this.deployDir, typeArr);
Expand Down Expand Up @@ -297,8 +296,7 @@ class Deployer {
const result = await MetadataTypeInfo[type].deploy(
this.metadata[type],
this.deployDir,
this.retrieveDir,
isRefresh
this.retrieveDir
);
multiMetadataTypeMap[type] = result;
cache.mergeMetadata(type, result);
Expand All @@ -312,7 +310,7 @@ class Deployer {
*
* @param {string} deployDir root directory of metadata.
* @param {string[]} [typeArr] limit deployment to given metadata type
* @param {boolean} [listBadKeys=false] do not print errors, used for badKeys()
* @param {boolean} [listBadKeys] do not print errors, used for badKeys()
* @returns {TYPE.MultiMetadataTypeMap} Metadata of BU in local directory
*/
static readBUMetadata(deployDir, typeArr, listBadKeys) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Retriever.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class Retriever {
}

/**
* helper for {@link retrieve} to get all dependencies of the given types
* helper for {@link Retriever.retrieve} to get all dependencies of the given types
*
* @param {TYPE.SupportedMetadataTypes[]} metadataTypes list of metadata types to retrieve; can include subtypes!
* @returns {TYPE.SupportedMetadataTypes[]} unique list dependent metadata types
Expand Down
78 changes: 69 additions & 9 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ yargs
.positional('KEY', {
type: 'string',
describe: 'metadata keys that shall be exclusively downloaded',
})
.option('like', {
type: 'string',
group: 'Options for retrieve:',
describe:
'filter metadata components (can include % as wildcard or _ for a single character)',
});
},
handler: (argv) => {
Expand Down Expand Up @@ -59,22 +65,31 @@ yargs
})
.option('changeKeyField', {
type: 'string',
group: 'Options for deploy:',
describe:
'enables updating the key of the deployed metadata with the value in provided field (e.g. c__newKey). Can be used to sync name and key fields.',
})
.option('changeKeyValue', {
type: 'string',
group: 'Options for deploy:',
describe:
'allows updating the key of the metadata to the provided value. Only available if a single type and key is deployed',
})
.option('fromRetrieve', {
type: 'boolean',
group: 'Options for deploy:',
describe: 'optionally deploy from retrieve folder',
})
.option('refresh', {
type: 'boolean',
group: 'Options for deploy:',
describe:
'optional for asset-message: runs refresh command for related triggeredSends after deploy',
})
.option('execute', {
type: 'boolean',
group: 'Options for deploy:',
describe: 'optional for query: runs execute after deploy',
});
},
handler: (argv) => {
Expand Down Expand Up @@ -307,6 +322,7 @@ yargs
builder: (yargs) => {
yargs.option('json', {
type: 'boolean',
group: 'Options for explainTypes:',
describe: 'optionaly return info in json format',
});
},
Expand All @@ -316,7 +332,7 @@ yargs
},
})
.command({
command: 'createDeltaPkg [range] [--filter <BU>] [--commitHistory <number>]',
command: 'createDeltaPkg [range]',
aliases: ['cdp'],
desc: 'Copies commit-based file delta into deploy folder',
builder: (yargs) => {
Expand All @@ -327,11 +343,13 @@ yargs
})
.option('filter', {
type: 'string',
group: 'Options for createDeltaPkg:',
describe:
'Disable templating & instead filter by the specified BU path (comma separated), can include subtype, will be prefixed with "retrieve/"',
})
.option('commitHistory', {
type: 'number',
group: 'Options for createDeltaPkg:',
describe: 'Number of commits to look back for changes (supersedes config)',
});
},
Expand Down Expand Up @@ -390,8 +408,8 @@ yargs
},
})
.command({
command: 'execute <BU> <TYPE> <KEY>',
aliases: ['exec'],
command: 'execute <BU> <TYPE> [KEY]',
aliases: ['exec', 'start'],
desc: 'executes the entity (query/journey/automation etc.)',
builder: (yargs) => {
yargs
Expand All @@ -406,11 +424,49 @@ yargs
.positional('KEY', {
type: 'string',
describe: 'key(s) of the metadata component(s)',
})
.option('like', {
type: 'string',
group: 'Options for execute:',
describe:
'filter metadata components (can include % as wildcard or _ for a single character)',
});
},
handler: (argv) => {
Mcdev.setOptions(argv);
// ! do not allow multiple types to be passed in here via csvToArray
Mcdev.execute(argv.BU, argv.TYPE, csvToArray(argv.KEY));
},
})
.command({
command: 'pause <BU> <TYPE> [KEY]',
aliases: ['p', 'stop'],
desc: 'pauses the entity (automation etc.)',
builder: (yargs) => {
yargs
.positional('BU', {
type: 'string',
describe: 'the business unit where to start an item',
})
.positional('TYPE', {
type: 'string',
describe: 'metadata type',
})
.positional('KEY', {
type: 'string',
describe: 'key(s) of the metadata component(s)',
})
.option('like', {
type: 'string',
group: 'Options for pause:',
describe:
'filter metadata components (can include % as wildcard or _ for a single character)',
});
},
handler: (argv) => {
Mcdev.setOptions(argv);
Mcdev.execute(argv.BU, csvToArray(argv.TYPE), csvToArray(argv.KEY));
// ! do not allow multiple types to be passed in here via csvToArray
Mcdev.pause(argv.BU, argv.TYPE, csvToArray(argv.KEY));
},
})
.command({
Expand Down Expand Up @@ -490,9 +546,13 @@ function csvToArray(csv) {
return !csv
? null
: csv.includes(',')
? csv.split(',').map((item) =>
// allow whitespace in comma-separated lists
item.trim()
)
: [csv.trim()];
? csv
.split(',')
.map((item) =>
// allow whitespace in comma-separated lists
item.trim()
)
// make sure trailing commas are ignored
.filter(Boolean)
: [csv.trim()].filter(Boolean);
}
Loading

0 comments on commit d0f8f4c

Please sign in to comment.