Fix deployment issue on linux

This commit is contained in:
Nicolas Dextraze 2017-04-28 12:45:59 -07:00
parent 6e4287606a
commit c5082e4e34
2 changed files with 15 additions and 11 deletions

View File

@ -1,6 +1,6 @@
{
"name": "goes-install",
"version": "0.3.1",
"version": "0.3.4",
"description": "Install GoES for your platform using npm",
"main": "lib/index.js",
"scripts": {
@ -10,6 +10,12 @@
"prepublish": "npm run build",
"start": "npm run build && npm run postinstall"
},
"files": [
"lib"
],
"directories": {
"lib": "lib"
},
"repository": {
"type": "git",
"url": "git+https://github.com/nicdex/npm-goes.git"
@ -30,7 +36,7 @@
"babel-preset-es2015": "^6.14.0"
},
"dependencies": {
"mkdirp": "^0.5.1",
"unzip": "^0.1.11"
"decompress": "^4.1.0",
"mkdirp": "^0.5.1"
}
}

View File

@ -4,7 +4,7 @@ import https from 'https';
import os from 'os';
import path from 'path';
import fs from 'fs';
import unzip from 'unzip';
import decompress from 'decompress';
import mkdirp from 'mkdirp';
const config = {
@ -66,15 +66,13 @@ function install(options) {
if (options.platform === 'win32') {
destParts.push('bin');
}
const destPath = destParts.join(path.sep);
const destPath = path.resolve(destParts.join(path.sep))
.replace('/node_modules/goes-install', '');
console.log('Installing to', destPath);
mkdirp(destPath, err => {
if (err) return reject(err);
fs.createReadStream(options.localPath)
.pipe(unzip.Extract({ path: destPath })
.on('finish', () => {
console.log(`- GoES ${config.versionToDownload} installed in .deps${path.sep}goes\n`);
}))
.on('error', reject);
decompress(options.localPath, destPath)
.then(resolve, reject);
});
});
}