-
Notifications
You must be signed in to change notification settings - Fork 226
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
dart pub get --pristine/--locked #2890
Comments
Hello, @jonasfj 👋 I want to go ahead and work on this issue would you please give me the initial steps to get started with :) |
@adarsh-technocrat, I would suggest figuring out how to run tests locally, and then experiment, it probably just means:
|
Thanks, @jonasfj for guiding I'll look into it..:p |
I don't think adding an extra option to |
Just to be clear:
@yjbanov When would people prefer to to fail, rather than just get their dependencies? I envision that failing rather than modifying But when doing local development, if I'm adding a dependency to |
Compute a hash of each downloaded archive and store it in: $PUB_CACHE/hosted/<hosted-url>/.hashes/<package>-<version>.sha256 (details here still subject to change) New optional field in the package listing api for the server to provide the content-hash. If that is provided - it is verified against the downloaded archive. When writing a pubspec.lock file, the sha256 is included in the description of each hosted package. On pub get If the description of a package from pubspec.lock doesn't match the one in the cache, the archive is redownloaded - if the hash still doesn't match, the resolution fails with an error. Has been moved to a follow-up PR Introduce a new option dart pub get --enforce-lockfile A mode that will NOT modify pubspec.lock. That means: won't add hashes if missing, will refuse to resolve if pubspec.yaml isn't satisfied, will refuse to resolve if hashes don't match cached hashes. will refuse to resolve if pubspec.lock is missing will verify that the extracted package content matches the contents of the original archive. This is useful when deploying to production. Fixes: dart pub get --pristine/--locked #2890 and locked option in pubspec.yaml #2905 An unfortunate side-effect of this change is that all already downloaded packages will be re-downloaded (because we don't store the archives, only the extracted files) to compute their hashes.
This was not completed in #3482, but separated to a later PR. |
It would be nice to have a mode where
dart pub get
fails ifpubspec.lock
is missing or changes topubspec.lock
is required to satisfypubspec.yaml
.Could be called
dart pub get --locked
ordart pub get --pristine
.Motivation: When doing a production build (or deployment) you explicitly want to avoid any deviation from
pubspec.lock
as this could result in shipping dependencies you have not tested.The text was updated successfully, but these errors were encountered: