We should use the path returned by npm config get prefix
to determine the path of the global module directory and load all local plugins from there.
$ npm config get prefix
# /Users/blabla/.nvm/versions/node/v6.3.0
After that, we only need to append "/lib/node_modules" and we have the location of all of the local packages that have been linked to global scope (just an example):
/Users/blabla/.nvm/versions/node/v6.3.0/lib/node_modules
Once this is implemented, the only thing an author needs to do is run npm link
in the local repository of his plugin or theme as well as add the name to the "plugins" or to the "theme" property.
HyperTerm will then try to load the plugin/theme from the path shown above, follow the symlink and inject the code into the terminal.
In turn, this means that ~/.hyperterm_plugins
will only be used for modules installed automatically and directly from npm or other sources that aren't local.
It is a good idea to move to _convention over configuration_?
@leo, what's the overall benefits of this? I'm struggling to understand.
@CodeTheory Consistency. We're a community. We should all do as much as possible to simply agree on certain things because it makes it much easier for new and existing developers to understand how our ecosystem works. We can't just assume that a user needs a whole new workflow for each package he's using.
npm link
is how node developers are linking their local development instances of a packages to the project/app in which they want to use it and we should support that workflow. 馃槉
That makes sense. I don't work on a workflow for plugins at all so I was just inquiring. 馃槃
But why would you npm link
your HyperTerm plugin/theme? I don't use npm link
often, so I must be misinterpreting it, but I think that the point is that you can require
your package in other package.
Besides that, I think is easier and better to just put the plugin in .hyperterm_plugins/local
or hpm link
it (like you suggested in matheuss/hpm#18). I say _better_ because I see no point in "mixing" HypterTerm plugins/themes with the stuff in npm's global module directory 馃槹
HyperTerm plugins/themes are essentially node packages. It doesn't matter if they're local or not: They are packages. Because of that, we should use the same workflow as for all.
Also I wouldn't recommend putting your local HyperTerm packages into .hyperterm_plugins/local
because it basically means you're scattering all of your repositories across your whole system. Instead of that, you should put all of your local packages into a single directory, develop them in there and npm link
them to global scope and then use npm link <package>
to use them within a certain directory/project.
The reason why I don't want this feature in hpm is because npm already has it. Like I said, we shouldn't confuse new and existing devs and just add more and more functionality that is already possible with existing tools.
I like this idea. I haven't tried to develop an HyperTerm plugin yet, butt seems tedious to have to move the package or create a symbolic link in .hyperterm_plugins/local
for developing.
I agree with @leo, plugins are packages and they should be used like any package: download from npm (or from a tarball, or from github, etc...) or 'npm link' them during development.
I agree with @leo on this. Hyperterm plugins are node modules. Why should they be treated any differently? I'm used to creating modules and using npm link
to load them locally before publishing. This threw me off for about 15 minutes just now trying to figure out how to get started creating a module.
馃挴 to @leo
Is there something I'm missing or is there no way to build a local plugin that has dependencies from the npm registry?
I also assumed I would be able to just npm link my plugin, but apparently that's not the case; and because of that, hyperterm doesn't know to install my plugin's dependencies (and actually deletes them if I manually install them in ~/.hyper_plugins)
Most helpful comment
I like this idea. I haven't tried to develop an HyperTerm plugin yet, butt seems tedious to have to move the package or create a symbolic link in
.hyperterm_plugins/local
for developing.I agree with @leo, plugins are packages and they should be used like any package: download from npm (or from a tarball, or from github, etc...) or 'npm link' them during development.