-
Notifications
You must be signed in to change notification settings - Fork 102
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
Bugfix for issue #667 - devon npm setup ignores a given version #668
Conversation
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.
@fdcg thanks for this great PR 👍
I did some minimal changes directly as constructive review.
For the download we should follow the new approach as commented in the review below.
Should I take over or would have have the chance/time to rework?
UPDATE: Did you also test my quickfix that has already been released?
doDevonCommand npm install -g "npm@${NPM_VERSION}" |
else | ||
local download_url="https://registry.npmjs.org/npm/-/npm-${software_version}.tgz" | ||
local software_dir="${NODE_HOME}/node_modules/npm" | ||
doInstall "${software_dir}" "${download_url}" "npm" "${software_version}" |
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.
this will not work as you have developed this PR for an older version of devonfw-ide and the function and download process has been improved and refactored. See: #641
So we should to put the URL into https://github.com/devonfw/ide-mirrors/ and change the arguments of doInstall
(see other commandlets that have been refactored already).
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.
As a quickfix, I changed the order of the parameters so it should already work, but we want to keep the download URLs out of our release as explained in #641
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 have already added the according config to the ide-mirrors repo:
https://github.com/devonfw/ide-mirrors/tree/master/npm
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.
so we could stip out the download_url (line 36) and change to:
doInstall "-" "${software_dir}" "npm" "${software_version}"
if [ -f "${NODE_HOME}/npm" ] | ||
then | ||
rm "${NODE_HOME}/npm" | ||
fi | ||
if [ -f "${NODE_HOME}/npm.cmd" ] | ||
then | ||
rm "${NODE_HOME}/npm.cmd" | ||
fi | ||
if [ -f "${NODE_HOME}/npx" ] | ||
then | ||
rm "${NODE_HOME}/npx" | ||
fi | ||
if [ -f "${NODE_HOME}/npx.cmd" ] | ||
then | ||
rm "${NODE_HOME}/npx.cmd" | ||
fi | ||
cp "${software_dir}/bin/npm" "${NODE_HOME}" | ||
cp "${software_dir}/bin/npm.cmd" "${NODE_HOME}" | ||
cp "${software_dir}/bin/npx" "${NODE_HOME}" | ||
cp "${software_dir}/bin/npx.cmd" "${NODE_HOME}" |
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.
Instead of removing and copying, I would prefer to create symlinks but due to windows limitations this does not seem to be an option. So I think there is no better solution than yours here that should always work (KISS).
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.
For the record: the current approach could fail on Windows if a npm.cmd
is currently running in parallel due to file locking.
@fdcg awesome. Thanks for updating this PR and testing on win. |
No description provided.