@jayree/sfdx-plugin-manifest 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE.txt +12 -0
- package/README.md +147 -0
- package/bin/is-sfdx.js +3 -0
- package/lib/commands/jayree/manifest/cleanup.d.ts +11 -0
- package/lib/commands/jayree/manifest/cleanup.js +79 -0
- package/lib/commands/jayree/manifest/cleanup.js.map +1 -0
- package/lib/commands/jayree/manifest/generate.d.ts +41 -0
- package/lib/commands/jayree/manifest/generate.js +207 -0
- package/lib/commands/jayree/manifest/generate.js.map +1 -0
- package/lib/commands/jayree/manifest/git/diff.d.ts +19 -0
- package/lib/commands/jayree/manifest/git/diff.js +245 -0
- package/lib/commands/jayree/manifest/git/diff.js.map +1 -0
- package/lib/hooks/changelog.d.ts +2 -0
- package/lib/hooks/changelog.js +59 -0
- package/lib/hooks/changelog.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +10 -0
- package/lib/index.js.map +1 -0
- package/lib/jayreeSfdxCommand.d.ts +5 -0
- package/lib/jayreeSfdxCommand.js +23 -0
- package/lib/jayreeSfdxCommand.js.map +1 -0
- package/lib/metadata/standardvalueset.json +84 -0
- package/lib/utils/gitdiff.d.ts +57 -0
- package/lib/utils/gitdiff.js +261 -0
- package/lib/utils/gitdiff.js.map +1 -0
- package/lib/utils/manifest.d.ts +1 -0
- package/lib/utils/manifest.js +73 -0
- package/lib/utils/manifest.js.map +1 -0
- package/messages/gitdiff.js +7 -0
- package/messages/manifestcleanup.json +5 -0
- package/messages/packagexml.json +15 -0
- package/oclif.manifest.json +1 -0
- package/package.json +138 -0
@@ -0,0 +1,261 @@
|
|
1
|
+
"use strict";
|
2
|
+
/*
|
3
|
+
* Copyright (c) 2021, jayree
|
4
|
+
* All rights reserved.
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
7
|
+
*/
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
9
|
+
exports.buildManifestComponentSet = exports.getGitResults = exports.getGitDiff = exports.analyzeFile = exports.createVirtualTreeContainer = exports.ensureGitPath = exports.ensureOSPath = exports.debug = exports.NodeFSTreeContainer = void 0;
|
10
|
+
const path_1 = require("path");
|
11
|
+
const fs = require("fs-extra");
|
12
|
+
const equal = require("fast-deep-equal");
|
13
|
+
const source_deploy_retrieve_1 = require("@salesforce/source-deploy-retrieve");
|
14
|
+
const utils_1 = require("@salesforce/source-deploy-retrieve/lib/src/utils");
|
15
|
+
const debug_1 = require("debug");
|
16
|
+
const isomorphic_git_1 = require("isomorphic-git");
|
17
|
+
exports.NodeFSTreeContainer = source_deploy_retrieve_1.NodeFSTreeContainer;
|
18
|
+
exports.debug = (0, debug_1.debug)('jayree:manifest:git:diff');
|
19
|
+
const registryAccess = new source_deploy_retrieve_1.RegistryAccess();
|
20
|
+
function ensureOSPath(path) {
|
21
|
+
return path.split(path_1.posix.sep).join(path_1.sep);
|
22
|
+
}
|
23
|
+
exports.ensureOSPath = ensureOSPath;
|
24
|
+
function ensureGitPath(path) {
|
25
|
+
return path.split(path_1.sep).join(path_1.posix.sep);
|
26
|
+
}
|
27
|
+
exports.ensureGitPath = ensureGitPath;
|
28
|
+
async function createVirtualTreeContainer(ref, dir, modifiedFiles) {
|
29
|
+
const paths = (await isomorphic_git_1.default.listFiles({ fs, dir, ref })).map((p) => ensureOSPath(p));
|
30
|
+
const virtualFsSet = new Map();
|
31
|
+
(0, exports.debug)({ modifiedFiles });
|
32
|
+
for (const path of paths) {
|
33
|
+
let dirOrFilePath = path;
|
34
|
+
while (dirOrFilePath !== (0, path_1.dirname)(dirOrFilePath)) {
|
35
|
+
const fileOrFolderName = (0, path_1.basename)(dirOrFilePath);
|
36
|
+
dirOrFilePath = (0, path_1.dirname)(dirOrFilePath);
|
37
|
+
if (!virtualFsSet.has(dirOrFilePath)) {
|
38
|
+
virtualFsSet.set(dirOrFilePath, new Set());
|
39
|
+
}
|
40
|
+
if (path.endsWith(fileOrFolderName)) {
|
41
|
+
const data = (0, utils_1.parseMetadataXml)(path) && modifiedFiles.includes(path)
|
42
|
+
? Buffer.from((await isomorphic_git_1.default.readBlob({
|
43
|
+
fs,
|
44
|
+
dir,
|
45
|
+
oid: await isomorphic_git_1.default.resolveRef({ fs, dir, ref }),
|
46
|
+
filepath: ensureGitPath(path),
|
47
|
+
})).blob)
|
48
|
+
: Buffer.from('');
|
49
|
+
virtualFsSet.get(dirOrFilePath).add({ name: fileOrFolderName, data });
|
50
|
+
}
|
51
|
+
else {
|
52
|
+
virtualFsSet.get(dirOrFilePath).add(fileOrFolderName);
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
const virtualFs = [];
|
57
|
+
for (const [dirPath, childSet] of virtualFsSet) {
|
58
|
+
virtualFs.push({ dirPath, children: [...childSet] });
|
59
|
+
}
|
60
|
+
return new source_deploy_retrieve_1.VirtualTreeContainer(virtualFs);
|
61
|
+
}
|
62
|
+
exports.createVirtualTreeContainer = createVirtualTreeContainer;
|
63
|
+
async function analyzeFile(path, ref1VirtualTreeContainer, ref2VirtualTreeContainer) {
|
64
|
+
if (!(0, utils_1.parseMetadataXml)(path)) {
|
65
|
+
return { status: 0 };
|
66
|
+
}
|
67
|
+
const ref2resolver = new source_deploy_retrieve_1.MetadataResolver(registryAccess, ref2VirtualTreeContainer);
|
68
|
+
const [ref2Component] = ref2resolver.getComponentsFromPath(path); // git path only conaints files
|
69
|
+
const ref1resolver = new source_deploy_retrieve_1.MetadataResolver(registryAccess, ref1VirtualTreeContainer);
|
70
|
+
const [ref1Component] = ref1resolver.getComponentsFromPath(path); // git path only conaints files
|
71
|
+
if (equal(await ref1Component.parseXml(), await ref2Component.parseXml())) {
|
72
|
+
return { status: -1 };
|
73
|
+
}
|
74
|
+
if (ref1Component.type.strictDirectoryName === true || !ref1Component.type.children) {
|
75
|
+
return { status: 0 };
|
76
|
+
}
|
77
|
+
const SourceComponentNotInSource = ref1Component.getChildren().filter((x) => !ref2Component
|
78
|
+
.getChildren()
|
79
|
+
.map((f) => {
|
80
|
+
return getUniqueIdentifier(f);
|
81
|
+
})
|
82
|
+
.includes(getUniqueIdentifier(x))); // deleted
|
83
|
+
const SourceComponentNotInTarget = ref2Component.getChildren().filter((x) => !ref1Component
|
84
|
+
.getChildren()
|
85
|
+
.map((f) => {
|
86
|
+
return getUniqueIdentifier(f);
|
87
|
+
})
|
88
|
+
.includes(getUniqueIdentifier(x))); // added
|
89
|
+
const SourceComponentInSourceAndTarget = ref1Component.getChildren().filter((x) => ref2Component
|
90
|
+
.getChildren()
|
91
|
+
.map((f) => {
|
92
|
+
return getUniqueIdentifier(f);
|
93
|
+
})
|
94
|
+
.includes(getUniqueIdentifier(x))); // modified?
|
95
|
+
(0, exports.debug)({ SourceComponentNotInSource, SourceComponentNotInTarget, SourceComponentInSourceAndTarget });
|
96
|
+
for (const x of SourceComponentInSourceAndTarget) {
|
97
|
+
const [y] = ref2Component.getChildren().filter((f) => getUniqueIdentifier(x) === getUniqueIdentifier(f));
|
98
|
+
if (!equal(await x.parseXml(), await y.parseXml())) {
|
99
|
+
SourceComponentNotInTarget.push(y); // modified! -> add to added
|
100
|
+
}
|
101
|
+
}
|
102
|
+
(0, exports.debug)({ SourceComponentNotInTarget });
|
103
|
+
return {
|
104
|
+
status: SourceComponentNotInSource.length + SourceComponentNotInTarget.length,
|
105
|
+
toManifest: SourceComponentNotInTarget,
|
106
|
+
toDestructiveChanges: SourceComponentNotInSource,
|
107
|
+
};
|
108
|
+
}
|
109
|
+
exports.analyzeFile = analyzeFile;
|
110
|
+
function getUniqueIdentifier(component) {
|
111
|
+
return `${component.type.name}#${component[component.type.uniqueIdElement]}`;
|
112
|
+
}
|
113
|
+
async function getFileStateChanges(commitHash1, commitHash2, dir) {
|
114
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
115
|
+
return isomorphic_git_1.default.walk({
|
116
|
+
fs,
|
117
|
+
dir,
|
118
|
+
trees: [isomorphic_git_1.default.TREE({ ref: commitHash1 }), commitHash2 ? isomorphic_git_1.default.TREE({ ref: commitHash2 }) : isomorphic_git_1.default.STAGE()],
|
119
|
+
async map(filepath, [A, B]) {
|
120
|
+
if (filepath === '.' || (await (A === null || A === void 0 ? void 0 : A.type())) === 'tree' || (await (B === null || B === void 0 ? void 0 : B.type())) === 'tree') {
|
121
|
+
return;
|
122
|
+
}
|
123
|
+
const Aoid = await (A === null || A === void 0 ? void 0 : A.oid());
|
124
|
+
const Boid = await (B === null || B === void 0 ? void 0 : B.oid());
|
125
|
+
let type = 'EQ';
|
126
|
+
if (Aoid !== Boid) {
|
127
|
+
type = 'M';
|
128
|
+
}
|
129
|
+
if (Aoid === undefined) {
|
130
|
+
type = 'A';
|
131
|
+
}
|
132
|
+
if (Boid === undefined) {
|
133
|
+
type = 'D';
|
134
|
+
}
|
135
|
+
if (type !== 'EQ') {
|
136
|
+
return {
|
137
|
+
path: filepath,
|
138
|
+
status: type,
|
139
|
+
};
|
140
|
+
}
|
141
|
+
},
|
142
|
+
});
|
143
|
+
}
|
144
|
+
async function getGitDiff(sfdxProjectFolders, ref1, ref2, dir) {
|
145
|
+
let gitLines = (await getFileStateChanges(ref1, ref2, dir))
|
146
|
+
.map((line) => {
|
147
|
+
return { path: ensureOSPath(line.path), status: line.status };
|
148
|
+
})
|
149
|
+
.filter((l) => sfdxProjectFolders.some((f) => {
|
150
|
+
return l.path.startsWith(f);
|
151
|
+
}));
|
152
|
+
const renames = [];
|
153
|
+
gitLines = gitLines.filter((line) => {
|
154
|
+
if (line.status === 'D') {
|
155
|
+
for (const sfdxFolder of sfdxProjectFolders) {
|
156
|
+
const defaultFolder = (0, path_1.join)(sfdxFolder, 'main', 'default');
|
157
|
+
const filePath = line.path.replace(line.path.startsWith(defaultFolder) ? defaultFolder : sfdxFolder, '');
|
158
|
+
const target = gitLines.find((t) => t.path.endsWith(filePath) && t.status === 'A');
|
159
|
+
if (target) {
|
160
|
+
renames.push({ from: line.path, to: target.path });
|
161
|
+
return false;
|
162
|
+
}
|
163
|
+
}
|
164
|
+
}
|
165
|
+
return true;
|
166
|
+
});
|
167
|
+
(0, exports.debug)({ gitLines, renames, sfdxProjectFolders });
|
168
|
+
return gitLines;
|
169
|
+
}
|
170
|
+
exports.getGitDiff = getGitDiff;
|
171
|
+
async function getGitResults(gitLines, ref1VirtualTreeContainer, ref2VirtualTreeContainer) {
|
172
|
+
const results = {
|
173
|
+
manifest: new source_deploy_retrieve_1.ComponentSet(undefined, registryAccess),
|
174
|
+
destructiveChanges: new source_deploy_retrieve_1.ComponentSet(undefined, registryAccess),
|
175
|
+
unchanged: [],
|
176
|
+
ignored: { ref1: [], ref2: [] },
|
177
|
+
counts: { added: 0, deleted: 0, modified: 0, unchanged: 0, ignored: 0, error: 0 },
|
178
|
+
errors: [],
|
179
|
+
};
|
180
|
+
const ref1Resolver = new source_deploy_retrieve_1.MetadataResolver(registryAccess, ref1VirtualTreeContainer);
|
181
|
+
const ref2Resolver = new source_deploy_retrieve_1.MetadataResolver(registryAccess, ref2VirtualTreeContainer);
|
182
|
+
for (const [, { status, path }] of gitLines.entries()) {
|
183
|
+
if (status === 'D') {
|
184
|
+
for (const c of ref1Resolver.getComponentsFromPath(path)) {
|
185
|
+
if (c.xml === path || gitLines.find((x) => x.path === c.xml)) {
|
186
|
+
results.destructiveChanges.add(c, true);
|
187
|
+
results.counts.deleted++;
|
188
|
+
}
|
189
|
+
else {
|
190
|
+
try {
|
191
|
+
ref2Resolver.getComponentsFromPath(c.xml);
|
192
|
+
results.manifest.add(c);
|
193
|
+
results.counts.added++;
|
194
|
+
}
|
195
|
+
catch (error) {
|
196
|
+
results.counts.error++;
|
197
|
+
results.errors.push(error);
|
198
|
+
}
|
199
|
+
}
|
200
|
+
}
|
201
|
+
}
|
202
|
+
else if (status === 'A') {
|
203
|
+
for (const c of ref2Resolver.getComponentsFromPath(path)) {
|
204
|
+
results.manifest.add(c);
|
205
|
+
results.counts.added++;
|
206
|
+
}
|
207
|
+
}
|
208
|
+
else {
|
209
|
+
const check = await analyzeFile(path, ref1VirtualTreeContainer, ref2VirtualTreeContainer);
|
210
|
+
if (check.status === 0) {
|
211
|
+
for (const c of ref2Resolver.getComponentsFromPath(path)) {
|
212
|
+
results.manifest.add(c);
|
213
|
+
results.counts.added++;
|
214
|
+
}
|
215
|
+
}
|
216
|
+
else if (check.status === -1) {
|
217
|
+
results.unchanged.push(path);
|
218
|
+
results.counts.unchanged++;
|
219
|
+
}
|
220
|
+
else {
|
221
|
+
results.counts.modified++;
|
222
|
+
for (const c of check.toDestructiveChanges) {
|
223
|
+
results.destructiveChanges.add(c, true);
|
224
|
+
}
|
225
|
+
for (const c of check.toManifest) {
|
226
|
+
results.manifest.add(c);
|
227
|
+
}
|
228
|
+
}
|
229
|
+
}
|
230
|
+
}
|
231
|
+
results.ignored = {
|
232
|
+
ref1: Array.from(ref1Resolver.forceIgnoredPaths),
|
233
|
+
ref2: Array.from(ref2Resolver.forceIgnoredPaths),
|
234
|
+
};
|
235
|
+
results.counts.ignored = ref1Resolver.forceIgnoredPaths.size + ref2Resolver.forceIgnoredPaths.size;
|
236
|
+
return results;
|
237
|
+
}
|
238
|
+
exports.getGitResults = getGitResults;
|
239
|
+
function buildManifestComponentSet(cs, forDestructiveChanges = false) {
|
240
|
+
// SDR library is more strict and avoids fixes like this
|
241
|
+
if (!forDestructiveChanges) {
|
242
|
+
// const missingParents = cs.find((c) => ['CustomFieldTranslation'].includes(c.type.name))?.parent;
|
243
|
+
// if (missingParents) {
|
244
|
+
// debug({ missingParents });
|
245
|
+
// cs.add(missingParents);
|
246
|
+
// }
|
247
|
+
const childsTobeReplacedByParent = [
|
248
|
+
...Object.keys(source_deploy_retrieve_1.registry.types.workflow.children.types),
|
249
|
+
...Object.keys(source_deploy_retrieve_1.registry.types.sharingrules.children.types),
|
250
|
+
];
|
251
|
+
return new source_deploy_retrieve_1.ComponentSet(cs.map((component) => {
|
252
|
+
if (childsTobeReplacedByParent.includes(component.type.id)) {
|
253
|
+
return component.parent;
|
254
|
+
}
|
255
|
+
return component;
|
256
|
+
}), registryAccess);
|
257
|
+
}
|
258
|
+
return cs;
|
259
|
+
}
|
260
|
+
exports.buildManifestComponentSet = buildManifestComponentSet;
|
261
|
+
//# sourceMappingURL=gitdiff.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"gitdiff.js","sourceRoot":"","sources":["../../src/utils/gitdiff.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,+BAA2D;AAC3D,+BAA+B;AAC/B,yCAAyC;AACzC,+EAU4C;AAC5C,4EAAoF;AACpF,iCAAuC;AACvC,mDAAiC;AAEpB,QAAA,mBAAmB,GAAG,4CAAe,CAAC;AAEtC,QAAA,KAAK,GAAG,IAAA,aAAK,EAAC,0BAA0B,CAAC,CAAC;AAEvD,MAAM,cAAc,GAAG,IAAI,uCAAc,EAAE,CAAC;AAgC5C,SAAgB,YAAY,CAAC,IAAY;IACvC,OAAO,IAAI,CAAC,KAAK,CAAC,YAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,UAAG,CAAC,CAAC;AACzC,CAAC;AAFD,oCAEC;AAED,SAAgB,aAAa,CAAC,IAAY;IACxC,OAAO,IAAI,CAAC,KAAK,CAAC,UAAG,CAAC,CAAC,IAAI,CAAC,YAAK,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC;AAFD,sCAEC;AAEM,KAAK,UAAU,0BAA0B,CAC9C,GAAW,EACX,GAAW,EACX,aAAuB;IAEvB,MAAM,KAAK,GAAG,CAAC,MAAM,wBAAG,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IAClF,MAAM,YAAY,GAAG,IAAI,GAAG,EAAqC,CAAC;IAClE,IAAA,aAAK,EAAC,EAAE,aAAa,EAAE,CAAC,CAAC;IACz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CAAC;AAnED,sCAmEC;AAED,SAAgB,yBAAyB,CAAC,EAAgB,EAAE,qBAAqB,GAAG,KAAK;IACvF,wDAAwD;IACxD,IAAI,CAAC,qBAAqB,EAAE;QAC1B,mGAAmG;QACnG,wBAAwB;QACxB,+BAA+B;QAC/B,4BAA4B;QAC5B,IAAI;QACJ,MAAM,0BAA0B,GAAG;YACjC,GAAG,MAAM,CAAC,IAAI,CAAC,iCAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC;YACtD,GAAG,MAAM,CAAC,IAAI,CAAC,iCAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC;SAC3D,CAAC;QACF,OAAO,IAAI,qCAAY,CACrB,EAAE,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;YACnB,IAAI,0BAA0B,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;gBAC1D,OAAO,SAAS,CAAC,MAAM,CAAC;aACzB;YACD,OAAO,SAAS,CAAC;QACnB,CAAC,CAAC,EACF,cAAc,CACf,CAAC;KACH;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AAxBD,8DAwBC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function cleanupManifestFile(manifest: string, ignoreManifest: string): Promise<void>;
|
@@ -0,0 +1,73 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.cleanupManifestFile = void 0;
|
4
|
+
/*
|
5
|
+
* Copyright (c) 2021, jayree
|
6
|
+
* All rights reserved.
|
7
|
+
* Licensed under the BSD 3-Clause license.
|
8
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
9
|
+
*/
|
10
|
+
const cli_ux_1 = require("cli-ux");
|
11
|
+
const fs = require("fs-extra");
|
12
|
+
const utils_1 = require("@salesforce/source-deploy-retrieve/lib/src/utils");
|
13
|
+
const fast_xml_parser_1 = require("fast-xml-parser");
|
14
|
+
const common_1 = require("@salesforce/source-deploy-retrieve/lib/src/common");
|
15
|
+
function parseManifest(xmlData) {
|
16
|
+
const { Package: { types, version }, } = (0, fast_xml_parser_1.parse)(xmlData, { stopNodes: ['version'] });
|
17
|
+
const packageTypeMembers = (0, utils_1.normalizeToArray)(types);
|
18
|
+
return { packageTypeMembers, version };
|
19
|
+
}
|
20
|
+
function js2Manifest(jsData) {
|
21
|
+
const js2Xml = new fast_xml_parser_1.j2xParser({ format: true, indentBy: ' ', ignoreAttributes: false });
|
22
|
+
jsData.Package[common_1.XML_NS_KEY] = common_1.XML_NS_URL;
|
23
|
+
return common_1.XML_DECL.concat(js2Xml.parse(jsData));
|
24
|
+
}
|
25
|
+
async function cleanupManifestFile(manifest, ignoreManifest) {
|
26
|
+
const { packageTypeMembers: manifestTypeMembers, version } = parseManifest(fs.readFileSync(manifest, 'utf8'));
|
27
|
+
cli_ux_1.cli.log(`apply '${ignoreManifest}' to '${manifest}'`);
|
28
|
+
const typeMap = new Map();
|
29
|
+
manifestTypeMembers.forEach((value) => {
|
30
|
+
typeMap.set(value.name, (0, utils_1.normalizeToArray)(value.members));
|
31
|
+
});
|
32
|
+
const { packageTypeMembers: ignoreTypeMembers } = parseManifest(fs.readFileSync(ignoreManifest, 'utf8'));
|
33
|
+
ignoreTypeMembers.forEach((types) => {
|
34
|
+
if (typeMap.get(types.name)) {
|
35
|
+
const packageTypeMembers = (0, utils_1.normalizeToArray)(types.members);
|
36
|
+
if (packageTypeMembers.includes('*') && packageTypeMembers.length > 1) {
|
37
|
+
const includemembers = packageTypeMembers.slice();
|
38
|
+
includemembers.splice(includemembers.indexOf('*'), 1);
|
39
|
+
const includedmembers = typeMap.get(types.name).filter((value) => {
|
40
|
+
return includemembers.includes(value);
|
41
|
+
});
|
42
|
+
if (includedmembers.length) {
|
43
|
+
cli_ux_1.cli.log('include only members ' + includedmembers.toString() + ' for type ' + types.name);
|
44
|
+
typeMap.set(types.name, includedmembers);
|
45
|
+
}
|
46
|
+
}
|
47
|
+
if (packageTypeMembers.includes('*') && packageTypeMembers.length === 1) {
|
48
|
+
cli_ux_1.cli.log('exclude all members for type ' + types.name);
|
49
|
+
typeMap.delete(types.name);
|
50
|
+
}
|
51
|
+
if (!packageTypeMembers.includes('*')) {
|
52
|
+
const includedmembers = typeMap.get(types.name).filter((value) => {
|
53
|
+
return !packageTypeMembers.includes(value);
|
54
|
+
});
|
55
|
+
typeMap.set(types.name, includedmembers);
|
56
|
+
}
|
57
|
+
packageTypeMembers.forEach((member) => {
|
58
|
+
if (member.startsWith('!')) {
|
59
|
+
typeMap.get(types.name).push(member.substring(1));
|
60
|
+
}
|
61
|
+
});
|
62
|
+
}
|
63
|
+
});
|
64
|
+
const typeMembers = [];
|
65
|
+
for (const [typeName, members] of typeMap.entries()) {
|
66
|
+
if (members.length) {
|
67
|
+
typeMembers.push({ name: typeName, members });
|
68
|
+
}
|
69
|
+
}
|
70
|
+
await fs.writeFile(manifest, js2Manifest({ Package: { types: typeMembers, version } }));
|
71
|
+
}
|
72
|
+
exports.cleanupManifestFile = cleanupManifestFile;
|
73
|
+
//# sourceMappingURL=manifest.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/utils/manifest.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,mCAA6B;AAC7B,+BAA+B;AAC/B,4EAAoF;AAEpF,qDAA+D;AAC/D,8EAAqG;AAUrG,SAAS,aAAa,CAAC,OAAe;IACpC,MAAM,EACJ,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,GAC5B,GAAG,IAAA,uBAAQ,EAAC,OAAO,EAAE,EAAE,SAAS,EAAE,CAAC,SAAS,CAAC,EAAE,CAA0B,CAAC;IAE3E,MAAM,kBAAkB,GAAG,IAAA,wBAAgB,EAAC,KAAK,CAAC,CAAC;IACnD,OAAO,EAAE,kBAAkB,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AAC,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;AAvDD,kDAuDC"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
module.exports = {
|
2
|
+
commandDescription: `create a manifest and destructiveChanges manifest using 'git diff' data
|
3
|
+
Creates a manifest and destructiveChanges manifest using 'git diff' data.
|
4
|
+
|
5
|
+
You can use all ways to spell <commit> which are valid for 'git diff'.
|
6
|
+
(See https://git-scm.com/docs/git-diff)`,
|
7
|
+
};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"commandDescription": "generate a complete package xml form the specified 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
|
+
"includeflowversionsDescription": "include flow versions as with api version 43.0",
|
10
|
+
"examples": [
|
11
|
+
"$ sfdx jayree:manifest:generate --targetusername myOrg@example.com",
|
12
|
+
"<?xml version='1.0' encoding='UTF-8'?>",
|
13
|
+
"<Package xmlns='http://soap.sforce.com/2006/04/metadata'>...</Package>"
|
14
|
+
]
|
15
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":"1.0.0","commands":{"jayree:manifest:cleanup":{"id":"jayree:manifest:cleanup","description":"removes those tags from a manifest file that are present in a second manifest file","usage":"<%= command.id %> [-x <filepath>] [-f <filepath>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@jayree/sfdx-plugin-manifest","pluginType":"core","aliases":[],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"manifest":{"name":"manifest","type":"option","char":"x","description":"path to the manifest file"},"file":{"name":"file","type":"option","char":"f","description":"path to the second 'cleanup' manifest file"}},"args":[]},"jayree:manifest:generate":{"id":"jayree:manifest:generate","description":"generate a complete package xml form the specified org","usage":"<%= command.id %> [-q <array>] [-c] [-w] [--includeflowversions] [-f <string>] [-x] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@jayree/sfdx-plugin-manifest","pluginType":"core","aliases":["jayree:packagexml"],"examples":["$ sfdx jayree:manifest:generate --targetusername myOrg@example.com","<?xml version='1.0' encoding='UTF-8'?>","<Package xmlns='http://soap.sforce.com/2006/04/metadata'>...</Package>"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"quickfilter":{"name":"quickfilter","type":"option","char":"q","description":"csv separated list of metadata type, member or file names to filter on"},"matchcase":{"name":"matchcase","type":"boolean","char":"c","description":"enable 'match case' for the quickfilter","allowNo":false},"matchwholeword":{"name":"matchwholeword","type":"boolean","char":"w","description":"enable 'match whole word' for the quickfilter","allowNo":false},"includeflowversions":{"name":"includeflowversions","type":"boolean","description":"include flow versions as with api version 43.0","allowNo":false},"file":{"name":"file","type":"option","char":"f","description":"write to 'file' instead of stdout"},"excludemanaged":{"name":"excludemanaged","type":"boolean","char":"x","description":"exclude managed packages from output","allowNo":false}},"args":[]},"jayree:manifest:git:diff":{"id":"jayree:manifest:git:diff","description":"create a manifest and destructiveChanges manifest using 'git diff' data\nCreates a manifest and destructiveChanges manifest using 'git diff' data.\n\nYou can use all ways to spell <commit> which are valid for 'git diff'.\n(See https://git-scm.com/docs/git-diff)","usage":"<%= command.id %> [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@jayree/sfdx-plugin-manifest","pluginType":"core","aliases":[],"examples":["$ sfdx jayree:manifest:git:diff <commit> <commit>\n$ sfdx jayree:manifest:git:diff <commit>..<commit>\nuses the changes between two arbitrary <commit>\n","$ 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>.\n ","$ sfdx jayree:manifest:git:diff branchA..branchB\nuses the diff of what is unique in branchB (REF2) and unique in branchA (REF1)\n","$ sfdx jayree:manifest:git:diff branchA...branchB\nuses the diff of what is unique in branchB (REF2)"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"}},"args":[{"name":"ref1","description":"base commit or branch","required":true,"hidden":false},{"name":"ref2","description":"commit or branch to compare to the base commit","required":false,"hidden":false}]}}}
|
package/package.json
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
{
|
2
|
+
"name": "@jayree/sfdx-plugin-manifest",
|
3
|
+
"description": "jayree sfdx source commands",
|
4
|
+
"version": "1.0.0",
|
5
|
+
"author": "jayree",
|
6
|
+
"bugs": "https://github.com/jayree/sfdx-plugin-manifest/issues",
|
7
|
+
"dependencies": {
|
8
|
+
"@oclif/command": "^1.8.0",
|
9
|
+
"@oclif/config": "^1.17.0",
|
10
|
+
"@oclif/errors": "^1.3.5",
|
11
|
+
"@salesforce/command": "^4.1.4",
|
12
|
+
"@salesforce/core": "^2.28.2",
|
13
|
+
"@salesforce/kit": "^1.5.17",
|
14
|
+
"@salesforce/source-deploy-retrieve": "^4.5.11",
|
15
|
+
"@salesforce/ts-types": "^1.5.20",
|
16
|
+
"cli-ux": "^5.6.3",
|
17
|
+
"debug": "^4.3.2",
|
18
|
+
"fast-deep-equal": "^3.1.3",
|
19
|
+
"fast-xml-parser": "^3.20.3",
|
20
|
+
"fs-extra": "^10.0.0",
|
21
|
+
"isomorphic-git": "^1.10.1",
|
22
|
+
"jsforce": "^1.10.1",
|
23
|
+
"listr2": "^3.12.2",
|
24
|
+
"marked": "^3.0.7",
|
25
|
+
"marked-terminal": "^4.2.0",
|
26
|
+
"tslib": "^2.3.1"
|
27
|
+
},
|
28
|
+
"devDependencies": {
|
29
|
+
"@commitlint/cli": "^13.2.1",
|
30
|
+
"@commitlint/config-conventional": "^13.2.0",
|
31
|
+
"@oclif/dev-cli": "^1.26.0",
|
32
|
+
"@oclif/plugin-help": "^3.2.3",
|
33
|
+
"@oclif/test": "^1.2.8",
|
34
|
+
"@salesforce/dev-config": "^2.1.2",
|
35
|
+
"@salesforce/dev-scripts": "^0.9.18",
|
36
|
+
"@salesforce/prettier-config": "^0.0.2",
|
37
|
+
"@salesforce/ts-sinon": "^1.3.21",
|
38
|
+
"@types/chai": "^4.2.22",
|
39
|
+
"@types/debug": "^4.1.7",
|
40
|
+
"@types/fs-extra": "^9.0.13",
|
41
|
+
"@types/jsforce": "^1.9.35",
|
42
|
+
"@types/marked": "^3.0.1",
|
43
|
+
"@types/mocha": "^9.0.0",
|
44
|
+
"@types/node": "^16.11.1",
|
45
|
+
"@types/sinon": "10.0.4",
|
46
|
+
"@typescript-eslint/eslint-plugin": "^5.1.0",
|
47
|
+
"@typescript-eslint/parser": "^5.1.0",
|
48
|
+
"chai": "^4.3.4",
|
49
|
+
"eslint": "^8.0.1",
|
50
|
+
"eslint-config-oclif": "^4.0",
|
51
|
+
"eslint-config-prettier": "^8.3.0",
|
52
|
+
"eslint-config-salesforce": "^0.1.6",
|
53
|
+
"eslint-config-salesforce-license": "^0.1.6",
|
54
|
+
"eslint-config-salesforce-typescript": "^0.2.8",
|
55
|
+
"eslint-plugin-header": "^3.1.1",
|
56
|
+
"eslint-plugin-import": "2.25.2",
|
57
|
+
"eslint-plugin-jsdoc": "^36.1.1",
|
58
|
+
"eslint-plugin-prettier": "^4.0.0",
|
59
|
+
"eslint-plugin-typescript": "^0.14.0",
|
60
|
+
"husky": "^7.0.2",
|
61
|
+
"is-ci": "^3.0.0",
|
62
|
+
"mocha": "^9.1.3",
|
63
|
+
"nyc": "^15.1.0",
|
64
|
+
"patch-package": "^6.4.7",
|
65
|
+
"pinst": "^2.1.6",
|
66
|
+
"prettier": "^2.4.1",
|
67
|
+
"pretty-quick": "^3.1.1",
|
68
|
+
"sinon": "11.1.2",
|
69
|
+
"source-map-support": "~0.5.20",
|
70
|
+
"ts-node": "^10.3.0",
|
71
|
+
"typescript": "^4.4.4"
|
72
|
+
},
|
73
|
+
"engines": {
|
74
|
+
"node": ">=12.0.0"
|
75
|
+
},
|
76
|
+
"files": [
|
77
|
+
"/lib",
|
78
|
+
"/messages",
|
79
|
+
"/npm-shrinkwrap.json",
|
80
|
+
"/oclif.manifest.json",
|
81
|
+
"/bin/is-sfdx.js"
|
82
|
+
],
|
83
|
+
"homepage": "https://github.com/jayree/sfdx-plugin-manifest",
|
84
|
+
"keywords": [
|
85
|
+
"sfdx-plugin"
|
86
|
+
],
|
87
|
+
"license": "BSD-3-Clause",
|
88
|
+
"oclif": {
|
89
|
+
"commands": "./lib/commands",
|
90
|
+
"bin": "sfdx",
|
91
|
+
"hooks": {
|
92
|
+
"update": "./lib/hooks/changelog"
|
93
|
+
},
|
94
|
+
"topics": {
|
95
|
+
"jayree": {
|
96
|
+
"description": "manifest, source, and org automation toolset"
|
97
|
+
},
|
98
|
+
"jayree:manifest": {
|
99
|
+
"description": "generate and manipulate manifest files"
|
100
|
+
},
|
101
|
+
"jayree:manifest:git": {
|
102
|
+
"description": "generate manifest files based on git data"
|
103
|
+
}
|
104
|
+
},
|
105
|
+
"devPlugins": [
|
106
|
+
"@oclif/plugin-help"
|
107
|
+
]
|
108
|
+
},
|
109
|
+
"repository": "jayree/sfdx-plugin-manifest",
|
110
|
+
"scripts": {
|
111
|
+
"build": "sf-build",
|
112
|
+
"clean": "sf-clean",
|
113
|
+
"clean-all": "sf-clean all",
|
114
|
+
"compile": "sf-compile",
|
115
|
+
"format": "sf-format",
|
116
|
+
"lint": "sf-lint",
|
117
|
+
"lint-fix": "sf-lint --fix",
|
118
|
+
"postcompile": "oclif-dev manifest && oclif-dev readme",
|
119
|
+
"_postinstall": "node ./bin/is-sfdx.js || patch-package",
|
120
|
+
"postpack": "rimraf oclif.manifest.json",
|
121
|
+
"postpublish": "pinst --enable",
|
122
|
+
"prepack": "sf-prepack",
|
123
|
+
"prepare": "is-ci || node ./bin/is-sfdx.js || husky install",
|
124
|
+
"prepublishOnly": "pinst --disable",
|
125
|
+
"pretest": "sf-compile-test",
|
126
|
+
"test": "sf-test",
|
127
|
+
"version": "oclif-dev manifest && oclif-dev readme"
|
128
|
+
},
|
129
|
+
"publishConfig": {
|
130
|
+
"access": "public"
|
131
|
+
},
|
132
|
+
"release": {
|
133
|
+
"branches": [
|
134
|
+
"main",
|
135
|
+
"next"
|
136
|
+
]
|
137
|
+
}
|
138
|
+
}
|