Skip to content
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

Merged
merged 16 commits into from
Jul 2, 2024
Prev Previous commit
Next Next commit
Use --frozen=false in error msg
  • Loading branch information
nathanwhit committed Jul 2, 2024
commit 2b79475803f059002f20555a3e486a9752a87d30
6 changes: 3 additions & 3 deletions cli/args/lockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 160,9 @@ impl CliLockfile {
let lockfile = self.lockfile.lock();
nathanwhit marked this conversation as resolved.
Show resolved Hide resolved
if self.frozen && lockfile.has_content_changed {
Copy link
Member

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.

let suggested = if *super::DENO_FUTURE {
"`deno cache`, `deno install`,"
"`deno cache --frozen=false`, `deno install --frozen=false`,"
} else {
"`deno cache`"
"`deno cache --frozen=false`"
};

let contents =
Expand All @@ -172,7 172,7 @@ impl CliLockfile {
// has an extra newline at the end
let diff = diff.trim_end();
Err(deno_core::anyhow::anyhow!(
"The lockfile is out of date. Run {suggested} or rerun without the `--frozen` flag to update it.\nchanges:\n{diff}"
"The lockfile is out of date. Run {suggested} or rerun with `--frozen=false` to update it.\nchanges:\n{diff}"
))
} else {
Ok(())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 1,4 @@
error: The lockfile is out of date. Run `deno cache` or rerun without the `--frozen` flag to update it.
error: The lockfile is out of date. Run `deno cache --frozen=false` or rerun with `--frozen=false` to update it.
changes:
5 | - "npm:@denotest/add@1": "npm:@denotest/[email protected]"
5 | "npm:@denotest/add@1": "npm:@denotest/[email protected]",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 1,5 @@
Download http://localhost:4545/welcome.ts
error: Uncaught (in promise) TypeError: The lockfile is out of date. Run `deno cache` or rerun without the `--frozen` flag to update it.
error: Uncaught (in promise) TypeError: The lockfile is out of date. Run `deno cache --frozen=false` or rerun with `--frozen=false` to update it.
changes:
14 | - "remote": {}
14 | "remote": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 1,7 @@
Download http://127.0.0.1:4250/@denotest/add/meta.json
Download http://127.0.0.1:4250/@denotest/add/1.0.0_meta.json
Download http://127.0.0.1:4250/@denotest/add/1.0.0/mod.ts
error: Uncaught (in promise) TypeError: The lockfile is out of date. Run `deno cache` or rerun without the `--frozen` flag to update it.
error: Uncaught (in promise) TypeError: The lockfile is out of date. Run `deno cache --frozen=false` or rerun with `--frozen=false` to update it.
changes:
5 | - "npm:@denotest/add@1": "npm:@denotest/[email protected]"
5 | "jsr:@denotest/add@1": "jsr:@denotest/[email protected]",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 1,5 @@
Download http://localhost:4260/@denotest/subtract
error: Uncaught (in promise) TypeError: The lockfile is out of date. Run `deno cache` or rerun without the `--frozen` flag to update it.
error: Uncaught (in promise) TypeError: The lockfile is out of date. Run `deno cache --frozen=false` or rerun with `--frozen=false` to update it.
changes:
5 | - "npm:@denotest/add@1": "npm:@denotest/[email protected]"
5 | "npm:@denotest/add@1": "npm:@denotest/[email protected]",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 1,4 @@
error: The lockfile is out of date. Run `deno cache` or rerun without the `--frozen` flag to update it.
error: The lockfile is out of date. Run `deno cache --frozen=false` or rerun with `--frozen=false` to update it.
changes:
5 | - "jsr:@denotest/add@1": "jsr:@denotest/[email protected]"
6 | - },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 1,6 @@
Download http://127.0.0.1:4250/@denotest/add/0.2.0_meta.json
Download http://127.0.0.1:4250/@denotest/add/0.2.0/mod.ts
error: The lockfile is out of date. Run `deno cache` or rerun without the `--frozen` flag to update it.
error: The lockfile is out of date. Run `deno cache --frozen=false` or rerun with `--frozen=false` to update it.
changes:
5 | - "jsr:@denotest/add@1": "jsr:@denotest/[email protected]"
6 | - },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 1,5 @@
Download http://localhost:4260/@denotest/subtract
error: The lockfile is out of date. Run `deno cache` or rerun without the `--frozen` flag to update it.
error: The lockfile is out of date. Run `deno cache --frozen=false` or rerun with `--frozen=false` to update it.
changes:
5 | - "npm:@denotest/add@1": "npm:@denotest/[email protected]"
5 | "npm:@denotest/add@1": "npm:@denotest/[email protected]",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 1,5 @@
Download http://localhost:4260/@denotest/bin
error: The lockfile is out of date. Run `deno cache` or rerun without the `--frozen` flag to update it.
error: The lockfile is out of date. Run `deno cache --frozen=false` or rerun with `--frozen=false` to update it.
changes:
5 | - "npm:@denotest/add@1": "npm:@denotest/[email protected]"
5 | "npm:@denotest/add@1": "npm:@denotest/[email protected]",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 1,5 @@
⚠️ `deno install` behavior will change in Deno 2. To preserve the current behavior use the `-g` or `--global` flag.
error: The lockfile is out of date. Run `deno cache`, `deno install`, or rerun without the `--frozen` flag to update it.
error: The lockfile is out of date. Run `deno cache --frozen=false`, `deno install --frozen=false`, or rerun with `--frozen=false` to update it.
changes:
5 | - "npm:@denotest/add@1": "npm:@denotest/[email protected]"
5 | "npm:@denotest/add@1": "npm:@denotest/[email protected]",
Expand Down
4 changes: 2 additions & 2 deletions tests/specs/lockfile/frozen_lockfile/no_lockfile_run.out
Original file line number Diff line number Diff line change
@@ -1,5 1,5 @@
Download http://localhost:4260/@denotest/add
error: The lockfile is out of date. Run `deno cache` or rerun without the `--frozen` flag to update it.
error: The lockfile is out of date. Run `deno cache --frozen=false` or rerun with `--frozen=false` to update it.
changes:
1 | -
1 | {
Expand All @@ -10,7 10,7 @@ changes:
6 | },
7 | "npm": {
8 | "@denotest/[email protected]": {
9 | "integrity": "sha512-vlb1k92Nai4CoHz1Z0XfhHLyaVXgvZSJjsQVooMsk/rdSAoRb1Qm8/DRsOdC6dnKGIQ4feIcUAP9JpHlukICYw==",
9 | "integrity": "[WILDCARD]",
10 | "dependencies": {}
11 | }
12 | }
Expand Down
Loading