Skip to content

Simplify the Node.js NPM caching example#690

Merged
vsvipul merged 2 commits into
actions:mainfrom
pimterry:patch-1
May 26, 2022
Merged

Simplify the Node.js NPM caching example#690
vsvipul merged 2 commits into
actions:mainfrom
pimterry:patch-1

Conversation

@pimterry

@pimterry pimterry commented Dec 3, 2021

Copy link
Copy Markdown
Contributor

This fixes #490. There's no good reason to have 3 examples here, especially when two of them (Windows & 'multiple systems') are effectively the same (they differ only in the ids they give the steps involved). The Linux example was different, but not better for any use cases - it just does the same thing in a more fragile & platform-specific way.

This change simplifies to a single suggested approach (the 3rd existing example) which works immediately for all platforms.

@pimterry pimterry requested a review from a team as a code owner December 3, 2021 16:40
@bishal-pdMSFT bishal-pdMSFT requested a review from vsvipul December 4, 2021 07:51
Comment thread examples.md

>Note: It is not recommended to cache `node_modules`, as it can break across Node versions and won't work with `npm ci`

### macOS and Ubuntu

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

IMO, we should keep this example as well, as it is much more simple without using an extra step. You can instead combine the two headers below (Windows and multiple systems) into one, which will be a much better approach. @bishal-pdMSFT thoughts?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's slightly simpler, but this is just copying and pasting anyway. Personally as a user, I just want one example that works everywhere.

More importantly though, this example isn't even 100% correct on Linux & Mac, as the hardcoded path here is actually configurable (by local & global config or env var). Checking npm config get cache is the only way to know what the correct path is for sure on any platform.

Also every other Node package manager in this file (Lerna, Yarn, Yarn 2) already uses a single two-step example like this, instead of having a special case that hardcodes the Mac/Linux default path.

Comment thread examples.md Outdated

@vsvipul vsvipul left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Left some comments. Do check.

@pimterry

Copy link
Copy Markdown
Contributor Author

@vsvipul any thoughts on this?

@vsvipul

vsvipul commented May 25, 2022

Copy link
Copy Markdown
Contributor

@pimterry Apologies for the very long delay in replying. Let's merge this. Can you please fix the merge conflicts?

@pimterry pimterry requested a review from a team as a code owner May 25, 2022 10:01
@pimterry

Copy link
Copy Markdown
Contributor Author

No problem @vsvipul - rebased with merge conflicts fixed.

@actions actions deleted a comment from Makaiza May 26, 2022

@vsvipul vsvipul left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Thank you for contributing 🚀

@vsvipul vsvipul merged commit 14c4fd4 into actions:main May 26, 2022
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.

Node npm 'windows' & 'multiple systems' examples are identical

3 participants