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

View File

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