sf-decomposer 5.3.0 → 5.3.2
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 +17 -0
- package/README.md +9 -21
- package/lib/commands/decomposer/decompose.js +4 -3
- package/lib/commands/decomposer/decompose.js.map +1 -1
- package/lib/commands/decomposer/recompose.js +4 -3
- package/lib/commands/decomposer/recompose.js.map +1 -1
- package/lib/helpers/constants.d.ts +1 -0
- package/lib/helpers/constants.js +1 -0
- package/lib/helpers/constants.js.map +1 -1
- package/lib/helpers/types.d.ts +1 -0
- package/lib/hooks/prerun.js +43 -32
- package/lib/hooks/prerun.js.map +1 -1
- package/lib/hooks/scopedPostRetrieve.js +11 -1
- package/lib/hooks/scopedPostRetrieve.js.map +1 -1
- package/lib/metadata/getPackageDirectories.js +14 -20
- package/lib/metadata/getPackageDirectories.js.map +1 -1
- package/lib/service/decomposeFileHandler.js +11 -13
- package/lib/service/decomposeFileHandler.js.map +1 -1
- package/lib/service/getRepoRoot.js +19 -25
- package/lib/service/getRepoRoot.js.map +1 -1
- package/lib/service/moveFiles.js +5 -5
- package/lib/service/moveFiles.js.map +1 -1
- package/lib/service/recomposeFileHandler.js +16 -18
- package/lib/service/recomposeFileHandler.js.map +1 -1
- package/lib/service/renameBotVersionFiles.js +6 -5
- package/lib/service/renameBotVersionFiles.js.map +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,23 @@
|
|
|
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.3.2](https://github.com/mcarvin8/sf-decomposer/compare/v5.3.1...v5.3.2) (2025-01-18)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* get all package directories in parallel ([7b412cd](https://github.com/mcarvin8/sf-decomposer/commit/7b412cd85918050faeda3d57ac9dfdbb9ce0c206))
|
|
14
|
+
* move files in parallel ([e23cd9b](https://github.com/mcarvin8/sf-decomposer/commit/e23cd9b1cc4a2a0c95a6fac394d9f0a46ad691f2))
|
|
15
|
+
* remove awaits in loops in handlers ([0e12cee](https://github.com/mcarvin8/sf-decomposer/commit/0e12ceeb734fc95be04bd5ccdbec52a340057e24))
|
|
16
|
+
* rename all bot version files in parallel ([b24645a](https://github.com/mcarvin8/sf-decomposer/commit/b24645a599e48c516ac0aca4b2adc161c7d8c2ae))
|
|
17
|
+
|
|
18
|
+
## [5.3.1](https://github.com/mcarvin8/sf-decomposer/compare/v5.3.0...v5.3.1) (2025-01-14)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* allow hooks to ignore package directories ([36de48c](https://github.com/mcarvin8/sf-decomposer/commit/36de48ca1eead66b02f001fd3e267aa1759c5025))
|
|
24
|
+
|
|
8
25
|
## [5.3.0](https://github.com/mcarvin8/sf-decomposer/compare/v5.2.3...v5.3.0) (2025-01-14)
|
|
9
26
|
|
|
10
27
|
|
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
- [`sf decomposer recompose`](#sf-decomposer-recompose)
|
|
14
14
|
- [Supported Metadata](#supported-metadata)
|
|
15
15
|
- [Metadata Exceptions](#metadata-exceptions)
|
|
16
|
-
- [
|
|
16
|
+
- [Debugging](#debugging)
|
|
17
17
|
- [Ignore Files when Decomposing](#ignore-files-when-decomposing)
|
|
18
18
|
- [Hooks](#hooks)
|
|
19
19
|
- [Ignore Files](#ignore-files)
|
|
@@ -153,9 +153,7 @@ EXAMPLES
|
|
|
153
153
|
|
|
154
154
|
All metadata types imported from this plugin's version of `@salesforce/source-deploy-retrieve` (SDR) toolkit are supported except for certain types.
|
|
155
155
|
|
|
156
|
-
The `--metadata-type`/`-m` flag should be the metadata's `
|
|
157
|
-
|
|
158
|
-
The suffix is this part of the original meta file name - `labels` is the suffix in `*.labels-meta.xml`.
|
|
156
|
+
The `--metadata-type`/`-m` flag should be the metadata's `suffix` value as listed in the [metadataRegistry.json](https://github.com/forcedotcom/source-deploy-retrieve/blob/main/src/registry/metadataRegistry.json).
|
|
159
157
|
|
|
160
158
|
Here are some examples:
|
|
161
159
|
|
|
@@ -166,8 +164,7 @@ Here are some examples:
|
|
|
166
164
|
- AI Scoring Model Definition (`--metadata-type "aiScoringModelDefinition"`)
|
|
167
165
|
- Decision Matrix Definition (`--metadata-type "decisionMatrixDefinition"`)
|
|
168
166
|
- Bot (`--metadata-type "bot"`)
|
|
169
|
-
- **NOTE**: Running "bot" will also decompose and recompose Bot Version meta files
|
|
170
|
-
- The `botVersion` meta suffix will be blocked from running directly
|
|
167
|
+
- **NOTE**: Running "bot" will also decompose and recompose Bot Version meta files. The `botVersion` meta suffix will be blocked from running directly.
|
|
171
168
|
- Marketing App Extension (`--metadata-type "marketingappextension"`)
|
|
172
169
|
|
|
173
170
|
### Metadata Exceptions
|
|
@@ -189,7 +186,7 @@ Here are some examples:
|
|
|
189
186
|
Error (1): Metadata type not found for the given suffix: field.
|
|
190
187
|
```
|
|
191
188
|
|
|
192
|
-
##
|
|
189
|
+
## Debugging
|
|
193
190
|
|
|
194
191
|
The plugin searches the current working directory for the `sfdx-project.json`, and if it's not found in the current working directory, it will search upwards for it until it hits your root drive. If the `sfdx-project.json` file isn't found, the plugin will fail with:
|
|
195
192
|
|
|
@@ -197,19 +194,13 @@ The plugin searches the current working directory for the `sfdx-project.json`, a
|
|
|
197
194
|
Error (1): sfdx-project.json not found in any parent directory.
|
|
198
195
|
```
|
|
199
196
|
|
|
200
|
-
The
|
|
201
|
-
|
|
202
|
-
By default, this package will only log errors to the file. This plugin will print `xml-disassembler` errors as warnings in the command terminal to allow all other files to be processed.
|
|
203
|
-
|
|
204
|
-
These warnings when running `decompose` and `recompose` commands will look as such:
|
|
197
|
+
The xml-disassembler package will log errors, and optionally debugging statements, to a log file, `disassemble.log`. This log will be created in the working directory and will be created when running this plugin at all times. If there were no errors, this log will be empty. By default, the log will only contain errors. This plugin will print the errors as warnings in the command terminal to allow all other files to be processed. These warnings when decomposing or recomposing will look like:
|
|
205
198
|
|
|
206
199
|
```
|
|
207
200
|
Warning: C:\Users\matth\Documents\sf-decomposer\test\baselines\flows\Get_Info\actionCalls\Get_Info.actionCalls-meta.xml was unabled to be parsed and will not be processed. Confirm formatting and try again.
|
|
208
201
|
```
|
|
209
202
|
|
|
210
|
-
To add additional debugging statements to the log file, provide the `--debug` flag to
|
|
211
|
-
|
|
212
|
-
General debugging statements in the log file will look like:
|
|
203
|
+
To add additional debugging statements to the log file, provide the `--debug` flag to the decompose or recompose command. Debugging statements will look like:
|
|
213
204
|
|
|
214
205
|
```
|
|
215
206
|
[2024-03-30T14:28:37.959] [DEBUG] default - Created disassembled file: mock\no-nested-elements\HR_Admin\HR_Admin.permissionset-meta.xml
|
|
@@ -231,17 +222,14 @@ The ignore file is not read by the recompose command.
|
|
|
231
222
|
|
|
232
223
|
## Hooks
|
|
233
224
|
|
|
234
|
-
**NOTE:** In order to avoid errors during the retrieval, you must configure your `.forceignore` file to have the Salesforce CLI ignore the decomposed files. See section below.
|
|
235
|
-
|
|
236
|
-
A post-retrieve hook (for the decompose command) and a pre-run hook (for the recompose command) have been configured if you elect to use them.
|
|
237
|
-
|
|
238
|
-
The post-retrieve hook will automatically decompose the desired metadata types after every Salesforce CLI retrieval (`sf project retrieve start` command).
|
|
225
|
+
**NOTE:** In order to avoid errors during the retrieval, you must configure your `.forceignore` file to have the Salesforce CLI ignore the decomposed files. See "Ignore Files" section below.
|
|
239
226
|
|
|
240
|
-
The pre-run hook will automatically recompose the desired metadata types before every Salesforce CLI deployment/validation (`sf project deploy start` and `sf project deploy validate` commands).
|
|
227
|
+
A post-retrieve hook (for the decompose command) and a pre-run hook (for the recompose command) have been configured if you elect to use them. The post-retrieve hook will automatically decompose the desired metadata types after every Salesforce CLI retrieval (`sf project retrieve start` command). The pre-run hook will automatically recompose the desired metadata types before every Salesforce CLI deployment/validation (`sf project deploy start` and `sf project deploy validate` commands).
|
|
241
228
|
|
|
242
229
|
Both hooks require you to create this file in the root of your repo: `.sfdecomposer.config.json`. You can use the sample [.sfdecomposer.config.json](https://raw.githubusercontent.com/mcarvin8/sf-decomposer/main/samples/.sfdecomposer.config.json) provided. Update the file as such:
|
|
243
230
|
|
|
244
231
|
- `metadataSuffixes` is required and should be a comma-separated string of metadata suffixes to decompose automatically after retrievals.
|
|
232
|
+
- `ignorePackageDirectories` is optional and should be a comma-separated string of package directories to ignore.
|
|
245
233
|
- `prePurge` is optional and should be a boolean. If true, this will delete any existing decomposed files before decomposing the files. If you do not provide this, the default will be `false`. This flag is not used by the recompose command/pre-run hook.
|
|
246
234
|
- `postPurge` is optional and should be a boolean. If true, this will delete the retrieval file after decomposing it or delete the decomposed files after recomposing them. If you do not provide this, the default will be `false`.
|
|
247
235
|
- `decomposedFormat` is optional and should be either `xml`, `json`, or `yaml`, depending on what file format you want the decomposed files created as. If you do not provide this, the default will be `xml`.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
/* eslint-disable no-await-in-loop */
|
|
3
2
|
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
4
3
|
import { Messages } from '@salesforce/core';
|
|
5
4
|
import { LOG_FILE, DECOMPOSED_FILE_TYPES } from '../../helpers/constants.js';
|
|
@@ -57,7 +56,7 @@ export default class DecomposerDecompose extends SfCommand {
|
|
|
57
56
|
const debug = flags['debug'];
|
|
58
57
|
const format = flags['format'];
|
|
59
58
|
const ignoreDirs = flags['ignore-package-directory'];
|
|
60
|
-
|
|
59
|
+
const promises = metadataTypes.map(async (metadataType) => {
|
|
61
60
|
const { metaAttributes, ignorePath } = await getRegistryValuesBySuffix(metadataType, 'decompose', ignoreDirs);
|
|
62
61
|
const currentLogFile = await readOriginalLogFile(LOG_FILE);
|
|
63
62
|
await decomposeFileHandler(metaAttributes, prepurge, postpurge, debug, format, ignorePath);
|
|
@@ -68,7 +67,9 @@ export default class DecomposerDecompose extends SfCommand {
|
|
|
68
67
|
});
|
|
69
68
|
}
|
|
70
69
|
this.log(`All metadata files have been decomposed for the metadata type: ${metadataType}`);
|
|
71
|
-
}
|
|
70
|
+
});
|
|
71
|
+
// Wait for all the promises to resolve
|
|
72
|
+
await Promise.all(promises);
|
|
72
73
|
return {
|
|
73
74
|
metadata: metadataTypes,
|
|
74
75
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decompose.js","sourceRoot":"","sources":["../../../src/commands/decomposer/decompose.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"decompose.js","sourceRoot":"","sources":["../../../src/commands/decomposer/decompose.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAC7E,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,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AO;YACL,QAAQ,EAAE,aAAa;SACxB,CAAC;IACJ,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
/* eslint-disable no-await-in-loop */
|
|
3
2
|
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
4
3
|
import { Messages } from '@salesforce/core';
|
|
5
4
|
import { LOG_FILE, DECOMPOSED_FILE_TYPES } from '../../helpers/constants.js';
|
|
@@ -51,7 +50,7 @@ export default class DecomposerRecompose extends SfCommand {
|
|
|
51
50
|
const debug = flags['debug'];
|
|
52
51
|
const format = flags['format'];
|
|
53
52
|
const ignoreDirs = flags['ignore-package-directory'];
|
|
54
|
-
|
|
53
|
+
const promises = metadataTypes.map(async (metadataType) => {
|
|
55
54
|
const { metaAttributes } = await getRegistryValuesBySuffix(metadataType, 'recompose', ignoreDirs);
|
|
56
55
|
const currentLogFile = await readOriginalLogFile(LOG_FILE);
|
|
57
56
|
await recomposeFileHandler(metaAttributes, postpurge, debug, format);
|
|
@@ -62,7 +61,9 @@ export default class DecomposerRecompose extends SfCommand {
|
|
|
62
61
|
});
|
|
63
62
|
}
|
|
64
63
|
this.log(`All metadata files have been recomposed for the metadata type: ${metadataType}`);
|
|
65
|
-
}
|
|
64
|
+
});
|
|
65
|
+
// Wait for all the promises to resolve
|
|
66
|
+
await Promise.all(promises);
|
|
66
67
|
return {
|
|
67
68
|
metadata: metadataTypes,
|
|
68
69
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recompose.js","sourceRoot":"","sources":["../../../src/commands/decomposer/recompose.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"recompose.js","sourceRoot":"","sources":["../../../src/commands/decomposer/recompose.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,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AC,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,CAAC,CAAC;QAEH,uCAAuC;QACvC,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAE5B,OAAO;YACL,QAAQ,EAAE,aAAa;SACxB,CAAC;IACJ,CAAC"}
|
package/lib/helpers/constants.js
CHANGED
|
@@ -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,CAAC,CAAC;AACvE,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"}
|
|
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,CAAC,CAAC;AACvE,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/helpers/types.d.ts
CHANGED
package/lib/hooks/prerun.js
CHANGED
|
@@ -3,40 +3,51 @@ import { readFile } from 'node:fs/promises';
|
|
|
3
3
|
import { resolve } from 'node:path';
|
|
4
4
|
import DecomposerRecompose from '../commands/decomposer/recompose.js';
|
|
5
5
|
import { getRepoRoot } from '../service/getRepoRoot.js';
|
|
6
|
+
import { HOOK_CONFIG_JSON } from '../helpers/constants.js';
|
|
6
7
|
export const prerun = async function (options) {
|
|
7
|
-
if (['project:deploy:validate', 'project:deploy:start'].includes(options.Command.id)) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
commandArgs.push('--
|
|
35
|
-
commandArgs.push(
|
|
36
|
-
|
|
37
|
-
|
|
8
|
+
if (!['project:deploy:validate', 'project:deploy:start'].includes(options.Command.id)) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
let configFile;
|
|
12
|
+
const { repoRoot } = await getRepoRoot();
|
|
13
|
+
if (!repoRoot) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const configPath = resolve(repoRoot, HOOK_CONFIG_JSON);
|
|
17
|
+
try {
|
|
18
|
+
const jsonString = await readFile(configPath, 'utf-8');
|
|
19
|
+
configFile = JSON.parse(jsonString);
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const metadataTypes = configFile.metadataSuffixes || '.';
|
|
25
|
+
const format = configFile.decomposedFormat || 'xml';
|
|
26
|
+
const postpurge = configFile.postPurge || false;
|
|
27
|
+
const ignorePackageDirs = configFile.ignorePackageDirectories || '';
|
|
28
|
+
if (metadataTypes.trim() === '.') {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const metadataTypesArray = metadataTypes.split(',');
|
|
32
|
+
const commandArgs = [];
|
|
33
|
+
for (const metadataType of metadataTypesArray) {
|
|
34
|
+
const sanitizedMetadataType = metadataType.replace(/,/g, '');
|
|
35
|
+
commandArgs.push('--metadata-type');
|
|
36
|
+
commandArgs.push(sanitizedMetadataType);
|
|
37
|
+
}
|
|
38
|
+
if (ignorePackageDirs.trim() !== '') {
|
|
39
|
+
const ignorePackageDirArray = ignorePackageDirs.split(',');
|
|
40
|
+
for (const dirs of ignorePackageDirArray) {
|
|
41
|
+
const sanitizedDir = dirs.replace(/,/g, '');
|
|
42
|
+
commandArgs.push('--ignore-package-directory');
|
|
43
|
+
commandArgs.push(sanitizedDir);
|
|
38
44
|
}
|
|
39
|
-
await DecomposerRecompose.run(commandArgs);
|
|
40
45
|
}
|
|
46
|
+
commandArgs.push('--format');
|
|
47
|
+
commandArgs.push(format);
|
|
48
|
+
if (postpurge) {
|
|
49
|
+
commandArgs.push('--postpurge');
|
|
50
|
+
}
|
|
51
|
+
await DecomposerRecompose.run(commandArgs);
|
|
41
52
|
};
|
|
42
53
|
//# sourceMappingURL=prerun.js.map
|
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;
|
|
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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;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,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC7B,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzB,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,6 +3,7 @@ import { readFile } from 'node:fs/promises';
|
|
|
3
3
|
import { resolve } from 'node:path';
|
|
4
4
|
import DecomposerDecompose from '../commands/decomposer/decompose.js';
|
|
5
5
|
import { getRepoRoot } from '../service/getRepoRoot.js';
|
|
6
|
+
import { HOOK_CONFIG_JSON } from '../helpers/constants.js';
|
|
6
7
|
export const scopedPostRetrieve = async function (options) {
|
|
7
8
|
if (!options.result?.retrieveResult.response.status) {
|
|
8
9
|
return;
|
|
@@ -12,7 +13,7 @@ export const scopedPostRetrieve = async function (options) {
|
|
|
12
13
|
if (!repoRoot) {
|
|
13
14
|
return;
|
|
14
15
|
}
|
|
15
|
-
const configPath = resolve(repoRoot,
|
|
16
|
+
const configPath = resolve(repoRoot, HOOK_CONFIG_JSON);
|
|
16
17
|
try {
|
|
17
18
|
const jsonString = await readFile(configPath, 'utf-8');
|
|
18
19
|
configFile = JSON.parse(jsonString);
|
|
@@ -24,6 +25,7 @@ export const scopedPostRetrieve = async function (options) {
|
|
|
24
25
|
const format = configFile.decomposedFormat || 'xml';
|
|
25
26
|
const prepurge = configFile.prePurge || false;
|
|
26
27
|
const postpurge = configFile.postPurge || false;
|
|
28
|
+
const ignorePackageDirs = configFile.ignorePackageDirectories || '';
|
|
27
29
|
if (metadataTypes.trim() === '.') {
|
|
28
30
|
return;
|
|
29
31
|
}
|
|
@@ -34,6 +36,14 @@ export const scopedPostRetrieve = async function (options) {
|
|
|
34
36
|
commandArgs.push('--metadata-type');
|
|
35
37
|
commandArgs.push(sanitizedMetadataType);
|
|
36
38
|
}
|
|
39
|
+
if (ignorePackageDirs.trim() !== '') {
|
|
40
|
+
const ignorePackageDirArray = ignorePackageDirs.split(',');
|
|
41
|
+
for (const dirs of ignorePackageDirArray) {
|
|
42
|
+
const sanitizedDir = dirs.replace(/,/g, '');
|
|
43
|
+
commandArgs.push('--ignore-package-directory');
|
|
44
|
+
commandArgs.push(sanitizedDir);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
37
47
|
commandArgs.push('--format');
|
|
38
48
|
commandArgs.push(format);
|
|
39
49
|
if (prepurge) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scopedPostRetrieve.js","sourceRoot":"","sources":["../../src/hooks/scopedPostRetrieve.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;
|
|
1
|
+
{"version":3,"file":"scopedPostRetrieve.js","sourceRoot":"","sources":["../../src/hooks/scopedPostRetrieve.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;A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AY,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,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC7B,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzB,IAAI,QAAQ,EAAE,CAAC;QACb,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACjC,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"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
/* eslint-disable no-await-in-loop */
|
|
3
2
|
import { resolve, join, basename } from 'node:path';
|
|
4
3
|
import { readFile, readdir, stat } from 'node:fs/promises';
|
|
5
4
|
import { getRepoRoot } from '../service/getRepoRoot.js';
|
|
@@ -15,33 +14,28 @@ export async function getPackageDirectories(metaDirectory, ignoreDirs) {
|
|
|
15
14
|
const sfdxProject = JSON.parse(sfdxProjectRaw);
|
|
16
15
|
const normalizedIgnoreDirs = (ignoreDirs ?? []).map((dir) => basename(dir));
|
|
17
16
|
const packageDirectories = sfdxProject.packageDirectories.map((directory) => resolve(repoRoot, directory.path));
|
|
18
|
-
const metadataPaths =
|
|
19
|
-
for (const directory of packageDirectories) {
|
|
17
|
+
const metadataPaths = (await Promise.all(packageDirectories.map(async (directory) => {
|
|
20
18
|
if (normalizedIgnoreDirs.includes(basename(directory))) {
|
|
21
|
-
|
|
19
|
+
return undefined;
|
|
22
20
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return { metadataPaths, ignorePath };
|
|
21
|
+
return searchRecursively(directory, metaDirectory);
|
|
22
|
+
}))).filter((filePath) => filePath !== undefined);
|
|
23
|
+
return { metadataPaths: metadataPaths.map((path) => resolve(path)), ignorePath };
|
|
29
24
|
}
|
|
30
25
|
async function searchRecursively(dxDirectory, subDirectoryName) {
|
|
31
26
|
const files = await readdir(dxDirectory);
|
|
32
|
-
|
|
27
|
+
const searchPromises = files.map(async (file) => {
|
|
33
28
|
const filePath = join(dxDirectory, file);
|
|
34
29
|
const stats = await stat(filePath);
|
|
35
|
-
if (stats.isDirectory()
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return result;
|
|
30
|
+
if (stats.isDirectory()) {
|
|
31
|
+
if (file === subDirectoryName) {
|
|
32
|
+
return filePath;
|
|
39
33
|
}
|
|
34
|
+
return searchRecursively(filePath, subDirectoryName);
|
|
40
35
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return undefined;
|
|
36
|
+
return undefined;
|
|
37
|
+
});
|
|
38
|
+
const results = await Promise.all(searchPromises);
|
|
39
|
+
return results.find((result) => result !== undefined);
|
|
46
40
|
}
|
|
47
41
|
//# sourceMappingURL=getPackageDirectories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPackageDirectories.js","sourceRoot":"","sources":["../../src/metadata/getPackageDirectories.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"getPackageDirectories.js","sourceRoot":"","sources":["../../src/metadata/getPackageDirectories.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,aAAqB,EACrB,UAAgC;IAEhC,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAAG,MAAM,WAAW,EAAE,CAAC;IAC3D,IAAI,CAAC,QAAQ,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;IACnF,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACxB,MAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IAClD,MAAM,cAAc,GAAW,MAAM,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IACzE,MAAM,WAAW,GAAgB,IAAI,CAAC,KAAK,CAAC,cAAc,CAAgB,CAAC;IAC3E,MAAM,oBAAoB,GAAG,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5E,MAAM,kBAAkB,GAAG,WAAW,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;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C,CAAC,MAAM,EAAoB,EAAE,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
/* eslint-disable no-await-in-loop */
|
|
3
2
|
import { resolve, relative, join } from 'node:path';
|
|
4
3
|
import { readdir, stat, rm, rename } from 'node:fs/promises';
|
|
5
4
|
import { DisassembleXMLFileHandler, setLogLevel } from 'xml-disassembler';
|
|
@@ -11,7 +10,7 @@ export async function decomposeFileHandler(metaAttributes, prepurge, postpurge,
|
|
|
11
10
|
const { metadataPaths, metaSuffix, strictDirectoryName, folderType, uniqueIdElements } = metaAttributes;
|
|
12
11
|
if (debug)
|
|
13
12
|
setLogLevel('debug');
|
|
14
|
-
|
|
13
|
+
await Promise.all(metadataPaths.map(async (metadataPath) => {
|
|
15
14
|
if (strictDirectoryName || folderType) {
|
|
16
15
|
await subDirectoryHandler(metadataPath, uniqueIdElements, prepurge, postpurge, format, ignorePath);
|
|
17
16
|
}
|
|
@@ -31,7 +30,7 @@ export async function decomposeFileHandler(metaAttributes, prepurge, postpurge,
|
|
|
31
30
|
if (metaSuffix === 'workflow') {
|
|
32
31
|
await renameWorkflows(metadataPath);
|
|
33
32
|
}
|
|
34
|
-
}
|
|
33
|
+
}));
|
|
35
34
|
}
|
|
36
35
|
async function disassembleHandler(filePath, uniqueIdElements, prePurge, postPurge, format, ignorePath) {
|
|
37
36
|
let handler;
|
|
@@ -54,49 +53,48 @@ async function disassembleHandler(filePath, uniqueIdElements, prePurge, postPurg
|
|
|
54
53
|
}
|
|
55
54
|
async function prePurgeLabels(metadataPath) {
|
|
56
55
|
const subFiles = await readdir(metadataPath);
|
|
57
|
-
|
|
56
|
+
await Promise.all(subFiles.map(async (subFile) => {
|
|
58
57
|
const subfilePath = join(metadataPath, subFile);
|
|
59
58
|
if ((await stat(subfilePath)).isFile() && subFile !== CUSTOM_LABELS_FILE) {
|
|
60
59
|
await rm(subfilePath, { recursive: true });
|
|
61
60
|
}
|
|
62
|
-
}
|
|
61
|
+
}));
|
|
63
62
|
}
|
|
64
63
|
async function moveAndRenameLabels(metadataPath, format) {
|
|
65
64
|
const sourceDirectory = join(metadataPath, 'CustomLabels', 'labels');
|
|
66
65
|
const destinationDirectory = metadataPath;
|
|
67
66
|
const labelFiles = await readdir(sourceDirectory);
|
|
68
|
-
|
|
67
|
+
await Promise.all(labelFiles.map(async (file) => {
|
|
69
68
|
if (file.endsWith(`.labels-meta.${format}`)) {
|
|
70
69
|
const oldFilePath = join(sourceDirectory, file);
|
|
71
70
|
const newFileName = file.replace(`.labels-meta.${format}`, `.label-meta.${format}`);
|
|
72
71
|
const newFilePath = join(destinationDirectory, newFileName);
|
|
73
72
|
await rename(oldFilePath, newFilePath);
|
|
74
73
|
}
|
|
75
|
-
}
|
|
74
|
+
}));
|
|
76
75
|
await moveFiles(sourceDirectory, destinationDirectory, () => true);
|
|
77
76
|
await rm(join(metadataPath, 'CustomLabels'), { recursive: true });
|
|
78
77
|
}
|
|
79
78
|
async function subDirectoryHandler(metadataPath, uniqueIdElements, prepurge, postpurge, format, ignorePath) {
|
|
80
79
|
const subFiles = await readdir(metadataPath);
|
|
81
|
-
|
|
80
|
+
await Promise.all(subFiles.map(async (subFile) => {
|
|
82
81
|
const subFilePath = join(metadataPath, subFile);
|
|
83
82
|
if ((await stat(subFilePath)).isDirectory()) {
|
|
84
83
|
await disassembleHandler(subFilePath, uniqueIdElements, prepurge, postpurge, format, ignorePath);
|
|
85
84
|
}
|
|
86
|
-
}
|
|
85
|
+
}));
|
|
87
86
|
}
|
|
88
87
|
async function renameWorkflows(directory) {
|
|
89
88
|
const files = await readdir(directory, { recursive: true });
|
|
90
|
-
|
|
89
|
+
await Promise.all(files.map(async (file) => {
|
|
91
90
|
// Check if the file matches any suffix in WORKFLOW_SUFFIX_MAPPING
|
|
92
91
|
for (const [suffix, newSuffix] of Object.entries(WORKFLOW_SUFFIX_MAPPING)) {
|
|
93
92
|
if (file.endsWith(suffix)) {
|
|
94
93
|
const oldFilePath = join(directory, file);
|
|
95
94
|
const newFilePath = join(directory, file.replace(suffix, newSuffix));
|
|
96
|
-
|
|
97
|
-
break;
|
|
95
|
+
return rename(oldFilePath, newFilePath);
|
|
98
96
|
}
|
|
99
97
|
}
|
|
100
|
-
}
|
|
98
|
+
}));
|
|
101
99
|
}
|
|
102
100
|
//# sourceMappingURL=decomposeFileHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decomposeFileHandler.js","sourceRoot":"","sources":["../../src/service/decomposeFileHandler.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"decomposeFileHandler.js","sourceRoot":"","sources":["../../src/service/decomposeFileHandler.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,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,OAAO,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,cAMC,EACD,QAAiB,EACjB,SAAkB,EAClB,KAAc,EACd,MAAc,EACd,UAAkB;IAElB,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,mBAAmB,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,cAAc,CAAC;IACxG,IAAI,KAAK;QAAE,WAAW,CAAC,OAAO,CAAC,C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ACf,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACvB,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,OAAO,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -1,32 +1,26 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
/* eslint-disable no-await-in-loop */
|
|
3
2
|
import { access } from 'node:fs/promises';
|
|
4
3
|
import { join, dirname } from 'node:path';
|
|
5
4
|
import { SFDX_PROJECT_FILE_NAME } from '../helpers/constants.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
found = true;
|
|
19
|
-
}
|
|
20
|
-
catch {
|
|
21
|
-
// If file not found, move up one directory level
|
|
22
|
-
const parentDir = dirname(currentDir);
|
|
23
|
-
if (currentDir === parentDir) {
|
|
24
|
-
// Reached the root without finding the file, throw an error
|
|
25
|
-
throw new Error('sfdx-project.json not found in any parent directory.');
|
|
26
|
-
}
|
|
27
|
-
currentDir = parentDir;
|
|
5
|
+
async function findRepoRoot(dir) {
|
|
6
|
+
const filePath = join(dir, SFDX_PROJECT_FILE_NAME);
|
|
7
|
+
try {
|
|
8
|
+
// Check if sfdx-project.json exists in the current directory
|
|
9
|
+
await access(filePath);
|
|
10
|
+
return { repoRoot: dir, dxConfigFilePath: filePath };
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
const parentDir = dirname(dir);
|
|
14
|
+
if (dir === parentDir) {
|
|
15
|
+
// Reached the root without finding the file, throw an error
|
|
16
|
+
throw new Error(`${SFDX_PROJECT_FILE_NAME} not found in any parent directory.`);
|
|
28
17
|
}
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
// Recursively search in the parent directory
|
|
19
|
+
return findRepoRoot(parentDir);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export async function getRepoRoot() {
|
|
23
|
+
const currentDir = process.cwd();
|
|
24
|
+
return findRepoRoot(currentDir);
|
|
31
25
|
}
|
|
32
26
|
//# sourceMappingURL=getRepoRoot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRepoRoot.js","sourceRoot":"","sources":["../../src/service/getRepoRoot.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,
|
|
1
|
+
{"version":3,"file":"getRepoRoot.js","sourceRoot":"","sources":["../../src/service/getRepoRoot.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,KAAK,UAAU,YAAY,CACzB,GAAW;IAEX,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,sBAAsB,CAAC,CAAC;IACnD,IAAI,CAAC;QACH,6DAA6D;QAC7D,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;QACvB,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,gBAAgB,EAAE,QAAQ,EAAE,CAAC;IACvD,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,4DAA4D;YAC5D,MAAM,IAAI,KAAK,CAAC,GAAG,sBAAsB,qCAAqC,CAAC,CAAC;QAClF,CAAC;QACD,6CAA6C;QAC7C,OAAO,YAAY,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW;IAC/B,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IACjC,OAAO,YAAY,CAAC,UAAU,CAAC,CAAC;AAClC,CAAC"}
|
package/lib/service/moveFiles.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
/* eslint-disable no-await-in-loop */
|
|
3
2
|
import { readdir, stat } from 'node:fs/promises';
|
|
4
3
|
import { join } from 'node:path';
|
|
5
4
|
import { move } from 'fs-extra';
|
|
6
5
|
export async function moveFiles(sourceDirectory, destinationDirectory, predicate) {
|
|
7
6
|
const files = await readdir(sourceDirectory);
|
|
8
|
-
|
|
9
|
-
const
|
|
7
|
+
const moveFilePromises = files.map(async (file) => {
|
|
8
|
+
const sourceFile = join(sourceDirectory, file);
|
|
9
|
+
const fileStat = await stat(sourceFile);
|
|
10
10
|
if (fileStat.isFile() && predicate(file)) {
|
|
11
|
-
const sourceFile = join(sourceDirectory, file);
|
|
12
11
|
const destinationFile = join(destinationDirectory, file);
|
|
13
12
|
await move(sourceFile, destinationFile, { overwrite: true });
|
|
14
13
|
}
|
|
15
|
-
}
|
|
14
|
+
});
|
|
15
|
+
await Promise.all(moveFilePromises);
|
|
16
16
|
}
|
|
17
17
|
//# sourceMappingURL=moveFiles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moveFiles.js","sourceRoot":"","sources":["../../src/service/moveFiles.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"moveFiles.js","sourceRoot":"","sources":["../../src/service/moveFiles.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,eAAuB,EACvB,oBAA4B,EAC5B,SAAwC;IAExC,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7C,MAAM,gBAAgB,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QAChD,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;QAC/C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,CAAC;QACxC,IAAI,QAAQ,CAAC,MAAM,EAAE,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;YACzC,MAAM,eAAe,GAAG,IAAI,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC;YACzD,MAAM,IAAI,CAAC,UAAU,EAAE,eAAe,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC,CAAC,CAAC;IACH,MAAM,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
/* eslint-disable no-await-in-loop */
|
|
3
2
|
import { readdir, stat, rm } from 'node:fs/promises';
|
|
4
3
|
import { join } from 'node:path';
|
|
5
4
|
import { ReassembleXMLFileHandler, setLogLevel } from 'xml-disassembler';
|
|
@@ -12,19 +11,18 @@ export async function recomposeFileHandler(metaAttributes, postpurge, debug, for
|
|
|
12
11
|
const { metaSuffix, strictDirectoryName, folderType, metadataPaths } = metaAttributes;
|
|
13
12
|
if (debug)
|
|
14
13
|
setLogLevel('debug');
|
|
15
|
-
|
|
14
|
+
await Promise.all(metadataPaths.map(async (metadataPath) => {
|
|
16
15
|
if (metaSuffix === 'labels') {
|
|
17
16
|
await reassembleLabels(metadataPath, metaSuffix, postpurge, format);
|
|
18
17
|
}
|
|
19
18
|
else {
|
|
20
|
-
|
|
21
|
-
if (strictDirectoryName || folderType)
|
|
22
|
-
recurse = true;
|
|
19
|
+
const recurse = strictDirectoryName || Boolean(folderType);
|
|
23
20
|
await reassembleDirectories(metadataPath, metaSuffix, recurse, postpurge, format);
|
|
24
21
|
}
|
|
25
|
-
if (metaSuffix === 'bot')
|
|
22
|
+
if (metaSuffix === 'bot') {
|
|
26
23
|
await renameBotVersionFile(metadataPath);
|
|
27
|
-
|
|
24
|
+
}
|
|
25
|
+
}));
|
|
28
26
|
}
|
|
29
27
|
async function reassembleHandler(filePath, fileExtension, postPurge, format) {
|
|
30
28
|
let handler;
|
|
@@ -47,7 +45,6 @@ async function reassembleLabels(metadataPath, metaSuffix, postpurge, format) {
|
|
|
47
45
|
let sourceDirectory = metadataPath;
|
|
48
46
|
let destinationDirectory = join(metadataPath, 'CustomLabels', 'labels');
|
|
49
47
|
await moveFiles(sourceDirectory, destinationDirectory, (fileName) => fileName !== CUSTOM_LABELS_FILE);
|
|
50
|
-
// do not use postpurge flag due to file moving
|
|
51
48
|
await reassembleHandler(join(metadataPath, 'CustomLabels'), `${metaSuffix}-meta.xml`, false, format);
|
|
52
49
|
sourceDirectory = join(metadataPath, 'CustomLabels', 'labels');
|
|
53
50
|
destinationDirectory = metadataPath;
|
|
@@ -58,25 +55,26 @@ async function reassembleLabels(metadataPath, metaSuffix, postpurge, format) {
|
|
|
58
55
|
}
|
|
59
56
|
async function deleteFilesInDirectory(directory) {
|
|
60
57
|
const files = await readdir(directory);
|
|
61
|
-
|
|
58
|
+
await Promise.all(files.map(async (file) => {
|
|
62
59
|
const filePath = join(directory, file);
|
|
63
60
|
const fileStat = await stat(filePath);
|
|
64
61
|
if (fileStat.isFile() && file !== CUSTOM_LABELS_FILE) {
|
|
65
62
|
await rm(filePath);
|
|
66
63
|
}
|
|
67
|
-
}
|
|
64
|
+
}));
|
|
68
65
|
}
|
|
69
66
|
async function reassembleDirectories(metadataPath, metaSuffix, recurse, postpurge, format) {
|
|
70
67
|
const subdirectories = (await readdir(metadataPath)).map((file) => join(metadataPath, file));
|
|
71
|
-
|
|
68
|
+
await Promise.all(subdirectories.map(async (subdirectory) => {
|
|
72
69
|
const subDirStat = await stat(subdirectory);
|
|
73
|
-
if (subDirStat.isDirectory()
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
if (subDirStat.isDirectory()) {
|
|
71
|
+
if (recurse) {
|
|
72
|
+
await reassembleDirectories(subdirectory, metaSuffix, false, postpurge, format);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
await reassembleHandler(subdirectory, `${metaSuffix}-meta.xml`, postpurge, format);
|
|
76
|
+
}
|
|
76
77
|
}
|
|
77
|
-
|
|
78
|
-
await reassembleHandler(subdirectory, `${metaSuffix}-meta.xml`, postpurge, format);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
78
|
+
}));
|
|
81
79
|
}
|
|
82
80
|
//# sourceMappingURL=recomposeFileHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recomposeFileHandler.js","sourceRoot":"","sources":["../../src/service/recomposeFileHandler.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"recomposeFileHandler.js","sourceRoot":"","sources":["../../src/service/recomposeFileHandler.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,W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2
|
import { lstat, readdir, rename } from 'node:fs/promises';
|
|
4
3
|
import { join } from 'node:path';
|
|
5
4
|
export async function renameBotVersionFile(metadataPath) {
|
|
6
5
|
const subDirectories = await readdir(metadataPath);
|
|
7
|
-
|
|
6
|
+
// Process all subdirectories concurrently
|
|
7
|
+
await Promise.all(subDirectories.map(async (subDirectory) => {
|
|
8
8
|
const subDirectoryPath = join(metadataPath, subDirectory);
|
|
9
9
|
const stats = await lstat(subDirectoryPath);
|
|
10
10
|
if (stats.isDirectory()) {
|
|
11
11
|
const files = await readdir(subDirectoryPath);
|
|
12
|
-
|
|
12
|
+
// Process all files concurrently
|
|
13
|
+
await Promise.all(files.map(async (file) => {
|
|
13
14
|
// Check if the bot meta file name contains "v" followed by a number
|
|
14
15
|
if (/v\d+\.bot-meta\.xml$/.test(file)) {
|
|
15
16
|
const sourcePath = join(subDirectoryPath, file);
|
|
16
17
|
const destinationPath = join(subDirectoryPath, file.replace('bot-meta.xml', 'botVersion-meta.xml'));
|
|
17
18
|
await rename(sourcePath, destinationPath);
|
|
18
19
|
}
|
|
19
|
-
}
|
|
20
|
+
}));
|
|
20
21
|
}
|
|
21
|
-
}
|
|
22
|
+
}));
|
|
22
23
|
}
|
|
23
24
|
//# sourceMappingURL=renameBotVersionFiles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renameBotVersionFiles.js","sourceRoot":"","sources":["../../src/service/renameBotVersionFiles.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,
|
|
1
|
+
{"version":3,"file":"renameBotVersionFiles.js","sourceRoot":"","sources":["../../src/service/renameBotVersionFiles.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,YAAoB;IAC7D,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC;IAEnD,0CAA0C;IAC1C,MAAM,OAAO,CAAC,GAAG,CACf,cAAc,CAAC,GAAG,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE;QACxC,MAAM,gBAAgB,GAAG,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;QAE1D,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAC5C,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;YAE9C,iCAAiC;YACjC,MAAM,OAAO,CAAC,GAAG,CACf,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;gBACvB,oEAAoE;gBACpE,IAAI,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBACtC,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;oBAChD,MAAM,eAAe,GAAG,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,qBAAqB,CAAC,CAAC,CAAC;oBACpG,MAAM,MAAM,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;gBAC5C,CAAC;YACH,CAAC,CAAC,CACH,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
package/oclif.manifest.json
CHANGED