From 942726eb748d10da99b2542b9a314c6d37e16b25 Mon Sep 17 00:00:00 2001 From: yuri Date: Wed, 1 May 2019 12:17:11 +0300 Subject: [PATCH] diff fix --- diff.js | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/diff.js b/diff.js index 5c3c5ddab9..97e93e4874 100644 --- a/diff.js +++ b/diff.js @@ -57,10 +57,8 @@ var currentPath = path.dirname(fs.realpathSync(__filename)); var buildRelPath = 'build/EspoCRM-' + version; var buildPath = currentPath + '/' + buildRelPath; var diffFilePath = currentPath + '/build/diff'; - var upgradePath = currentPath + '/build/EspoCRM-upgrade-' + acceptedVersionName + '-to-' + version; - var exec = require('child_process').exec; function execute(command, callback) { @@ -69,6 +67,23 @@ function execute(command, callback) { }); }; +var deleteDirRecursively = function (path) { + if (fs.existsSync(path)) { + fs.readdirSync(path).forEach(function(file, index) { + var curPath = path + "/" + file; + if (fs.lstatSync(curPath).isDirectory()) { + deleteDirRecursively(curPath); + } else { + fs.unlinkSync(curPath); + } + }); + fs.rmdirSync(path); + } +}; + +deleteDirRecursively(diffFilePath); +deleteDirRecursively(upgradePath); + execute('git diff --name-only ' + versionFrom, function (stdout) { if (!fs.existsSync(upgradePath)) { fs.mkdirSync(upgradePath); @@ -149,15 +164,9 @@ execute('git diff --name-only ' + versionFrom, function (stdout) { } fs.writeFileSync(upgradePath + '/manifest.json', JSON.stringify(manifest, null, ' ')); - }); fs.unlinkSync(diffFilePath); }); - - - }); - }); -