-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
make --pure-lockfile
default for install
#570
Comments
Summary: Wacky nodeModules.js is replaced with install-node-modules.js. A few concerns to address: - I did not make it a `hg mv nodeModules.js ..../install-node-modules.js` because I want to start with clean-ish slate and have a good peer review to the script - I did not want to use external dependencies for install-node-modules.js because I want this script to startup as fast as possible and don't want to either check in its dependencies or use yarn to install them. Otherwise I would use shell.js, node-fetch and optimist, still an option if this script proves to be a hassle to support Things to come: - hook up jsbuddy and flow on install-node-modules.js - yarnpkg/yarn#576 - yarnpkg/yarn#569 - yarnpkg/yarn#570 Usage for fbsource projects: ``` fbcode/react_native/kpm/wrapper/install-node-modules.sh fbsource/.../js-project ``` Reviewed By: yungsters Differential Revision: D3996416 fbshipit-source-id: 078b2ca5c076c2c6e2e7209945e59aaa31ebc4aa
I agree. There should be a discussion on why There is a case for |
Should there be a way to modify the lockfile without |
I suppose the option could be inveresed
On 17 October 2016 at 18:53, James Ide [email protected] wrote:
|
I am also confused by this. What is the reasoning for the current default behavior? |
Afaik, there was no strong reasons for the default behavior. |
BTW PR is welcome |
I think the reason for it was that yarn was originally designed with a single |
So, as to check if i understand this correctly:
Thanks for the explanation! |
The problem is that if the lockfile is pure by default then people are going to forget to update it since it'd be a separate command. |
@kittens Shouldn't the lock file only be updated upon add/remove/upgrade of any packages? Those should always upgrade the lock file, as well as an initial install. |
That being a problem depends on what you consider to be the main objective of a package manager. In my opinion, one of the roles a package manager fills is make it as easy as possible to get started with developing on a project. A simple With Another role of a package manager is giving projects control of their dependencies. If it is made pure by default, developers are able to have a look at |
I agree with everything @esphen says. I am surprised the pure behavior is not the default in Yarn – I thought this kind of consistency was the major benefit Yarn had over NPM. This should be the most compelling reason for switching from NPM the way I see it. |
Totally surprised us by breaking build after we started using |
@ide Imagine a scenario where someone is just using npm and updates |
Can someone please write up the scenarios that lead to the lockfile being modified unexpectedly? This change is a serious one and does make the lockfile a second class citizen by requiring updates to it to be explicit which means a lot of overhead in remembering what operations result in it being updated etc. |
More info on the above: our build has coffeescript from Github as a subdependency. coffeescript pushed some commits and we got a modified diff --git a/foo/yarn.lock b/foo/yarn.lock
index ec667fa..bb1f6ae 100644
--- a/foo/yarn.lock
+++ b/foo/yarn.lock
@@ -930,9 +930,9 @@ code-point-at@^1.0.0:
version "1.6.3"
resolved "https://registry.yarnpkg.com/coffee-script/-/coffee-script-1.6.3.tgz#6355d32cf1b04cdff6b484e5e711782b2f0c39be"
-"coffee-script@github:jashkenas/coffeescript":
+coffee-script@jashkenas/coffeescript:
version "1.11.1"
- resolved "https://codeload.github.com/jashkenas/coffeescript/tar.gz/887052de079b2f0af9f080031a00bb7544eaca08"
+ resolved "https://codeload.github.com/jashkenas/coffeescript/tar.gz/0d132318ce8f7116a436d97db1f2a5c8b1dedf28"
[email protected]:
version "0.3.0" |
I perceive Examples when I don't expect things changing:
|
If we assume that |
+1 yarn install should not mutate the yarn.lock
I'm not worried about updating the lock file. Ideally greenkeeper would do this when deps change and we could merge the lock file change then. |
I want to update this issue with the current thoughts about it. @kittens and I both think that It starts with how people add/remove/update dependencies. While there are commands for it, it is common practice to manually update the Once you have manually modified the On the topic of syncing, when you run an install with new dependencies you expect the Your On a side note I believe many people who are voicing support for this issue are confused about what's actually being discussed here. Using When you update your In regards to CI being able to get different dependencies when you have updated your If we were to make this change it would have a negative impact far more often when changing dependencies. For the reasons I've listed I say we should close this issue. |
@thejameskyle I would appreciate it if you could clarify something:
Here's a similar situation:
I think those are the kind of situations that most people are worried about. So if you could clarify that the current behavior of |
@jspiro, thanks for writing this up. Are you on latest version of Yarn? Questions:
Dev and optional dependencies can be left out for the same lockfile.
That is a nice feature request, would love to see a PR for that.
That reflects npm's behavior.
Yarn runs a quick shallow check by default.
Haven't seen this for a while.
After some time new versions of transitive dependencies might have been released. @jspiro, Yarn is a young community driven project, your PRs to make it better work for you are welcome. |
The behavior causing the Travis CI builds is a bug, see yarnpkg/yarn#1568 A more in-depth conversation around the lockfile behavior is in this issue: yarnpkg/yarn#570 Run `yarn upgrade to update yarn.lock.
Any chance to get at least an option to set the desired default behavior? |
Currently we are fixing this issue #3490, sometimes You can set --pure-lockfile/--frozen-lockfile to true in .yarnrc and it will be appended to the install command by default:
|
My problem is that if I don't use pure-lockfile I get the wrong version of the dependencies installed. It's not related the unwanted yarn.lock changes |
Can you submit an issue with repro steps? |
I was bitten by this as well when a I disagree though that As It's then up to the developer to decide which version to add in the package.json / yarn.lock. The unfortunate default of The gist should be though: Only commands like
|
I think we can enable this automatically when we detect we are in CI mode? |
@BYK I didn't realize this issue was closed before adding in here. Should I maybe open a new one or can this be reopened? |
I'd say open a new one |
Not sure if this has been said, but just in case: you don't have to invalidate the entire yarn.lock when anything in package.json changes. You can invalidate only the dependencies of only packages that were modified inside of package.json. F.e. if you updated only TypeScript, on the dependencies of TypeScript would need to be modified (with considerations respecting other unchanged packages). |
Do you want to request a feature or report a bug?
feature
What is the current behavior?
Not passing
--pure-lockfile
forinstall
command confuses me because it modifies the lock file while installing node_modules.We agreed on semantics that
add/upgrade/remove
are to change dependencies andinstall
is to consistently rebuild node_modules from lockfile.Consistency gets lost when lockfile is modified depending on environment (version of yarn currently installed).
What is the expected behavior?
Not write yarn.lock or package.json when doing
yarn install
.To update yarn.lock use
yarn upgrade
Please mention your node.js, yarn and operating system version.
yarn 0.14
The text was updated successfully, but these errors were encountered: