Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
f311d74a
Commit
f311d74a
authored
Feb 16, 2017
by
NGPixel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
npm install fixes + logs folder
parent
e0bb77ef
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
71 additions
and
50 deletions
+71
-50
.gitignore
.gitignore
+1
-0
README.md
README.md
+1
-1
README.md
npm/README.md
+1
-3
install.js
npm/install.js
+48
-33
wiki.js
wiki.js
+20
-13
No files found.
.gitignore
View file @
f311d74a
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
logs
logs
*.log
*.log
npm-debug.log*
npm-debug.log*
/logs
# Runtime data
# Runtime data
pids
pids
...
...
README.md
View file @
f311d74a
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
[

](https://github.com/Requarks/wiki/releases)
[

](https://github.com/Requarks/wiki/releases)
[

](https://github.com/requarks/wiki/blob/master/LICENSE)
[

](https://github.com/requarks/wiki/blob/master/LICENSE)
[

](https://www.npmjs.com/package/wiki.js)
[

](https://www.npmjs.com/package/wiki.js)
[

](https://github.com/Requarks/wiki/releases/latest)
[

](https://www.npmjs.com/package/wiki.js)
[

](https://travis-ci.org/Requarks/wiki)
[

](https://travis-ci.org/Requarks/wiki)
[

](https://www.codacy.com/app/Requarks/wiki)
[

](https://www.codacy.com/app/Requarks/wiki)
[

](https://gemnasium.com/github.com/Requarks/wiki)
[

](https://gemnasium.com/github.com/Requarks/wiki)
...
...
npm/README.md
View file @
f311d74a
...
@@ -8,9 +8,7 @@
...
@@ -8,9 +8,7 @@
[

](https://github.com/Requarks/wiki/releases)
[

](https://github.com/Requarks/wiki/releases)
[

](https://github.com/requarks/wiki/blob/master/LICENSE)
[

](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, including detailed installation steps, read the following links:
This npm package is an installer for Wiki.js. For information about Wiki.js, use the following links:
-
[
Official Website
](
https://wiki.requarks.io/
)
-
[
Official Website
](
https://wiki.requarks.io/
)
-
[
Installation Guide
](
https://wiki.requarks.io/get-started.html
)
-
[
Installation Guide
](
https://wiki.requarks.io/get-started.html
)
...
...
npm/install.js
View file @
f311d74a
...
@@ -13,32 +13,43 @@ const _ = require('lodash')
...
@@ -13,32 +13,43 @@ const _ = require('lodash')
let
installDir
=
path
.
resolve
(
__dirname
,
'../..'
)
let
installDir
=
path
.
resolve
(
__dirname
,
'../..'
)
/**
ora
.
text
=
'Looking for running instances...'
* Fetch version from npm package
pm2
.
connectAsync
().
then
(()
=>
{
*/
return
pm2
.
describeAsync
(
'wiki'
).
then
(()
=>
{
fs
.
readJsonAsync
(
'package.json'
).
then
((
packageObj
)
=>
{
ora
.
text
=
'Stopping and deleting from pm2...'
let
remoteURL
=
_
.
replace
(
'https://github.com/Requarks/wiki/releases/download/v{0}/wiki-js.tar.gz'
,
'{0}'
,
packageObj
.
version
)
return
pm2
.
deleteAsync
(
'wiki'
)
}).
catch
(
err
=>
{
// eslint-disable-line handle-callback-err
return
new
Promise
((
resolve
,
reject
)
=>
{
return
true
/**
})
* Fetch tarball
}).
then
(()
=>
{
*/
/**
ora
.
text
=
'Looking for latest release...'
* Fetch version from npm package
https
.
get
(
remoteURL
,
resp
=>
{
*/
if
(
resp
.
statusCode
!==
200
)
{
return
fs
.
readJsonAsync
(
'package.json'
).
then
((
packageObj
)
=>
{
return
reject
(
new
Error
(
'Remote file not found'
))
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
)
ora
.
text
=
'Install tarball found. Downloading...'
return
new
Promise
((
resolve
,
reject
)
=>
{
/**
/**
*
Extract
tarball
*
Fetch
tarball
*/
*/
resp
.
pipe
(
zlib
.
createGunzip
())
ora
.
text
=
'Looking for latest release...'
.
pipe
(
tar
.
Extract
({
path
:
installDir
}))
https
.
get
(
remoteURL
,
resp
=>
{
.
on
(
'error'
,
err
=>
reject
(
err
))
if
(
resp
.
statusCode
!==
200
)
{
.
on
(
'end'
,
()
=>
{
return
reject
(
new
Error
(
'Remote file not found'
))
ora
.
text
=
'Tarball extracted successfully.'
}
resolve
(
true
)
ora
.
text
=
'Install tarball found. Downloading...'
/**
* Extract tarball
*/
resp
.
pipe
(
zlib
.
createGunzip
())
.
pipe
(
tar
.
Extract
({
path
:
installDir
}))
.
on
(
'error'
,
err
=>
reject
(
err
))
.
on
(
'end'
,
()
=>
{
ora
.
text
=
'Tarball extracted successfully.'
resolve
(
true
)
})
})
})
})
})
})
})
...
@@ -62,17 +73,19 @@ fs.readJsonAsync('package.json').then((packageObj) => {
...
@@ -62,17 +73,19 @@ fs.readJsonAsync('package.json').then((packageObj) => {
/**
/**
* Upgrade mode
* Upgrade mode
*/
*/
ora
.
text
=
'Upgrade succeeded. Reloading Wiki.js...'
return
new
Promise
((
resolve
,
reject
)
=>
{
return
pm2
.
connectAsync
().
then
(()
=>
{
ora
.
text
=
'Upgrade succeeded. Starting Wiki.js...'
return
pm2
.
restartAsync
(
'wiki'
).
catch
(
err
=>
{
// eslint-disable-line handle-callback-err
let
npmInstallProc
=
exec
(
'wiki start'
,
{
return
new
Error
(
'Unable to restart Wiki.js via pm2... Do a manual restart!'
)
cwd
:
installDir
}).
then
(()
=>
{
})
ora
.
succeed
(
'Wiki.js has restarted. Upgrade completed.'
)
npmInstallProc
.
stdout
.
pipe
(
process
.
stdout
)
npmInstallProc
.
on
(
'error'
,
err
=>
{
reject
(
err
)
})
.
on
(
'exit'
,
()
=>
{
ora
.
succeed
(
'Wiki.js has started. Upgrade completed.'
)
resolve
(
true
)
})
})
}).
catch
(
err
=>
{
ora
.
fail
(
err
)
}).
finally
(()
=>
{
pm2
.
disconnect
()
})
})
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
/**
/**
...
@@ -89,4 +102,6 @@ fs.readJsonAsync('package.json').then((packageObj) => {
...
@@ -89,4 +102,6 @@ fs.readJsonAsync('package.json').then((packageObj) => {
})
})
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
ora
.
fail
(
err
)
ora
.
fail
(
err
)
}).
finally
(()
=>
{
pm2
.
disconnect
()
})
})
wiki.js
View file @
f311d74a
#!/usr/bin/env node
#!/usr/bin/env node
'use strict'
'use strict'
const
fs
=
require
(
'fs-extra'
)
const
ora
=
require
(
'ora'
)
const
Promise
=
require
(
'bluebird'
)
const
Promise
=
require
(
'bluebird'
)
const
fs
=
Promise
.
promisifyAll
(
require
(
'fs-extra'
))
const
ora
=
require
(
'ora'
)
const
pm2
=
Promise
.
promisifyAll
(
require
(
'pm2'
))
const
pm2
=
Promise
.
promisifyAll
(
require
(
'pm2'
))
const
cmdr
=
require
(
'commander'
)
const
cmdr
=
require
(
'commander'
)
const
path
=
require
(
'path'
)
const
packageObj
=
fs
.
readJsonSync
(
'package.json'
)
const
packageObj
=
fs
.
readJsonSync
(
'package.json'
)
...
@@ -15,18 +16,24 @@ cmdr.command('start')
...
@@ -15,18 +16,24 @@ cmdr.command('start')
.
description
(
'Start Wiki.js process'
)
.
description
(
'Start Wiki.js process'
)
.
action
(()
=>
{
.
action
(()
=>
{
let
spinner
=
ora
(
'Initializing...'
).
start
()
let
spinner
=
ora
(
'Initializing...'
).
start
()
pm2
.
connectAsync
().
then
(()
=>
{
fs
.
emptyDirAsync
(
path
.
join
(
__dirname
,
'./logs'
)).
then
(()
=>
{
return
pm2
.
startAsync
({
return
pm2
.
connectAsync
().
then
(()
=>
{
name
:
'wiki'
,
return
pm2
.
startAsync
({
script
:
'server.js'
,
name
:
'wiki'
,
cwd
:
__dirname
script
:
'server.js'
,
}).
then
(()
=>
{
cwd
:
__dirname
,
spinner
.
succeed
(
'Wiki.js has started successfully.'
)
output
:
path
.
join
(
__dirname
,
'./logs/wiki-output.log'
),
}).
finally
(()
=>
{
error
:
path
.
join
(
__dirname
,
'./logs/wiki-error.log'
),
pm2
.
disconnect
()
minUptime
:
5000
,
maxRestarts
:
5
}).
then
(()
=>
{
spinner
.
succeed
(
'Wiki.js has started successfully.'
)
}).
finally
(()
=>
{
pm2
.
disconnect
()
})
})
})
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
console
.
error
(
err
)
spinner
.
fail
(
err
)
process
.
exit
(
1
)
process
.
exit
(
1
)
})
})
})
})
...
@@ -42,7 +49,7 @@ cmdr.command('stop')
...
@@ -42,7 +49,7 @@ cmdr.command('stop')
pm2
.
disconnect
()
pm2
.
disconnect
()
})
})
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
console
.
error
(
err
)
spinner
.
fail
(
err
)
process
.
exit
(
1
)
process
.
exit
(
1
)
})
})
})
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment