Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@adonisjs/ignitor

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adonisjs/ignitor - npm Package Compare versions

Comparing version 1.0.12 to 1.0.13

17

CHANGELOG.md

@@ -0,1 +1,18 @@

<a name="1.0.13"></a>
## [1.0.13](https://github.com/adonisjs/adonis-ignitor/compare/v1.0.12...v1.0.13) (2017-10-29)
### Bug Fixes
* **http:** allow end-user to bind custom http instance ([703ef28](https://github.com/adonisjs/adonis-ignitor/commit/703ef28))
* **ignitor:** fix breaking tests ([8d676e4](https://github.com/adonisjs/adonis-ignitor/commit/8d676e4))
### Features
* **http:** add hook to gracefully shutdown server ([26b0684](https://github.com/adonisjs/adonis-ignitor/commit/26b0684))
* **ignitor:** handle `unhandledRejections` ([b6f6d06](https://github.com/adonisjs/adonis-ignitor/commit/b6f6d06)), closes [#1](https://github.com/adonisjs/adonis-ignitor/issues/1)
<a name="1.0.12"></a>

@@ -2,0 +19,0 @@ ## [1.0.12](https://github.com/adonisjs/adonis-ignitor/compare/v1.0.11...v1.0.12) (2017-10-03)

21

package.json
{
"name": "@adonisjs/ignitor",
"version": "1.0.12",
"version": "1.0.13",
"description": "Fire the adonis-app (in good sense)",

@@ -23,13 +23,13 @@ "main": "index.js",

"devDependencies": {
"@adonisjs/fold": "^4.0.2",
"@adonisjs/sink": "^1.0.11",
"@adonisjs/fold": "^4.0.5",
"@adonisjs/sink": "^1.0.13",
"clear-require": "^2.0.0",
"coveralls": "^2.13.1",
"cz-conventional-changelog": "^2.0.0",
"fs-extra": "^4.0.1",
"japa": "^1.0.3",
"coveralls": "^3.0.0",
"cz-conventional-changelog": "^2.1.0",
"fs-extra": "^4.0.2",
"japa": "^1.0.5",
"japa-cli": "^1.0.1",
"nyc": "^11.1.0",
"nyc": "^11.2.1",
"semver": "^5.4.1",
"standard": "^10.0.2"
"standard": "^10.0.3"
},

@@ -47,3 +47,4 @@ "config": {

"dependencies": {
"debug": "^2.6.8",
"debug": "^3.1.0",
"exit-hook": "^1.1.1",
"pify": "^3.0.0"

@@ -50,0 +51,0 @@ },

@@ -14,5 +14,14 @@ 'use strict'

const path = require('path')
const exitHook = require('exit-hook')
const Helpers = require('../Helpers')
const hooks = require('../Hooks')
const WARNING_MESSAGE = `
WARNING: Adonis has detect an unhandled promise rejection, which may
cause undesired behavior in production.
Make sure to always attach (catch) method on promises and wrap await
calls inside try/catch.
`
/**

@@ -414,3 +423,3 @@ * Directories to be binded with resolver

*
* @param {Object} customHttpInstance
* @param {Object} httpServerCallback
*

@@ -424,3 +433,3 @@ * @method _startHttpServer

*/
async _startHttpServer (customHttpInstance) {
async _startHttpServer (httpServerCallback) {
this._callHooks('before', 'httpServer')

@@ -435,4 +444,6 @@

*/
if (customHttpInstance) {
Server.setInstance(customHttpInstance)
if (typeof (httpServerCallback) === 'function') {
debug('binding custom http instance to adonis server')
const instance = httpServerCallback(Server.handle.bind(Server))
Server.setInstance(instance)
}

@@ -443,6 +454,33 @@

*/
Server.listen(Env.get('HOST'), Env.get('PORT'), () => (this._callHooks('after', 'httpServer')))
Server.listen(Env.get('HOST'), Env.get('PORT'), () => {
if (typeof (process.emit) === 'function') {
process.emit('adonis:server:start')
}
this._callHooks('after', 'httpServer')
})
}
/**
* Binds the listener to gracefully shutdown
* the server
*
* @method _gracefullyShutDown
*
* @return {void}
*
* @private
*/
_gracefullyShutDown () {
/**
* Gracefully closing http server
*/
exitHook(() => {
const Server = this._fold.ioc.use('Adonis/Src/Server')
Server.getInstance().once('close', function () {
process.exit(0)
})
})
}
/**
* Preloads a file by appending it to the end

@@ -572,2 +610,11 @@ * of the preloads list.

async fire () {
process.once('unhandledRejection', (response) => {
try {
this._fold.ioc.use('Adonis/Src/Logger').warning(WARNING_MESSAGE)
} catch (error) {
console.warn(WARNING_MESSAGE)
}
console.error(response)
})
if (!this._appRoot) {

@@ -601,7 +648,10 @@ throw new Error('Cannot start http server, make sure to register the app root inside server.js file')

*
* @param {Function} httpServerCallback
*
* @return {void}
*/
async fireHttpServer (customHttpInstance = null) {
async fireHttpServer (httpServerCallback) {
await this.fire()
await this._startHttpServer()
await this._startHttpServer(httpServerCallback)
this._gracefullyShutDown()
}

@@ -608,0 +658,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc