fix: install deps from prebuilt package

This commit is contained in:
NGPixel 2017-07-26 21:40:34 -04:00
parent eb99744564
commit 9df9976537
4 changed files with 36 additions and 16 deletions

View File

@ -75,7 +75,8 @@ const tasks = {
.on('error', err => reject(err))
.on('end', () => {
ora.text = 'Tarball extracted successfully.'
resolve(true)
resolve(tasks.installDependencies())
isContainerBased && console.info('>> Installing dependencies...')
})
})
} else {
@ -90,27 +91,49 @@ const tasks = {
// Fetch version from npm package
return fs.readJsonAsync('package.json').then((packageObj) => {
let versionGet = _.chain(packageObj.version).split('.').take(4).join('.')
let remoteURL = _.replace('https://github.com/Requarks/wiki/releases/download/v{0}/wiki-js.tar.gz', '{0}', versionGet)
let remoteURLApp = _.replace('https://github.com/Requarks/wiki/releases/download/v{0}/wiki-js.tar.gz', '{0}', versionGet)
let remoteURLDeps = _.replace('https://github.com/Requarks/wiki/releases/download/v{0}/node_modules.tar.gz', '{0}', versionGet)
return new Promise((resolve, reject) => {
// Fetch tarball
ora.text = 'Looking for latest release...'
https.get(remoteURL, resp => {
// Fetch app tarball
ora.text = 'Looking for app package...'
https.get(remoteURLApp, resp => {
if (resp.statusCode !== 200) {
return reject(new Error('Remote file not found'))
}
ora.text = 'Remote wiki.js tarball found. Downloading...'
isContainerBased && console.info('>> Extracting to ' + installDir)
ora.text = 'Remote app tarball found. Downloading...'
isContainerBased && console.info('>> Extracting app to ' + installDir)
// Extract tarball
// Extract app tarball
resp.pipe(zlib.createGunzip())
.pipe(tar.extract({ cwd: installDir }))
.on('error', err => reject(err))
.on('end', () => {
ora.text = 'Tarball extracted successfully.'
ora.text = 'App tarball extracted successfully.'
resolve(true)
})
})
}).then(() => {
return new Promise((resolve, reject) => {
// Fetch deps tarball
ora.text = 'Looking for dependencies package...'
https.get(remoteURLDeps, resp => {
if (resp.statusCode !== 200) {
return reject(new Error('Remote file not found'))
}
ora.text = 'Remote dependencies tarball found. Downloading...'
isContainerBased && console.info('>> Extracting dependencies to ' + installDir)
// Extract deps tarball
resp.pipe(zlib.createGunzip())
.pipe(tar.extract({ cwd: path.join(installDir, 'node_modules') }))
.on('error', err => reject(err))
.on('end', () => {
ora.text = 'Dependencies tarball extracted successfully.'
resolve(true)
})
})
})
})
})
},
@ -247,9 +270,6 @@ Promise.join(
}).then(() => {
isContainerBased && console.info('>> Creating config file...')
return tasks.ensureConfigFile()
}).then(() => {
isContainerBased && console.info('>> Installing dependencies...')
return tasks.installDependencies()
}).then(() => {
return tasks.startConfigurationWizard()
}).catch(err => {

2
npm/package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "wiki.js",
"version": "1.0.3",
"version": "1.0.4",
"lockfileVersion": 1,
"dependencies": {
"amp": {

View File

@ -1,6 +1,6 @@
{
"name": "wiki.js",
"version": "1.0.3",
"version": "1.0.4",
"description": "A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown",
"main": "install.js",
"scripts": {

View File

@ -1,6 +1,6 @@
{
"name": "wiki",
"version": "1.0.3",
"version": "1.0.4",
"description": "A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown",
"main": "wiki.js",
"scripts": {
@ -34,7 +34,7 @@
},
"homepage": "https://github.com/Requarks/wiki#readme",
"engines": {
"node": ">=4.6"
"node": ">=6.11.1"
},
"dependencies": {
"auto-load": "~3.0.0",