[pulsar-next] Ensure the canary release channel's `pulsar` and `ppm` always work correctly
The “canary” channel — which I sometimes call “PulsarNext” because I can't decide on a name — is something we'll have to do for a while so that people can run the latest-Electron version alongside the regular Pulsar version. This roughly corresponds to Atom's concept of a separate “release channel”; Atom had beta and nightly release channels.
To make this possible, yarn dist --next (the --next flag is new) will tell the repo to build a different channel of Pulsar — complete with a different name, a different storage path (for IndexedDB and other data), and a different ATOM_HOME (since two versions of Pulsar with different underlying Electron versions shouldn't share ~/.pulsar). The pulsar and ppm executables should have different names — e.g., pulsar-next and ppm-next.
Perhaps most challenging is the fact that ppm-next will need to point to the PulsarNext app's ATOM_HOME. For instance, ppm-next should not list the packages that are installed into ~/.pulsar; it should default to listing the packages installed into ~/.pulsar-next.
Requirements:
- Alias
pulsarandppmto (e.g.)pulsar-nextandppm-nextso they don't get in the way - Make it impossible for
pulsar-nextto launch Pulsar - Make it impossible for
pulsarto launch PulsarNext - Make it difficult for
ppm-nextto install things in the wrongATOM_HOMEfolder and vice versa- we may want to let the user override this with
ATOM_HOME, but we might also want to introduce some sort of “are you sure”? speed bump here.
- we may want to let the user override this with
- Ensure
ppm-next rebuild foorebuilds packagefoo…- …in the correct location
- …against the correct version of Electron
- …both in the CLI and in the GUI (via the builtin
incompatible-packagespackage)
This is almost 100% done:
- At build time
pulsar.shis copied to the resources folder and named eitherpulsarorpulsar-nextdepending on the chosen release channel - That script also exports an
ATOM_BASE_NAMEvariable that the editor can read; that's how the editor itself knows which release channel it is (at least when launched via CLI) - The “Install Shell Commands” command needs to know the path of the script it's symlinking, so it first tries to read
ATOM_BASE_NAME, then falls back to checking for the presence of eitherpulsar.shorpulsar-next.sh(or.cmdfor Windows) in the resources directory -
pulsar.shis symlinked topulsar;pulsar-next.shis symlinked topulsar-next(whichever of the two is present) - If the user defines an explicit
ATOM_HOME, it's respected; otherwise the shell script picks the correctATOM_HOMEfor the user's release channel and exports it so the editor can read it
Things left to solve:
- What about when the editor isn't launched via CLI?
- I should define the release channel in a place that can be read by the app no matter how it's launched
- What about when
ppmis run in the terminal? How does it know that it's a version ofppmthat operates on a version of Pulsar under a different release channel? (In other words, how does it know it's supposed to install things in~/.pulsar-nextrather than~/.pulsar?- I might do what we did with Pulsar here and rename the binary to
ppm-nextat build time - Failing that, it could check for some metadata in its directory (this is what I'm doing now, but it feels hacky)
- I might do what we did with Pulsar here and rename the binary to