Skip to content

Commit 834fad8

Browse files
Sm/display tracking info (#290)
* feat: supports source tracking for deploy/retrieve * fix: existing mpd nuts ignore tracking conflicts * chore: deps * test: nuts from plugin-source * test(wip): remoteChanges nut fails until plugin-source PO merges (sfdx/sf folder) * feat: ignoreConflicts for validate * Update messages/deploy.metadata.md Co-authored-by: Juliet Shackell <[email protected]> * Update messages/retrieve.metadata.md Co-authored-by: Juliet Shackell <[email protected]> * Update messages/deploy.metadata.md Co-authored-by: Juliet Shackell <[email protected]> * Update messages/deploy.metadata.md Co-authored-by: Juliet Shackell <[email protected]> * Update messages/deploy.metadata.md Co-authored-by: Juliet Shackell <[email protected]> * Update messages/deploy.metadata.md Co-authored-by: Juliet Shackell <[email protected]> * Update messages/retrieve.metadata.md Co-authored-by: Juliet Shackell <[email protected]> * Update messages/deploy.metadata.md Co-authored-by: Juliet Shackell <[email protected]> * Update messages/retrieve.metadata.md Co-authored-by: Juliet Shackell <[email protected]> * Update messages/retrieve.metadata.md Co-authored-by: Juliet Shackell <[email protected]> * Update messages/retrieve.metadata.md Co-authored-by: Juliet Shackell <[email protected]> * Update messages/retrieve.metadata.md Co-authored-by: Juliet Shackell <[email protected]> * Update messages/retrieve.metadata.md Co-authored-by: Juliet Shackell <[email protected]> * chore: bump plugins * chore: bump lint rules and sdr (for events) * refactor: linter fixes * test: lwc nut and pjson script * test: factor out ebikes deploy count * fix: no tracking on validate/quick * feat: preview metadata (missing ignored on non-push) * feat: ignores work for source/manifest/etc * feat: retrieve preview (for changes only) * test: nuts for preview * chore: bump oclif/core * test: 2 nuts use status AND preview * test: working except remote deletes * feat: wip for showing pulled deletes * fix: review messages for "sf deploy metadata preview" * fix: shared preview messages * fix: messages for sf retrieve metadata preview * fix: edit * docs: text fixes from Juliet * fix: display deleted files on retrieve * chore: schema * docs: oclif subtopic * chore: use changes in STL * chore: deps * Edit preview messages (#315) * fix: edit shared preview messages. * fix: quick edit * Update retrieve.metadata.preview.md * Update deploy.metadata.md * Update deploy.metadata.validate.md * edit * refactor: pr feedback 1 * refactor: remove unnecessary type * chore: dedupe deps * refactor: one map, with more if else return {} (#316) * refactor: one map, with more if else return {} * refactor: if/else from PR comments * fix: retrieve needs an stl for conflicts * test: nuts for preview --ignore-conflicts * test: nuts for conflict preview options Co-authored-by: Juliet Shackell <[email protected]>
1 parent 7c0fc5c commit 834fad8

21 files changed

+1180
-75
lines changed

command-snapshot.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
"flags": ["async", "job-id", "json", "use-most-recent", "wait"],
3737
"alias": []
3838
},
39+
{
40+
"command": "deploy:metadata:preview",
41+
"plugin": "@salesforce/plugin-deploy-retrieve",
42+
"flags": ["ignore-conflicts", "json", "manifest", "metadata", "source-dir", "target-org"],
43+
"alias": []
44+
},
3945
{
4046
"command": "deploy:metadata:quick",
4147
"plugin": "@salesforce/plugin-deploy-retrieve",
@@ -90,5 +96,11 @@
9096
"wait"
9197
],
9298
"alias": []
99+
},
100+
{
101+
"command": "retrieve:metadata:preview",
102+
"plugin": "@salesforce/plugin-deploy-retrieve",
103+
"flags": ["ignore-conflicts", "json", "target-org"],
104+
"alias": []
93105
}
94106
]

messages/deploy.metadata.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ Target API version for the deploy.
156156

157157
# flags.api-version.description
158158

159-
Use this flag to override the default API version, which is the latest version supported the CLI, with the API version of your package.xml file.
159+
Use this flag to override the default API version with the API version of your package.xml file. The default API version is the latest version supported by the CLI.
160160

161161
# flags.async.summary
162162

@@ -204,3 +204,11 @@ There are changes in the org that conflict with the local changes you're trying
204204
- To overwrite the remote changes, rerun this command with the --ignore-conflicts flag.
205205

