From c5082e4e34ff3a6c977160b2bd2d69f125657780 Mon Sep 17 00:00:00 2001 From: Nicolas Dextraze Date: Fri, 28 Apr 2017 12:45:59 -0700 Subject: [PATCH] Fix deployment issue on linux --- package.json | 12 +++++++++--- src/index.js | 14 ++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index b3c314d..96f0fed 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/src/index.js b/src/index.js index a094f79..f53eb49 100644 --- a/src/index.js +++ b/src/index.js @@ -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); }); }); }