@jayree/sfdx-plugin-manifest 2.7.4 → 2.8.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +19 -0
- package/README.md +83 -66
- package/lib/SDR-extra/utils/localGitRepo.js +1 -1
- package/lib/SDR-extra/utils/localGitRepo.js.map +1 -1
- package/lib/commands/jayree/manifest/beta/git/diff.d.ts +8 -6
- package/lib/commands/jayree/manifest/beta/git/diff.js +11 -11
- package/lib/commands/jayree/manifest/beta/git/diff.js.map +1 -1
- package/lib/commands/jayree/manifest/cleanup.d.ts +11 -9
- package/lib/commands/jayree/manifest/cleanup.js +78 -18
- package/lib/commands/jayree/manifest/cleanup.js.map +1 -1
- package/lib/commands/jayree/manifest/generate.d.ts +18 -11
- package/lib/commands/jayree/manifest/generate.js +57 -48
- package/lib/commands/jayree/manifest/generate.js.map +1 -1
- package/lib/commands/jayree/manifest/git/diff.d.ts +17 -11
- package/lib/commands/jayree/manifest/git/diff.js +479 -55
- package/lib/commands/jayree/manifest/git/diff.js.map +1 -1
- package/messages/{gitdiffbeta.md → gitdiff.md} +7 -0
- package/messages/manifestcleanup.md +21 -0
- package/messages/manifestgenerate.md +43 -0
- package/oclif.manifest.json +121 -262
- package/package.json +14 -15
- package/lib/jayreeSfdxCommand.d.ts +0 -8
- package/lib/jayreeSfdxCommand.js +0 -26
- package/lib/jayreeSfdxCommand.js.map +0 -1
- package/lib/utils/gitdiff.d.ts +0 -57
- package/lib/utils/gitdiff.js +0 -442
- package/lib/utils/gitdiff.js.map +0 -1
- package/lib/utils/manifest.d.ts +0 -1
- package/lib/utils/manifest.js +0 -66
- package/lib/utils/manifest.js.map +0 -1
- package/messages/gitdiff.json +0 -12
- package/messages/manifestcleanup.json +0 -6
- package/messages/manifestgenerate.json +0 -16
package/lib/utils/manifest.js
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright (c) 2022, jayree
|
3
|
-
* All rights reserved.
|
4
|
-
* Licensed under the BSD 3-Clause license.
|
5
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
6
|
-
*/
|
7
|
-
import { CliUx } from '@oclif/core';
|
8
|
-
import fs from 'fs-extra';
|
9
|
-
import { ensureArray } from '@salesforce/kit';
|
10
|
-
import { XMLParser, XMLBuilder } from 'fast-xml-parser';
|
11
|
-
import { XML_DECL, XML_NS_KEY, XML_NS_URL } from '@salesforce/source-deploy-retrieve/lib/src/common/index.js';
|
12
|
-
function parseManifest(xmlData) {
|
13
|
-
const parser = new XMLParser({ stopNodes: ['version'], parseTagValue: false });
|
14
|
-
const { Package: { types, version }, } = parser.parse(xmlData);
|
15
|
-
const packageTypeMembers = ensureArray(types);
|
16
|
-
return { packageTypeMembers, version };
|
17
|
-
}
|
18
|
-
function js2Manifest(jsData) {
|
19
|
-
const js2Xml = new XMLBuilder({ format: true, indentBy: ' ', ignoreAttributes: false });
|
20
|
-
jsData.Package[XML_NS_KEY] = XML_NS_URL;
|
21
|
-
return XML_DECL.concat(js2Xml.build(jsData));
|
22
|
-
}
|
23
|
-
export async function cleanupManifestFile(manifest, ignoreManifest) {
|
24
|
-
const { packageTypeMembers: manifestTypeMembers, version } = parseManifest(fs.readFileSync(manifest, 'utf8'));
|
25
|
-
CliUx.ux.log(`apply '${ignoreManifest}' to '${manifest}'`);
|
26
|
-
const typeMap = new Map();
|
27
|
-
manifestTypeMembers.forEach((value) => {
|
28
|
-
typeMap.set(value.name, ensureArray(value.members));
|
29
|
-
});
|
30
|
-
const { packageTypeMembers: ignoreTypeMembers } = parseManifest(fs.readFileSync(ignoreManifest, 'utf8'));
|
31
|
-
ignoreTypeMembers.forEach((types) => {
|
32
|
-
if (typeMap.get(types.name)) {
|
33
|
-
const packageTypeMembers = ensureArray(types.members);
|
34
|
-
if (packageTypeMembers.includes('*') && packageTypeMembers.length > 1) {
|
35
|
-
const includemembers = packageTypeMembers.slice();
|
36
|
-
includemembers.splice(includemembers.indexOf('*'), 1);
|
37
|
-
const includedmembers = typeMap.get(types.name).filter((value) => includemembers.includes(value));
|
38
|
-
if (includedmembers.length) {
|
39
|
-
CliUx.ux.log('include only members ' + includedmembers.toString() + ' for type ' + types.name);
|
40
|
-
typeMap.set(types.name, includedmembers);
|
41
|
-
}
|
42
|
-
}
|
43
|
-
if (packageTypeMembers.includes('*') && packageTypeMembers.length === 1) {
|
44
|
-
CliUx.ux.log('exclude all members for type ' + types.name);
|
45
|
-
typeMap.delete(types.name);
|
46
|
-
}
|
47
|
-
if (!packageTypeMembers.includes('*')) {
|
48
|
-
const includedmembers = typeMap.get(types.name).filter((value) => !packageTypeMembers.includes(value));
|
49
|
-
typeMap.set(types.name, includedmembers);
|
50
|
-
}
|
51
|
-
packageTypeMembers.forEach((member) => {
|
52
|
-
if (member.startsWith('!')) {
|
53
|
-
typeMap.get(types.name).push(member.substring(1));
|
54
|
-
}
|
55
|
-
});
|
56
|
-
}
|
57
|
-
});
|
58
|
-
const typeMembers = [];
|
59
|
-
for (const [typeName, members] of typeMap.entries()) {
|
60
|
-
if (members.length) {
|
61
|
-
typeMembers.push({ name: typeName, members });
|
62
|
-
}
|
63
|
-
}
|
64
|
-
await fs.writeFile(manifest, js2Manifest({ Package: { types: typeMembers, version } }));
|
65
|
-
}
|
66
|
-
//# sourceMappingURL=manifest.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/utils/manifest.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,4DAA4D,CAAC;AAU9G,SAAS,aAAa,CAAC,OAAe;IACpC,MAAM,MAA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AAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBACrC,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;gBACvG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;aAC1C;YAED,kBAAkB,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBACpC,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;oBAC1B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;iBACnD;YACH,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,WAAW,GAAyB,EAAE,CAAC;IAC7C,KAAK,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,EAAE;QACnD,IAAI,OAAO,CAAC,MAAM,EAAE;YAClB,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;SAC/C;KACF;IAED,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,WAAW,CAAC,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC1F,CAAC"}
|
package/messages/gitdiff.json
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"commandDescription": "create a manifest and destructiveChanges manifest using 'git diff' data\nUse this command to create a manifest and destructiveChanges manifest file based on the difference (git diff) of two git refs.\n\nYou can use all ways to spell <commit> which are valid for 'git diff'.\n(See https://git-scm.com/docs/git-diff)",
|
3
|
-
"examples": [
|
4
|
-
"$ sfdx jayree:manifest:git:diff <commit> <commit>\n$ sfdx jayree:manifest:git:diff <commit>..<commit>\nuses the changes between two arbitrary <commit>",
|
5
|
-
"$ sfdx jayree:manifest:git:diff <commit>...<commit>\nuses the changes on the branch containing and up to the second <commit>, starting at a common ancestor of both <commit>.",
|
6
|
-
"$ sfdx jayree:manifest:git:diff branchA..branchB\nuses the diff of what is unique in branchB (REF2) and unique in branchA (REF1)",
|
7
|
-
"$ sfdx jayree:manifest:git:diff branchA...branchB\nuses the diff of what is unique in branchB (REF2)"
|
8
|
-
],
|
9
|
-
"outputdir": "directory to save the created manifest files",
|
10
|
-
"sourcepath": "comma-separated list of source file paths to limit the diff",
|
11
|
-
"destructivechangesonly": "create a destructiveChanges manifest only (package.xml will be empty)"
|
12
|
-
}
|
@@ -1,6 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"commandDescription": "removes those tags from a manifest file that are present in a second manifest file\nUse this command to remove components or metadata types from a manifes file.\nIf the 'cleanup' manifest file (--file) doesn't exist, a template file is created, which can then be modified.",
|
3
|
-
"manifestFlagDescription": "path to the manifest file",
|
4
|
-
"fileFlagDescription": "path to the second 'cleanup' manifest file",
|
5
|
-
"examples": ["$ sfdx jayree:manifest:cleanup --manifest=package.xml --file=packageignore.xml"]
|
6
|
-
}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"commandDescription": "generate a complete manifest file form the specified org\nUse this command to generate a manifest file based on an existing org.",
|
3
|
-
"configFlagDescription": "path to config file",
|
4
|
-
"quickfilterFlagDescription": "csv separated list of metadata type, member or file names to filter on",
|
5
|
-
"matchCaseFlagDescription": "enable 'match case' for the quickfilter",
|
6
|
-
"matchWholeWordFlagDescription": "enable 'match whole word' for the quickfilter",
|
7
|
-
"fileFlagDescription": "write to 'file' instead of stdout",
|
8
|
-
"excludeManagedFlagDescription": "exclude managed packages from output",
|
9
|
-
"excludeAllFlagDescription": "exclude all packages from output",
|
10
|
-
"includeflowversionsDescription": "include flow versions as with api version 43.0",
|
11
|
-
"examples": [
|
12
|
-
"$ sfdx jayree:manifest:generate --targetusername myOrg@example.com",
|
13
|
-
"<?xml version='1.0' encoding='UTF-8'?>",
|
14
|
-
"<Package xmlns='http://soap.sforce.com/2006/04/metadata'>...</Package>"
|
15
|
-
]
|
16
|
-
}
|