fix: npm tasks cleanup
This commit is contained in:
		
							
								
								
									
										67
									
								
								CHANGELOG.md
									
									
									
									
									
								
							
							
						
						
									
										67
									
								
								CHANGELOG.md
									
									
									
									
									
								
							| @@ -1,67 +0,0 @@ | |||||||
| # Change Log |  | ||||||
| All notable changes to this project will be documented in this file. |  | ||||||
| This project adheres to [Semantic Versioning](http://semver.org/). |  | ||||||
|  |  | ||||||
| ## [2.0.0-beta.84] - 2019-03-24 |  | ||||||
| ### Added |  | ||||||
| - Added Search Engine - Algolia |  | ||||||
| - Added Search Engine - Elasticsearch |  | ||||||
|  |  | ||||||
| ### Fixed |  | ||||||
| - Fixed error when saving navigation in admin area |  | ||||||
| - Fixed guest search failing because of missing global permissions |  | ||||||
| - Fixed PostgreSQL search engine indexing issues |  | ||||||
|  |  | ||||||
| ### Changed |  | ||||||
| - Improved search suggestions from sanitized content |  | ||||||
| - Search engine deactivate handler is now being called on engine switch |  | ||||||
| - Markdown editor UI improvements for insert actions (wip) |  | ||||||
|  |  | ||||||
| ## [2.0.0-beta.68] - 2019-03-17 |  | ||||||
| ### Added |  | ||||||
| - Added Search Results overlay |  | ||||||
| - Added Search Engine - DB Basic |  | ||||||
| - Added Search Engine - DB PostgreSQL |  | ||||||
| - Added Search Engine - Azure Search |  | ||||||
| - Added Search Engine - AWS CloudSearch |  | ||||||
| - Added Git changes processing (add/modify/delete) |  | ||||||
| - Added Storage last sync date in status panel |  | ||||||
| - Added Dev Flags |  | ||||||
| - Added HTTPS server option |  | ||||||
| - Added HTTP to HTTPS redirect server option |  | ||||||
|  |  | ||||||
| ### Fixed |  | ||||||
| - Fixed SQLite migrations |  | ||||||
|  |  | ||||||
| ### Changed |  | ||||||
| - Split admin dev section into separate pages |  | ||||||
|  |  | ||||||
| ## [2.0.0-beta.42] - 2019-02-17 |  | ||||||
| ### Added |  | ||||||
| - Added Patreon link in Contribute admin page |  | ||||||
| - Added Theme Code Injection functionality |  | ||||||
| - Added Theme CSS Injection code minification |  | ||||||
| - Added Page Delete functionality |  | ||||||
| - Dev locale .yml files in `server/locales` are now loaded |  | ||||||
| - Added SQLite dependencies in Docker image |  | ||||||
| - Added rate limiting to login mutations |  | ||||||
|  |  | ||||||
| ### Fixed |  | ||||||
| - Fixed root admin refresh token fail |  | ||||||
| - Fixed error page metadata title warning |  | ||||||
| - Fixed telemetry |  | ||||||
| - Await page render job to complete before resolving |  | ||||||
| - Fixed JSON fields for MariaDB |  | ||||||
| - Fixed MSSQL driver support |  | ||||||
|  |  | ||||||
| ### Changed |  | ||||||
| - Moved Insert Media button in Markdown editor |  | ||||||
| - Use semver for DB migrations ordering |  | ||||||
|  |  | ||||||
| ## [2.0.0-beta.11] - 2019-01-20 |  | ||||||
| - First beta release |  | ||||||
|  |  | ||||||
| [2.0.0-beta.84]: https://github.com/Requarks/wiki/releases/tag/2.0.0-beta.84 |  | ||||||
| [2.0.0-beta.68]: https://github.com/Requarks/wiki/releases/tag/2.0.0-beta.68 |  | ||||||
| [2.0.0-beta.42]: https://github.com/Requarks/wiki/releases/tag/2.0.0-beta.42 |  | ||||||
| [2.0.0-beta.11]: https://github.com/Requarks/wiki/releases/tag/2.0.0-beta.11 |  | ||||||
| @@ -5,9 +5,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": "wiki.js", |   "main": "wiki.js", | ||||||
|   "scripts": { |   "scripts": { | ||||||
|     "start": "node wiki start", |     "start": "node server", | ||||||
|     "stop": "node wiki stop", |  | ||||||
|     "restart": "node wiki restart", |  | ||||||
|     "dev": "node wiki dev", |     "dev": "node wiki dev", | ||||||
|     "build": "webpack --profile --config dev/webpack/webpack.prod.js", |     "build": "webpack --profile --config dev/webpack/webpack.prod.js", | ||||||
|     "watch": "webpack --config dev/webpack/webpack.dev.js", |     "watch": "webpack --config dev/webpack/webpack.dev.js", | ||||||
| @@ -119,7 +117,6 @@ | |||||||
|     "node-cache": "4.2.0", |     "node-cache": "4.2.0", | ||||||
|     "nodemailer": "6.1.1", |     "nodemailer": "6.1.1", | ||||||
|     "objection": "1.6.8", |     "objection": "1.6.8", | ||||||
|     "ora": "3.4.0", |  | ||||||
|     "passport": "0.4.0", |     "passport": "0.4.0", | ||||||
|     "passport-auth0": "1.1.0", |     "passport-auth0": "1.1.0", | ||||||
|     "passport-azure-ad-oauth2": "0.0.4", |     "passport-azure-ad-oauth2": "0.0.4", | ||||||
| @@ -143,7 +140,6 @@ | |||||||
|     "pg-hstore": "2.3.2", |     "pg-hstore": "2.3.2", | ||||||
|     "pg-query-stream": "2.0.0", |     "pg-query-stream": "2.0.0", | ||||||
|     "pg-tsquery": "8.0.4", |     "pg-tsquery": "8.0.4", | ||||||
|     "pm2": "3.5.0", |  | ||||||
|     "pug": "2.0.3", |     "pug": "2.0.3", | ||||||
|     "qr-image": "3.2.0", |     "qr-image": "3.2.0", | ||||||
|     "raven": "2.6.4", |     "raven": "2.6.4", | ||||||
|   | |||||||
							
								
								
									
										164
									
								
								wiki.js
									
									
									
									
									
								
							
							
						
						
									
										164
									
								
								wiki.js
									
									
									
									
									
								
							| @@ -1,120 +1,58 @@ | |||||||
| #!/usr/bin/env node | #!/usr/bin/env node | ||||||
|  |  | ||||||
| // =========================================== | // =========================================== | ||||||
| // Wiki.js | // Wiki.js DEV UTILITY | ||||||
| // 2.0 |  | ||||||
| // Licensed under AGPLv3 | // Licensed under AGPLv3 | ||||||
| // =========================================== | // =========================================== | ||||||
|  |  | ||||||
| const Promise = require('bluebird') | const Promise = require('bluebird') | ||||||
| const fs = Promise.promisifyAll(require('fs-extra')) |  | ||||||
| const pm2 = Promise.promisifyAll(require('pm2')) |  | ||||||
| const ora = require('ora') |  | ||||||
| const path = require('path') |  | ||||||
| const cluster = require('cluster') |  | ||||||
| const _ = require('lodash') | const _ = require('lodash') | ||||||
| const chalk = require('chalk') | const chalk = require('chalk') | ||||||
|  |  | ||||||
| const ROOTPATH = process.cwd() |  | ||||||
|  |  | ||||||
| const init = { | const init = { | ||||||
|   /** |  | ||||||
|    * Start in background mode |  | ||||||
|    */ |  | ||||||
|   start () { |  | ||||||
|     let spinner = ora('Initializing...').start() |  | ||||||
|     return fs.emptyDirAsync(path.join(ROOTPATH, './logs')).then(() => { |  | ||||||
|       return pm2.connectAsync().then(() => { |  | ||||||
|         return pm2.startAsync({ |  | ||||||
|           name: 'wiki', |  | ||||||
|           script: 'server', |  | ||||||
|           cwd: ROOTPATH, |  | ||||||
|           output: path.join(ROOTPATH, './logs/wiki-output.log'), |  | ||||||
|           error: path.join(ROOTPATH, './logs/wiki-error.log'), |  | ||||||
|           minUptime: 5000, |  | ||||||
|           maxRestarts: 5 |  | ||||||
|         }).then(() => { |  | ||||||
|           spinner.succeed('Wiki.js has started successfully.') |  | ||||||
|         }).finally(() => { |  | ||||||
|           pm2.disconnect() |  | ||||||
|         }) |  | ||||||
|       }) |  | ||||||
|     }).catch(err => { |  | ||||||
|       spinner.fail(err) |  | ||||||
|       process.exit(1) |  | ||||||
|     }) |  | ||||||
|   }, |  | ||||||
|   /** |  | ||||||
|    * Stop Wiki.js process(es) |  | ||||||
|    */ |  | ||||||
|   stop () { |  | ||||||
|     let spinner = ora('Shutting down Wiki.js...').start() |  | ||||||
|     return pm2.connectAsync().then(() => { |  | ||||||
|       return pm2.stopAsync('wiki').then(() => { |  | ||||||
|         spinner.succeed('Wiki.js has stopped successfully.') |  | ||||||
|       }).finally(() => { |  | ||||||
|         pm2.disconnect() |  | ||||||
|       }) |  | ||||||
|     }).catch(err => { |  | ||||||
|       spinner.fail(err) |  | ||||||
|       process.exit(1) |  | ||||||
|     }) |  | ||||||
|   }, |  | ||||||
|   /** |  | ||||||
|    * Restart Wiki.js process(es) |  | ||||||
|    */ |  | ||||||
|   restart: function () { |  | ||||||
|     return this.stop().delay(1000).then(() => { |  | ||||||
|       this.start() |  | ||||||
|     }) |  | ||||||
|   }, |  | ||||||
|   dev() { |   dev() { | ||||||
|     if (cluster.isMaster) { |     const webpack = require('webpack') | ||||||
|       const webpack = require('webpack') |     const chokidar = require('chokidar') | ||||||
|       const chokidar = require('chokidar') |  | ||||||
|  |  | ||||||
|       global.DEV = true |     global.DEV = true | ||||||
|       global.WP_CONFIG = require('./dev/webpack/webpack.dev.js') |     global.WP_CONFIG = require('./dev/webpack/webpack.dev.js') | ||||||
|       global.WP = webpack(global.WP_CONFIG) |     global.WP = webpack(global.WP_CONFIG) | ||||||
|       global.WP_DEV = { |     global.WP_DEV = { | ||||||
|         devMiddleware: require('webpack-dev-middleware')(global.WP, { |       devMiddleware: require('webpack-dev-middleware')(global.WP, { | ||||||
|           publicPath: global.WP_CONFIG.output.publicPath |         publicPath: global.WP_CONFIG.output.publicPath | ||||||
|         }), |       }), | ||||||
|         hotMiddleware: require('webpack-hot-middleware')(global.WP) |       hotMiddleware: require('webpack-hot-middleware')(global.WP) | ||||||
|       } |     } | ||||||
|       global.WP_DEV.devMiddleware.waitUntilValid(() => { |     global.WP_DEV.devMiddleware.waitUntilValid(() => { | ||||||
|         console.info(chalk.yellow.bold('>>> Starting Wiki.js in DEVELOPER mode...')) |       console.info(chalk.yellow.bold('>>> Starting Wiki.js in DEVELOPER mode...')) | ||||||
|         require('./server') |       require('./server') | ||||||
|  |  | ||||||
|         process.stdin.setEncoding('utf8') |       process.stdin.setEncoding('utf8') | ||||||
|         process.stdin.on('data', data => { |       process.stdin.on('data', data => { | ||||||
|           if (_.trim(data) === 'rs') { |         if (_.trim(data) === 'rs') { | ||||||
|             console.warn(chalk.yellow.bold('--- >>>>>>>>>>>>>>>>>>>>>>>> ---')) |           console.warn(chalk.yellow.bold('--- >>>>>>>>>>>>>>>>>>>>>>>> ---')) | ||||||
|             console.warn(chalk.yellow.bold('--- Manual restart requested ---')) |           console.warn(chalk.yellow.bold('--- Manual restart requested ---')) | ||||||
|             console.warn(chalk.yellow.bold('--- <<<<<<<<<<<<<<<<<<<<<<<< ---')) |           console.warn(chalk.yellow.bold('--- <<<<<<<<<<<<<<<<<<<<<<<< ---')) | ||||||
|             this.reload() |           this.reload() | ||||||
|           } |         } | ||||||
|         }) |       }) | ||||||
|  |  | ||||||
|         const devWatcher = chokidar.watch([ |       const devWatcher = chokidar.watch([ | ||||||
|           './server', |         './server', | ||||||
|           '!./server/views/master.pug' |         '!./server/views/master.pug' | ||||||
|         ], { |       ], { | ||||||
|           ignoreInitial: true, |         ignoreInitial: true, | ||||||
|           atomic: 400 |         atomic: 400 | ||||||
|         }) |       }) | ||||||
|         devWatcher.on('ready', () => { |       devWatcher.on('ready', () => { | ||||||
|           devWatcher.on('all', () => { |         devWatcher.on('all', () => { | ||||||
|             console.warn(chalk.yellow.bold('--- >>>>>>>>>>>>>>>>>>>>>>>>>>>> ---')) |           console.warn(chalk.yellow.bold('--- >>>>>>>>>>>>>>>>>>>>>>>>>>>> ---')) | ||||||
|             console.warn(chalk.yellow.bold('--- Changes detected: Restarting ---')) |           console.warn(chalk.yellow.bold('--- Changes detected: Restarting ---')) | ||||||
|             console.warn(chalk.yellow.bold('--- <<<<<<<<<<<<<<<<<<<<<<<<<<<< ---')) |           console.warn(chalk.yellow.bold('--- <<<<<<<<<<<<<<<<<<<<<<<<<<<< ---')) | ||||||
|             this.reload() |           this.reload() | ||||||
|           }) |  | ||||||
|         }) |         }) | ||||||
|       }) |       }) | ||||||
|     } else { |     }) | ||||||
|       require('./server') |  | ||||||
|     } |  | ||||||
|   }, |   }, | ||||||
|   async reload() { |   async reload() { | ||||||
|     console.warn(chalk.yellow('--- Stopping scheduled jobs...')) |     console.warn(chalk.yellow('--- Stopping scheduled jobs...')) | ||||||
| @@ -152,30 +90,6 @@ const init = { | |||||||
|  |  | ||||||
| require('yargs') // eslint-disable-line no-unused-expressions | require('yargs') // eslint-disable-line no-unused-expressions | ||||||
|   .usage('Usage: node $0 <cmd> [args]') |   .usage('Usage: node $0 <cmd> [args]') | ||||||
|   .command({ |  | ||||||
|     command: 'start', |  | ||||||
|     alias: ['boot', 'init'], |  | ||||||
|     desc: 'Start Wiki.js process', |  | ||||||
|     handler: argv => { |  | ||||||
|       init.start() |  | ||||||
|     } |  | ||||||
|   }) |  | ||||||
|   .command({ |  | ||||||
|     command: 'stop', |  | ||||||
|     alias: ['quit', 'exit'], |  | ||||||
|     desc: 'Stop Wiki.js process', |  | ||||||
|     handler: argv => { |  | ||||||
|       init.stop() |  | ||||||
|     } |  | ||||||
|   }) |  | ||||||
|   .command({ |  | ||||||
|     command: 'restart', |  | ||||||
|     alias: ['reload'], |  | ||||||
|     desc: 'Restart Wiki.js process', |  | ||||||
|     handler: argv => { |  | ||||||
|       init.restart() |  | ||||||
|     } |  | ||||||
|   }) |  | ||||||
|   .command({ |   .command({ | ||||||
|     command: 'dev', |     command: 'dev', | ||||||
|     desc: 'Start in Developer Mode', |     desc: 'Start in Developer Mode', | ||||||
| @@ -187,5 +101,5 @@ require('yargs') // eslint-disable-line no-unused-expressions | |||||||
|   .demandCommand(1, 'You must provide one of the accepted commands above.') |   .demandCommand(1, 'You must provide one of the accepted commands above.') | ||||||
|   .help() |   .help() | ||||||
|   .version() |   .version() | ||||||
|   .epilogue('Read the docs at https://docs.requarks.io/wiki') |   .epilogue('Read the docs at https://docs-beta.requarks.io/dev') | ||||||
|   .argv |   .argv | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user