206206
- To overwrite the local changes, run the "sf retrieve metadata" command with the --ignore-conflicts flag.
207+
208+
# error.nothingToDeploy
209+
210+
No local changes to deploy.
211+
212+
# error.nothingToDeploy.Actions
213+
214+
- To see conflicts and ignored files, run "sf deploy metadata preview" with any of the manifest, directory, or metadata flags.
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# summary
2+
3+
Preview a deployment to see what will deploy to the org, the potential conflicts, and the ignored files.
4+
5+
# description
6+
7+
You must run this command from within a project.
8+
9+
The command outputs a table that describes what will happen if you run the "sf deploy metadata" command. The table lists the metadata components that will be deployed and deleted. The table also lists the current conflicts between files in your local project and components in the org. Finally, the table lists the files that won't be deployed because they're included in your .forceignore file.
10+
11+
If your org allows source tracking, then this command considers conflicts between the org and local. Some orgs, such as production orgs, never allow source tracking. Use the "--no-track-source" flag when you create a scratch or sandbox org to disable source tracking.
12+
13+
To preview the deployment of multiple metadata components, either set multiple --metadata <name> flags or a single --metadata flag with multiple names separated by spaces. Enclose names that contain spaces in one set of double quotes. The same syntax applies to --manifest and --source-dir.
14+
15+
# examples
16+
17+
- NOTE: The commands to preview a deployment and actually deploy it use similar flags. We provide a few preview examples here, but see the help for "sf deploy metadata" for more examples that you can adapt for previewing.
18+
19+
- Preview the deployment of source files in a directory, such as force-app:
20+
21+
<%= config.bin %> <%= command.id %> --source-dir force-app
22+
23+
- Preview the deployment of all Apex classes:
24+
25+
<%= config.bin %> <%= command.id %> --metadata ApexClass
26+
27+
- Preview deployment of a specific Apex class:
28+
29+
<%= config.bin %> <%= command.id %> --metadata ApexClass:MyApexClass
30+
31+
- Preview deployment of all components listed in a manifest:
32+
33+
<%= config.bin %> <%= command.id %> --manifest path/to/package.xml
34+
35+
# flags.target-org.summary
36+
37+
Login username or alias for the target org.
38+
39+
# flags.target-org.description
40+
41+
Overrides your default org.
42+
43+
# flags.metadata.summary
44+
45+
Metadata component names to preview.
46+
47+
# flags.source-dir.summary
48+
49+
Path to the local source files to preview.
50+
51+
# flags.source-dir.description
52+
53+
The supplied path can be to a single file (in which case the operation is applied to only one file) or to a folder (in which case the operation is applied to all metadata types in the directory and its subdirectories).
54+
55+
If you specify this flag, don’t specify --metadata or --manifest.
56+
57+
# flags.manifest.summary
58+
59+
Full file path for manifest (package.xml) of components to preview.
60+
61+
# flags.manifest.description
62+
63+
All child components are included. If you specify this flag, don’t specify --metadata or --source-dir.
64+
65+
# flags.ignore-conflicts.summary
66+
67+
Ignore conflicts and deploy local files, even if they overwrite changes in the org.
68+
69+
# flags.ignore-conflicts.description
70+
71+
This flag applies only to orgs that allow source tracking. It has no effect on orgs that don't allow it, such as production orgs.
72+
73+
# flags.concise.summary
74+
75+
Omit ignored files.
76+
77+
# flags.api-version.summary
78+
79+
Target API version for the preview.
80+
81+
# flags.api-version.description
82+
83+
Use this flag to override the default API version with the API version of your package.xml file. The default API version is the latest version supported by the CLI.
84+
85+
# error.Conflicts
86+
87+
There are changes in the org that conflict with the local changes you're trying to preview.
88+
89+
# error.Conflicts.Actions
90+
91+
- To overwrite the remote changes, rerun this command with the --ignore-conflicts flag.
92+
93+
- To overwrite the local changes, run the "sf retrieve metadata" command with the --ignore-conflicts flag.

messages/deploy.metadata.validate.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Target API version for the validation.
104104

105105
# flags.api-version.description
106106

107-
Use this flag to override the default API version, which is the latest version supported the CLI, with the API version in your package.xml file.
107+
Use this flag to override the default API version with the API version of your package.xml file. The default API version is the latest version supported by the CLI.
108108

109109
# flags.async.summary
110110

