|
What's the best way to use packages from npm in an event script? |
Replies: 1 comment
|
Yes, absolutely. The main thing to understand is that xyOps deliberately does not manage language-specific dependencies for Event Plugins. It is designed to be language-agnostic. At launch time, xyOps essentially starts the command configured in the Plugin, optionally supplies an inline script, sends the job data to the process over STDIN, and reads status messages and results from STDOUT. That is really the whole arrangement. This is what allows an Event Plugin to be written in Node.js, Python, Go, Ruby, PHP, a shell language, or virtually anything else. The tradeoff is that installing the program and its dependencies is left to the Plugin author or the administrator of the target server. So there is no special xyOps syntax for importing an npm package into an inline script. A statement such as: const library = require('some-library');will only work if Node.js can resolve There are three good ways to handle this, depending on how you plan to distribute and operate the event. Option 1: Package the event as an npm CLI and launch it with
|
Yes, absolutely. The main thing to understand is that xyOps deliberately does not manage language-specific dependencies for Event Plugins. It is designed to be language-agnostic. At launch time, xyOps essentially starts the command configured in the Plugin, optionally supplies an inline script, sends the job data to the process over STDIN, and reads status messages and results from STDOUT. That is really the whole arrangement.
This is what allows an Event Plugin to be written in Node.js, Python, Go, Ruby, PHP, a shell language, or virtually anything else. The tradeoff is that installing the program and its dependencies is left to the Plugin author or the administrator of the target server.
…