-
Notifications
You must be signed in to change notification settings - Fork 1
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
[DCA11Y-1145] Node version manager support #4
base: master
Are you sure you want to change the base?
[DCA11Y-1145] Node version manager support #4
Conversation
...ugin/src/main/java/com/github/eirslett/maven/plugins/frontend/mojo/AbstractFrontendMojo.java
Outdated
Show resolved
Hide resolved
...gin/src/main/java/com/github/eirslett/maven/plugins/frontend/mojo/InstallNodeAndNpmMojo.java
Outdated
Show resolved
Hide resolved
...nd-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/GlobalCache.java
Outdated
Show resolved
Hide resolved
...d-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/NPMInstaller.java
Outdated
Show resolved
Hide resolved
.../java/com/github/eirslett/maven/plugins/frontend/lib/version/manager/VersionManagerType.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of work, but looking pretty good so far
I think I'd rather we get feature complete now so we can do one QA demo to rule them all. I'm thinking in the QA demo we check;
I can't think of anything else right now |
Perhaps a good development loop is to set yourself up some docker containers, one for each version manager? Maybe you already having something working for you |
One case I'm not sure about yet is no version file is specified and a version of Node is specified in the POM. I'm tempted to say we should do the vanilla behaviour and download it ourselves. We tell the users that the file is missing and they probably should create it. This offers a simple way to drop-in this fork as a replacement in situations where they haven't previously created the files. That's because we'll have other features like incremental compilation which we want them to adopt. |
- fix fnm when multiple node versions installed - use fnm dir to get installed node - disable tests on windows - fix paths in tests setup
I have skipped the new tests on windows, for now I'll assume we don't support windows. I'll revisit it later |
… of version provided to fmp
QA Demo note: test on a project with split node installation in root and npm execution in modules |
…ger-support # Conflicts: # FORK_CHANGELOG.md # frontend-maven-plugin/src/main/java/com/github/eirslett/maven/plugins/frontend/mojo/NodeAndNpmMojo.java # frontend-maven-plugin/src/main/java/com/github/eirslett/maven/plugins/frontend/mojo/NpmMojo.java
+ update prebuild script output streams + fix npmmojo after nodemojo revert + fix fnm node directory
* Enables node installation using node version manager | ||
*/ | ||
@Parameter(property = "useNodeVersionManager", defaultValue = "true") | ||
private boolean useNodeVersionManager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do one more like you suggested before? Just direct path to where node binary is. Both Maven property and use System.getEnv
. I'm worried that someone will use an old branch with old version of this in the future and it won't support new version of FNM/NVS/etc. If we can tell them "no worries" modify your .mvn/cnfig
and/or shell envinroment, that will be a great get out of jail pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added installedNodeDirectory
property and AFMP_INSTALLED_NODE_DIRECTORY
env var for specifying node explicitly
...gin/src/main/java/com/github/eirslett/maven/plugins/frontend/mojo/InstallNodeAndNpmMojo.java
Outdated
Show resolved
Hide resolved
@@ -84,6 +102,19 @@ protected boolean skipExecution() { | |||
|
|||
@Override | |||
public synchronized void execute(FrontendPluginFactory factory) throws Exception { | |||
String nodeVersion = getNodeVersion(workingDirectory, this.nodeVersion, this.nodeVersionFile, project.getArtifactId(), getFrontendMavenPluginVersion()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to update metrics too so we can say x% of time using from version manager
} | ||
|
||
String validNodeVersion = getDownloadableVersion(nodeVersion); | ||
factory.loadNodeVersionManager(validNodeVersion); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to myself: Does this actually install if it's missing? If it does, not sure we want that? Probably don't want to encourage this, should be installing once in the parent POM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't, it only sets the values of node and npm executable paths if version manager is available
} | ||
|
||
String validNodeVersion = getDownloadableVersion(nodeVersion); | ||
factory.loadNodeVersionManager(validNodeVersion); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did it get the webpack binary before? Presumably out of node_modules/.bin
? How did it know the node version, relied on it being in the FMP managed node installation folder before?
...core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/FrontendPluginFactory.java
Outdated
Show resolved
Hide resolved
frontend-maven-plugin/src/it/node-version-manager/asdf/prebuild.groovy
Outdated
Show resolved
Hide resolved
Platform platform = installConfig.getPlatform(); | ||
String architecture = platform.getArchitectureName(); | ||
String osCodename = platform.getCodename(); | ||
String nodeOnPlatform = String.format("node-%s-%s-%s", nodeVersionWithV, osCodename, architecture); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All my local installastions are like:
fnm/node-versions/v6.17.1/installation/bin
. maybe only macOS problem?
until we can better reproduce, not sure the oscodename and architecture will perfectly match, hopefully they do and they might both be based off NodeJS' zip filename scheme
...ava/com/github/eirslett/maven/plugins/frontend/lib/version/manager/VersionManagerRunner.java
Outdated
Show resolved
Hide resolved
...ava/com/github/eirslett/maven/plugins/frontend/lib/version/manager/VersionManagerRunner.java
Outdated
Show resolved
Hide resolved
VersionManagerFactory versionManagerFactory = new VersionManagerFactory(installConfig); | ||
for (VersionManagerType versionManagerType : VersionManagerType.values()) { | ||
VersionManagerClient versionManagerClient = versionManagerFactory.getClient(versionManagerType); | ||
if (versionManagerClient.isInstalled()) return versionManagerType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like trying each version manager so people can have multiple installed without issues, e.g. fnm for everything except mise for JSM. Problem is we should adjust the logs to be less noisy. Single output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ATM it only checks if version manager directory is available but it doesn't check if node version is available in the version manager. This could be improved to choose version manager based on node versions available
|
||
} | ||
|
||
public VersionManagerType getVersionManagerType() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super nit: don't really gain anything from getters/setters when this isn't API. IDEs ca refeactor this almost instantly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, it was autogenerated by IDE in the first place. Some of the getters have extra logic so using getters for everything makes it uniform
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can probably avoid extraction if it's nested classclass, should be able to make public static nested. then it's only two line change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The exception is used in all the executor classes (BunExecutor, YarnExecutor, etc..). Nesting it will require changes in those classes instead AFAICS
...-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/NodeInstaller.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this cache shared between <executions>
(the Maven definiton)? If so, will cause problems if configuration is changing (it can) between them?
Sorry, I'm not trying to sound pass-agro, I reviewed, but I don't know the ansers yet till I read the code and play with it more. |
Changes: