-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
86db4da
commit a5aee4c
Showing
2 changed files
with
4 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
language: node_js | ||
node_js: | ||
- node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a5aee4c
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.
@silverwind this
rm -rf node_modules
is Linux only, This errors out Windows side. Is there another way to do this that works cross OS?a5aee4c
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 was under the impression that npm shims certain unix commands in the package scripts. Is this not the case?
Generally, I'd advice you to look into using a Unix-like shell, it's just less pain overall than trying to make things work in
cmd
orpowershell
. WSL or Cygwin are good options on Windows.a5aee4c
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 dont use WSL, probably never will, I could use bash that comes with Git for windows but I lose all my gitfified prompt which is not nearly as nice and complete in bash.
I dont think its a good tradeoff just to make this not error. Also I dont understand why this is needed, thers has to be a better way to do this.
No idea, clearly not.
a5aee4c
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.
Apparently there is https://github.com/shelljs/shx for this purpose.
a5aee4c
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.
Odd, the
rm -rf node_modules
works for me. I usually use git bash, but another very nice alternative is https://conemu.github.io/.a5aee4c
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.
Its not odd at all with git bash, I dont use it though.
a5aee4c
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.
In my scripts I use del-cli which is cross platform. I'm not sure how this would work for deleting the
node_modules
folder though, I only use it for cleaning up build assets.a5aee4c
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.
OK Ive tried
shx
it works and it doesnt.This is the setup
When I do
npm run update
it deletes the node_modules folder but it also says it cant find it.Console output
Debug log
Any clews?
a5aee4c
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.
Try putting it all in one command
npx updates -cu && shx rm -rf node_modules && npm install
. I think it's failing because it's deleting itself.a5aee4c
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.
Maybe you want to save yourself the headache and install coreutils for windows:
http://gnuwin32.sourceforge.net/packages/coreutils.htm
It looks pretty unmaintained, but I guess those tools never really change much anyways.
a5aee4c
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.
Ah, yes... I've encountered that issue before. I ended up doing this:
a5aee4c
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.
That wouldn't be a unclean module reinstallation. I have put this
rm
there because of past issues with npm not properly updatingnode_modules
, maybe it can actually be removed if npm can guarantee a consistent module state without deleting everything beforenpm install
.a5aee4c
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 just tried using this on Win10 (in the GitHub Dark repo) and it seemed to work as expected:
Since that's using
npx
it should be using a temp copy instead of the local copy correct? If I leave off thenpm install
portion the entirenode_modules
folder is deleted so it looks like a clean install happens at the end.a5aee4c
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.
@xt0rted that doesnt error out, but even if there are no updates it proceeds to install everything again.
SO wre adding quite a bit of tme for nothing when there are no updates
a5aee4c
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.
Hmm, @silverwind is there a way to get
npx updates -cu
to returnfalse
if there are no updates?a5aee4c
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.
No, but that sounds like a good addition, will add.
a5aee4c
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.
Actually, there is a suitable argument already:
So this should work:
It seems like a inverse exit code might actually be more easy to use, hmm.
a5aee4c
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 that so starting with
updates
8.3.0, you can conditionally reinstall modules like this:a5aee4c
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.
Actually, the command was sillily named. Fixed that by publishing 8.4.0, so it's now
-U
over-S
:@the-j0k3r if that works for you, feel free to add it to our repositories. Might want to run
npm i --save-dev rimraf
to have it in the dependencies.a5aee4c
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.
Why do you need to use
uU
? Wouldn't it be easier to just have it namedU
?a5aee4c
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.
-u
is the actual update action, without it will not writepackage.json
. I prefer to have that separate so arguments stay composable. Thought it probably doesn't make much sense to run-U
without-u
.a5aee4c
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.
Sorry, what I meant was to have
u
stay the same, butU
act likeu
but then error if no updates are available.a5aee4c
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.
But yeah, keeping them separate would probably be a better idea.