managed-service-daemon
TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published

Managed Service Daemon

A wrapper for spawning child processes as managed daemons in Node, with typescript definitions included.

Usage

Install via NPM and require in your project.

const gulp = require('gulp')
const shell = require('gulp-shell')
const { Service } = require('managed-service-daemon')
const workingDir = './.azurite'
const azuriteBlob = new Service({
  name: 'azuriteBlob',
  command: 'node',
  args: [path.normalize('./node_modules/azurite/dist/src/blob/main'), '-s', '-l', workingDir],
  startWait: 500,
  onStart: () => fs.mkdirSync(workingDir),
  onStop: () => fs.rmdirSync(workingDir, { recursive: true })
})

exports.mocha = async function mocha () {
  return shell.task(['mocha'], { ignoreErrors: true })()
}

exports.test = gulp.series(azuriteBlob.start, exports.mocha, azuriteBlob.stop)

The Service options also accept all non-overlapping child_process.spawn options; overlapping options would include stdio, for example.

Aditional options specific to the Service class can be viewed in the TypeScript code.

Readme

Keywords

Package Sidebar

Install

npm i managed-service-daemon

Weekly Downloads

3

Version

1.2.1

License

MIT

Unpacked Size

15.9 kB

Total Files

10

Last publish

Collaborators

  • aaron.nuclearfamily