sfdx-git-delta
Advanced tools
Comparing version 2.0.3 to 2.0.4
@@ -37,2 +37,4 @@ 'use strict' | ||
fs.readFileSync = () => '<type>MasterDetail</type>' | ||
fs.writeFile = (_filePath, _content, _encoding, cb) => | ||
@@ -39,0 +41,0 @@ errorMode ? cb(new Error()) : cb(null) |
@@ -5,5 +5,4 @@ 'use strict' | ||
const fse = require('fs-extra') | ||
const fs = require('fs') | ||
const OBJECT_META_XML_SUFFIX = `object${StandardHandler.METAFILE_SUFFIX}` | ||
class SubCustomObjectHandler extends StandardHandler { | ||
@@ -22,22 +21,30 @@ handleDeletion() { | ||
const customObjectPath = this.splittedLine | ||
.slice(0, [this.splittedLine.indexOf(this.type)]) | ||
.join(path.sep) | ||
const customObject = this.splittedLine[ | ||
this.splittedLine.indexOf(this.type) - 1 | ||
] | ||
const fieldContent = fs.readFileSync(path.join(this.config.repo, this.line)) | ||
if ( | ||
!!fieldContent && | ||
fieldContent.includes(SubCustomObjectHandler.MASTER_DETAIL_TAG) | ||
) { | ||
const customObjectPath = this.splittedLine | ||
.slice(0, [this.splittedLine.indexOf(this.type)]) | ||
.join(path.sep) | ||
const customObject = this.splittedLine[ | ||
this.splittedLine.indexOf(this.type) - 1 | ||
] | ||
const commonPath = `${customObjectPath + | ||
path.sep + | ||
customObject}.${OBJECT_META_XML_SUFFIX}` | ||
const commonPath = `${customObjectPath + path.sep + customObject}.${ | ||
SubCustomObjectHandler.OBJECT_META_XML_SUFFIX | ||
}` | ||
this.promises.push( | ||
fse.copy( | ||
path.join(this.config.repo, commonPath), | ||
path.join(this.config.output, commonPath) | ||
this.promises.push( | ||
fse.copy( | ||
path.join(this.config.repo, commonPath), | ||
path.join(this.config.output, commonPath) | ||
) | ||
) | ||
) | ||
} | ||
} | ||
} | ||
SubCustomObjectHandler.MASTER_DETAIL_TAG = '<type>MasterDetail</type>' | ||
SubCustomObjectHandler.OBJECT_META_XML_SUFFIX = `object${StandardHandler.METAFILE_SUFFIX}` | ||
module.exports = SubCustomObjectHandler |
{ | ||
"name": "sfdx-git-delta", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "Generate the sfdx content in source format and destructive change from two git commits", | ||
@@ -25,3 +25,3 @@ "keyword": [ | ||
"pre-commit": "lint-staged", | ||
"pre-push": "npm run test" | ||
"pre-push": "npm run test:coverage" | ||
} | ||
@@ -28,0 +28,0 @@ }, |
12834364
2086
13