@ds-sfdc/sfparty 1.4.9 → 1.4.11

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.
@@ -0,0 +1 @@
1
+ force-app-party/**/*.yaml
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ds-sfdc/sfparty",
3
- "version": "1.4.9",
3
+ "version": "1.4.11",
4
4
  "description": "Salesforce metadata XML splitter for CI/CD",
5
5
  "type": "module",
6
6
  "repository": {
@@ -44,8 +44,12 @@ export function deleteDirectory(dirPath, recursive = false, fsTmp = fs) {
44
44
  // recurse
45
45
  deleteDirectory(curPath, recursive, fsTmp)
46
46
  } else {
47
- // delete file
48
- fsTmp.unlinkSync(curPath)
47
+ try {
48
+ // delete file
49
+ fsTmp.unlinkSync(curPath)
50
+ } catch (error) {
51
+ fsTmp.rmdirSync(curPath)
52
+ }
49
53
  }
50
54
  })
51
55
  return fsTmp.rmdirSync(dirPath)
@@ -22,6 +22,7 @@ export class Combine {
22
22
  #fileName = {
23
23
  fullName: undefined,
24
24
  shortName: undefined,
25
+ profileName: undefined,
25
26
  }
26
27
  #errorMessage = ''
27
28
  #frameIndex = 0
@@ -115,35 +116,37 @@ export class Combine {
115
116
  })
116
117
 
117
118
  function processStart(that) {
118
- const pathMatch = `/${that.metadataDefinition.directory}/${
119
- that.#fileName.shortName
120
- }/`
119
+ // set delta based on metadata definition if git delta enabled
120
+ that.#delta = that.metadataDefinition.delta && global.git.delta
121
121
 
122
- // get a list of all the added files
123
- that.#addedFiles = global.metaTypes[
124
- that.metadataDefinition.alias
125
- ].add.files.filter((i) =>
126
- i.toLowerCase().includes(pathMatch.toLowerCase()),
127
- )
122
+ if (that.#delta) {
123
+ const pathMatch = `/${that.metadataDefinition.directory}/${
124
+ that.#fileName.shortName
125
+ }/`
128
126
 
129
- // get a list of all the removed files
130
- that.#deletedFiles = global.metaTypes[
131
- that.metadataDefinition.alias
132
- ].remove.files.filter((i) =>
133
- i.toLowerCase().includes(pathMatch.toLowerCase()),
134
- )
127
+ // get a list of all the added files
128
+ that.#addedFiles = global.metaTypes[
129
+ that.metadataDefinition.alias
130
+ ].add.files.filter((i) =>
131
+ i.toLowerCase().includes(pathMatch.toLowerCase()),
132
+ )
135
133
 
136
- // check if main part file deleted
137
- that.#mainDeleted = global.metaTypes[
138
- that.metadataDefinition.alias
139
- ].remove.files.some(
140
- (i) =>
141
- i.includes(pathMatch) &&
142
- i.toLowerCase().includes(`/main.${global.format}`),
143
- )
134
+ // get a list of all the removed files
135
+ that.#deletedFiles = global.metaTypes[
136
+ that.metadataDefinition.alias
137
+ ].remove.files.filter((i) =>
138
+ i.toLowerCase().includes(pathMatch.toLowerCase()),
139
+ )
144
140
 
145
- // set delta based on metadata definition if git delta enabled
146
- that.#delta = that.metadataDefinition.delta && global.git.delta
141
+ // check if main part file deleted
142
+ that.#mainDeleted = global.metaTypes[
143
+ that.metadataDefinition.alias
144
+ ].remove.files.some(
145
+ (i) =>
146
+ i.includes(pathMatch) &&
147
+ i.toLowerCase().includes(`/main.${global.format}`),
148
+ )
149
+ }
147
150
 
148
151
  let success = processParts(that)
149
152
  // Ensure we only match existing metadata type directory and item
@@ -455,7 +458,7 @@ export class Combine {
455
458
 
456
459
  // abort function if doing a delta deploy and file is not in git list
457
460
  if (
458
- global.git.delta &&
461
+ that.#delta &&
459
462
  !global.metaTypes[
460
463
  that.metadataDefinition.alias
461
464
  ].add.files.includes(fileObj.fullName) &&
@@ -469,6 +472,20 @@ export class Combine {
469
472
  return true
470
473
  }
471
474
  let result = fileUtils.readFile(fileObj.fullName)
475
+ if (
476
+ fileObj.fullName ==
477
+ path.join(
478
+ that.sourceDir,
479
+ that.metaDir,
480
+ `main.${global.format}`,
481
+ ) &&
482
+ that.#type == 'profile'
483
+ ) {
484
+ that.#fileName.profileName = path.join(
485
+ that.targetDir,
486
+ result.main.fullName + `.${that.#type}-meta.xml`,
487
+ )
488
+ }
472
489
 
473
490
  // if split by object we need to add object back to values
474
491
  if (