npm installation feature

pull/33/head v1.0.0-beta.7
NGPixel 8 years ago
parent ab32c95233
commit e0bb77efbb

@ -4,14 +4,15 @@
# Wiki.js # Wiki.js
[![Release](https://img.shields.io/github/release/Requarks/wiki.svg?maxAge=3600)](https://github.com/Requarks/wiki/releases) [![Release](https://img.shields.io/github/release/Requarks/wiki.svg?style=flat-square&maxAge=3600)](https://github.com/Requarks/wiki/releases)
[![License](https://img.shields.io/badge/license-AGPLv3-blue.svg)](https://github.com/requarks/wiki/blob/master/LICENSE) [![License](https://img.shields.io/badge/license-AGPLv3-blue.svg?style=flat-square)](https://github.com/requarks/wiki/blob/master/LICENSE)
[![Github All Releases](https://img.shields.io/github/downloads/Requarks/wiki/total.svg)](https://github.com/Requarks/wiki/releases/latest) [![npm](https://img.shields.io/badge/npm-wiki.js-blue.svg?style=flat-square)](https://www.npmjs.com/package/wiki.js)
[![Build Status](https://travis-ci.org/Requarks/wiki.svg?branch=master)](https://travis-ci.org/Requarks/wiki) [![Github All Releases](https://img.shields.io/github/downloads/Requarks/wiki/total.svg?style=flat-square)](https://github.com/Requarks/wiki/releases/latest)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/1d0217a3153c4595bdedb322263e55c8)](https://www.codacy.com/app/Requarks/wiki) [![Build Status](https://img.shields.io/travis/Requarks/wiki/master.svg?style=flat-square)](https://travis-ci.org/Requarks/wiki)
[![Dependency Status](https://gemnasium.com/badges/github.com/Requarks/wiki.svg)](https://gemnasium.com/github.com/Requarks/wiki) [![Codacy Badge](https://img.shields.io/codacy/grade/1d0217a3153c4595bdedb322263e55c8/master.svg?style=flat-square)](https://www.codacy.com/app/Requarks/wiki)
[![Known Vulnerabilities](https://snyk.io/test/github/requarks/wiki/badge.svg)](https://snyk.io/test/github/requarks/wiki) [![Dependency Status](https://img.shields.io/gemnasium/Requarks/wiki.svg?style=flat-square)](https://gemnasium.com/github.com/Requarks/wiki)
[![Standard - JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) [![Known Vulnerabilities](https://snyk.io/test/github/requarks/wiki/badge.svg?style=flat-square)](https://snyk.io/test/github/requarks/wiki)
[![Standard - JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com/)
##### A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown ##### A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown
*Under active development* *Under active development*

@ -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
[![npm](https://img.shields.io/npm/v/wiki.js.svg?style=flat-square)](https://github.com/Requarks)
[![Release](https://img.shields.io/github/release/Requarks/wiki.svg?style=flat-square&maxAge=3600)](https://github.com/Requarks/wiki/releases)
[![License](https://img.shields.io/badge/license-AGPLv3-blue.svg?style=flat-square)](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 ora = require('ora')('Initializing...').start()
const Promise = require('bluebird') const Promise = require('bluebird')
const exec = require('child_process').exec
const fs = Promise.promisifyAll(require('fs-extra')) const fs = Promise.promisifyAll(require('fs-extra'))
const https = require('follow-redirects').https const https = require('follow-redirects').https
const path = require('path') 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(() => { }).then(() => {
fs.accessAsync(path.join(installDir, 'config.yml')).then(() => { fs.accessAsync(path.join(installDir, 'config.yml')).then(() => {
/** /**
* Upgrade mode * Upgrade mode
*/ */
ora.text = 'Upgrade succeeded. Reloading Wiki.js...' ora.text = 'Upgrade succeeded. Reloading Wiki.js...'
return pm2.restartAsync('wiki').catch(err => { // eslint-disable-line handle-callback-err return pm2.connectAsync().then(() => {
return new Error('Unable to restart Wiki.js via pm2... Do a manual restart!') return pm2.restartAsync('wiki').catch(err => { // eslint-disable-line handle-callback-err
}).then(() => { return new Error('Unable to restart Wiki.js via pm2... Do a manual restart!')
ora.succeed('Wiki.js has restarted. Upgrade completed.') }).then(() => {
ora.succeed('Wiki.js has restarted. Upgrade completed.')
})
}).catch(err => {
ora.fail(err)
}).finally(() => {
pm2.disconnect()
}) })
}).catch(err => { }).catch(err => {
/** /**
* Install mode * Install mode
*/ */
if (err.code === 'ENOENT') { 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 { } else {
return err return err
} }

@ -1,12 +1,11 @@
{ {
"name": "wiki.js", "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", "description": "A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown",
"main": "install.js", "main": "install.js",
"scripts": { "scripts": {
"test": "exit 1", "test": "exit 1",
"install": "node install.js", "postinstall": "node install.js"
"preuninstall": "node uninstall.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

@ -1,6 +1,6 @@
{ {
"name": "wiki", "name": "wiki",
"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", "description": "A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown",
"main": "server.js", "main": "server.js",
"scripts": { "scripts": {
@ -89,7 +89,7 @@
"pug": "^2.0.0-beta11", "pug": "^2.0.0-beta11",
"read-chunk": "^2.0.0", "read-chunk": "^2.0.0",
"remove-markdown": "^0.1.0", "remove-markdown": "^0.1.0",
"requarks-core": "^0.2.1", "requarks-core": "^0.2.2",
"request": "^2.79.0", "request": "^2.79.0",
"search-index": "^0.9.9", "search-index": "^0.9.9",
"serve-favicon": "^2.3.2", "serve-favicon": "^2.3.2",

Loading…
Cancel
Save