@ds-sfdc/sfparty 1.4.0 → 1.4.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/.prettierrc
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
"semi": false,
|
|
3
|
+
"useTabs": true,
|
|
4
|
+
"tabWidth": 4,
|
|
5
|
+
"singleQuote": true,
|
|
6
|
+
"trailingComma": "all",
|
|
7
|
+
"printWidth": 80
|
|
8
|
+
}
|
package/package.json
CHANGED
package/src/lib/packageUtil.js
CHANGED
|
@@ -68,8 +68,9 @@ export class Package {
|
|
|
68
68
|
packageDefinition.metadataDefinition.fallbackVersion
|
|
69
69
|
}
|
|
70
70
|
that.packageJSON = json
|
|
71
|
-
if (json.Package.types !== undefined)
|
|
71
|
+
if (json.Package.types !== undefined) {
|
|
72
72
|
transformJSON(json.Package.types)
|
|
73
|
+
}
|
|
73
74
|
cleanPackage(that)
|
|
74
75
|
}
|
|
75
76
|
|
|
@@ -80,6 +81,7 @@ export class Package {
|
|
|
80
81
|
)
|
|
81
82
|
if (that.packageJSON.Package == undefined)
|
|
82
83
|
throw new Error('Package initialization failed')
|
|
84
|
+
|
|
83
85
|
if (that.packageJSON.Package.types === undefined)
|
|
84
86
|
return 'No types found'
|
|
85
87
|
|
|
@@ -93,6 +95,12 @@ export class Package {
|
|
|
93
95
|
)
|
|
94
96
|
}
|
|
95
97
|
})
|
|
98
|
+
|
|
99
|
+
// remove all types nodes that have no members
|
|
100
|
+
that.packageJSON.Package.types =
|
|
101
|
+
that.packageJSON.Package.types.filter(
|
|
102
|
+
(subType) => subType.members.length > 0,
|
|
103
|
+
)
|
|
96
104
|
}
|
|
97
105
|
}
|
|
98
106
|
|
package/src/meta/Profiles.js
CHANGED
package/src/meta/Workflows.js
CHANGED
package/src/party/combine.js
CHANGED
|
@@ -32,7 +32,10 @@ export class Combine {
|
|
|
32
32
|
mtime: undefined,
|
|
33
33
|
}
|
|
34
34
|
#json = {}
|
|
35
|
-
#
|
|
35
|
+
#delta = false
|
|
36
|
+
#addedFiles = []
|
|
37
|
+
#deletedFiles = []
|
|
38
|
+
#mainDeleted = false
|
|
36
39
|
|
|
37
40
|
constructor(config) {
|
|
38
41
|
this.metadataDefinition = config.metadataDefinition
|
|
@@ -83,11 +86,6 @@ export class Combine {
|
|
|
83
86
|
combine() {
|
|
84
87
|
return new Promise((resolve, reject) => {
|
|
85
88
|
const that = this
|
|
86
|
-
that.#diffOnly =
|
|
87
|
-
global.metaTypes[that.metadataDefinition.alias].add.files
|
|
88
|
-
.length > 0 ||
|
|
89
|
-
global.metaTypes[that.metadataDefinition.alias].remove.files
|
|
90
|
-
.length > 0
|
|
91
89
|
|
|
92
90
|
if (!fileUtils.directoryExists({ dirPath: that.sourceDir, fs }))
|
|
93
91
|
reject(`Path does not exist: ${that.sourceDir}`)
|
|
@@ -118,28 +116,53 @@ export class Combine {
|
|
|
118
116
|
})
|
|
119
117
|
|
|
120
118
|
function processStart(that) {
|
|
119
|
+
const pathMatch = `/${that.metadataDefinition.directory}/${
|
|
120
|
+
that.#fileName.shortName
|
|
121
|
+
}/`
|
|
122
|
+
|
|
123
|
+
// get a list of all the added files
|
|
124
|
+
that.#addedFiles = global.metaTypes[
|
|
125
|
+
that.metadataDefinition.alias
|
|
126
|
+
].add.files.filter((i) =>
|
|
127
|
+
i.toLowerCase().includes(pathMatch.toLowerCase()),
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
// get a list of all the removed files
|
|
131
|
+
that.#deletedFiles = global.metaTypes[
|
|
132
|
+
that.metadataDefinition.alias
|
|
133
|
+
].remove.files.filter((i) =>
|
|
134
|
+
i.toLowerCase().includes(pathMatch.toLowerCase()),
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
// check if main part file deleted
|
|
138
|
+
that.#mainDeleted = global.metaTypes[
|
|
139
|
+
that.metadataDefinition.alias
|
|
140
|
+
].remove.files.some(
|
|
141
|
+
(i) =>
|
|
142
|
+
i.includes(pathMatch) &&
|
|
143
|
+
i.toLowerCase().includes(`/main.${global.format}`),
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
// set delta based on metadata definition
|
|
147
|
+
that.#delta = that.metadataDefinition.delta
|
|
148
|
+
|
|
121
149
|
let success = processParts(that)
|
|
150
|
+
// Ensure we only match existing metadata type directory and item
|
|
151
|
+
|
|
122
152
|
if (success) {
|
|
123
153
|
if (
|
|
124
154
|
!that.metadataDefinition.packageTypeIsDirectory &&
|
|
125
155
|
global.git.enabled
|
|
126
156
|
) {
|
|
127
|
-
if (
|
|
128
|
-
!that.#diffOnly ||
|
|
129
|
-
global.metaTypes[that.metadataDefinition.alias].add
|
|
130
|
-
.files.length > 0
|
|
131
|
-
) {
|
|
157
|
+
if (!that.#delta || that.#addedFiles.length > 0) {
|
|
132
158
|
that.addPkg.addMember(
|
|
133
159
|
that.#root,
|
|
134
160
|
that.#fileName.shortName,
|
|
135
161
|
)
|
|
136
162
|
}
|
|
137
163
|
|
|
138
|
-
if
|
|
139
|
-
|
|
140
|
-
global.metaTypes[that.metadataDefinition.alias].remove
|
|
141
|
-
.files.length > 0
|
|
142
|
-
) {
|
|
164
|
+
// only include the workflow node if main part file is delete
|
|
165
|
+
if (that.#delta && that.#mainDeleted) {
|
|
143
166
|
that.desPkg.addMember(
|
|
144
167
|
that.#root,
|
|
145
168
|
that.#fileName.shortName,
|
|
@@ -364,19 +387,21 @@ export class Combine {
|
|
|
364
387
|
)
|
|
365
388
|
}
|
|
366
389
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
390
|
+
if (that.#delta) {
|
|
391
|
+
if (
|
|
392
|
+
!that.#addedFiles
|
|
393
|
+
.concat(that.#deletedFiles)
|
|
394
|
+
.includes(fileObj.fullName) &&
|
|
395
|
+
!fileObj.fullName
|
|
396
|
+
.toLowerCase()
|
|
397
|
+
.includes(`/main.${global.format}`)
|
|
398
|
+
)
|
|
399
|
+
return true
|
|
375
400
|
}
|
|
376
401
|
|
|
377
402
|
if (!fileUtils.fileExists({ filePath: fileObj.fullName, fs })) {
|
|
378
403
|
// File does not exist
|
|
379
|
-
// If file is main
|
|
404
|
+
// If file is main part file, then return false to indicate that the XML file should be deleted
|
|
380
405
|
if (
|
|
381
406
|
fileObj.fullName ==
|
|
382
407
|
path.join(
|
|
@@ -389,6 +414,7 @@ export class Combine {
|
|
|
389
414
|
}
|
|
390
415
|
|
|
391
416
|
if (
|
|
417
|
+
// git enabled and (package directory OR package mapping)
|
|
392
418
|
global.git.enabled &&
|
|
393
419
|
(that.metadataDefinition.packageTypeIsDirectory ||
|
|
394
420
|
(that.metadataDefinition.package !== undefined &&
|
|
@@ -396,6 +422,7 @@ export class Combine {
|
|
|
396
422
|
that.metadataDefinition.package))
|
|
397
423
|
) {
|
|
398
424
|
if (
|
|
425
|
+
// package mapping
|
|
399
426
|
that.metadataDefinition.package !== undefined &&
|
|
400
427
|
path.dirname(fileObj.fullName).split('/').pop() in
|
|
401
428
|
that.metadataDefinition.package
|
|
@@ -411,7 +438,10 @@ export class Combine {
|
|
|
411
438
|
'',
|
|
412
439
|
),
|
|
413
440
|
)
|
|
414
|
-
} else if (
|
|
441
|
+
} else if (
|
|
442
|
+
// package directory
|
|
443
|
+
that.metadataDefinition.packageTypeIsDirectory
|
|
444
|
+
) {
|
|
415
445
|
that.desPkg.addMember(
|
|
416
446
|
that.#root,
|
|
417
447
|
fileObj.shortName.replace(`.${global.format}`, ''),
|
|
@@ -152,7 +152,7 @@ it('should correctly process the json object returned from the XML file', async
|
|
|
152
152
|
name: 'PermissionSet',
|
|
153
153
|
},
|
|
154
154
|
{
|
|
155
|
-
members: ['Test
|
|
155
|
+
members: ['Test.yaml'],
|
|
156
156
|
name: 'Workflow',
|
|
157
157
|
},
|
|
158
158
|
],
|
|
@@ -182,10 +182,6 @@ it('should correctly process the json object returned from the XML file', async
|
|
|
182
182
|
members: ['Test'],
|
|
183
183
|
name: 'PermissionSet',
|
|
184
184
|
},
|
|
185
|
-
{
|
|
186
|
-
members: ['Test'],
|
|
187
|
-
name: 'Workflow',
|
|
188
|
-
},
|
|
189
185
|
],
|
|
190
186
|
version: '56.0',
|
|
191
187
|
},
|