Skip to content

zuker/trailpack-autoreload

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

trailpack-autoreload

NPM version Build status Dependency Status Code Climate

This Trailpack will automatically reload your Trails application on code changes. It listens for changes in api/ and config/.

Install

$ npm install --save trailpack-autoreload

Configure

// config/main.js
module.exports = {
  packs: [
    // ... other trailpacks
    require('trailpack-autoreload')
  ]
}

This trailpack offers significant performance advantages over other solutions such as nodemon, which restarts the entire node process. This trailpack detects the file(s) in which the change occured, evicts those modules from the require cache, and reloads the Trails application (via app.start()). Moreover, the application will continue running in its current state if a syntax error is written into a watched file; Trails will inform you of the error, and carry on.

The synchronous node require statement incurs non-negligible boot-time overhead. We avoid these costs by evicting only the affected module(s).

About

📦 Reload Trails on Code Changes

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%