fix: install deps from prebuilt package

pull/180/merge
NGPixel 8 years ago
parent eb99744564
commit 9df9976537

@ -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 => {

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

@ -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": {

@ -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",

Loading…
Cancel
Save