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

Fix #967 : Add pnpm executable to PATH #1045

Merged
merged 4 commits into from
Oct 8, 2022

Conversation

JulesAaelio
Copy link
Contributor

Summary

Fix the issue described in #967

the PNPMInstaller tries to copy pnpm & pnpm.cmd (copyPnpmScripts), but pnpm has no such predefined files, thus it does not find anything to copy.

The solution I propose is to create a symlink to node_modules/pnpm/bin/pnpm.cjs when no pnpm or pnpm.cmd is available.

Tests and Documentation

I tested using this dummy project : https://github.com/JulesAaelio/test-frontend-maven-plugin

@eirslett
Copy link
Owner

How will this work on Windows (which doesn't have symlinks, I think)?

@GuillaumeC
Copy link

pnpm work with symlinks to a global store. So it should be work on Windows too.

@JulesAaelio
Copy link
Contributor Author

Hi @eirslett ,
You have a valid point here, although symlinks are supposed to work on Windows 10 it is still unclear under what conditions.

According to their documentation, pnpm does'nt use symlinks neither, but junctions, that we cannot use here because we're trying to create a link to a file and not to a directory. https://pnpm.io/faq#does-it-work-on-windows

The others options to make this works on windows are :
As stated in the issue :

to execute cmd-shim if the files are not found.
to install the .tgz files with npm instead of just extracting them, which I assume would add the executables automatically. But of course that would require the npm to be installed in advance.

Or :
to use the freshly installed pnpm to "install" itself so it creates the executables.

=> As all of these are non-trivial, I propose to simply add a check before creating the symlink to ensure that we're running on a non-windows platform. I updated my code accordingly .

@eirslett
Copy link
Owner

eirslett commented Oct 1, 2022

👍

However, this project has an integration test that tries to run pnpm. As far as I can see, that integration test is now passing. Is it possible to create a reproduction of this bug/issue (a failing integration test), to show that the problem has indeed been fixed with this patch?

@JulesAaelio
Copy link
Contributor Author

JulesAaelio commented Oct 1, 2022

Sure, I can have a look. Should I include the new test in this merge request or in a new one ?
EDIT: Added in #1053

@eirslett
Copy link
Owner

eirslett commented Oct 2, 2022

@JulesAaelio I merged your PR with the failing integration test. As you can see here: https://github.com/eirslett/frontend-maven-plugin/actions/runs/3169669688/jobs/5161739948 it looks like the integration test is still failing on Ubuntu? Can you have a look?

If you rebase your pull request branch, the integration test should be included in there, so it's easier to check whether the test passes or fails.

A764364 and others added 3 commits October 3, 2022 23:17
@JulesAaelio
Copy link
Contributor Author

Hi @eirslett
Looks like the integration tests on ubuntu were failing due to a version mismatch between pnpm and node (Seems like pnpm compatibility table is not up to date).

=> I bumped the versions and the tests are now behaving as expected :
Failing on windows and passing on ubuntu
The macos job was cancelled because the windows job failed

@eirslett
Copy link
Owner

eirslett commented Oct 4, 2022

👍 So how do we make the test pass on Windows then?

@JulesAaelio JulesAaelio force-pushed the copy-pnpm-binary branch 6 times, most recently from f426247 to 50909c5 Compare October 8, 2022 16:52
@JulesAaelio
Copy link
Contributor Author

JulesAaelio commented Oct 8, 2022

As I said on my previous comment, making it work on windows is a bit more complicated and I don't feel like digging into it.
So I used a profile to ensure the test doesn't run.
It is not really a fix but the tests are passing. Let me know what you think :)

@eirslett
Copy link
Owner

eirslett commented Oct 8, 2022

Ok, let's merge it anyways! And hopefully somebody on Windows will fix it if they need it.

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.

3 participants