Skip to content
This repository was archived by the owner on Sep 17, 2023. It is now read-only.

feat: add subcommand to lint depenendency versions for consistent values #152

Closed
wants to merge 1 commit into from

Conversation

EricCrosson
Copy link
Contributor

The lint-dependency-version subcommand takes a list of dependencies,
and for each dependency will test that there is at most one version
of that dependency in use throughout the target monorepo.

If this condition is violated, the command will exit non-zero exit code.

The plan is to use this in CI to enforce monorepo invariants for using
only a single version of a given external dependency; for example,
typescript.

Ideally we separate out the library and binary code in this crate,
and later we can write multiple binaries that use this library, one
of which will invoke this new code and can function as a stand-alone
Drone plugin. Thinking about it now, the coupling to Drone is not a
goal of this crate but importing the library portion of this codebase
from a different crate will be a prerequisite for the plugin.

})
.take(1)
.next()
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got a q for @ocornoc

Does clone not work here because we need to change types, and clone can only preserve type?

The `lint-dependency-version` subcommand takes a list of dependencies,
and for each dependency will test that there is at most one version
of that dependency in use throughout the target monorepo.

If this condition is violated, the command will exit non-zero exit code.

The plan is to use this in CI to enforce monorepo invariants for using
only a single version of a given external dependency; for example,
`typescript`.

Ideally we separate out the library and binary code in this crate,
and later we can write multiple binaries that use this library, one
of which will invoke this new code and can function as a stand-alone
Drone plugin. Thinking about it now, the coupling to Drone is not a
goal of this crate but importing the library portion of this codebase
from a different crate will be a prerequisite for the plugin.
@EricCrosson EricCrosson force-pushed the lint-dependency-version branch from 1970678 to c3810c0 Compare April 30, 2022 19:52
@@ -59,7 +61,6 @@ pub struct MakeDepend {

#[derive(Parser)]
pub struct Query {
/// internal-dependencies
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pretty sure this doesn't appear anywhere in the docstring

}

fn most_common_dependency_version(
package_manifests_by_dependency_version: &HashMap<String, Vec<String>>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ocornoc if I wanted to semantically type String to something narrower like PackageManifestPath or DependencyVersion, what would that look like?

@EricCrosson
Copy link
Contributor Author

Superseded by #156

@EricCrosson EricCrosson closed this May 7, 2022
@EricCrosson EricCrosson deleted the lint-dependency-version branch May 7, 2022 20:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant