background
When a package.json
file contains the following:
"package-deps": [
"vanilla",
"githubuser/chocolate"
],
the package-deps
code will install the vanilla package from atom.io and the chocolate package from github.com/githubuser/chocolate. Before installing, it will check whether these packages already exist.
expected behavior
Both vanilla and chocolate should be installed on first run, and neither should be installed again.
actual behavior
The vanilla package installs once, and never gets installed again (this is expected).
Unfortunately, the chocolate package gets installed every time Atom is loaded.
the cause
package-deps
checks whether a package is installed in this line from helpers.js, using a call to atom.packages.resolvePackagePath(name)
.
However, resolvePackagePath(name)
only works for actual package names, so it works for vanilla (and other packages from atom.io), but fails for githubuser/chocolate (because the package name is probably just chocolate, but might be something like atom-chocolate if the maintainer decided to use a package name different from the repo name! ;).
possible solution
The best solution I can think of is to expand the syntax of the package-deps
JSON key by allowing objects (or perhaps arrays) instead of just strings. The example above would be changed to something like this:
"package-deps": [
"vanilla",
{ "chocolate": "githubuser/chocolate" }
],
(The above object syntax is intended to be similar to the npm
"dependencies" syntax, but an array or a more structured map would work too.)
If this sounds like a good solution, I can write a pull request (but I'm not familiar with Flow, so it would be straight JS/ES).