Skip to content
This repository has been archived by the owner on Jul 14, 2019. It is now read-only.

Publishing Your Command Modules to NPM

Alex Ford edited this page Mar 9, 2014 · 17 revisions

<< home


Shotgun supports the ability to publish command modules to NPM. To do this simply write your command module and publish it to NPM as you would any node module, except the name must begin with "shotguncmd-".

This ability allows anyone to "npm install shotguncmd-yourmodule" and shotgun will automatically load that command module. By default shotgun automatically searches your node_modules folder for any modules that begin with "shotguncmd-". You can disable this behavior by passing loadNpmCmds: false as an option when instantiating the shell. Here is an example of using multiple shell instances and disabling NPM command module loading in one of them:

// Will look in shotgun_cmds at the root of your project for command modules to load.
// Will load NPM command modules by default.
var shell1 = new shotgun.Shell();

// Will look in shell2_cmds at the root of your project for command modules to load.
// Will not load NPM command modules.
var shell2 = new shotgun.Shell({ cmdsDir: 'shell2_cmds', loadNpmCmds: false });

That's all the articles we have for now. Feel free to ask questions in the issue tracker if you get stuck :)


Next up: Shotgun In The Browser >>

Clone this wiki locally