UNPKG

@custody/plugin-command-restart-server

Version:

Custody plugin to add a command to restart a Node server (vs. the entire build process)

17 lines (14 loc) 414 B
const {join: joinPath} = require('path'); const {promisify} = require('promise-callbacks'); const fileExists = promisify(require('fs').access); async function canRestartServer(process) { const cwd = await process.getWorkingDirectory(); const appPath = joinPath(cwd, 'app.js'); try { await fileExists(appPath); return true; } catch (e) { return false; } } module.exports = canRestartServer;