@jayree/sfdx-plugin-manifest 2.5.2 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +64 -45
- package/README.md +63 -4
- package/lib/SDR-extra/collections/componentSetExtra.d.ts +38 -0
- package/lib/SDR-extra/collections/componentSetExtra.js +66 -0
- package/lib/SDR-extra/collections/componentSetExtra.js.map +1 -0
- package/lib/SDR-extra/resolve/gitDiffResolver.d.ts +18 -0
- package/lib/SDR-extra/resolve/gitDiffResolver.js +192 -0
- package/lib/SDR-extra/resolve/gitDiffResolver.js.map +1 -0
- package/lib/SDR-extra/resolve/treeContainersExtra.d.ts +13 -0
- package/lib/SDR-extra/resolve/treeContainersExtra.js +51 -0
- package/lib/SDR-extra/resolve/treeContainersExtra.js.map +1 -0
- package/lib/SDR-extra/utils/git-extra.d.ts +65 -0
- package/lib/SDR-extra/utils/git-extra.js +198 -0
- package/lib/SDR-extra/utils/git-extra.js.map +1 -0
- package/lib/commands/jayree/manifest/beta/git/diff.d.ts +32 -0
- package/lib/commands/jayree/manifest/beta/git/diff.js +127 -0
- package/lib/commands/jayree/manifest/beta/git/diff.js.map +1 -0
- package/lib/jayreeSfdxCommand.d.ts +3 -0
- package/lib/jayreeSfdxCommand.js +8 -1
- package/lib/jayreeSfdxCommand.js.map +1 -1
- package/lib/utils/gitdiff.js +2 -2
- package/lib/utils/gitdiff.js.map +1 -1
- package/messages/gitdiffbeta.json +17 -0
- package/oclif.manifest.json +1 -1
- package/package.json +5 -5
@@ -0,0 +1,192 @@
|
|
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 path from 'path';
|
8
|
+
import { ComponentSet, RegistryAccess, MetadataResolver, SourceComponent, DestructiveChangesType, } from '@salesforce/source-deploy-retrieve';
|
9
|
+
import { SfProject, SfError } from '@salesforce/core';
|
10
|
+
import fs from 'fs-extra';
|
11
|
+
import { parseMetadataXml } from '@salesforce/source-deploy-retrieve/lib/src/utils/index.js';
|
12
|
+
import equal from 'fast-deep-equal';
|
13
|
+
import Debug from 'debug';
|
14
|
+
import { resolveMultiRefString, resolveSingleRefString, getFileState, getStatus } from '../utils/git-extra.js';
|
15
|
+
import { VirtualTreeContainerExtra } from './treeContainersExtra.js';
|
16
|
+
export const debug = Debug('sf:gitDiff:resolver');
|
17
|
+
const registryAccess = new RegistryAccess();
|
18
|
+
/**
|
19
|
+
* Resolver for metadata type and component objects from a git diff result
|
20
|
+
*
|
21
|
+
* @internal
|
22
|
+
*/
|
23
|
+
export class GitDiffResolver {
|
24
|
+
static async getFileStatus(ref1, ref2, dir, resolveSourcePaths) {
|
25
|
+
let files;
|
26
|
+
if (ref2) {
|
27
|
+
files = (await getFileState(ref1, ref2, dir)).filter((l) => resolveSourcePaths.some((f) => l.path.startsWith(f)));
|
28
|
+
}
|
29
|
+
else {
|
30
|
+
files = await getStatus(dir, ref1);
|
31
|
+
files = files.filter((l) => resolveSourcePaths.some((f) => l.path.startsWith(f)));
|
32
|
+
}
|
33
|
+
files = files.filter((file) => {
|
34
|
+
if (file.status === 'D') {
|
35
|
+
for (const sourcePath of resolveSourcePaths) {
|
36
|
+
const defaultFolder = path.join(sourcePath, 'main', 'default');
|
37
|
+
const filePath = file.path.replace(file.path.startsWith(defaultFolder) ? defaultFolder : sourcePath, '');
|
38
|
+
const target = files.find((t) => t.path.endsWith(filePath) && t.status === 'A');
|
39
|
+
if (target) {
|
40
|
+
return false;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
return true;
|
45
|
+
});
|
46
|
+
return files;
|
47
|
+
}
|
48
|
+
async resolve(ref1, ref2, fsPaths) {
|
49
|
+
const proj = await SfProject.resolve();
|
50
|
+
if (ref2 === undefined) {
|
51
|
+
const { ref1: r1, ref2: r2 } = await resolveMultiRefString({ ref: ref1, dir: proj.getPath(), fs });
|
52
|
+
ref1 = r1;
|
53
|
+
ref2 = r2;
|
54
|
+
}
|
55
|
+
else {
|
56
|
+
const [r1, r2] = await Promise.all([
|
57
|
+
resolveSingleRefString({ ref: ref1, dir: proj.getPath(), fs }),
|
58
|
+
resolveSingleRefString({ ref: ref2, dir: proj.getPath(), fs }),
|
59
|
+
]);
|
60
|
+
ref1 = r1;
|
61
|
+
ref2 = r2;
|
62
|
+
}
|
63
|
+
debug({ ref1, ref2 });
|
64
|
+
const fileStatus = await GitDiffResolver.getFileStatus(ref1, ref2, proj.getPath(), fsPaths);
|
65
|
+
debug({ fileStatus });
|
66
|
+
const [ref1VirtualTreeContainer, ref2VirtualTreeContainer] = await Promise.all([
|
67
|
+
VirtualTreeContainerExtra.fromGitRef(ref1, proj.getPath(), fileStatus.filter((l) => l.status === 'M').map((l) => l.path)),
|
68
|
+
VirtualTreeContainerExtra.fromGitRef(ref2, proj.getPath(), fileStatus.filter((l) => l.status === 'M').map((l) => l.path)),
|
69
|
+
]);
|
70
|
+
this.ref1VirtualTreeContainer = ref1VirtualTreeContainer;
|
71
|
+
this.ref2VirtualTreeContainer = ref2VirtualTreeContainer;
|
72
|
+
fsPaths = fsPaths.map((filepath) => {
|
73
|
+
filepath = path.resolve(filepath);
|
74
|
+
if (!this.ref1VirtualTreeContainer.exists(filepath) && !this.ref2VirtualTreeContainer.exists(filepath)) {
|
75
|
+
throw new SfError(`The sourcepath "${filepath}" is not a valid source file path.`);
|
76
|
+
}
|
77
|
+
return filepath;
|
78
|
+
});
|
79
|
+
debug({ fsPaths });
|
80
|
+
this.ref1Resolver = new MetadataResolver(registryAccess, this.ref1VirtualTreeContainer);
|
81
|
+
this.ref2Resolver = new MetadataResolver(registryAccess, this.ref2VirtualTreeContainer);
|
82
|
+
return this.getComponentSet(fileStatus, fsPaths);
|
83
|
+
}
|
84
|
+
async getComponentSet(gitLines, fsPaths) {
|
85
|
+
const results = new ComponentSet(undefined, registryAccess);
|
86
|
+
const childComponentPromises = [];
|
87
|
+
for (const [, { status, path: fpath }] of gitLines.entries()) {
|
88
|
+
if (!fsPaths || fsPaths.some((fsPath) => path.resolve(fpath).startsWith(fsPath))) {
|
89
|
+
if (status === 'D') {
|
90
|
+
for (const c of this.ref1Resolver.getComponentsFromPath(fpath)) {
|
91
|
+
// if the component supports partial delete AND there are files that are not deleted,
|
92
|
+
// set the component for deploy, not for delete.
|
93
|
+
if (!!c.type.supportsPartialDelete && c.content && this.ref2VirtualTreeContainer.exists(c.content)) {
|
94
|
+
// all bundle types have a directory name
|
95
|
+
try {
|
96
|
+
this.ref2Resolver
|
97
|
+
.getComponentsFromPath(path.resolve(c.content))
|
98
|
+
.filter((input) => input instanceof SourceComponent)
|
99
|
+
.map((nonDeletedComponent) => {
|
100
|
+
results.add(nonDeletedComponent);
|
101
|
+
});
|
102
|
+
}
|
103
|
+
catch (e) {
|
104
|
+
debug(`unable to find component at ${c.content}. That's ok if it was supposed to be deleted`);
|
105
|
+
}
|
106
|
+
}
|
107
|
+
else {
|
108
|
+
results.add(c, DestructiveChangesType.POST);
|
109
|
+
}
|
110
|
+
}
|
111
|
+
}
|
112
|
+
else if (status === 'A') {
|
113
|
+
for (const c of this.ref2Resolver.getComponentsFromPath(fpath)) {
|
114
|
+
results.add(c);
|
115
|
+
}
|
116
|
+
}
|
117
|
+
else {
|
118
|
+
childComponentPromises.push(this.getChildComponentStatus(fpath));
|
119
|
+
}
|
120
|
+
}
|
121
|
+
}
|
122
|
+
for await (const check of childComponentPromises) {
|
123
|
+
if (check.status === 0) {
|
124
|
+
for (const c of this.ref2Resolver.getComponentsFromPath(check.path)) {
|
125
|
+
results.add(c);
|
126
|
+
}
|
127
|
+
}
|
128
|
+
else if (check.status === -1) {
|
129
|
+
// unchanged file
|
130
|
+
}
|
131
|
+
else {
|
132
|
+
for (const c of check.toDestructiveChanges) {
|
133
|
+
results.add(c, DestructiveChangesType.POST);
|
134
|
+
}
|
135
|
+
for (const c of check.toManifest) {
|
136
|
+
results.add(c);
|
137
|
+
}
|
138
|
+
}
|
139
|
+
}
|
140
|
+
debug({
|
141
|
+
forceIgnoredPaths: {
|
142
|
+
ref1: Array.from(this.ref1Resolver.forceIgnoredPaths),
|
143
|
+
ref2: Array.from(this.ref2Resolver.forceIgnoredPaths),
|
144
|
+
},
|
145
|
+
});
|
146
|
+
return results;
|
147
|
+
}
|
148
|
+
async getChildComponentStatus(fpath) {
|
149
|
+
if (!parseMetadataXml(fpath)) {
|
150
|
+
return { path: fpath, status: 0 };
|
151
|
+
}
|
152
|
+
const [ref2Component] = this.ref2Resolver.getComponentsFromPath(fpath); // git path only conaints files
|
153
|
+
const [ref1Component] = this.ref1Resolver.getComponentsFromPath(fpath); // git path only conaints files
|
154
|
+
if (equal(await ref1Component.parseXml(), await ref2Component.parseXml())) {
|
155
|
+
return { path: fpath, status: -1 };
|
156
|
+
}
|
157
|
+
if (ref1Component.type.strictDirectoryName === true || !ref1Component.type.children) {
|
158
|
+
return { path: fpath, status: 0 };
|
159
|
+
}
|
160
|
+
const getUniqueIdentifier = (component) => `${component.type.name}#${component[component.type.uniqueIdElement]}`;
|
161
|
+
const ref2ChildUniqueIdArray = ref2Component
|
162
|
+
.getChildren()
|
163
|
+
.map((childComponent) => getUniqueIdentifier(childComponent));
|
164
|
+
const ref1ChildUniqueIdArray = ref1Component
|
165
|
+
.getChildren()
|
166
|
+
.map((childComponent) => getUniqueIdentifier(childComponent));
|
167
|
+
const childComponentsNotInRef2 = ref1Component
|
168
|
+
.getChildren()
|
169
|
+
.filter((childComponent) => !ref2ChildUniqueIdArray.includes(getUniqueIdentifier(childComponent))); // deleted
|
170
|
+
const childComponentsNotInRef1 = ref2Component
|
171
|
+
.getChildren()
|
172
|
+
.filter((childComponent) => !ref1ChildUniqueIdArray.includes(getUniqueIdentifier(childComponent))); // added
|
173
|
+
const childComponentsInRef1AndRef2 = ref1Component
|
174
|
+
.getChildren()
|
175
|
+
.filter((childComponent) => ref2ChildUniqueIdArray.includes(getUniqueIdentifier(childComponent))); // modified?
|
176
|
+
for await (const childComponentRef1 of childComponentsInRef1AndRef2) {
|
177
|
+
const [childComponentRef2] = ref2Component
|
178
|
+
.getChildren()
|
179
|
+
.filter((childComponent) => getUniqueIdentifier(childComponentRef1) === getUniqueIdentifier(childComponent));
|
180
|
+
if (!equal(await childComponentRef1.parseXml(), await childComponentRef2.parseXml())) {
|
181
|
+
childComponentsNotInRef1.push(childComponentRef2); // modified! -> add to added
|
182
|
+
}
|
183
|
+
}
|
184
|
+
return {
|
185
|
+
path: fpath,
|
186
|
+
status: 1 + childComponentsNotInRef2.length + childComponentsNotInRef1.length,
|
187
|
+
toManifest: childComponentsNotInRef1,
|
188
|
+
toDestructiveChanges: childComponentsNotInRef2,
|
189
|
+
};
|
190
|
+
}
|
191
|
+
}
|
192
|
+
//# sourceMappingURL=gitDiffResolver.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"gitDiffResolver.js","sourceRoot":"","sources":["../../../src/SDR-extra/resolve/gitDiffResolver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EACL,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,2DAA2D,CAAC;AAC7F,OAAO,KAAK,MAAM,iBAAiB,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC/G,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,CAAC,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;QAED,OAAO;YACL,IAAI,EAAE,KAAK;YACX,MAAM,EAAE,CAAC,GAAG,wBAAwB,CAAC,MAAM,GAAG,wBAAwB,CAAC,MAAM;YAC7E,UAAU,EAAE,wBAAwB;YACpC,oBAAoB,EAAE,wBAAwB;SAC/C,CAAC;IACJ,CAAC;CACF"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { VirtualTreeContainer } from '@salesforce/source-deploy-retrieve';
|
2
|
+
export declare class VirtualTreeContainerExtra extends VirtualTreeContainer {
|
3
|
+
/**
|
4
|
+
* Designed for recreating virtual files from a git ref
|
5
|
+
* To support use of MetadataResolver to also resolve metadata xmls file names can be provided
|
6
|
+
*
|
7
|
+
* @param ref git ref
|
8
|
+
* @param dir git dir
|
9
|
+
* @param includeBufferForFiles full paths to modified files
|
10
|
+
* @returns VirtualTreeContainer
|
11
|
+
*/
|
12
|
+
static fromGitRef(ref: string, dir: string, includeBufferForFiles: string[]): Promise<VirtualTreeContainer>;
|
13
|
+
}
|
@@ -0,0 +1,51 @@
|
|
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 path from 'path';
|
8
|
+
import { VirtualTreeContainer } from '@salesforce/source-deploy-retrieve';
|
9
|
+
import { parseMetadataXml } from '@salesforce/source-deploy-retrieve/lib/src/utils/index.js';
|
10
|
+
import fs from 'fs-extra';
|
11
|
+
import { listFullPathFiles, getOid, readBlobAsBuffer } from '../utils/git-extra.js';
|
12
|
+
export class VirtualTreeContainerExtra extends VirtualTreeContainer {
|
13
|
+
/**
|
14
|
+
* Designed for recreating virtual files from a git ref
|
15
|
+
* To support use of MetadataResolver to also resolve metadata xmls file names can be provided
|
16
|
+
*
|
17
|
+
* @param ref git ref
|
18
|
+
* @param dir git dir
|
19
|
+
* @param includeBufferForFiles full paths to modified files
|
20
|
+
* @returns VirtualTreeContainer
|
21
|
+
*/
|
22
|
+
static async fromGitRef(ref, dir, includeBufferForFiles) {
|
23
|
+
const paths = await listFullPathFiles(dir, ref);
|
24
|
+
const oid = await getOid(dir, ref);
|
25
|
+
const virtualDirectoryByFullPath = new Map();
|
26
|
+
for await (const filename of paths) {
|
27
|
+
let dirPath = path.dirname(filename);
|
28
|
+
virtualDirectoryByFullPath.set(dirPath, {
|
29
|
+
dirPath,
|
30
|
+
children: Array.from(new Set(virtualDirectoryByFullPath.get(dirPath)?.children ?? []).add({
|
31
|
+
name: path.basename(filename),
|
32
|
+
data: parseMetadataXml(filename) && includeBufferForFiles.includes(filename)
|
33
|
+
? oid
|
34
|
+
? await readBlobAsBuffer(dir, oid, filename)
|
35
|
+
: await fs.readFile(filename)
|
36
|
+
: Buffer.from(''),
|
37
|
+
})),
|
38
|
+
});
|
39
|
+
const splits = filename.split(path.sep);
|
40
|
+
for (let i = 1; i < splits.length - 1; i++) {
|
41
|
+
dirPath = splits.slice(0, i + 1).join(path.sep);
|
42
|
+
virtualDirectoryByFullPath.set(dirPath, {
|
43
|
+
dirPath,
|
44
|
+
children: Array.from(new Set(virtualDirectoryByFullPath.get(dirPath)?.children ?? []).add(splits[i + 1])),
|
45
|
+
});
|
46
|
+
}
|
47
|
+
}
|
48
|
+
return new VirtualTreeContainer(Array.from(virtualDirectoryByFullPath.values()));
|
49
|
+
}
|
50
|
+
}
|
51
|
+
//# sourceMappingURL=treeContainersExtra.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"treeContainersExtra.js","sourceRoot":"","sources":["../../../src/SDR-extra/resolve/treeContainersExtra.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAoB,MAAM,oCAAoC,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,2DAA2D,CAAC;AAC7F,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,IAAI,CAAC,GAAG,CAAC,CAAC;YACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;gBAC1C,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBAChD,0BAA0B,CAAC,GAAG,CAAC,OAAO,EAAE;oBACtC,OAAO;oBACP,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,0BAA0B,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;iBAC1G,CAAC,CAAC;aACJ;SACF;QACD,OAAO,IAAI,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,0BAA0B,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACnF,CAAC;CACF"}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
2
|
+
import { CallbackFsClient, PromiseFsClient } from 'isomorphic-git';
|
3
|
+
import Debug from 'debug';
|
4
|
+
export declare const debug: Debug.Debugger;
|
5
|
+
export interface GetCommitLogOptions {
|
6
|
+
/**
|
7
|
+
* File paths or directory paths to resolve components against
|
8
|
+
*/
|
9
|
+
ref: string;
|
10
|
+
/**
|
11
|
+
* File paths or directory paths to resolve components against
|
12
|
+
*/
|
13
|
+
dir: string;
|
14
|
+
/**
|
15
|
+
* File paths or directory paths to resolve components against
|
16
|
+
*/
|
17
|
+
fs: CallbackFsClient | PromiseFsClient;
|
18
|
+
}
|
19
|
+
interface MultiRefStringOptions {
|
20
|
+
/**
|
21
|
+
* File paths or directory paths to resolve components against
|
22
|
+
*/
|
23
|
+
ref: string;
|
24
|
+
/**
|
25
|
+
* File paths or directory paths to resolve components against
|
26
|
+
*/
|
27
|
+
dir: string;
|
28
|
+
/**
|
29
|
+
* File paths or directory paths to resolve components against
|
30
|
+
*/
|
31
|
+
fs: CallbackFsClient | PromiseFsClient;
|
32
|
+
}
|
33
|
+
export declare function resolveMultiRefString(options: MultiRefStringOptions): Promise<{
|
34
|
+
ref1: string;
|
35
|
+
ref2: string;
|
36
|
+
}>;
|
37
|
+
interface SingleRefStringOptions {
|
38
|
+
/**
|
39
|
+
* File paths or directory paths to resolve components against
|
40
|
+
*/
|
41
|
+
ref: string;
|
42
|
+
/**
|
43
|
+
* File paths or directory paths to resolve components against
|
44
|
+
*/
|
45
|
+
dir: string;
|
46
|
+
/**
|
47
|
+
* File paths or directory paths to resolve components against
|
48
|
+
*/
|
49
|
+
fs: CallbackFsClient | PromiseFsClient;
|
50
|
+
}
|
51
|
+
export declare function resolveSingleRefString(options: SingleRefStringOptions): Promise<string>;
|
52
|
+
export declare function getFileState(commitHash1: string, commitHash2: string, dir: string): Promise<[
|
53
|
+
{
|
54
|
+
path: string;
|
55
|
+
status: string;
|
56
|
+
}
|
57
|
+
]>;
|
58
|
+
export declare function getStatus(dir: string, ref: string): Promise<Array<{
|
59
|
+
path: string;
|
60
|
+
status: string;
|
61
|
+
}>>;
|
62
|
+
export declare function listFullPathFiles(dir: string, ref: string): Promise<string[]>;
|
63
|
+
export declare function getOid(dir: string, ref: string): Promise<string>;
|
64
|
+
export declare function readBlobAsBuffer(dir: string, oid: string, filename: string): Promise<Buffer>;
|
65
|
+
export {};
|
@@ -0,0 +1,198 @@
|
|
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 util from 'util';
|
8
|
+
import path from 'path';
|
9
|
+
import git from 'isomorphic-git';
|
10
|
+
import fs from 'fs-extra';
|
11
|
+
import Debug from 'debug';
|
12
|
+
export const debug = Debug('sf:gitDiff:extra');
|
13
|
+
async function getCommitLog(options) {
|
14
|
+
try {
|
15
|
+
const [log] = await git.log({
|
16
|
+
fs: options.fs,
|
17
|
+
dir: options.dir,
|
18
|
+
ref: options.ref,
|
19
|
+
depth: 1,
|
20
|
+
});
|
21
|
+
return { oid: log.oid, parents: log.commit.parent };
|
22
|
+
}
|
23
|
+
catch (error) {
|
24
|
+
throw new Error(`ambiguous argument '${options.ref}': unknown revision or path not in the working tree.
|
25
|
+
See more help with --help`);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
export async function resolveMultiRefString(options) {
|
29
|
+
const a = options.ref.split('.');
|
30
|
+
let ref1;
|
31
|
+
let ref2;
|
32
|
+
if (a.length === 3 || a.length === 4) {
|
33
|
+
ref1 = a[0];
|
34
|
+
ref2 = a[a.length - 1];
|
35
|
+
}
|
36
|
+
else if (a.length === 1) {
|
37
|
+
ref1 = a[0];
|
38
|
+
ref2 = undefined;
|
39
|
+
}
|
40
|
+
else {
|
41
|
+
throw new Error(`Ambiguous ${util.format('argument%s', options.ref.length === 1 ? '' : 's')}: ${options.ref}
|
42
|
+
See more help with --help`);
|
43
|
+
}
|
44
|
+
if (a.length === 4) {
|
45
|
+
ref1 = (await git.findMergeBase({
|
46
|
+
fs: options.fs,
|
47
|
+
dir: options.dir,
|
48
|
+
oids: [ref2, ref1],
|
49
|
+
}))[0];
|
50
|
+
}
|
51
|
+
else {
|
52
|
+
ref1 = await resolveSingleRefString({ ref: ref1, dir: options.dir, fs: options.fs });
|
53
|
+
}
|
54
|
+
ref2 = await resolveSingleRefString({ ref: ref2, dir: options.dir, fs: options.fs });
|
55
|
+
return { ref1, ref2 };
|
56
|
+
}
|
57
|
+
export async function resolveSingleRefString(options) {
|
58
|
+
if (options.ref === undefined) {
|
59
|
+
return '';
|
60
|
+
}
|
61
|
+
if (!['~', '^'].some((el) => options.ref.includes(el))) {
|
62
|
+
return (await getCommitLog({ ref: options.ref, fs: options.fs, dir: options.dir })).oid;
|
63
|
+
}
|
64
|
+
const firstIndex = [options.ref.indexOf('^'), options.ref.indexOf('~')]
|
65
|
+
.filter((a) => a >= 0)
|
66
|
+
.reduce((a, b) => Math.min(a, b));
|
67
|
+
let ipath = options.ref.substring(firstIndex);
|
68
|
+
let resolvedRef = options.ref.substring(0, firstIndex);
|
69
|
+
while (ipath.length && resolvedRef !== undefined) {
|
70
|
+
if (ipath.startsWith('^')) {
|
71
|
+
ipath = ipath.substring(1);
|
72
|
+
let next = Number(ipath.substring(0, 1));
|
73
|
+
ipath = next ? ipath.substring(1) : ipath;
|
74
|
+
next = next ? next : 1;
|
75
|
+
// eslint-disable-next-line no-await-in-loop
|
76
|
+
resolvedRef = (await getCommitLog({ ref: resolvedRef, fs: options.fs, dir: options.dir })).parents[next - 1];
|
77
|
+
}
|
78
|
+
else if (ipath.startsWith('~')) {
|
79
|
+
ipath = ipath.substring(1);
|
80
|
+
let next = Number(ipath.substring(0, 1));
|
81
|
+
ipath = next ? ipath.substring(1) : ipath;
|
82
|
+
next = next ? next : 1;
|
83
|
+
for (let index = 0; index <= next - 1; index++) {
|
84
|
+
// eslint-disable-next-line no-await-in-loop
|
85
|
+
resolvedRef = (await getCommitLog({ ref: resolvedRef, fs: options.fs, dir: options.dir })).parents[0];
|
86
|
+
}
|
87
|
+
}
|
88
|
+
else {
|
89
|
+
resolvedRef = undefined;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
if (resolvedRef === undefined) {
|
93
|
+
throw new Error(`ambiguous argument '${options.ref}': unknown revision or path not in the working tree.`);
|
94
|
+
}
|
95
|
+
return resolvedRef;
|
96
|
+
}
|
97
|
+
export async function getFileState(commitHash1, commitHash2, dir) {
|
98
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
99
|
+
return git.walk({
|
100
|
+
fs,
|
101
|
+
dir,
|
102
|
+
trees: [git.TREE({ ref: commitHash1 }), git.TREE({ ref: commitHash2 })],
|
103
|
+
async map(filepath, [A, B]) {
|
104
|
+
if (filepath === '.' || (await A?.type()) === 'tree' || (await B?.type()) === 'tree') {
|
105
|
+
return;
|
106
|
+
}
|
107
|
+
const Aoid = await A?.oid();
|
108
|
+
const Boid = await B?.oid();
|
109
|
+
let type = 'EQ';
|
110
|
+
if (Aoid !== Boid) {
|
111
|
+
type = 'M';
|
112
|
+
}
|
113
|
+
if (Aoid === undefined) {
|
114
|
+
type = 'A';
|
115
|
+
}
|
116
|
+
if (Boid === undefined) {
|
117
|
+
type = 'D';
|
118
|
+
}
|
119
|
+
if (type !== 'EQ') {
|
120
|
+
return {
|
121
|
+
path: path.join(dir, ensureOSPath(filepath)),
|
122
|
+
status: type,
|
123
|
+
};
|
124
|
+
}
|
125
|
+
},
|
126
|
+
});
|
127
|
+
}
|
128
|
+
export async function getStatus(dir, ref) {
|
129
|
+
const getStatusText = (row) => {
|
130
|
+
if ([
|
131
|
+
[0, 2, 2],
|
132
|
+
[0, 2, 3], // added, staged, with unstaged changes
|
133
|
+
].some((a) => a.every((val, index) => val === row[index]))) {
|
134
|
+
return 'A';
|
135
|
+
}
|
136
|
+
if ([
|
137
|
+
[1, 0, 0],
|
138
|
+
[1, 0, 1],
|
139
|
+
[1, 1, 0],
|
140
|
+
[1, 2, 0],
|
141
|
+
[1, 0, 3], // modified, staged, with unstaged deletion
|
142
|
+
].some((a) => a.every((val, index) => val === row[index]))) {
|
143
|
+
return 'D';
|
144
|
+
}
|
145
|
+
if ([
|
146
|
+
[1, 2, 1],
|
147
|
+
[1, 2, 2],
|
148
|
+
[1, 2, 3], // modified, staged, with unstaged changes
|
149
|
+
].some((a) => a.every((val, index) => val === row[index]))) {
|
150
|
+
return 'M';
|
151
|
+
}
|
152
|
+
};
|
153
|
+
const statusMatrix = await git.statusMatrix({ fs, dir, ref });
|
154
|
+
const unstaged = statusMatrix
|
155
|
+
.filter((row) => [
|
156
|
+
[0, 2, 0],
|
157
|
+
[0, 0, 3],
|
158
|
+
[0, 2, 3],
|
159
|
+
[1, 2, 1],
|
160
|
+
[1, 0, 3],
|
161
|
+
[1, 1, 3],
|
162
|
+
[1, 2, 3],
|
163
|
+
[1, 1, 0],
|
164
|
+
[1, 2, 0],
|
165
|
+
[1, 0, 1], // deleted, unstaged
|
166
|
+
].some((a) => a.every((val, index) => val === row.slice(1)[index])))
|
167
|
+
.map((row) => path.join(dir, ensureOSPath(row[0])));
|
168
|
+
debug({ unstaged });
|
169
|
+
const gitlines = statusMatrix
|
170
|
+
.filter((row) => ![
|
171
|
+
[0, 0, 0],
|
172
|
+
[1, 1, 1],
|
173
|
+
[0, 0, 3],
|
174
|
+
[0, 2, 0],
|
175
|
+
[1, 1, 3], // modified, staged, with unstaged original file
|
176
|
+
].some((a) => a.every((val, index) => val === row.slice(1)[index])))
|
177
|
+
.map((row) => ({
|
178
|
+
path: path.join(dir, ensureOSPath(row[0])),
|
179
|
+
status: getStatusText(row.slice(1)),
|
180
|
+
}));
|
181
|
+
return gitlines;
|
182
|
+
}
|
183
|
+
function ensureOSPath(fpath) {
|
184
|
+
return fpath.split(path.posix.sep).join(path.sep);
|
185
|
+
}
|
186
|
+
function ensureGitRelPath(dir, fpath) {
|
187
|
+
return path.relative(dir, fpath).split(path.sep).join(path.posix.sep);
|
188
|
+
}
|
189
|
+
export async function listFullPathFiles(dir, ref) {
|
190
|
+
return (await git.listFiles({ fs, dir, ref })).map((p) => path.join(dir, ensureOSPath(p)));
|
191
|
+
}
|
192
|
+
export async function getOid(dir, ref) {
|
193
|
+
return ref ? git.resolveRef({ fs, dir, ref }) : '';
|
194
|
+
}
|
195
|
+
export async function readBlobAsBuffer(dir, oid, filename) {
|
196
|
+
return Buffer.from((await git.readBlob({ fs, dir, oid, filepath: ensureGitRelPath(dir, filename) })).blob);
|
197
|
+
}
|
198
|
+
//# sourceMappingURL=git-extra.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"git-extra.js","sourceRoot":"","sources":["../../../src/SDR-extra/utils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GAAG,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACrD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,GAAW,EAAE,GAAW,EAAE,QAAgB;IAC/E,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,gBAAgB,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAC7G,CAAC"}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { ArgInput } from '@oclif/core/lib/interfaces';
|
2
|
+
import { FlagsConfig } from '@salesforce/command';
|
3
|
+
import { JayreeSfdxCommand } from '../../../../../jayreeSfdxCommand.js';
|
4
|
+
interface CreateCommandResult {
|
5
|
+
manifest?: {
|
6
|
+
path: string;
|
7
|
+
name: string;
|
8
|
+
};
|
9
|
+
destructiveChanges?: {
|
10
|
+
path: string;
|
11
|
+
name: string;
|
12
|
+
};
|
13
|
+
}
|
14
|
+
export default class gitDiff extends JayreeSfdxCommand {
|
15
|
+
static description: string;
|
16
|
+
static examples: string[];
|
17
|
+
static args: ArgInput;
|
18
|
+
protected static flagsConfig: FlagsConfig;
|
19
|
+
protected static requiresUsername: boolean;
|
20
|
+
protected static supportsDevhubUsername: boolean;
|
21
|
+
protected static requiresProject: boolean;
|
22
|
+
private outputDir;
|
23
|
+
private manifestName;
|
24
|
+
private destructiveChangesName;
|
25
|
+
private outputPath;
|
26
|
+
private componentSet;
|
27
|
+
private destructiveChangesOnly;
|
28
|
+
run(): Promise<CreateCommandResult>;
|
29
|
+
protected createManifest(): Promise<void>;
|
30
|
+
protected formatResult(): CreateCommandResult;
|
31
|
+
}
|
32
|
+
export {};
|