Skip to content

API for registering command line commands #109

@loppear

Description

@loppear

Currently it is possible (for e.g. a command to build js assets outside of app startup) for a module to act as a run-and-exit command with the following coordination:

  • A config flag to run whatever process and then stop & exit:
    if (this.config.commandName) this.runCommandAfterLaunch.then(::app.stop).then(::process.exit)
  • Disable the router module and application file watcher (there's a potentially larger set you might want to disable, but hard to reason about whether any might be contributing to the application behavior you want to command)
  • Combine all these flags into an npm script in the application file, e.g.
    DEBUG=nxus:module:* nxus_router__disabled=true nxus_module__command=true npm start

Ideally these patterns could be supported more directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions