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

2
npm/package-lock.json generated
View File

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

View File

@ -1,6 +1,6 @@
{ {
"name": "wiki.js", "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", "description": "A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown",
"main": "install.js", "main": "install.js",
"scripts": { "scripts": {

View File

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