Skip to content

Commit ba82ba9

Browse files
authored
chore: replace tar-pack with tar (#4503)
1 parent 896ab1a commit ba82ba9

File tree

5 files changed

+73
-275
lines changed

5 files changed

+73
-275
lines changed

package-lock.json

Lines changed: 5 additions & 258 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const tar = require('tar');
2+
const path = require('path');
3+
4+
module.exports = async function tarGz(srcDirectory, dest) {
5+
await tar.create(
6+
{
7+
file: dest,
8+
cwd: path.dirname(srcDirectory),
9+
portable: true,
10+
gzip: true,
11+
},
12+
['.']
13+
);
14+
15+
return dest;
16+
};

packages/hadron-build/lib/target.js

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@ const windowsInstallerVersion = require('./windows-installer-version');
1515
const debug = require('debug')('hadron-build:target');
1616
const execFile = promisify(childProcess.execFile);
1717
const mongodbNotaryServiceClient = require('@mongodb-js/mongodb-notary-service-client');
18-
const tarPack = require('tar-pack').pack;
1918
const which = require('which');
20-
const os = require('os');
2119
const plist = require('plist');
2220
const { signtool } = require('./signtool');
21+
const tarGz = require('./tar-gz');
2322

2423
async function signLinuxPackage(src) {
2524
debug('Signing ... %s', src);
@@ -33,19 +32,6 @@ async function signWindowsPackage(src) {
3332
debug('Successfully signed %s', src);
3433
}
3534

36-
function tar(srcDirectory, dest) {
37-
return new Promise(function(resolve, reject) {
38-
tarPack(srcDirectory)
39-
.pipe(fs.createWriteStream(dest))
40-
.on('error', function(err) {
41-
reject(err);
42-
})
43-
.on('close', function() {
44-
resolve(dest);
45-
});
46-
});
47-
}
48-
4935
function _canBuildInstaller(ext) {
5036
var bin = null;
5137
var help = null;
@@ -771,7 +757,8 @@ class Target {
771757
this.appPath,
772758
this.dest(this.app_archive_name)
773759
);
774-
return tar(this.appPath, this.dest(this.app_archive_name));
760+
761+
return tarGz(this.appPath, this.dest(this.app_archive_name));
775762
};
776763

777764
this.createInstaller = () => {

0 commit comments

Comments
 (0)