npm installation feature
This commit is contained in:
@@ -1 +1,30 @@
|
||||
Under development
|
||||
<a href="https://github.com/Requarks/wiki">
|
||||
<img src="https://raw.githubusercontent.com/Requarks/wiki/master/assets/favicons/favicon-96x96.png" alt="Wiki.js" title="Wiki.js" align="right" />
|
||||
</a>
|
||||
|
||||
# Wiki.js
|
||||
|
||||
[](https://github.com/Requarks)
|
||||
[](https://github.com/Requarks/wiki/releases)
|
||||
[](https://github.com/requarks/wiki/blob/master/LICENSE)
|
||||
|
||||
##### A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown
|
||||
|
||||
This npm package is an installer for Wiki.js. For information about Wiki.js, use the following links:
|
||||
|
||||
- [Official Website](https://wiki.requarks.io/)
|
||||
- [Installation Guide](https://wiki.requarks.io/get-started.html)
|
||||
- [GitHub Repository](https://github.com/Requarks/wiki)
|
||||
|
||||
### Install Wiki.js using npm
|
||||
|
||||
1. Create an empty folder where Wiki.js will run.
|
||||
2. Launch a terminal / command prompt inside this newly created folder.
|
||||
3. Run the command: `npm install wiki.js@latest`
|
||||
4. Wait for the installation process to complete. This may take several minutes.
|
||||
5. Edit the file `config.yml` located in the root of your folder and change the settings accordingly.
|
||||
6. Run the command: `node wiki start`
|
||||
|
||||
### Install Wiki.js manually
|
||||
|
||||
For a manual installation, read the [Installation Guide](https://wiki.requarks.io/get-started.html).
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
const ora = require('ora')('Initializing...').start()
|
||||
const Promise = require('bluebird')
|
||||
const exec = require('child_process').exec
|
||||
const fs = Promise.promisifyAll(require('fs-extra'))
|
||||
const https = require('follow-redirects').https
|
||||
const path = require('path')
|
||||
@@ -41,23 +42,47 @@ fs.readJsonAsync('package.json').then((packageObj) => {
|
||||
})
|
||||
})
|
||||
})
|
||||
}).then(() => {
|
||||
return new Promise((resolve, reject) => {
|
||||
ora.text = 'Installing Wiki.js npm dependencies...'
|
||||
let npmInstallProc = exec('npm install --only=production', {
|
||||
cwd: installDir
|
||||
})
|
||||
npmInstallProc.stdout.pipe(process.stdout)
|
||||
npmInstallProc.on('error', err => {
|
||||
reject(err)
|
||||
})
|
||||
.on('exit', () => {
|
||||
ora.text = 'Wiki.js npm dependencies installed successfully.'
|
||||
resolve(true)
|
||||
})
|
||||
})
|
||||
}).then(() => {
|
||||
fs.accessAsync(path.join(installDir, 'config.yml')).then(() => {
|
||||
/**
|
||||
* Upgrade mode
|
||||
*/
|
||||
ora.text = 'Upgrade succeeded. Reloading Wiki.js...'
|
||||
return pm2.restartAsync('wiki').catch(err => { // eslint-disable-line handle-callback-err
|
||||
return new Error('Unable to restart Wiki.js via pm2... Do a manual restart!')
|
||||
}).then(() => {
|
||||
ora.succeed('Wiki.js has restarted. Upgrade completed.')
|
||||
return pm2.connectAsync().then(() => {
|
||||
return pm2.restartAsync('wiki').catch(err => { // eslint-disable-line handle-callback-err
|
||||
return new Error('Unable to restart Wiki.js via pm2... Do a manual restart!')
|
||||
}).then(() => {
|
||||
ora.succeed('Wiki.js has restarted. Upgrade completed.')
|
||||
})
|
||||
}).catch(err => {
|
||||
ora.fail(err)
|
||||
}).finally(() => {
|
||||
pm2.disconnect()
|
||||
})
|
||||
}).catch(err => {
|
||||
/**
|
||||
* Install mode
|
||||
*/
|
||||
if (err.code === 'ENOENT') {
|
||||
ora.succeed('Installation succeeded. You can now continue with the configuration steps. Check out https://docs.wiki.requarks.io/install for more info.')
|
||||
ora.text = 'First-time install, creating a new config.yml...'
|
||||
return fs.copyAsync(path.join(installDir, 'config.sample.yml'), path.join(installDir, 'config.yml')).then(() => {
|
||||
ora.succeed('Installation succeeded. You can now continue with the configuration steps. Check out https://docs.wiki.requarks.io/install for more info.')
|
||||
})
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
|
@@ -1,12 +1,11 @@
|
||||
{
|
||||
"name": "wiki.js",
|
||||
"version": "1.0.0-beta.6",
|
||||
"version": "1.0.0-beta.7",
|
||||
"description": "A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown",
|
||||
"main": "install.js",
|
||||
"scripts": {
|
||||
"test": "exit 1",
|
||||
"install": "node install.js",
|
||||
"preuninstall": "node uninstall.js"
|
||||
"postinstall": "node install.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
Reference in New Issue
Block a user