-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
feat(cli): Add --frozen
flag to error out if lockfile is out of date
#24355
Conversation
6de7f8a
to
8908220
Compare
As suggested in #24355 (comment). I wasn't able to hide the mutex stuff as much as I'd like (ended up just adding an escape hatch `inner()` method that locks the inner mutex), because you can't return references to the inner fields through a mutex. This is mostly motivated by the frozen lockfile changes
66d248a
to
87d8ecc
Compare
87d8ecc
to
8b450a3
Compare
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.
Looks great!
Can you add one test for something that does a non-analyzable dynamic import of an npm package and then another for an https or jsr specifier? It looks like the code will handle it.
…and#24366) As suggested in denoland#24355 (comment). I wasn't able to hide the mutex stuff as much as I'd like (ended up just adding an escape hatch `inner()` method that locks the inner mutex), because you can't return references to the inner fields through a mutex. This is mostly motivated by the frozen lockfile changes
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.
LGTM!
cli/args/lockfile.rs
Outdated
Err(err) => Err(err).with_context(|| { | ||
format!("Failed reading lockfile '{}'", filename.display()) | ||
}), | ||
} | ||
} | ||
pub fn error_if_changed(&self) -> Result<(), AnyError> { | ||
let lockfile = self.lockfile.lock(); | ||
if self.frozen && lockfile.has_content_changed { |
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 the future, we should probably error on insert into the lockfile.
An issue at the moment, is if a dynamic import inserts into the lockfile then all future dynamic imports will fail.
…and#24366) As suggested in denoland#24355 (comment). I wasn't able to hide the mutex stuff as much as I'd like (ended up just adding an escape hatch `inner()` method that locks the inner mutex), because you can't return references to the inner fields through a mutex. This is mostly motivated by the frozen lockfile changes
denoland#24355) Closes denoland#18296. Adds a `--frozen` (alias `--frozen-lockfile`) flag that errors out if the lockfile is out of date. This is useful for running in CI (where an out of date lockfile is usually a mistake) or to prevent accidental changes in dependencies. 
This commit deprecates `--lock-write` flag by removing it from the help output and printing a warning message when it's used. Users should use `--frozen=false` instead which was added in denoland#24355. Towards denoland#24167.
Closes #18296.
Adds a
--frozen
(alias--frozen-lockfile
) flag that errors out if the lockfile is out of date. This is useful for running in CI (where an out of date lockfile is usually a mistake) or to prevent accidental changes in dependencies.