Skip to content

Accept local package-lock.json as target #1116

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

KirilldogU
Copy link
Contributor

This is a draft PR until resolving and analyzing Multi-target seeds in parallel is implemented.
Code contains functionality to accept, parse, and convert to a MultiTargetSeed a local package-lock.json.

@KirilldogU KirilldogU marked this pull request as draft April 9, 2025 19:36
@KirilldogU KirilldogU force-pushed the kusubyan/package-lock-json-target-support branch from 764dc3d to 5bed196 Compare April 9, 2025 19:36
Comment on lines 901 to 917
#[derive(Debug, Clone, clap::Args)]
pub struct CheckPackageLockJsonArgs {
/// package-lock.json to analyze
pub path: String,
}

impl ToTargetSeedKind for CheckPackageLockJsonArgs {
fn to_target_seed_kind(&self) -> Result<TargetSeedKind> {
let path = PathBuf::from(&self.path);
if path.exists() {
if self.path.ends_with("package-lock.json") {
return Ok(TargetSeedKind::Multi(MultiTargetSeedKind::PackageLockJson(
path,
)));
}
}
Err(hc_error!("The provided package-lock.json does not exist"))
}
}
Copy link
Collaborator

@j-lanson j-lanson Apr 9, 2025

Choose a reason for hiding this comment

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

@alilleybrinker thoughts on adding PackageLockJson as a supported hc check subcommand? Since we are trying to deprecate the hc check repo invocation style, and the method for detecting package lock json files is so straightforward, we could eschew adding hc check package-lock-json and force-rely on the target kind detection.

Only drawback is that we can't allow people to coerce the target kind, the file will always have to be named package-lock.json

@KirilldogU not saying to remove this yet

@KirilldogU KirilldogU self-assigned this Apr 9, 2025
@j-lanson
Copy link
Collaborator

j-lanson commented Apr 9, 2025

Kirill, can you fix the linting issue on this branch?

@KirilldogU KirilldogU force-pushed the kusubyan/package-lock-json-target-support branch from 5bed196 to 69fb0cb Compare April 9, 2025 20:54
@alilleybrinker alilleybrinker changed the title DRAFT: feat: accept local package-lock.json as target Accept local package-lock.json as target Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants