@jayree/sfdx-plugin-manifest 2.6.4 → 2.7.1
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 +58 -53
- package/lib/SDR-extra/collections/componentSetExtra.d.ts +2 -3
- package/lib/SDR-extra/collections/componentSetExtra.js +28 -18
- package/lib/SDR-extra/collections/componentSetExtra.js.map +1 -1
- package/lib/SDR-extra/collections/index.d.ts +1 -0
- package/lib/SDR-extra/collections/index.js +8 -0
- package/lib/SDR-extra/collections/index.js.map +1 -0
- package/lib/SDR-extra/index.d.ts +3 -0
- package/lib/SDR-extra/index.js +10 -0
- package/lib/SDR-extra/index.js.map +1 -0
- package/lib/SDR-extra/resolve/gitDiffResolver.d.ts +3 -6
- package/lib/SDR-extra/resolve/gitDiffResolver.js +22 -18
- package/lib/SDR-extra/resolve/gitDiffResolver.js.map +1 -1
- package/lib/SDR-extra/resolve/index.d.ts +2 -0
- package/lib/SDR-extra/resolve/index.js +9 -0
- package/lib/SDR-extra/resolve/index.js.map +1 -0
- package/lib/SDR-extra/resolve/treeContainersExtra.d.ts +1 -1
- package/lib/SDR-extra/resolve/treeContainersExtra.js +9 -8
- package/lib/SDR-extra/resolve/treeContainersExtra.js.map +1 -1
- package/lib/SDR-extra/utils/index.d.ts +1 -0
- package/lib/SDR-extra/utils/index.js +8 -0
- package/lib/SDR-extra/utils/index.js.map +1 -0
- package/lib/SDR-extra/utils/localGitRepo.d.ts +39 -0
- package/lib/SDR-extra/utils/localGitRepo.js +239 -0
- package/lib/SDR-extra/utils/localGitRepo.js.map +1 -0
- package/lib/commands/jayree/manifest/beta/git/diff.d.ts +15 -10
- package/lib/commands/jayree/manifest/beta/git/diff.js +49 -35
- package/lib/commands/jayree/manifest/beta/git/diff.js.map +1 -1
- package/lib/commands/jayree/manifest/cleanup.js +7 -1
- package/lib/commands/jayree/manifest/cleanup.js.map +1 -1
- package/lib/commands/jayree/manifest/generate.js +7 -1
- package/lib/commands/jayree/manifest/generate.js.map +1 -1
- package/lib/commands/jayree/manifest/git/diff.js +7 -2
- package/lib/commands/jayree/manifest/git/diff.js.map +1 -1
- package/lib/hooks/changelog.js +7 -2
- package/lib/hooks/changelog.js.map +1 -1
- package/lib/utils/gitdiff.js +2 -2
- package/lib/utils/gitdiff.js.map +1 -1
- package/messages/gitdiffbeta.md +78 -0
- package/oclif.manifest.json +1 -1
- package/package.json +5 -3
- package/lib/SDR-extra/utils/git-extra.d.ts +0 -71
- package/lib/SDR-extra/utils/git-extra.js +0 -202
- package/lib/SDR-extra/utils/git-extra.js.map +0 -1
- package/messages/gitdiffbeta.json +0 -17
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
## [2.7.1](https://github.com/jayree/sfdx-plugin-manifest/compare/v2.7.0...v2.7.1) (2023-01-12)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* restore windows compatibility ([8846d18](https://github.com/jayree/sfdx-plugin-manifest/commit/8846d1889418ecf4284c89aba15ff10104f44922))
|
7
|
+
|
8
|
+
# [2.7.0](https://github.com/jayree/sfdx-plugin-manifest/compare/v2.6.4...v2.7.0) (2023-01-09)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* **manifest:beta:git:diff:** fix output if ref2 is set ([9886831](https://github.com/jayree/sfdx-plugin-manifest/commit/9886831f7533d2b9d2bfdba2f1da5f94f2eb3caa))
|
14
|
+
|
15
|
+
|
16
|
+
### Features
|
17
|
+
|
18
|
+
* **manifest:beta:git:diff:** more enhancements and new sf flags. -d is now used for --source-dir ([1c6be65](https://github.com/jayree/sfdx-plugin-manifest/commit/1c6be65967f6c1fd0afa6ae590466563347d80aa))
|
19
|
+
|
1
20
|
## [2.6.4](https://github.com/jayree/sfdx-plugin-manifest/compare/v2.6.3...v2.6.4) (2023-01-09)
|
2
21
|
|
3
22
|
|
package/README.md
CHANGED
@@ -3,32 +3,16 @@
|
|
3
3
|
A Salesforce CLI plugin containing commands for creating manifest files from Salesforce orgs or git commits of sfdx projects.
|
4
4
|
|
5
5
|
[![sfdx](https://img.shields.io/badge/cli-sfdx-brightgreen.svg)](https://developer.salesforce.com/tools/sfdxcli)
|
6
|
-
[![
|
6
|
+
[![NPM](https://img.shields.io/npm/v/@jayree/sfdx-plugin-manifest.svg?label=@jayree/sfdx-plugin-manifest)](https://npmjs.org/package/@jayree/sfdx-plugin-manifest)
|
7
7
|
[![test-and-release](https://github.com/jayree/sfdx-plugin-manifest/actions/workflows/release.yml/badge.svg)](https://github.com/jayree/sfdx-plugin-manifest/actions/workflows/release.yml)
|
8
8
|
[![Downloads/week](https://img.shields.io/npm/dw/@jayree/sfdx-plugin-manifest.svg)](https://npmjs.org/package/@jayree/sfdx-plugin-manifest)
|
9
9
|
[![License](https://img.shields.io/npm/l/@jayree/sfdx-plugin-manifest.svg)](https://github.com/jayree-plugins/sfdx-plugin-manifest/blob/main/package.json)
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
<!-- install -->
|
16
|
-
|
17
|
-
## Usage
|
18
|
-
|
19
|
-
<!-- usage -->
|
20
|
-
```sh-session
|
21
|
-
$ sfdx plugins:install @jayree/sfdx-plugin-manifest
|
22
|
-
$ sfdx jayree:[COMMAND]
|
23
|
-
running command...
|
24
|
-
$ sfdx plugins
|
25
|
-
@jayree/sfdx-plugin-manifest 2.6.4
|
26
|
-
$ sfdx help jayree:[COMMAND]
|
27
|
-
USAGE
|
28
|
-
$ sfdx jayree:COMMAND
|
29
|
-
...
|
11
|
+
## Install
|
12
|
+
|
13
|
+
```bash
|
14
|
+
sfdx plugins:install @jayree/sfdx-plugin-manifest
|
30
15
|
```
|
31
|
-
<!-- usagestop -->
|
32
16
|
|
33
17
|
## Commands
|
34
18
|
|
@@ -40,61 +24,82 @@ USAGE
|
|
40
24
|
|
41
25
|
### `sfdx jayree:manifest:beta:git:diff`
|
42
26
|
|
43
|
-
|
27
|
+
Create a project manifest and destructiveChanges manifest that lists the metadata components you want to deploy or delete based on changes in your git history.
|
44
28
|
|
45
29
|
```
|
46
30
|
USAGE
|
47
|
-
$ sfdx jayree:manifest:beta:git:diff [
|
48
|
-
|
31
|
+
$ sfdx jayree:manifest:beta:git:diff [REF1] [REF2] [--json] [--api-version <value>] [-d <value>] [--output-dir <value>]
|
32
|
+
[--destructive-changes-only]
|
49
33
|
|
50
34
|
ARGUMENTS
|
51
35
|
REF1 base commit or branch
|
52
36
|
REF2 commit or branch to compare to the base commit
|
53
37
|
|
54
38
|
FLAGS
|
55
|
-
-d, --
|
56
|
-
|
57
|
-
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
--apiversion=<value> override the api version used for
|
63
|
-
api requests made by this command
|
64
|
-
--json format output as json
|
65
|
-
--loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
|
66
|
-
this command invocation
|
39
|
+
-d, --source-dir=<value>... Path to the local source files to include in the manifest.
|
40
|
+
--api-version=<value> Override the api version used for api requests made by this command
|
41
|
+
--destructive-changes-only Create a destructiveChanges manifest only.
|
42
|
+
--output-dir=<value> Directory to save the created manifest files.
|
43
|
+
|
44
|
+
GLOBAL FLAGS
|
45
|
+
--json Format output as json.
|
67
46
|
|
68
47
|
DESCRIPTION
|
69
|
-
|
70
|
-
delete based on changes in your git history
|
48
|
+
Create a project manifest and destructiveChanges manifest that lists the metadata components you want to deploy or
|
49
|
+
delete based on changes in your git history.
|
50
|
+
|
71
51
|
Use this command to create a manifest and destructiveChanges manifest file based on the difference (git diff) of two
|
72
52
|
git refs.
|
73
53
|
|
74
|
-
You can use all ways to spell <commit> which are valid for 'git diff'.
|
75
|
-
(See https://git-scm.com/docs/git-diff)
|
54
|
+
You can use all ways to spell <commit> which are valid for 'git diff' (See https://git-scm.com/docs/git-diff).
|
76
55
|
|
77
56
|
EXAMPLES
|
78
|
-
|
57
|
+
Uses the changes between two arbitrary <commit>.
|
79
58
|
|
80
|
-
|
59
|
+
$ sfdx jayree:manifest:beta:git:diff <commit> <commit>
|
60
|
+
$ sfdx jayree:manifest:beta:git:diff <commit>..<commit>
|
81
61
|
|
82
|
-
|
62
|
+
Uses the changes on the branch containing and up to the second <commit>, starting at a common ancestor of both
|
63
|
+
<commit>.
|
83
64
|
|
84
|
-
|
65
|
+
$ sfdx jayree:manifest:beta:git:diff <commit>...<commit>
|
85
66
|
|
86
|
-
|
67
|
+
Uses the diff of what is unique in branchB (REF2) and unique in branchA (REF1).
|
87
68
|
|
88
|
-
|
69
|
+
$ sfdx jayree:manifest:beta:git:diff branchA..branchB
|
89
70
|
|
90
|
-
|
71
|
+
Uses the diff of what is unique in branchB (REF2).
|
91
72
|
|
92
|
-
|
73
|
+
$ sfdx jayree:manifest:beta:git:diff branchA...branchB
|
93
74
|
|
94
|
-
|
75
|
+
Specify the flags before or after the REF args
|
76
|
+
|
77
|
+
$ sfdx jayree:manifest:beta:git:diff --output-dir package <commit> <commit>
|
78
|
+
$ sfdx jayree:manifest:beta:git:diff <commit> <commit> --output-dir package
|
79
|
+
|
80
|
+
If you specify the 'source-dir' flag before the REF args, use '--' to separate the args from the 'source-dir'
|
81
|
+
values.
|
82
|
+
|
83
|
+
$ sfdx jayree:manifest:beta:git:diff --source-dir force-app -- <commit> <commit>
|
84
|
+
|
85
|
+
FLAG DESCRIPTIONS
|
86
|
+
-d, --source-dir=<value>... Path to the local source files to include in the manifest.
|
87
|
+
|
88
|
+
The supplied path can be to a single file (in which case the operation is applied to only one file) or to a folder
|
89
|
+
(in which case the operation is applied to all metadata types in the directory and its subdirectories).
|
90
|
+
|
91
|
+
You can specify this flag more than once.
|
92
|
+
|
93
|
+
--destructive-changes-only Create a destructiveChanges manifest only.
|
94
|
+
|
95
|
+
Use this flag to create a 'destructiveChanges.xml' and a blank 'package.xml'.
|
96
|
+
|
97
|
+
--output-dir=<value> Directory to save the created manifest files.
|
98
|
+
|
99
|
+
The location can be an absolute path or relative to the current working directory.
|
95
100
|
```
|
96
101
|
|
97
|
-
_See code: [src/commands/jayree/manifest/beta/git/diff.ts](https://github.com/jayree/sfdx-plugin-manifest/blob/v2.
|
102
|
+
_See code: [src/commands/jayree/manifest/beta/git/diff.ts](https://github.com/jayree/sfdx-plugin-manifest/blob/v2.7.1/src/commands/jayree/manifest/beta/git/diff.ts)_
|
98
103
|
|
99
104
|
### `sfdx jayree:manifest:cleanup`
|
100
105
|
|
@@ -122,7 +127,7 @@ EXAMPLES
|
|
122
127
|
$ sfdx jayree:manifest:cleanup --manifest=package.xml --file=packageignore.xml
|
123
128
|
```
|
124
129
|
|
125
|
-
_See code: [src/commands/jayree/manifest/cleanup.ts](https://github.com/jayree/sfdx-plugin-manifest/blob/v2.
|
130
|
+
_See code: [src/commands/jayree/manifest/cleanup.ts](https://github.com/jayree/sfdx-plugin-manifest/blob/v2.7.1/src/commands/jayree/manifest/cleanup.ts)_
|
126
131
|
|
127
132
|
### `sfdx jayree:manifest:generate`
|
128
133
|
|
@@ -165,7 +170,7 @@ EXAMPLES
|
|
165
170
|
<Package xmlns='http://soap.sforce.com/2006/04/metadata'>...</Package>
|
166
171
|
```
|
167
172
|
|
168
|
-
_See code: [src/commands/jayree/manifest/generate.ts](https://github.com/jayree/sfdx-plugin-manifest/blob/v2.
|
173
|
+
_See code: [src/commands/jayree/manifest/generate.ts](https://github.com/jayree/sfdx-plugin-manifest/blob/v2.7.1/src/commands/jayree/manifest/generate.ts)_
|
169
174
|
|
170
175
|
### `sfdx jayree:manifest:git:diff`
|
171
176
|
|
@@ -219,5 +224,5 @@ EXAMPLES
|
|
219
224
|
uses the diff of what is unique in branchB (REF2)
|
220
225
|
```
|
221
226
|
|
222
|
-
_See code: [src/commands/jayree/manifest/git/diff.ts](https://github.com/jayree/sfdx-plugin-manifest/blob/v2.
|
227
|
+
_See code: [src/commands/jayree/manifest/git/diff.ts](https://github.com/jayree/sfdx-plugin-manifest/blob/v2.7.1/src/commands/jayree/manifest/git/diff.ts)_
|
223
228
|
<!-- commandsstop -->
|
@@ -1,7 +1,5 @@
|
|
1
1
|
import { ComponentSet, OptionalTreeRegistryOptions } from '@salesforce/source-deploy-retrieve';
|
2
|
-
|
3
|
-
export declare const debug: Debug.Debugger;
|
4
|
-
export interface FromGitDiffOptions extends OptionalTreeRegistryOptions {
|
2
|
+
interface FromGitDiffOptions extends OptionalTreeRegistryOptions {
|
5
3
|
/**
|
6
4
|
* Git ref to resolve components against
|
7
5
|
*/
|
@@ -36,3 +34,4 @@ export declare class ComponentSetExtra extends ComponentSet {
|
|
36
34
|
*/
|
37
35
|
static fromGitDiff(options: FromGitDiffOptions): Promise<ComponentSet>;
|
38
36
|
}
|
37
|
+
export {};
|
@@ -4,13 +4,13 @@
|
|
4
4
|
* Licensed under the BSD 3-Clause license.
|
5
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
6
6
|
*/
|
7
|
-
import path from 'path';
|
7
|
+
import path from 'node:path';
|
8
8
|
import { ComponentSet, DestructiveChangesType, registry as untypedRegistry, } from '@salesforce/source-deploy-retrieve';
|
9
|
-
import { SfProject } from '@salesforce/core';
|
9
|
+
import { SfProject, Lifecycle } from '@salesforce/core';
|
10
10
|
import Debug from 'debug';
|
11
|
-
import fs from 'fs
|
12
|
-
import { GitDiffResolver } from '../resolve/
|
13
|
-
|
11
|
+
import fs from 'graceful-fs';
|
12
|
+
import { GitDiffResolver } from '../resolve/index.js';
|
13
|
+
const debug = Debug('sf:gitDiff:ComponentSetExtra');
|
14
14
|
export class ComponentSetExtra extends ComponentSet {
|
15
15
|
static async fromGitDiff(input) {
|
16
16
|
let fsPaths;
|
@@ -38,8 +38,20 @@ export class ComponentSetExtra extends ComponentSet {
|
|
38
38
|
ref1 = input;
|
39
39
|
}
|
40
40
|
const project = await SfProject.resolve();
|
41
|
-
const gitDiffResolver = new GitDiffResolver(project
|
41
|
+
const gitDiffResolver = new GitDiffResolver(project);
|
42
42
|
const inclusiveFilter = await gitDiffResolver.resolve(ref1, ref2, fsPaths);
|
43
|
+
const childsTobeReplacedByParent = [
|
44
|
+
...Object.keys(untypedRegistry.types.workflow.children.types),
|
45
|
+
...Object.keys(untypedRegistry.types.sharingrules.children.types),
|
46
|
+
...Object.keys(untypedRegistry.types.customobjecttranslation.children.types),
|
47
|
+
...Object.keys(untypedRegistry.types.bot.children.types),
|
48
|
+
];
|
49
|
+
for (const component of inclusiveFilter.getSourceComponents()) {
|
50
|
+
if (childsTobeReplacedByParent.includes(component.type.id)) {
|
51
|
+
debug(`add parent ${component.parent.type.name}:${component.parent.fullName} of ${component.type.name}:${component.fullName} to manifest`);
|
52
|
+
inclusiveFilter.add(component.parent);
|
53
|
+
}
|
54
|
+
}
|
43
55
|
fsPaths =
|
44
56
|
fsPaths?.map((filepath) => path.resolve(filepath)).filter((filepath) => fs.existsSync(filepath)) ||
|
45
57
|
project.getUniquePackageDirectories().map((pDir) => pDir.fullPath);
|
@@ -50,21 +62,19 @@ export class ComponentSetExtra extends ComponentSet {
|
|
50
62
|
tree,
|
51
63
|
registry,
|
52
64
|
});
|
53
|
-
const
|
54
|
-
...Object.keys(untypedRegistry.types.workflow.children.types),
|
55
|
-
...Object.keys(untypedRegistry.types.sharingrules.children.types),
|
56
|
-
...Object.keys(untypedRegistry.types.customobjecttranslation.children.types),
|
57
|
-
...Object.keys(untypedRegistry.types.bot.children.types),
|
58
|
-
];
|
59
|
-
for (const component of inclusiveFilter
|
60
|
-
.getSourceComponents()
|
61
|
-
.filter((comp) => fsPaths.some((fsPath) => path.resolve(comp.xml).startsWith(fsPath)))) {
|
65
|
+
for (const component of inclusiveFilter.getSourceComponents()) {
|
62
66
|
if (component.isMarkedForDelete()) {
|
63
67
|
components.add(component, DestructiveChangesType.POST);
|
64
68
|
}
|
65
|
-
|
66
|
-
|
67
|
-
|
69
|
+
}
|
70
|
+
for await (const component of inclusiveFilter.getSourceComponents()) {
|
71
|
+
if (!components
|
72
|
+
.getSourceComponents()
|
73
|
+
.find((localComponent) => !!localComponent
|
74
|
+
.getChildren()
|
75
|
+
.find((localChild) => component.type.name === localChild.type.name && component.fullName === localChild.fullName) ||
|
76
|
+
(component.type.name === localComponent.type.name && component.fullName === localComponent.fullName))) {
|
77
|
+
await Lifecycle.getInstance().emitWarning(`The component "${component.type.name}:${component.fullName}" was not found locally.`);
|
68
78
|
}
|
69
79
|
}
|
70
80
|
return components;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"componentSetExtra.js","sourceRoot":"","sources":["../../../src/SDR-extra/collections/componentSetExtra.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,IAAI,MAAM,
|
1
|
+
{"version":3,"file":"componentSetExtra.js","sourceRoot":"","sources":["../../../src/SDR-extra/collections/componentSetExtra.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,YAAY,EAGZ,sBAAsB,EAEtB,QAAQ,IAAI,eAAe,GAC5B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,KAAK,GAAG,KAAK,CAAC,8BAA8B,CAAC,CAAC;AAapD,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IA0B1C,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,KAA6C;QAC3E,IAAI,OAAiB,CAAC;QACtB,IAAI,QAAwB,CAAC;QAC7B,IAAI,IAAmB,CAAC;QACxB,IAAI,IAAuB,CAAC;QAC5B,IAAI,IAAY,CAAC;QAEjB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACxB,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YAChB,IAAI,GAAG,KA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,EAAE;iBACb,IAAI,CACH,CAAC,UAAU,EAAE,EAAE,CACb,SAAS,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,SAAS,CAAC,QAAQ,KAAK,UAAU,CAAC,QAAQ,CAC7F;gBACH,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,IAAI,CAAC,IAAI,IAAI,SAAS,CAAC,QAAQ,KAAK,cAAc,CAAC,QAAQ,CAAC,CACvG,EACH;gBACA,MAAM,SAAS,CAAC,WAAW,EAAE,CAAC,WAAW,CACvC,kBAAkB,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,SAAS,CAAC,QAAQ,0BAA0B,CACtF,CAAC;aACH;SACF;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './componentSetExtra.js';
|
@@ -0,0 +1,8 @@
|
|
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
|
+
export * from './componentSetExtra.js';
|
8
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/SDR-extra/collections/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,wBAAwB,CAAC"}
|
@@ -0,0 +1,10 @@
|
|
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
|
+
export * from './collections/index.js';
|
8
|
+
export * from './resolve/index.js';
|
9
|
+
export * from './utils/index.js';
|
10
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/SDR-extra/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC"}
|
@@ -1,24 +1,21 @@
|
|
1
1
|
import { ComponentSet } from '@salesforce/source-deploy-retrieve';
|
2
2
|
import { SfProject } from '@salesforce/core';
|
3
|
-
import Debug from 'debug';
|
4
|
-
import { CallbackFsClient, PromiseFsClient } from '../utils/git-extra.js';
|
5
|
-
export declare const debug: Debug.Debugger;
|
6
3
|
/**
|
7
4
|
* Resolver for metadata type and component objects from a git diff result
|
8
5
|
*
|
9
6
|
* @internal
|
10
7
|
*/
|
11
8
|
export declare class GitDiffResolver {
|
12
|
-
private fs;
|
13
9
|
private ref2VirtualTreeContainer;
|
14
10
|
private ref1Resolver;
|
15
11
|
private ref2Resolver;
|
16
|
-
private
|
12
|
+
private gitDir;
|
17
13
|
private uniquePackageDirectories;
|
14
|
+
private localRepo;
|
18
15
|
/**
|
19
16
|
* @param dir SFDX project directory
|
20
17
|
*/
|
21
|
-
constructor(project: SfProject
|
18
|
+
constructor(project: SfProject);
|
22
19
|
resolve(ref1: string, ref2: string, fsPaths: string[]): Promise<ComponentSet>;
|
23
20
|
private getFileStatus;
|
24
21
|
private getComponentSet;
|
@@ -4,14 +4,14 @@
|
|
4
4
|
* Licensed under the BSD 3-Clause license.
|
5
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
6
6
|
*/
|
7
|
-
import path from 'path';
|
7
|
+
import path from 'node:path';
|
8
8
|
import { ComponentSet, RegistryAccess, MetadataResolver, SourceComponent, DestructiveChangesType, } from '@salesforce/source-deploy-retrieve';
|
9
|
-
import { SfError } from '@salesforce/core';
|
9
|
+
import { SfError, Lifecycle } from '@salesforce/core';
|
10
10
|
import equal from 'fast-deep-equal';
|
11
11
|
import Debug from 'debug';
|
12
|
-
import {
|
13
|
-
import { VirtualTreeContainerExtra, parseMetadataXml } from './
|
14
|
-
|
12
|
+
import { GitRepo } from '../utils/localGitRepo.js';
|
13
|
+
import { VirtualTreeContainerExtra, parseMetadataXml } from './index.js';
|
14
|
+
const debug = Debug('sf:gitDiff:resolver');
|
15
15
|
const registryAccess = new RegistryAccess();
|
16
16
|
/**
|
17
17
|
* Resolver for metadata type and component objects from a git diff result
|
@@ -22,21 +22,24 @@ export class GitDiffResolver {
|
|
22
22
|
/**
|
23
23
|
* @param dir SFDX project directory
|
24
24
|
*/
|
25
|
-
constructor(project
|
26
|
-
this.
|
27
|
-
this.dir = project.getPath();
|
25
|
+
constructor(project) {
|
26
|
+
this.gitDir = project.getPath();
|
28
27
|
this.uniquePackageDirectories = project.getUniquePackageDirectories().map((pDir) => pDir.fullPath);
|
28
|
+
this.localRepo = GitRepo.getInstance({
|
29
|
+
gitDir: this.gitDir,
|
30
|
+
packageDirs: this.uniquePackageDirectories,
|
31
|
+
});
|
29
32
|
}
|
30
33
|
async resolve(ref1, ref2, fsPaths) {
|
31
34
|
if (ref2 === undefined) {
|
32
|
-
const { ref1: r1, ref2: r2 } = await resolveMultiRefString(
|
35
|
+
const { ref1: r1, ref2: r2 } = await this.localRepo.resolveMultiRefString(ref1);
|
33
36
|
ref1 = r1;
|
34
37
|
ref2 = r2;
|
35
38
|
}
|
36
39
|
else {
|
37
40
|
const [r1, r2] = await Promise.all([
|
38
|
-
resolveSingleRefString(
|
39
|
-
resolveSingleRefString(
|
41
|
+
this.localRepo.resolveSingleRefString(ref1),
|
42
|
+
this.localRepo.resolveSingleRefString(ref2),
|
40
43
|
]);
|
41
44
|
ref1 = r1;
|
42
45
|
ref2 = r2;
|
@@ -45,8 +48,8 @@ export class GitDiffResolver {
|
|
45
48
|
const fileStatus = await this.getFileStatus(ref1, ref2);
|
46
49
|
debug({ fileStatus });
|
47
50
|
const [ref1VirtualTreeContainer, ref2VirtualTreeContainer] = await Promise.all([
|
48
|
-
VirtualTreeContainerExtra.fromGitRef(ref1, this.
|
49
|
-
VirtualTreeContainerExtra.fromGitRef(ref2, this.
|
51
|
+
VirtualTreeContainerExtra.fromGitRef(ref1, this.gitDir, fileStatus.filter((l) => l.status === 'M').map((l) => l.path)),
|
52
|
+
VirtualTreeContainerExtra.fromGitRef(ref2, this.gitDir, fileStatus.filter((l) => l.status === 'M').map((l) => l.path)),
|
50
53
|
]);
|
51
54
|
if (fsPaths) {
|
52
55
|
fsPaths.map((filepath) => {
|
@@ -64,10 +67,10 @@ export class GitDiffResolver {
|
|
64
67
|
async getFileStatus(ref1, ref2) {
|
65
68
|
let files;
|
66
69
|
if (ref2) {
|
67
|
-
files = await getFileState({ ref1, ref2
|
70
|
+
files = (await this.localRepo.getFileState({ ref1, ref2 })).filter((l) => this.uniquePackageDirectories.some((f) => l.path.startsWith(f)));
|
68
71
|
}
|
69
72
|
else {
|
70
|
-
files = await getStatus(
|
73
|
+
files = await this.localRepo.getStatus(ref1);
|
71
74
|
}
|
72
75
|
files = files.filter((file) => {
|
73
76
|
if (file.status === 'D') {
|
@@ -143,9 +146,10 @@ export class GitDiffResolver {
|
|
143
146
|
}
|
144
147
|
}
|
145
148
|
}
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
+
const forceIgnored = Array.from(new Set([...this.ref1Resolver.forceIgnoredPaths, ...this.ref2Resolver.forceIgnoredPaths]));
|
150
|
+
for await (const file of forceIgnored) {
|
151
|
+
await Lifecycle.getInstance().emitWarning(`The forceignored file "${file}" was ignored.`);
|
152
|
+
}
|
149
153
|
return results;
|
150
154
|
}
|
151
155
|
async getChildComponentStatus(fpath) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"gitDiffResolver.js","sourceRoot":"","sources":["../../../src/SDR-extra/resolve/gitDiffResolver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,IAAI,MAAM,
|
1
|
+
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WAAW,EAAE;aACb,MAAM,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,sBAAsB,CAAC,QAAQ,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY;QAEjH,IAAI,KAAK,EAAE,MAAM,kBAAkB,IAAI,4BAA4B,EAAE;YACnE,MAAM,CAAC,kBAAkB,CAAC,GAAG,aAAa;iBACvC,WAAW,EAAE;iBACb,MAAM,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,KAAK,mBAAmB,CAAC,cAAc,CAAC,CAAC,CAAC;YAC/G,IAAI,CAAC,KAAK,CAAC,MAAM,kBAAkB,CAAC,QAAQ,EAAE,EAAE,MAAM,kBAAkB,CAAC,QAAQ,EAAE,CAAC,EAAE;gBACpF,wBAAwB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,4BAA4B;aAChF;SACF;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,9 @@
|
|
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
|
+
export * from './gitDiffResolver.js';
|
8
|
+
export * from './treeContainersExtra.js';
|
9
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/SDR-extra/resolve/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC"}
|
@@ -10,5 +10,5 @@ export declare class VirtualTreeContainerExtra extends VirtualTreeContainer {
|
|
10
10
|
* @param includeBufferForFiles full paths to modified files
|
11
11
|
* @returns VirtualTreeContainer
|
12
12
|
*/
|
13
|
-
static fromGitRef(ref: string,
|
13
|
+
static fromGitRef(ref: string, gitDir: string, includeBufferForFiles: string[]): Promise<VirtualTreeContainer>;
|
14
14
|
}
|
@@ -4,11 +4,11 @@
|
|
4
4
|
* Licensed under the BSD 3-Clause license.
|
5
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
6
6
|
*/
|
7
|
-
import path from 'path';
|
7
|
+
import path from 'node:path';
|
8
8
|
import { VirtualTreeContainer } from '@salesforce/source-deploy-retrieve';
|
9
9
|
import { parseMetadataXml } from '@salesforce/source-deploy-retrieve/lib/src/utils/index.js';
|
10
|
-
import fs from 'fs
|
11
|
-
import {
|
10
|
+
import fs from 'graceful-fs';
|
11
|
+
import { GitRepo } from '../utils/index.js';
|
12
12
|
export { parseMetadataXml } from '@salesforce/source-deploy-retrieve/lib/src/utils/index.js';
|
13
13
|
export class VirtualTreeContainerExtra extends VirtualTreeContainer {
|
14
14
|
/**
|
@@ -20,9 +20,10 @@ export class VirtualTreeContainerExtra extends VirtualTreeContainer {
|
|
20
20
|
* @param includeBufferForFiles full paths to modified files
|
21
21
|
* @returns VirtualTreeContainer
|
22
22
|
*/
|
23
|
-
static async fromGitRef(ref,
|
24
|
-
const
|
25
|
-
const
|
23
|
+
static async fromGitRef(ref, gitDir, includeBufferForFiles) {
|
24
|
+
const localRepo = GitRepo.getInstance({ gitDir });
|
25
|
+
const paths = await localRepo.listFullPathFiles(ref);
|
26
|
+
const oid = await localRepo.getOid(ref);
|
26
27
|
const virtualDirectoryByFullPath = new Map();
|
27
28
|
for await (const filename of paths) {
|
28
29
|
let dirPath = path.dirname(filename);
|
@@ -32,8 +33,8 @@ export class VirtualTreeContainerExtra extends VirtualTreeContainer {
|
|
32
33
|
name: path.basename(filename),
|
33
34
|
data: parseMetadataXml(filename) && includeBufferForFiles.includes(filename)
|
34
35
|
? oid
|
35
|
-
? await readBlobAsBuffer({
|
36
|
-
: await fs.readFile(filename)
|
36
|
+
? await localRepo.readBlobAsBuffer({ oid, filename })
|
37
|
+
: await fs.promises.readFile(filename)
|
37
38
|
: Buffer.from(''),
|
38
39
|
})),
|
39
40
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"treeContainersExtra.js","sourceRoot":"","sources":["../../../src/SDR-extra/resolve/treeContainersExtra.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,IAAI,MAAM,
|
1
|
+
{"version":3,"file":"treeContainersExtra.js","sourceRoot":"","sources":["../../../src/SDR-extra/resolve/treeContainersExtra.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAoB,MAAM,oCAAoC,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,2DAA2D,CAAC;AAC7F,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2DAA2D,CAAC;AAE7F,MAAM,OAAO,yBAA0B,SAAQ,oBAAoB;IACjE;;;;;;;;OAQG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAC5B,GAAW,EACX,MAAc,EACd,qBAA+B;QAE/B,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QAElD,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;QACrD,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACxC,MAAM,0BAA0B,GAAG,IAAI,GAAG,EAA4B,CAAC;QACv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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 @@
|
|
1
|
+
export * from './localGitRepo.js';
|
@@ -0,0 +1,8 @@
|
|
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
|
+
export * from './localGitRepo.js';
|
8
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/SDR-extra/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,mBAAmB,CAAC"}
|