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

fix(cli): Explicitly cache NPM packages during deno install #24190

Merged
merged 3 commits into from
Jun 12, 2024

Conversation

nathanwhit
Copy link
Member

@nathanwhit nathanwhit commented Jun 12, 2024

Fixes a regression introduced in #24170, where we wouldn't actually set up the node modules dir on deno install if there was an up to date deno lockfile present.

Previously we were relying on the fact that resolving pending module resolution called cache_packages (which sets up the node modules dir). When pending resolutions were removed, and the resolve_pending function with it, we also removed the cache_packages call needed to set up node modules.

@nathanwhit nathanwhit requested a review from dsherret June 12, 2024 21:37
@nathanwhit nathanwhit merged commit a753136 into denoland:main Jun 12, 2024
17 checks passed
@nathanwhit nathanwhit deleted the install-regression branch June 12, 2024 23:06
@@ -75,6 +75,9 @@ pub async fn load_top_level_deps(factory: &CliFactory) -> Result<(), AnyError> {
let npm_resolver = factory.npm_resolver().await?;
if let Some(npm_resolver) = npm_resolver.as_managed() {
npm_resolver.ensure_top_level_package_json_install().await?;
// TODO(nathanwhit): we call `cache_packages` if the lockfile is modified,
// so by calling it here it's possible we end up calling it twice
npm_resolver.cache_packages().await?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be doing this within ensure_top_level_package_json_install. Does it not happen?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see:

if reqs
      .iter()
      .all(|req| self.resolution.resolve_pkg_id_from_pkg_req(req).is_ok())
    {
      log::debug!(
        "All package.json deps resolvable. Skipping top level install."
      );
      return Ok(()); // everything is already resolvable
    }

nathanwhit added a commit that referenced this pull request Jun 13, 2024
Fixes a regression introduced in
#24170, where we wouldn't actually
set up the node modules dir on `deno install` if there was an up to date
deno lockfile present.

Previously we were relying on the fact that resolving pending module
resolution called `cache_packages` (which sets up the node modules dir).
When pending resolutions were removed, and the `resolve_pending`
function with it, we also removed the `cache_packages` call needed to
set up node modules.
zebreus pushed a commit to zebreus/deno that referenced this pull request Jul 8, 2024
…nd#24190)

Fixes a regression introduced in
denoland#24170, where we wouldn't actually
set up the node modules dir on `deno install` if there was an up to date
deno lockfile present.

Previously we were relying on the fact that resolving pending module
resolution called `cache_packages` (which sets up the node modules dir).
When pending resolutions were removed, and the `resolve_pending`
function with it, we also removed the `cache_packages` call needed to
set up node modules.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants