Skip to content

Commit 305d87f

Browse files
committed
Use copy over rename, bring in fs-extra because it's better than fs
1 parent 59ced6c commit 305d87f

3 files changed

Lines changed: 37 additions & 5 deletions

File tree

ci/buildRelease.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const checksum = require('checksum');
2-
const fs = require('fs');
2+
const fs = require('fs-extra');
33
const mkdirp = require('mkdirp');
44
const path = require('path');
55
const request = require('request');
@@ -92,7 +92,7 @@ const bundleGit = ({
9292

9393
mkdirp.sync(vendorDirectoryPath);
9494

95-
fs.copyFileSync(gitRsBinaryPath, path.join(buildDirectory, gitRsBinaryName));
95+
await fs.copy(gitRsBinaryPath, path.join(buildDirectory, gitRsBinaryName));
9696

9797
try {
9898
await tar.extract({
@@ -104,14 +104,17 @@ const bundleGit = ({
104104
process.exit(1);
105105
}
106106

107-
fs.unlinkSync(path.join(tempFile));
107+
await fs.remove(tempFile);
108108

109+
110+
let zipSourceDir = buildDirectory;
109111
if (process.platform === 'win32') {
110-
fs.renameSync(buildDirectory, path.join(buildDirectory, 'git-rs'));
112+
let zipSourceDir = path.join(buildDirectory, 'git-rs');
113+
await fs.copy(buildDirectory, zipSourceDir);
111114
}
112115

113116
try {
114-
zip.zipSync(buildDirectory, `${process.env.TARGET}.zip`);
117+
zip.zipSync(zipSourceDir, `${process.env.TARGET}.zip`);
115118
} catch (error) {
116119
console.log('Could not build git-rs archive');
117120
console.error(error);

ci/package-lock.json

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ci/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"dependencies": {
55
"checksum": "^0.1.1",
66
"cross-zip": "^2.1.5",
7+
"fs-extra": "^6.0.1",
78
"mkdirp": "^0.5.1",
89
"request": "^2.87.0",
910
"tar": "^4.4.4"

0 commit comments

Comments
 (0)