Skip to content

anuoua/make-it-restart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

59da241 · Oct 24, 2019

History

21 Commits
Oct 24, 2019
Oct 17, 2017
May 7, 2017
Oct 17, 2017
May 7, 2017
Oct 24, 2019
Oct 17, 2017
Nov 6, 2017

Repository files navigation

make-it-restart Build Status

Make command or app restart. e.g. make electron/webpack... restart.

usage

install

npm install make-it-restart --save-dev

create a restartor

const restart = require('make-it-restart')
let restartor = restart(command, env)

parameter

  • command: it supports running commands directly which in ./node_modules/.bin/, like npm run.
  • env: set environment variables with an object.

example

script.js

let count = 0
console.log(process.env.NODE_ENV)
setInterval(() => {
    console.log(++count)
}, 500)

index.js

const restart = require('make-it-restart')

let restartor = restart('node ./script.js', { NODE_ENV: 'production' })

restartor()

setInterval(() => {
    restartor()
}, 2000)

result

production
1
2
3
restarting...
production
1
2
3
restarting...

About

Make command or app restart

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published