sf-decomposer 5.4.6 → 5.6.0
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/CHANGELOG.md +25 -1
- package/README.md +62 -79
- package/lib/commands/decomposer/recompose.d.ts +0 -1
- package/lib/commands/decomposer/recompose.js +2 -11
- package/lib/commands/decomposer/recompose.js.map +1 -1
- package/lib/helpers/constants.js +1 -1
- package/lib/helpers/constants.js.map +1 -1
- package/lib/hooks/prerun.js +0 -3
- package/lib/hooks/prerun.js.map +1 -1
- package/lib/service/decomposeFileHandler.js +2 -16
- package/lib/service/decomposeFileHandler.js.map +1 -1
- package/lib/service/recomposeFileHandler.d.ts +1 -1
- package/lib/service/recomposeFileHandler.js +10 -25
- package/lib/service/recomposeFileHandler.js.map +1 -1
- package/messages/decomposer.recompose.md +1 -6
- package/oclif.lock +1155 -993
- package/oclif.manifest.json +4 -20
- package/package.json +9 -11
package/CHANGELOG.md
CHANGED
|
@@ -5,12 +5,36 @@
|
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
7
7
|
|
|
8
|
+
## [5.6.0](https://github.com/mcarvin8/sf-decomposer/compare/v5.5.0...v5.6.0) (2025-04-12)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* add toml support ([37f61fb](https://github.com/mcarvin8/sf-decomposer/commit/37f61fbbf67e2a92625d90ca2642696cd1a35662))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **deps:** bump @salesforce/core from 8.8.7 to 8.9.0 ([c5b654d](https://github.com/mcarvin8/sf-decomposer/commit/c5b654d44dfc302d698654b7279a9f17a355afc5))
|
|
19
|
+
* **deps:** bump xml-disassembler from 1.5.0 to 1.5.1 ([bd8a4cf](https://github.com/mcarvin8/sf-decomposer/commit/bd8a4cf2a91b75ca55353ef6e5349535d5914102))
|
|
20
|
+
|
|
21
|
+
## [5.5.0](https://github.com/mcarvin8/sf-decomposer/compare/v5.4.6...v5.5.0) (2025-04-11)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
* remove format flag on recompose ([7caea40](https://github.com/mcarvin8/sf-decomposer/commit/7caea40a1964a07c5595f0813d0a30f63f6717ae))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* **deps:** bump @salesforce/source-deploy-retrieve ([9c8e11f](https://github.com/mcarvin8/sf-decomposer/commit/9c8e11fb38cc307b22d1af37d7e7bfb058aab65b))
|
|
32
|
+
|
|
8
33
|
## [5.4.6](https://github.com/mcarvin8/sf-decomposer/compare/v5.4.5...v5.4.6) (2025-04-02)
|
|
9
34
|
|
|
10
35
|
|
|
11
36
|
### Bug Fixes
|
|
12
37
|
|
|
13
|
-
* upgrade xml-disassemblers ([1720e97](https://github.com/mcarvin8/sf-decomposer/commit/1720e973861b7d633543dab83f444a20b6e5fc20))
|
|
14
38
|
* upgrade xml-disassemblers ([7198cc1](https://github.com/mcarvin8/sf-decomposer/commit/7198cc1ebd8026a75add6224f37fff41563f3c77))
|
|
15
39
|
|
|
16
40
|
## [5.4.5](https://github.com/mcarvin8/sf-decomposer/compare/v5.4.4...v5.4.5) (2025-04-01)
|
package/README.md
CHANGED
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
<summary>Table of Contents</summary>
|
|
8
8
|
|
|
9
9
|
- [Quick Start](#quick-start)
|
|
10
|
-
- [Why Choose `sf-decomposer
|
|
10
|
+
- [Why Choose `sf-decomposer`?](#why-choose-sf-decomposer)
|
|
11
11
|
- [Commands](#commands)
|
|
12
12
|
- [`sf decomposer decompose`](#sf-decomposer-decompose)
|
|
13
13
|
- [`sf decomposer recompose`](#sf-decomposer-recompose)
|
|
14
14
|
- [Decompose Structure](#decompose-structure)
|
|
15
15
|
- [Supported Metadata](#supported-metadata)
|
|
16
|
-
- [
|
|
16
|
+
- [Exceptions](#exceptions)
|
|
17
17
|
- [Troubleshooting](#troubleshooting)
|
|
18
18
|
- [Hooks](#hooks)
|
|
19
19
|
- [Ignore Files](#ignore-files)
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
- [License](#license)
|
|
27
27
|
</details>
|
|
28
28
|
|
|
29
|
-
Break down large Salesforce metadata files (XML) into smaller, more manageable files (XML/JSON/YAML/JSON5) for version control and then recreate deployment-compatible files.
|
|
29
|
+
Break down large Salesforce metadata files (XML) into smaller, more manageable files (XML/JSON/YAML/TOML/JSON5) for version control and then recreate deployment-compatible files.
|
|
30
30
|
|
|
31
31
|
## Quick Start
|
|
32
32
|
|
|
@@ -56,24 +56,25 @@ sf decomposer recompose -m "flow" -m "labels"
|
|
|
56
56
|
|
|
57
57
|
6. Deploy recomposed metadata
|
|
58
58
|
|
|
59
|
-
## Why Choose `sf-decomposer
|
|
59
|
+
## Why Choose `sf-decomposer`?
|
|
60
60
|
|
|
61
|
-
Salesforce's built-in decomposition has limitations. `sf-decomposer` offers more control, flexibility, and versioning benefits for Admins and Developers.
|
|
61
|
+
Salesforce's built-in decomposition has limitations. `sf-decomposer` offers more control, flexibility, and versioning benefits for Admins and Developers.
|
|
62
62
|
|
|
63
|
-
### Key Advantages
|
|
63
|
+
### Key Advantages
|
|
64
64
|
|
|
65
|
-
- **Supports More Metadata** – Works with most Metadata API types, unlike Salesforce’s limited decomposition.
|
|
66
|
-
- **Selective Decomposition** – Decompose only what you need, avoiding Salesforce’s all-or-nothing approach.
|
|
67
|
-
- See [.sfdecomposerignore](#.sfdecomposerignore)
|
|
68
|
-
- **Fully Decomposes Metadata** – Ensures complete decomposition for types that Salesforce only partially decomposes (e.g., `decomposePermissionSetBeta2`).
|
|
69
|
-
- **Consistent Sorting** – Keeps elements in a predictable order to reduce unnecessary version control noise.
|
|
70
|
-
|
|
71
|
-
- **
|
|
72
|
-
- **
|
|
65
|
+
- **Supports More Metadata** – Works with most Metadata API types, unlike Salesforce’s limited decomposition.
|
|
66
|
+
- **Selective Decomposition** – Decompose only what you need, avoiding Salesforce’s all-or-nothing approach.
|
|
67
|
+
- See [.sfdecomposerignore](#.sfdecomposerignore)
|
|
68
|
+
- **Fully Decomposes Metadata** – Ensures complete decomposition for types that Salesforce only partially decomposes (e.g., `decomposePermissionSetBeta2`).
|
|
69
|
+
- **Consistent Sorting** – Keeps elements in a predictable order to reduce unnecessary version control noise.
|
|
70
|
+
> DISCLAIMER: If you use "toml" format for decomposed files, the element sorting will vary compared to the other formats
|
|
71
|
+
- **Multiple Output Formats** – Supports XML, JSON, JSON5, TOML, and YAML for greater flexibility.
|
|
72
|
+
- **CI/CD Integration** – Hooks enable seamless decomposition and recomposition in automated workflows.
|
|
73
|
+
- **Improved Version Control** – Smaller, structured files make pull requests easier to review and reduce merge conflicts.
|
|
73
74
|
|
|
74
|
-
### How It Helps Salesforce Teams
|
|
75
|
+
### How It Helps Salesforce Teams
|
|
75
76
|
|
|
76
|
-
- **Better Peer Reviews** – More readable diffs for large metadata in GitHub and other CI/CD platforms.
|
|
77
|
+
- **Better Peer Reviews** – More readable diffs for large metadata in GitHub and other CI/CD platforms.
|
|
77
78
|
- **Safer Deployments** – Ensures only intended changes are deployed, improving release quality.
|
|
78
79
|
|
|
79
80
|
## Commands
|
|
@@ -95,8 +96,7 @@ FLAGS
|
|
|
95
96
|
-m, --metadata-type=<value> The metadata suffix to process, such as 'flow', 'labels', etc.
|
|
96
97
|
Can be declared multiple times.
|
|
97
98
|
-f, --format=<value> The file type for the decomposed files.
|
|
98
|
-
|
|
99
|
-
Options: ['xml', 'yaml', 'json', 'json5']
|
|
99
|
+
Options: ['xml', 'yaml', 'json', 'toml', 'json5']
|
|
100
100
|
[default: 'xml']
|
|
101
101
|
-i, --ignore-package-directory=<value> Package directory to ignore.
|
|
102
102
|
Should be as they appear in the "sfdx-project.json".
|
|
@@ -132,15 +132,11 @@ Recompose decomposed files into deployment-compatible files.
|
|
|
132
132
|
|
|
133
133
|
```
|
|
134
134
|
USAGE
|
|
135
|
-
$ sf decomposer recompose -m <value> -
|
|
135
|
+
$ sf decomposer recompose -m <value> -i <value> [--postpurge --debug --json]
|
|
136
136
|
|
|
137
137
|
FLAGS
|
|
138
138
|
-m, --metadata-type=<value> The metadata suffix to process, such as 'flow', 'labels', etc.
|
|
139
139
|
Can be declared multiple times.
|
|
140
|
-
-f, --format=<value> The file format for the decomposed files.
|
|
141
|
-
Must match what format you provide for decompose.
|
|
142
|
-
Options: ['xml', 'yaml', 'json', 'json5']
|
|
143
|
-
[default: 'xml']
|
|
144
140
|
-i, --ignore-package-directory=<value> Package directory to ignore.
|
|
145
141
|
Should be as they appear in the "sfdx-project.json".
|
|
146
142
|
Can be declared multiple times.
|
|
@@ -155,11 +151,7 @@ GLOBAL FLAGS
|
|
|
155
151
|
EXAMPLES
|
|
156
152
|
Recompose all flows:
|
|
157
153
|
|
|
158
|
-
$ sf decomposer recompose -m "flow"
|
|
159
|
-
|
|
160
|
-
Recompose all decomposed flows and custom labels YAMLs into XMLs
|
|
161
|
-
|
|
162
|
-
$ sf decomposer recompose -m "flow" -m "labels" -f "yaml" --postpurge --debug
|
|
154
|
+
$ sf decomposer recompose -m "flow" --postpurge --debug
|
|
163
155
|
|
|
164
156
|
Recompose flows except for those in the "force-app" package directory.
|
|
165
157
|
|
|
@@ -173,22 +165,22 @@ When the original metadata files are decomposed, this structure is followed for
|
|
|
173
165
|
|
|
174
166
|
- Leaf elements (i.e. `<userLicense>Salesforce</userLicense>`) will be decomposed in the same file in the root of the decomposed directory. The leaf file-name will match the original file-name.
|
|
175
167
|
- Nested elements will be decomposed into their own files under sub-directories by the element type, i.e. custom permissions in a permission set will have their own decomposed file under a custom permissions sub-folder.
|
|
176
|
-
- If unique ID elements are found, the decomposed nested files will be named using them.
|
|
177
|
-
- Otherwise, the decomposed nested files will be named with the SHA-256 hash of the element contents.
|
|
168
|
+
- If unique ID elements are found, the decomposed nested files will be named using them. Otherwise, the decomposed nested files will be named with the SHA-256 hash of the element contents.
|
|
178
169
|
- See [Contributing](#contributing) for more information on unique ID elements.
|
|
179
170
|
|
|
180
|
-
|
|
181
|
-
<p><em>Decomposed Permission Sets named using unique ID elements</em></p>
|
|
171
|
+
**Decomposed Permission Set Example**
|
|
182
172
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
173
|
+
| Format | Example |
|
|
174
|
+
| --------- | --------------------------------------------------------------------------------------------------------------- |
|
|
175
|
+
| **XML** | <br> |
|
|
176
|
+
| **YAML** | <br> |
|
|
177
|
+
| **JSON** | <br> |
|
|
178
|
+
| **JSON5** | <br> |
|
|
179
|
+
| **TOML** | <br> |
|
|
187
180
|
|
|
188
181
|
When custom labels are decomposed, each custom label will have its own file in the original labels directory.
|
|
189
182
|
|
|
190
|
-
|
|
191
|
-
<p><em>Decomposed Custom Labels</em></p>
|
|
183
|
+
<br>
|
|
192
184
|
|
|
193
185
|
## Supported Metadata
|
|
194
186
|
|
|
@@ -198,33 +190,25 @@ The `--metadata-type`/`-m` flag should be the metadata's `suffix` value as liste
|
|
|
198
190
|
|
|
199
191
|
Here are some examples:
|
|
200
192
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
- Metadata types such as Apex Classes, Apex Components, Triggers, etc. with certain SDR adapter strategies (`matchingContentFile`, `digitalExperience`, `mixedContent`, `bundle`) are not supported by this plugin.
|
|
221
|
-
```
|
|
222
|
-
Error (1): Metadata types with [matchingContentFile, digitalExperience, mixedContent, bundle] strategies are not supported by this plugin.
|
|
223
|
-
```
|
|
224
|
-
- Children metadata types (i.e. custom fields) are not supported and will result in this general error:
|
|
225
|
-
```
|
|
226
|
-
Error (1): Metadata type not found for the given suffix: field.
|
|
227
|
-
```
|
|
193
|
+
| Metadata Type | CLI Option |
|
|
194
|
+
| --------------------------- | -------------------------------------------- |
|
|
195
|
+
| Custom Labels | `--metadata-type "labels"` |
|
|
196
|
+
| Workflows | `--metadata-type "workflow"` |
|
|
197
|
+
| Profiles | `--metadata-type "profile"` |
|
|
198
|
+
| Permission Sets | `--metadata-type "permissionset"` |
|
|
199
|
+
| AI Scoring Model Definition | `--metadata-type "aiScoringModelDefinition"` |
|
|
200
|
+
| Decision Matrix Definition | `--metadata-type "decisionMatrixDefinition"` |
|
|
201
|
+
| Bot | `--metadata-type "bot"` |
|
|
202
|
+
| Marketing App Extension | `--metadata-type "marketingappextension"` |
|
|
203
|
+
|
|
204
|
+
### Exceptions
|
|
205
|
+
|
|
206
|
+
| Scenario | Message |
|
|
207
|
+
| --------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
208
|
+
| `botVersion` is blocked from being run directly | `Error (1): botVersion suffix should not be used. Please use bot to decompose/recompose bot and bot version files.` |
|
|
209
|
+
| Custom Objects not supported | `Error (1): Custom Objects are not supported by this plugin.` |
|
|
210
|
+
| Unsupported SDR adapter strategies (e.g., `matchingContentFile`, `digitalExperience`, `mixedContent`, `bundle`) | `Error (1): Metadata types with [matchingContentFile, digitalExperience, mixedContent, bundle] strategies are not supported by this plugin.` |
|
|
211
|
+
| Children metadata types (e.g., custom fields) and invalid suffixes | `Error (1): Metadata type not found for the given suffix: field.` |
|
|
228
212
|
|
|
229
213
|
## Troubleshooting
|
|
230
214
|
|
|
@@ -256,18 +240,18 @@ To add debugging to the log, provide the `--debug` flag to the decompose or reco
|
|
|
256
240
|
|
|
257
241
|
You can copy and update the sample [.sfdecomposer.config.json](https://raw.githubusercontent.com/mcarvin8/sf-decomposer/main/samples/.sfdecomposer.config.json).
|
|
258
242
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
243
|
+
| Configuration Option | Required | Description |
|
|
244
|
+
| -------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
245
|
+
| `metadataSuffixes` | Yes | Comma-separated string of metadata suffixes to decompose and recompose based on the CLI command. |
|
|
246
|
+
| `ignorePackageDirectories` | No | Comma-separated string of package directories to ignore. |
|
|
247
|
+
| `prePurge` | No | `true` or `false`. If `true`, deletes existing decomposed files before decomposing. Defaults to `false`. |
|
|
248
|
+
| `postPurge` | No | `true` or `false`. If `true`, deletes the retrieval file after decomposing or deletes decomposed files after recomposing. Defaults to `false`. |
|
|
249
|
+
| `decomposedFormat` | No | Format of decomposed files: `xml`, `json`, `json5`, `toml`, or `yaml`. Defaults to `xml`. |
|
|
264
250
|
|
|
265
251
|
If `.sfdecomposer.config.json` is found, the hooks will run:
|
|
266
252
|
|
|
267
|
-
- the decompose command **after** a `sf project retrieve start` command completes successfully
|
|
268
|
-
- the recompose command **before** a `sf project deploy [start/validate]` command starts
|
|
269
|
-
|
|
270
|
-
If `.sfdecomposer.config.json` isn't found, the hooks will be skipped.
|
|
253
|
+
- the decompose command **after** a `sf project retrieve start` command completes successfully
|
|
254
|
+
- the recompose command **before** a `sf project deploy [start/validate]` command starts
|
|
271
255
|
|
|
272
256
|
## Ignore Files
|
|
273
257
|
|
|
@@ -275,7 +259,7 @@ If `.sfdecomposer.config.json` isn't found, the hooks will be skipped.
|
|
|
275
259
|
|
|
276
260
|
The Salesforce CLI **must** ignore the decomposed files and allow the recomposed files.
|
|
277
261
|
|
|
278
|
-
You can use the sample [.forceignore](https://raw.githubusercontent.com/mcarvin8/sf-decomposer/main/samples/.forceignore). Update the decomposed file extensions based on what format you're using (`.xml`, `.json`, `.json5`, or `.yaml`).
|
|
262
|
+
You can use the sample [.forceignore](https://raw.githubusercontent.com/mcarvin8/sf-decomposer/main/samples/.forceignore). Update the decomposed file extensions based on what format you're using (`.xml`, `.json`, `.json5`, `.toml`, or `.yaml`).
|
|
279
263
|
|
|
280
264
|
### `.sfdecomposerignore`
|
|
281
265
|
|
|
@@ -301,10 +285,9 @@ If you encounter any bugs or would like to request features, please create an [i
|
|
|
301
285
|
|
|
302
286
|
## Built With
|
|
303
287
|
|
|
304
|
-
- [`xml-disassembler`](https://github.com/mcarvin8/xml-disassembler)
|
|
305
|
-
- [`
|
|
306
|
-
- [
|
|
307
|
-
- [`xml2json5-disassembler`](https://github.com/mcarvin8/xml2json5-disassembler)
|
|
288
|
+
- [`xml-disassembler`](https://github.com/mcarvin8/xml-disassembler) - Disassembles XML files into smaller files and reassembles the XML
|
|
289
|
+
- [`fs-extra`](https://github.com/jprichardson/node-fs-extra) - Node.js: extra methods for the fs object like copy(), remove(), mkdirs()
|
|
290
|
+
- [`@salesforce/source-deploy-retrieve`](https://github.com/forcedotcom/source-deploy-retrieve) - JavaScript toolkit for working with Salesforce metadata
|
|
308
291
|
|
|
309
292
|
## Contributing
|
|
310
293
|
|
|
@@ -8,7 +8,6 @@ export default class DecomposerRecompose extends SfCommand<DecomposerResult> {
|
|
|
8
8
|
'metadata-type': import("@oclif/core/interfaces").OptionFlag<string[], import("@oclif/core/interfaces").CustomOptions>;
|
|
9
9
|
postpurge: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
10
|
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
-
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
11
|
'ignore-package-directory': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
12
|
};
|
|
14
13
|
run(): Promise<DecomposerResult>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable no-await-in-loop */
|
|
3
3
|
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
4
4
|
import { Messages } from '@salesforce/core';
|
|
5
|
-
import { LOG_FILE
|
|
5
|
+
import { LOG_FILE } from '../../helpers/constants.js';
|
|
6
6
|
import { recomposeFileHandler } from '../../service/recomposeFileHandler.js';
|
|
7
7
|
import { getRegistryValuesBySuffix } from '../../metadata/getRegistryValuesBySuffix.js';
|
|
8
8
|
import { readOriginalLogFile, checkLogForErrors } from '../../service/checkLogforErrors.js';
|
|
@@ -29,14 +29,6 @@ export default class DecomposerRecompose extends SfCommand {
|
|
|
29
29
|
required: false,
|
|
30
30
|
default: false,
|
|
31
31
|
}),
|
|
32
|
-
format: Flags.string({
|
|
33
|
-
summary: messages.getMessage('flags.format.summary'),
|
|
34
|
-
char: 'f',
|
|
35
|
-
required: true,
|
|
36
|
-
multiple: false,
|
|
37
|
-
default: 'xml',
|
|
38
|
-
options: DECOMPOSED_FILE_TYPES,
|
|
39
|
-
}),
|
|
40
32
|
'ignore-package-directory': Flags.directory({
|
|
41
33
|
summary: messages.getMessage('flags.ignore-package-directory.summary'),
|
|
42
34
|
char: 'i',
|
|
@@ -49,12 +41,11 @@ export default class DecomposerRecompose extends SfCommand {
|
|
|
49
41
|
const metadataTypes = flags['metadata-type'];
|
|
50
42
|
const postpurge = flags['postpurge'];
|
|
51
43
|
const debug = flags['debug'];
|
|
52
|
-
const format = flags['format'];
|
|
53
44
|
const ignoreDirs = flags['ignore-package-directory'];
|
|
54
45
|
for (const metadataType of metadataTypes) {
|
|
55
46
|
const { metaAttributes } = await getRegistryValuesBySuffix(metadataType, 'recompose', ignoreDirs);
|
|
56
47
|
const currentLogFile = await readOriginalLogFile(LOG_FILE);
|
|
57
|
-
await recomposeFileHandler(metaAttributes, postpurge, debug
|
|
48
|
+
await recomposeFileHandler(metaAttributes, postpurge, debug);
|
|
58
49
|
const recomposeErrors = await checkLogForErrors(LOG_FILE, currentLogFile);
|
|
59
50
|
if (recomposeErrors.length > 0) {
|
|
60
51
|
recomposeErrors.forEach((error) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recompose.js","sourceRoot":"","sources":["../../../src/commands/decomposer/recompose.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,qCAAqC;AAErC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"recompose.js","sourceRoot":"","sources":["../../../src/commands/decomposer/recompose.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,qCAAqC;AAErC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAG5F,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,eAAe,EAAE,sBAAsB,CAAC,CAAC;AAEhF,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,SAA2B;IACnE,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAE5D,MAAM,CAAU,KAAK,GAAG;QAC7B,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC;YAC5B,OAAO,EAAE,QAAQ,CAAC,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;YAC7D,MAAM,eAAe,GAAG,MAAM,iBAAiB,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;YAC1E,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC/B,eAAe,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;oBAChC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACnB,CAAC,CAAC,CAAC;YACL,CAAC;YACD,IAAI,CAAC,GAAG,CAAC,kEAAkE,YAAY,EAAE,CAAC,CAAC;QAC7F,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,aAAa;SACxB,CAAC;IACJ,CAAC"}
|
package/lib/helpers/constants.js
CHANGED
|
@@ -3,7 +3,7 @@ export const SFDX_PROJECT_FILE_NAME = 'sfdx-project.json';
|
|
|
3
3
|
export const CUSTOM_LABELS_FILE = 'CustomLabels.labels-meta.xml';
|
|
4
4
|
export const DEFAULT_UNIQUE_ID_ELEMENTS = 'fullName,name';
|
|
5
5
|
export const LOG_FILE = 'disassemble.log';
|
|
6
|
-
export const DECOMPOSED_FILE_TYPES = ['xml', 'json', 'yaml', 'json5'];
|
|
6
|
+
export const DECOMPOSED_FILE_TYPES = ['xml', 'json', 'yaml', 'json5', 'toml'];
|
|
7
7
|
export const IGNORE_FILE = '.sfdecomposerignore';
|
|
8
8
|
export const WORKFLOW_SUFFIX_MAPPING = {
|
|
9
9
|
'alerts-meta.xml': 'workflowAlert-meta.xml',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/helpers/constants.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAC1D,MAAM,CAAC,MAAM,kBAAkB,GAAG,8BAA8B,CAAC;AACjE,MAAM,CAAC,MAAM,0BAA0B,GAAW,eAAe,CAAC;AAClE,MAAM,CAAC,MAAM,QAAQ,GAAG,iBAAiB,CAAC;AAC1C,MAAM,CAAC,MAAM,qBAAqB,GAAa,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/helpers/constants.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAC1D,MAAM,CAAC,MAAM,kBAAkB,GAAG,8BAA8B,CAAC;AACjE,MAAM,CAAC,MAAM,0BAA0B,GAAW,eAAe,CAAC;AAClE,MAAM,CAAC,MAAM,QAAQ,GAAG,iBAAiB,CAAC;AAC1C,MAAM,CAAC,MAAM,qBAAqB,GAAa,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AACxF,MAAM,CAAC,MAAM,WAAW,GAAG,qBAAqB,CAAC;AACjD,MAAM,CAAC,MAAM,uBAAuB,GAA8B;IAChE,iBAAiB,EAAE,wBAAwB;IAC3C,uBAAuB,EAAE,8BAA8B;IACvD,sBAAsB,EAAE,6BAA6B;IACrD,6BAA6B,EAAE,mCAAmC;IAClE,2BAA2B,EAAE,kCAAkC;IAC/D,gBAAgB,EAAE,uBAAuB;IACzC,gBAAgB,EAAE,uBAAuB;IACzC,eAAe,EAAE,uBAAuB;CACzC,CAAC;AACF,MAAM,CAAC,MAAM,gBAAgB,GAAG,2BAA2B,CAAC"}
|
package/lib/hooks/prerun.js
CHANGED
|
@@ -22,7 +22,6 @@ export const prerun = async function (options) {
|
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
24
|
const metadataTypes = configFile.metadataSuffixes || '.';
|
|
25
|
-
const format = configFile.decomposedFormat || 'xml';
|
|
26
25
|
const postpurge = configFile.postPurge || false;
|
|
27
26
|
const ignorePackageDirs = configFile.ignorePackageDirectories || '';
|
|
28
27
|
if (metadataTypes.trim() === '.') {
|
|
@@ -43,8 +42,6 @@ export const prerun = async function (options) {
|
|
|
43
42
|
commandArgs.push(sanitizedDir);
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
|
-
commandArgs.push('--format');
|
|
47
|
-
commandArgs.push(format);
|
|
48
45
|
if (postpurge) {
|
|
49
46
|
commandArgs.push('--postpurge');
|
|
50
47
|
}
|
package/lib/hooks/prerun.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prerun.js","sourceRoot":"","sources":["../../src/hooks/prerun.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,mBAAmB,MAAM,qCAAqC,CAAC;AAEtE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,CAAC,MAAM,MAAM,GAAmB,KAAK,WAAW,OAAO;IAC3D,IAAI,CAAC,CAAC,yBAAyB,EAAE,sBAAsB,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;QACtF,OAAO;IACT,CAAC;IAED,IAAI,UAAsB,CAAC;IAC3B,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,WAAW,EAAE,CAAC;IACzC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO;IACT,CAAC;IACD,MAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;IAEvD,IAAI,CAAC;QACH,MAAM,UAAU,GAAW,MAAM,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAC/D,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAe,CAAC;IACpD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;IACT,CAAC;IAED,MAAM,aAAa,G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,aAAa,CAAC,IAAI,EAAE,KAAK,GAAG,EAAE,CAAC;QACjC,OAAO;IACT,CAAC;IAED,MAAM,kBAAkB,GAAa,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAE9D,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,KAAK,MAAM,YAAY,IAAI,kBAAkB,EAAE,CAAC;QAC9C,MAAM,qBAAqB,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC7D,WAAW,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACpC,WAAW,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IAC1C,CAAC;IACD,IAAI,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACpC,MAAM,qBAAqB,GAAa,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACrE,KAAK,MAAM,IAAI,IAAI,qBAAqB,EAAE,CAAC;YACzC,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC5C,WAAW,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;YAC/C,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IACD,IAAI,SAAS,EAAE,CAAC;QACd,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAClC,CAAC;IACD,MAAM,mBAAmB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AAC7C,CAAC,CAAC"}
|
|
@@ -3,9 +3,6 @@
|
|
|
3
3
|
import { resolve, relative, join } from 'node:path';
|
|
4
4
|
import { readdir, stat, rm, rename } from 'node:fs/promises';
|
|
5
5
|
import { DisassembleXMLFileHandler, setLogLevel } from 'xml-disassembler';
|
|
6
|
-
import { XmlToYamlDisassembler } from 'xml2yaml-disassembler';
|
|
7
|
-
import { XmlToJsonDisassembler } from 'xml2json-disassembler';
|
|
8
|
-
import { XmlToJson5Disassembler } from 'xml2json5-disassembler';
|
|
9
6
|
import { CUSTOM_LABELS_FILE, WORKFLOW_SUFFIX_MAPPING } from '../helpers/constants.js';
|
|
10
7
|
import { moveFiles } from './moveFiles.js';
|
|
11
8
|
export async function decomposeFileHandler(metaAttributes, prepurge, postpurge, debug, format, ignorePath) {
|
|
@@ -35,25 +32,14 @@ export async function decomposeFileHandler(metaAttributes, prepurge, postpurge,
|
|
|
35
32
|
}
|
|
36
33
|
}
|
|
37
34
|
async function disassembleHandler(filePath, uniqueIdElements, prePurge, postPurge, format, ignorePath) {
|
|
38
|
-
|
|
39
|
-
if (format === 'yaml') {
|
|
40
|
-
handler = new XmlToYamlDisassembler();
|
|
41
|
-
}
|
|
42
|
-
else if (format === 'json') {
|
|
43
|
-
handler = new XmlToJsonDisassembler();
|
|
44
|
-
}
|
|
45
|
-
else if (format === 'json5') {
|
|
46
|
-
handler = new XmlToJson5Disassembler();
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
handler = new DisassembleXMLFileHandler();
|
|
50
|
-
}
|
|
35
|
+
const handler = new DisassembleXMLFileHandler();
|
|
51
36
|
await handler.disassemble({
|
|
52
37
|
filePath,
|
|
53
38
|
uniqueIdElements,
|
|
54
39
|
prePurge,
|
|
55
40
|
postPurge,
|
|
56
41
|
ignorePath,
|
|
42
|
+
format,
|
|
57
43
|
});
|
|
58
44
|
}
|
|
59
45
|
async function prePurgeLabels(metadataPath) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decomposeFileHandler.js","sourceRoot":"","sources":["../../src/service/decomposeFileHandler.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,qCAAqC;AACrC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAA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E,EAAE,CAAC;YAC5C,MAAM,kBAAkB,CAAC,WAAW,EAAE,gBAAgB,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;QACnG,CAAC;IACH,CAAC;AACH,CAAC;AAED,KAAK,UAAU,eAAe,CAAC,SAAiB;IAC9C,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAE5D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,kEAAkE;QAClE,KAAK,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,uBAAuB,CAAC,EAAE,CAAC;YAC1E,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC1B,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;gBAC1C,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;gBACrE,MAAM,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;gBACvC,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -3,56 +3,41 @@
|
|
|
3
3
|
import { readdir, stat, rm } from 'node:fs/promises';
|
|
4
4
|
import { join } from 'node:path';
|
|
5
5
|
import { ReassembleXMLFileHandler, setLogLevel } from 'xml-disassembler';
|
|
6
|
-
import { YamlToXmlReassembler } from 'xml2yaml-disassembler';
|
|
7
|
-
import { JsonToXmlReassembler } from 'xml2json-disassembler';
|
|
8
|
-
import { Json5ToXmlReassembler } from 'xml2json5-disassembler';
|
|
9
6
|
import { CUSTOM_LABELS_FILE } from '../helpers/constants.js';
|
|
10
7
|
import { renameBotVersionFile } from './renameBotVersionFiles.js';
|
|
11
8
|
import { moveFiles } from './moveFiles.js';
|
|
12
|
-
export async function recomposeFileHandler(metaAttributes, postpurge, debug
|
|
9
|
+
export async function recomposeFileHandler(metaAttributes, postpurge, debug) {
|
|
13
10
|
const { metaSuffix, strictDirectoryName, folderType, metadataPaths } = metaAttributes;
|
|
14
11
|
if (debug)
|
|
15
12
|
setLogLevel('debug');
|
|
16
13
|
for (const metadataPath of metadataPaths) {
|
|
17
14
|
if (metaSuffix === 'labels') {
|
|
18
|
-
await reassembleLabels(metadataPath, metaSuffix, postpurge
|
|
15
|
+
await reassembleLabels(metadataPath, metaSuffix, postpurge);
|
|
19
16
|
}
|
|
20
17
|
else {
|
|
21
18
|
let recurse = false;
|
|
22
19
|
if (strictDirectoryName || folderType)
|
|
23
20
|
recurse = true;
|
|
24
|
-
await reassembleDirectories(metadataPath, metaSuffix, recurse, postpurge
|
|
21
|
+
await reassembleDirectories(metadataPath, metaSuffix, recurse, postpurge);
|
|
25
22
|
}
|
|
26
23
|
if (metaSuffix === 'bot')
|
|
27
24
|
await renameBotVersionFile(metadataPath);
|
|
28
25
|
}
|
|
29
26
|
}
|
|
30
|
-
async function reassembleHandler(filePath, fileExtension, postPurge
|
|
31
|
-
|
|
32
|
-
if (format === 'yaml') {
|
|
33
|
-
handler = new YamlToXmlReassembler();
|
|
34
|
-
}
|
|
35
|
-
else if (format === 'json') {
|
|
36
|
-
handler = new JsonToXmlReassembler();
|
|
37
|
-
}
|
|
38
|
-
else if (format === 'json5') {
|
|
39
|
-
handler = new Json5ToXmlReassembler();
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
handler = new ReassembleXMLFileHandler();
|
|
43
|
-
}
|
|
27
|
+
async function reassembleHandler(filePath, fileExtension, postPurge) {
|
|
28
|
+
const handler = new ReassembleXMLFileHandler();
|
|
44
29
|
await handler.reassemble({
|
|
45
30
|
filePath,
|
|
46
31
|
fileExtension,
|
|
47
32
|
postPurge,
|
|
48
33
|
});
|
|
49
34
|
}
|
|
50
|
-
async function reassembleLabels(metadataPath, metaSuffix, postpurge
|
|
35
|
+
async function reassembleLabels(metadataPath, metaSuffix, postpurge) {
|
|
51
36
|
let sourceDirectory = metadataPath;
|
|
52
37
|
let destinationDirectory = join(metadataPath, 'CustomLabels', 'labels');
|
|
53
38
|
await moveFiles(sourceDirectory, destinationDirectory, (fileName) => fileName !== CUSTOM_LABELS_FILE);
|
|
54
39
|
// do not use postpurge flag due to file moving
|
|
55
|
-
await reassembleHandler(join(metadataPath, 'CustomLabels'), `${metaSuffix}-meta.xml`, false
|
|
40
|
+
await reassembleHandler(join(metadataPath, 'CustomLabels'), `${metaSuffix}-meta.xml`, false);
|
|
56
41
|
sourceDirectory = join(metadataPath, 'CustomLabels', 'labels');
|
|
57
42
|
destinationDirectory = metadataPath;
|
|
58
43
|
await moveFiles(sourceDirectory, destinationDirectory, () => true);
|
|
@@ -70,16 +55,16 @@ async function deleteFilesInDirectory(directory) {
|
|
|
70
55
|
}
|
|
71
56
|
}
|
|
72
57
|
}
|
|
73
|
-
async function reassembleDirectories(metadataPath, metaSuffix, recurse, postpurge
|
|
58
|
+
async function reassembleDirectories(metadataPath, metaSuffix, recurse, postpurge) {
|
|
74
59
|
const subdirectories = (await readdir(metadataPath)).map((file) => join(metadataPath, file));
|
|
75
60
|
for (const subdirectory of subdirectories) {
|
|
76
61
|
const subDirStat = await stat(subdirectory);
|
|
77
62
|
if (subDirStat.isDirectory() && recurse) {
|
|
78
63
|
// recursively call this function and set recurse to false
|
|
79
|
-
await reassembleDirectories(subdirectory, metaSuffix, false, postpurge
|
|
64
|
+
await reassembleDirectories(subdirectory, metaSuffix, false, postpurge);
|
|
80
65
|
}
|
|
81
66
|
else if (subDirStat.isDirectory()) {
|
|
82
|
-
await reassembleHandler(subdirectory, `${metaSuffix}-meta.xml`, postpurge
|
|
67
|
+
await reassembleHandler(subdirectory, `${metaSuffix}-meta.xml`, postpurge);
|
|
83
68
|
}
|
|
84
69
|
}
|
|
85
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recomposeFileHandler.js","sourceRoot":"","sources":["../../src/service/recomposeFileHandler.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,qCAAqC;AACrC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"recomposeFileHandler.js","sourceRoot":"","sources":["../../src/service/recomposeFileHandler.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,qCAAqC;AACrC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,cAKC,EACD,SAAkB,EAClB,KAAc;IAEd,MAAM,EAAE,UAAU,EAAE,mBAAmB,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,cAAc,CAAC;IACtF,IAAI,KAAK;QAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAChC,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE,CAAC;QACzC,IAAI,UAAU,KAAK,QAAQ,EAAE,CAAC;YAC5B,MAAM,gBAAgB,CAAC,YAAY,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;QAC9D,CAAC;aAAM,CAAC;YACN,IAAI,OAAO,GAAY,KAAK,CAAC;YAC7B,IAAI,mBAAmB,IAA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|
|
|
13
|
-
- `sf decomposer recompose -m "flow"
|
|
14
|
-
- `sf decomposer recompose -m "flow" -m "labels" -f "xml" --postpurge --debug`
|
|
13
|
+
- `sf decomposer recompose -m "flow" --postpurge --debug`
|
|
15
14
|
- `sf decomposer recompose -m "flow" -i "force-app"`
|
|
16
15
|
|
|
17
16
|
# flags.metadata-type.summary
|
|
@@ -26,10 +25,6 @@ Purge the decomposed files after recomposing them.
|
|
|
26
25
|
|
|
27
26
|
Debug to a log file.
|
|
28
27
|
|
|
29
|
-
# flags.format.summary
|
|
30
|
-
|
|
31
|
-
File format for the decomposed files.
|
|
32
|
-
|
|
33
28
|
# flags.ignore-package-directory.summary
|
|
34
29
|
|
|
35
30
|
Ignore a package directory.
|