messages/previewMessages.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# conflicts.none
2+
3+
No conflicts found.
4+
5+
# conflicts.header
6+
7+
Conflicts [%s]. Run the command with the --ignore-conflicts flag to override.
8+
9+
# ignored.none
10+
11+
No files were ignored. Update your your .forceignore file if you want to ignore certain files.
12+
13+
# ignored.header
14+
15+
Ignored [%s] files. These files won't %s because they're ignored by your .forceignore file.
16+
17+
# deploy.header
18+
19+
Will Deploy [%s] files.
20+
21+
# deploy.none
22+
23+
No files will be deployed.
24+
25+
# retrieve.header
26+
27+
Will Retrieve [%s] files.
28+
29+
# retrieve.none
30+
31+
No files will be retrieved.
32+
33+
# delete.header
34+
35+
Will Delete [%s] files.
36+
37+
# delete.none
38+
39+
No files will be deleted.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# summary
2+
3+
Preview a retrieval to see what will be retrieved from the org, the potential conflicts, and the ignored files.
4+
5+
# description
6+
7+
You must run this command from within a project.
8+
9+
The command outputs a table that describes what will happen if you run the "sf retrieve metadata" command. The table lists the metadata components that will be retrieved and deleted. The table also lists the current conflicts between files in your local project and components in the org. Finally, the table lists the files that won't be retrieved because they're included in your .forceignore file.
10+
11+
If your org allows source tracking, then this command considers conflicts between the org and local. Some orgs, such as production orgs, never allow source tracking. Use the "--no-track-source" flag when you create a scratch or sandbox org to disable source tracking.
12+
13+
# examples
14+
15+
- Preview the retrieve of all changes from the org:
16+
17+
<%= config.bin %> <%= command.id %>
18+
19+
- Preview the retrieve when ignoring any conflicts:
20+
21+
<%= config.bin %> <%= command.id %> --ignore-conflicts
22+
23+
# flags.target-org.summary
24+
25+
Login username or alias for the target org.
26+
27+
# flags.target-org.description
28+
29+
Overrides your default org.
30+
31+
# flags.ignore-conflicts.summary
32+
33+
Ignore conflicts and preview the retrieve of remote components, even if they will overwrite local changes.
34+
35+
# flags.ignore-conflicts.description
36+
37+
This flag applies only to orgs that allow source tracking. It has no effect on orgs that don't allow it, such as production orgs.
38+
39+
# flags.concise.summary
40+
41+
Omit ignored files.
42+
43+
# flags.api-version.summary
44+
45+
Target API version for the deploy.
46+
47+
# flags.api-version.description
48+
49+
Use this flag to override the default API version with the API version of your package.xml file. The default API version is the latest version supported by the CLI.
50+
51+
# error.Conflicts
52+
53+
There are local changes that conflict with the remote changes that would be retrieved.
54+
55+
# error.Conflicts.Actions
56+
57+
- To overwrite the remote changes, run the "sf deploy metadata" command with the --ignore-conflicts flag.
58+
59+
- To overwrite the local changes, run the "sf retrieve metadata" command with the --ignore-conflicts flag.

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,12 @@
114114
}
115115
},
116116
"retrieve": {
117-
"description": "Commands to retrieve artifacts from an environment."
117+
"description": "Commands to retrieve artifacts from an environment.",
118+
"subtopics": {
119+
"metadata": {
120+
"description": "Commands to retrieve metadata from a Salesforce org."
121+
}
122+
}
118123
}
119124
}
120125
},
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$ref": "#/definitions/PreviewResult",
4+
"definitions": {
5+
"PreviewResult": {
6+
"type": "object",
7+
"properties": {
8+
"ignored": {
9+
"type": "array",
10+
"items": {
11+
"$ref": "#/definitions/PreviewFile"
12+
}
13+
},
14+
"conflicts": {
15+
"type": "array",
16+
"items": {
17+
"$ref": "#/definitions/PreviewFile"
18+
}
19+
},
20+
"toDeploy": {
21+
"type": "array",
22+
"items": {
23+
"$ref": "#/definitions/PreviewFile"
24+
}
25+
},
26+
"toDelete": {
27+
"type": "array",
28+
"items": {
29+
"$ref": "#/definitions/PreviewFile"
30+
}
31+
},
32+
"toRetrieve": {
33+
"type": "array",
34+
"items": {
35+
"$ref": "#/definitions/PreviewFile"
36+
}
37+
}
38+
},
39+
"required": ["ignored", "conflicts", "toDeploy", "toDelete", "toRetrieve"],
40+
"additionalProperties": false
41+
},
42+
"PreviewFile": {
43+
"type": "object",
44+
"properties": {
45+
"fullName": {
46+
"type": "string"
47+
},
48+
"type": {
49+
"type": "string"
50+
},
51+
"conflict": {
52+
"type": "boolean"
53+
},
54+
"ignored": {
55+
"type": "boolean"
56+
},
57+
"path": {
58+
"type": "string"
59+
},
60+
"projectRelativePath": {
61+
"type": "string"
62+
},
63+
"operation": {
64+
"type": "string",
65+
"enum": ["deploy", "retrieve", "deletePost", "deletePre"]
66+
}
67+
},
68+
"required": ["fullName", "type", "conflict", "ignored"],
69+
"additionalProperties": false
70+
}
71+
}
72+
}

0 commit comments

Comments
 (0)