-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Use CI friendly commands in documentation #326
Use CI friendly commands in documentation #326
Conversation
@dmitry-shibanov Anything blocking this from getting merged? |
+1 |
@@ -86,7 +86,7 @@ steps: | |||
node-version: '14' | |||
cache: 'npm' | |||
cache-dependency-path: '**/package-lock.json' | |||
- run: npm install | |||
- run: npm ci |
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.
Does it make sense to use npm ci
when the dependencies are being restored from a cache?
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 believe the cache option only caches the global cache, not the node_modules
directory. So it still makes sense.
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 does look like it's running npm config get cache
to get the path to cache, so that does make sense, thanks 👍
@dmitry-shibanov @brcrista @marko-zivic-93 is there any interest in getting this merged? |
Hello @jonkoops. Thank you for your pull request. I think we can adjust these changes when caching is enabled, because it relies on hash from dependency files. For other cases I think we should leave it as |
I think differently about this matter, checking in lockfiles is considered best practice for all package managers. Instead of appeasing users that might not have checked this file in we should encourage them to follow these practices. For example, the NPM documentation says the following about the
All of these points apply directly to Github and Github Actions and I believe that these best practices should be reflected here as well. I propose that all commands are replaced with their appropriate CI friendly versions as per the original purpose of this PR and that the documentation is amended to have a dedicated section to lockfiles. |
Replaces `npm install` with `npm ci` command and adds the `--frozen-lockfile` flag for Yarn and PNPM installation commands.
I've added some documentation about lockfiles as mentioned above. |
For an official action like this, I think it's important to use examples that adopt best practices. There are many beginners that read these examples that are not aware of the trade-offs between The problem with using For example, a new dependency update that satisfies the
|
Thank you @jonkoops for improving the documentation and your work. |
Thanks for taking this into consideration and merging it! |
Replaces
npm install
withnpm ci
command and adds the--frozen-lockfile
flag for Yarn and PNPM installation commands. This makes installation of packages faster (for NPM) and provides guarantees about lockfile correctness at install time.Previous efforts for this are documented in #103.