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): Warn on not-run lifecycle scripts with global cache #25786

Merged
merged 18 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Lint + comments + rename
  • Loading branch information
nathanwhit committed Sep 23, 2024
commit a8ba15a815d771199b6cb5931ea240e47c96321b
2 changes: 1 addition & 1 deletion cli/npm/managed/resolvers/common/lifecycle_scripts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ impl<'a> LifecycleScripts<'a> {
cwd: &package_path,
env_vars: env_vars.clone(),
custom_commands: custom_commands.clone(),
init_cwd: &init_cwd,
init_cwd,
argv: &[],
root_node_modules_dir: root_node_modules_dir_path,
},
Expand Down
19 changes: 14 additions & 5 deletions cli/npm/managed/resolvers/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,10 @@ impl NpmPackageFsResolver for LocalNpmPackageResolver {
}
}

fn local_node_modules_package_path(
/// `node_modules/.deno/<package>/node_modules/<package_name>`
///
/// Where the actual package is stored.
fn local_node_modules_package_contents_path(
local_registry_dir: &Path,
package: &NpmResolutionPackage,
) -> PathBuf {
Expand Down Expand Up @@ -691,7 +694,8 @@ async fn sync_resolution_with_fs(
Ok(())
}

fn local_package_folder_name(
/// `node_modules/.deno/<package>/`
fn local_node_modules_package_folder(
local_registry_dir: &Path,
package: &NpmResolutionPackage,
) -> PathBuf {
Expand All @@ -705,13 +709,15 @@ struct LocalLifecycleScripts<'a> {
}

impl<'a> LocalLifecycleScripts<'a> {
/// `node_modules/.deno/<package>/.scripts-run`
fn ran_scripts_file(&self, package: &NpmResolutionPackage) -> PathBuf {
local_package_folder_name(&self.deno_local_registry_dir, package)
local_node_modules_package_folder(self.deno_local_registry_dir, package)
.join(".scripts-run")
}

/// `node_modules/.deno/<package>/.scripts-warned`
fn warned_scripts_file(&self, package: &NpmResolutionPackage) -> PathBuf {
local_package_folder_name(&self.deno_local_registry_dir, package)
local_node_modules_package_folder(self.deno_local_registry_dir, package)
.join(".scripts-warned")
}
}
Expand All @@ -720,7 +726,10 @@ impl<'a> super::common::lifecycle_scripts::LifecycleScriptsStrategy
for LocalLifecycleScripts<'a>
{
fn package_path(&self, package: &NpmResolutionPackage) -> PathBuf {
local_node_modules_package_path(self.deno_local_registry_dir, package)
local_node_modules_package_contents_path(
self.deno_local_registry_dir,
package,
)
}

fn did_run_scripts(
Expand Down