sf-git-merge-driver 1.2.0 → 1.2.1-dev-137.18569178375-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -121
- package/lib/service/installService.js +0 -1
- package/lib/service/installService.js.map +1 -1
- package/npm-shrinkwrap.json +1450 -1476
- package/oclif.manifest.json +1 -1
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -1,144 +1,65 @@
|
|
|
1
1
|
# Salesforce Metadata Git Merge Driver
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[]()
|
|
4
|
+
[]()
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
An intelligent Git merge driver specifically designed for Salesforce metadata files. **Eliminates hours** of manual merge conflicts resolution.
|
|
6
7
|
|
|
7
|
-
-
|
|
8
|
-
- Handles complex metadata structures like arrays with unique identifiers
|
|
9
|
-
- Supports both local and global installation
|
|
10
|
-
- Easy to use with SFDX CLI plugin commands
|
|
11
|
-
- Warning: as of now it does not preserve the order of items that are order dependant like valuesets
|
|
8
|
+

|
|
12
9
|
|
|
13
|
-
##
|
|
10
|
+
## Why use this plugin?
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
<!-- commands -->
|
|
22
|
-
* [`sf git merge driver install`](#sf-git-merge-driver-install)
|
|
23
|
-
* [`sf git merge driver run`](#sf-git-merge-driver-run)
|
|
24
|
-
* [`sf git merge driver uninstall`](#sf-git-merge-driver-uninstall)
|
|
25
|
-
|
|
26
|
-
## `sf git merge driver install`
|
|
27
|
-
|
|
28
|
-
Installs a local git merge driver for the given org and branch.
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
USAGE
|
|
32
|
-
$ sf git merge driver install [--json] [--flags-dir <value>]
|
|
33
|
-
|
|
34
|
-
GLOBAL FLAGS
|
|
35
|
-
--flags-dir=<value> Import flag values from a directory.
|
|
36
|
-
--json Format output as json.
|
|
37
|
-
|
|
38
|
-
DESCRIPTION
|
|
39
|
-
Installs a local git merge driver for the given org and branch.
|
|
12
|
+
- **Saves time**: No more manual XML conflict resolution
|
|
13
|
+
- **Zero-config**: Works immediately after installation
|
|
14
|
+
- **Reliable**: Understands Salesforce metadata structure
|
|
15
|
+
- **Transparent**: Seamless Git workflow integration
|
|
40
16
|
|
|
41
|
-
|
|
42
|
-
project, creating a new merge driver configuration in the `.git/config` of the project, and installing the binary in
|
|
43
|
-
the node_modules/.bin directory.
|
|
17
|
+
## How it works
|
|
44
18
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
19
|
+
```mermaid
|
|
20
|
+
sequenceDiagram
|
|
21
|
+
participant Dev
|
|
22
|
+
participant Git
|
|
23
|
+
participant MergeDriver
|
|
50
24
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
```
|
|
58
|
-
USAGE
|
|
59
|
-
$ sf git merge driver run -O <value> -A <value> -B <value> -P <value> [--json] [--flags-dir <value>] [-L <value>] [-S
|
|
60
|
-
<value>] [-X <value>] [-Y <value>]
|
|
61
|
-
|
|
62
|
-
FLAGS
|
|
63
|
-
-A, --local-file=<value> (required) path to our version of the file
|
|
64
|
-
-B, --other-file=<value> (required) path to their version of the file
|
|
65
|
-
-L, --conflict-marker-size=<value> [default: 7] number of characters to show for conflict markers
|
|
66
|
-
-O, --ancestor-file=<value> (required) path to the common ancestor version of the file
|
|
67
|
-
-P, --output-file=<value> (required) path to the file where the merged content will be written
|
|
68
|
-
-S, --ancestor-conflict-tag=<value> [default: BASE] string used to tag ancestor version in conflicts
|
|
69
|
-
-X, --local-conflict-tag=<value> [default: LOCAL] string used to tag local version in conflicts
|
|
70
|
-
-Y, --other-conflict-tag=<value> [default: REMOTE] string used to tag other version in conflicts
|
|
71
|
-
|
|
72
|
-
GLOBAL FLAGS
|
|
73
|
-
--flags-dir=<value> Import flag values from a directory.
|
|
74
|
-
--json Format output as json.
|
|
75
|
-
|
|
76
|
-
DESCRIPTION
|
|
77
|
-
Runs the merge driver for the specified files.
|
|
78
|
-
|
|
79
|
-
Runs the merge driver for the specified files, handling the merge conflict resolution using Salesforce-specific merge
|
|
80
|
-
strategies. This command is typically called automatically by Git when a merge conflict is detected.
|
|
81
|
-
|
|
82
|
-
EXAMPLES
|
|
83
|
-
Run the merge driver for conflicting files:
|
|
84
|
-
|
|
85
|
-
$ sf git merge driver run --ancestor-file=<value> --local-file=<value> --other-file=<value> \
|
|
86
|
-
--output-file=<value>
|
|
87
|
-
|
|
88
|
-
Where:
|
|
89
|
-
- ancestor-file is the path to the common ancestor version of the file
|
|
90
|
-
- local-file is the path to our version of the file
|
|
91
|
-
- other-file is the path to their version of the file
|
|
92
|
-
- output-file is the path to the file where the merged content will be written
|
|
25
|
+
Dev->>Git: git merge
|
|
26
|
+
Git->>MergeDriver: Detects XML conflict
|
|
27
|
+
MergeDriver->>MergeDriver: Analyzes metadata structure
|
|
28
|
+
MergeDriver->>MergeDriver: Smart merging
|
|
29
|
+
MergeDriver->>Git: Returns merged result
|
|
30
|
+
Git->>Dev: Clean commit (no conflicts)
|
|
93
31
|
```
|
|
94
32
|
|
|
95
|
-
|
|
33
|
+
## Installation (30 seconds)
|
|
96
34
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
35
|
+
```bash
|
|
36
|
+
# Install plugin (one time, global)
|
|
37
|
+
sf plugins install sf-git-merge-driver
|
|
100
38
|
|
|
39
|
+
# Configure merge driver in your project (one time, local per project)
|
|
40
|
+
cd my/sf/project
|
|
41
|
+
sf git merge driver install
|
|
101
42
|
```
|
|
102
|
-
USAGE
|
|
103
|
-
$ sf git merge driver uninstall [--json] [--flags-dir <value>]
|
|
104
|
-
|
|
105
|
-
GLOBAL FLAGS
|
|
106
|
-
--flags-dir=<value> Import flag values from a directory.
|
|
107
|
-
--json Format output as json.
|
|
108
|
-
|
|
109
|
-
DESCRIPTION
|
|
110
|
-
Uninstalls the local git merge driver for the given org and branch.
|
|
111
43
|
|
|
112
|
-
|
|
113
|
-
`.git/info/attributes` files in the project, deleting the merge driver configuration from the `.git/config` of the
|
|
114
|
-
project, and removing the installed binary from the node_modules/.bin directory.
|
|
44
|
+
## Usage
|
|
115
45
|
|
|
116
|
-
|
|
117
|
-
|
|
46
|
+
The merge driver activates **automatically** for conflicts on:
|
|
47
|
+
- [Full list of supported metadata](#configuration)
|
|
118
48
|
|
|
119
|
-
|
|
49
|
+
**No additional steps required!** Works during normal Git operations:
|
|
50
|
+
```bash
|
|
51
|
+
git pull # Conflicts resolved automatically
|
|
52
|
+
git merge # Same here
|
|
120
53
|
```
|
|
121
54
|
|
|
122
|
-
_See code: [src/commands/git/merge/driver/uninstall.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.2.0/src/commands/git/merge/driver/uninstall.ts)_
|
|
123
|
-
<!-- commandsstop -->
|
|
124
|
-
|
|
125
|
-
## How It Works
|
|
126
|
-
|
|
127
|
-
The merge driver works by:
|
|
128
|
-
1. Converting XML to JSON for easier processing
|
|
129
|
-
2. Using a specialized three-way merge algorithm that understands Salesforce metadata structures
|
|
130
|
-
3. Intelligently resolving conflicts based on metadata type
|
|
131
|
-
4. Converting the merged result back to properly formatted XML
|
|
132
|
-
|
|
133
55
|
## Configuration
|
|
134
56
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
```
|
|
138
|
-
*.labels-meta.xml merge=salesforce-source
|
|
139
|
-
*.label-meta.xml merge=salesforce-source
|
|
57
|
+
Configured for these metadata files by default:
|
|
58
|
+
```gitattributes
|
|
140
59
|
*.profile-meta.xml merge=salesforce-source
|
|
141
60
|
*.permissionset-meta.xml merge=salesforce-source
|
|
61
|
+
*.labels-meta.xml merge=salesforce-source
|
|
62
|
+
*.label-meta.xml merge=salesforce-source
|
|
142
63
|
*.applicationVisibility-meta.xml merge=salesforce-source
|
|
143
64
|
*.classAccess-meta.xml merge=salesforce-source
|
|
144
65
|
*.customMetadataTypeAccess-meta.xml merge=salesforce-source
|
|
@@ -184,7 +105,7 @@ The driver is configured to work with `.xml` files by default. The installation
|
|
|
184
105
|
*.objectTranslation-meta.xml merge=salesforce-source
|
|
185
106
|
```
|
|
186
107
|
|
|
187
|
-
##
|
|
108
|
+
## Troubleshooting
|
|
188
109
|
|
|
189
110
|
The plugin uses the [Salesforce CLI logging system](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_dev_cli_log_messages.htm) to log information.
|
|
190
111
|
You can control the logging level by setting the `SF_LOG_LEVEL` environment variable.
|
|
@@ -204,7 +125,6 @@ GIT_TRACE=true
|
|
|
204
125
|
git merge ...
|
|
205
126
|
```
|
|
206
127
|
|
|
207
|
-
|
|
208
128
|
## Changelog
|
|
209
129
|
|
|
210
130
|
[changelog.md](CHANGELOG.md) is available for consultation.
|
|
@@ -220,7 +140,7 @@ Versioning follows [SemVer](http://semver.org/) specification.
|
|
|
220
140
|
|
|
221
141
|
## Contributing
|
|
222
142
|
|
|
223
|
-
Contributions are what make the trailblazer community such an amazing place.
|
|
143
|
+
Contributions are what make the trailblazer community such an amazing place. We regard this component as a way to inspire and learn from others. Any contributions you make are **appreciated**.
|
|
224
144
|
|
|
225
145
|
See [contributing.md](CONTRIBUTING.md) for sgd contribution principles.
|
|
226
146
|
|
|
@@ -10,7 +10,6 @@ export class InstallService {
|
|
|
10
10
|
const git = simpleGit();
|
|
11
11
|
await git.addConfig(`merge.${DRIVER_NAME}.name`, 'Salesforce source merge driver');
|
|
12
12
|
await git.addConfig(`merge.${DRIVER_NAME}.driver`, `sh -c '${RUN_PLUGIN_COMMAND} -O "$1" -A "$2" -B "$3" -P "$4" -L "$5" -X "$6" -Y "$7"' -- %O %A %B %P %L %X %Y`);
|
|
13
|
-
await git.addConfig(`merge.${DRIVER_NAME}.recursive`, 'true');
|
|
14
13
|
// Configure merge driver for each metadata type pattern
|
|
15
14
|
const patterns = METADATA_TYPES_PATTERNS.map(pattern => `*.${pattern}-meta.xml merge=${DRIVER_NAME}`).join('\n');
|
|
16
15
|
const content = `${patterns}\n`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installService.js","sourceRoot":"","sources":["../../src/service/installService.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAA;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAE,GAAG,EAAE,MAAM,8BAA8B,CAAA;AAElD,MAAM,OAAO,cAAc;IAEZ,AAAN,KAAK,CAAC,kBAAkB;QAC7B,MAAM,GAAG,GAAG,SAAS,EAAE,CAAA;QACvB,MAAM,GAAG,CAAC,SAAS,CACjB,SAAS,WAAW,OAAO,EAC3B,gCAAgC,CACjC,CAAA;QACD,MAAM,GAAG,CAAC,SAAS,CACjB,SAAS,WAAW,SAAS,EAC7B,UAAU,kBAAkB,mFAAmF,CAChH,CAAA;
|
|
1
|
+
{"version":3,"file":"installService.js","sourceRoot":"","sources":["../../src/service/installService.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAA;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAE,GAAG,EAAE,MAAM,8BAA8B,CAAA;AAElD,MAAM,OAAO,cAAc;IAEZ,AAAN,KAAK,CAAC,kBAAkB;QAC7B,MAAM,GAAG,GAAG,SAAS,EAAE,CAAA;QACvB,MAAM,GAAG,CAAC,SAAS,CACjB,SAAS,WAAW,OAAO,EAC3B,gCAAgC,CACjC,CAAA;QACD,MAAM,GAAG,CAAC,SAAS,CACjB,SAAS,WAAW,SAAS,EAC7B,UAAU,kBAAkB,mFAAmF,CAChH,CAAA;QAED,wDAAwD;QACxD,MAAM,QAAQ,GAAG,uBAAuB,CAAC,GAAG,CAC1C,OAAO,CAAC,EAAE,CAAC,KAAK,OAAO,mBAAmB,WAAW,EAAE,CACxD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACZ,MAAM,OAAO,GAAG,GAAG,QAAQ,IAAI,CAAA;QAE/B,MAAM,iBAAiB,GAAG,MAAM,oBAAoB,EAAE,CAAA;QAEtD,MAAM,UAAU,CAAC,iBAAiB,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAA;IAC7D,CAAC;CACF;AArBc;IADZ,GAAG;wDAqBH"}
|