Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'ppm' bins to complement existing 'apm' bins #80

Merged
merged 2 commits into from
Jul 21, 2023

Conversation

DeeDeeG
Copy link
Member

@DeeDeeG DeeDeeG commented Jul 21, 2023

I think the PR title pretty much says what's going on here, but my extended thoughts below for anyone curious

Makes it easier to integrate ppm in various contexts, such as on the user's PATH to be run from the CLI, without having to run it as 'apm'.

Notably, this should make it easier to get a ppm.cmd command on users' PATHs on Windows, based on the method we've been using so far, which thus far has ended up giving users an apm.cmd command on Windows...

Aside/commentary: It also subjectively lets us do something less "jank" feeling than for ppm to be a symlink to apm on Unix-likes (Linux + macOS)... We can do ppm --> ppm instead now... But that hasn't been an issue thus far, honestly. I don't worry myself over that one, truthfully. It's just been an itch at the back of my neck to finally do this, I suppose, and the Windows integration gave me a real reason to finally do so.

Leaving the old 'apm' and 'apm.cmd' bins in case these are useful for troubleshooting during the transition to 'ppm'-named bins, or in case some edge case requires them.

(They're two small text files, I think we can afford to keep ones with either name, at least for now, if not forever. We'll see what's best.)

And less importantly, but relatedly...

Also adjusted a script that sets the correct file permissions on Windows, although this is really only relevant for sharing the files in archives (tarballs definitely, not sure if it affects zip files) -- notably when uploading the (packed, tarballed) package to the npm registry.

We do not publish ppm to the npm package registry, unlike what they used to do with apm. So, this doesn't really apply to us. Still, I wanted there to be parity / no bit-rot in this "legacy code" in case we change our minds and start publishing ppm to the npm package registry again like they did with apm. (Or else we can delete said code, on way or the other. I vote for keeping it, since it's not doing any harm, IMO... Less churn = less unexpected issues. Low stakes, might as well keep it, again IMO).

DeeDeeG added 2 commits July 20, 2023 21:24
Makes it easier to integrate ppm in various contexts, such as on the
user's PATH to be run from the CLI, without having to run it as 'apm'.

Leaving the old 'apm' and 'apm.cmd' bins in case these are useful for
troubleshooting during the transition to 'ppm'-named bins, or in case
some edge case requires them.

They're two small text files, I think we can afford to keep ones with
either name, at least for now, if not forever. We'll see what's best.
We just added a 'ppm' bin, better treat it the same as the 'apm' bin.

Apparently the file permissions for these binaries get easily
lost in translation when synced between Linux and Windows and back...

So, we explicitly set correct file permissions for the bins during
the postinstall script on Windows. Otherwise, the published bins
are somewhat broken (not easily runnable) for Linux users
when published from a Windows machine to the npm package registry
and then downloaded from there onto a Linux machine.

(Pulsar team doesn't publish ppm to the npm package registry,
but you never know when we might want to start doing that,
like they used to do with apm?)

(We might as well keep this "legacy code" functional,
ensuring parity for all relevant files it pertains to,
unless we're going to outright delete said "legacy code" entirely...)
Copy link
Member

@confused-Techie confused-Techie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super excited to see this!

Confirmed that these are completely identical with ./bin/apm and ./bin/apm.cmd respectively. As well as the change in ./script/postinstall.js has the exact same behavior applied to these others.

So even without testing behavior, if apm works (which obviously it does) then these are really almost sure fire to work as well.

Plus the want of having this change finally implemented is exciting, so wanting to fast track this.

Otherwise, like you mentioned, I see no harm in keeping the other files around still, they don't do any harm, and since Windows users have had to use apm for months, it makes sense to leave a grace period. Even if eventually I'd like to see those other files removed, I don't think it's harmful if that takes a while, or even only happens once PPM is moved into the core.

Thanks a ton for getting to this, lets get it merged!

@DeeDeeG
Copy link
Member Author

DeeDeeG commented Jul 21, 2023

Restating a key point in case that wall of text above was too long:

I opted for adding new bins (ppm and ppm.cmd), and leaving apm and apm.cmd for now until we're 1000% sure removing them hasn't broken anything, and to leave people the option to integrate how they wish -- we can use exclusively the ppm ones in our own first-party stuff, and let third parties do what they want??? Or just delete the apm ones as soon as we are sure nothing breaks with them gone. Either way...

I figure this is the lower-risk way to get the ppm and ppm.cmd bins out the door and shipped into Pulsar core. Though the other way isn't high risk that I can tell, so if we're set on it, we can just do so. It's just that the cost of doing it this was is virtually zero to us, IMO, so... Yeah, I went with this. Seems safe and low-cost to us/potential ecosystem integrations.

I still expect us to stop symlinking to the apm bin on Linux/macOS and instead link to the ppm one. And the ppm.cmd should be useful on Windows for sure, according to what I've heard @confused-Techie saying about this so far.

@DeeDeeG
Copy link
Member Author

DeeDeeG commented Jul 21, 2023

Codacy wants me to change code style in the middle of an existing JS file by adding a semicolon... 🤦

Suggested diff:

  fs.chmodSync(path.join(__dirname, '..', 'bin', 'apm'), 0o755)
- fs.chmodSync(path.join(__dirname, '..', 'bin', 'ppm'), 0o755)
+ fs.chmodSync(path.join(__dirname, '..', 'bin', 'ppm'), 0o755);
  fs.chmodSync(path.join(__dirname, '..', 'bin', 'npm'), 0o755)

(I'm not gonna do that, sorry Codacy.)

@DeeDeeG DeeDeeG merged commit 49c8ced into master Jul 21, 2023
@DeeDeeG DeeDeeG deleted the add-ppm-bins_not-just-apm-bins branch December 13, 2023 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants