Skip to content

Commit

Permalink
fix(post-install): check if bundles dir exists before creating (#398)
Browse files Browse the repository at this point in the history
Fixes: #397
  • Loading branch information
dlabrecq committed Jun 25, 2018
1 parent 3117934 commit e6d2a53
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/scripts/package/install.js
Expand Up @@ -13,6 +13,7 @@ var fs = require('fs');
var path = require('path');
var appPath = './dist/app';
var bundlePath = './dist/bundles';
var bundleTargetPath = './bundles';

function copyFile(source, target) {
var targetFile = target;
Expand Down Expand Up @@ -82,9 +83,11 @@ fs.readdir(appPath, function(err, items) {
});

fs.readdir(bundlePath, function(err, items) {
fs.mkdirSync('./bundles');
if (!fs.existsSync(bundleTargetPath)) {
fs.mkdirSync(bundleTargetPath);
}
for (var i = 0; i < items.length; i++) {
copyFolderRecursive(bundlePath + '/' + items[i], './bundles');
copyFolderRecursive(bundlePath + '/' + items[i], bundleTargetPath);
}
deleteFolderRecursive(bundlePath);
});

0 comments on commit e6d2a53

Please sign in to comment.