-
Notifications
You must be signed in to change notification settings - Fork 72
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: javascript workspace bugs #1309
Changes from all commits
f78226f
5f5f00f
3c5a258
ed3b040
d71fadb
26d6965
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -355,10 +355,16 @@ pub struct WorkspaceInfo { | |
pub workspace_dir: Utf8PathBuf, | ||
/// Path to the root manifest of the workspace | ||
/// | ||
/// This can be either a Cargo.toml or package.json. In either case this manifest | ||
/// may or may not represent a "real" package. Both systems have some notion of | ||
/// "virtual" manifest which exists only to list the actual packages in the workspace. | ||
/// This can be either a Cargo.toml, package.json, dist.toml, or dist-workspace.toml. | ||
/// | ||
/// In most cases this manifest may or may not represent a "real" package. Many systems | ||
/// have some notion of "virtual" manifest which exists only to list the actual packages | ||
/// in the workspace. | ||
pub manifest_path: Utf8PathBuf, | ||
/// Path to the dist.toml or dist-workspace.toml for the workspace | ||
/// | ||
/// If this is ever set, then this will be the same as manifest_path. | ||
pub dist_manifest_path: Option<Utf8PathBuf>, | ||
/// If the workspace root has some auto-includeable files, here they are! | ||
/// | ||
/// This is currently what is use for top-level Announcement contents. | ||
|
@@ -406,6 +412,8 @@ impl RepositoryUrl { | |
if let Some(cur_url) = &repo_url { | ||
if &normalized_new_url == cur_url { | ||
// great! consensus! | ||
} else if cur_url.github_repo().ok() == normalized_new_url.github_repo().ok() { | ||
// good enough! consensus on the github repo! | ||
} else { | ||
return Err(AxoprojectError::InconsistentRepositoryKey { | ||
file1: repo_url_origin.as_ref().unwrap().to_owned(), | ||
|
@@ -443,8 +451,13 @@ pub struct PackageInfo { | |
/// | ||
/// This may be needed when e.g. talking to cargo about the package. | ||
pub true_version: Option<Version>, | ||
/// Path to the manifest for this package | ||
/// Path to the primary manifest for this package | ||
pub manifest_path: Utf8PathBuf, | ||
/// Path to a dist.toml overriding this package's contents | ||
/// | ||
/// NOTE: this WILL be the same path as the manifest_path for a pure dist.toml | ||
/// package. Don't assume these are disjoint! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there a reason people might assume they are disjoint beyond that they are 2 diff vars? and if so what's the consequence? besides... being wrong There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Code like init which loads up some state, edits it, and then writes it back could go sideways if it's too clever about batching edits / caching state, but forgets that these "two" files are the same one. This is not a problem with the current impl. |
||
pub dist_manifest_path: Option<Utf8PathBuf>, | ||
/// Path to the root dir for this package | ||
pub package_root: Utf8PathBuf, | ||
/// Name of the package | ||
|
@@ -547,6 +560,8 @@ pub struct PackageInfo { | |
/// A unique id used by Cargo to refer to the package | ||
#[cfg(feature = "cargo-projects")] | ||
pub cargo_package_id: Option<PackageId>, | ||
/// npm scope (with the @, like "@axodotdev") | ||
pub npm_scope: Option<String>, | ||
/// Command to run to build this package | ||
pub build_command: Option<Vec<String>>, | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,7 +105,7 @@ pub enum DistError { | |
}, | ||
|
||
/// Error parsing metadata in Cargo.toml (json because it's from cargo-metadata) | ||
#[error("Malformed metadata.dist in {manifest_path}")] | ||
#[error("Malformed metadata.dist in\n{manifest_path}")] | ||
#[diagnostic(help("you can find a reference for the configuration schema at https://opensource.axo.dev/cargo-dist/book/reference/config.html"))] | ||
CargoTomlParse { | ||
/// path to file | ||
|
@@ -320,7 +320,7 @@ pub enum DistError { | |
GitArchiveError {}, | ||
|
||
/// An error running `git -C path rev-parse HEAD` | ||
#[error("We failed to query information about the git submodule at {path}")] | ||
#[error("We failed to query information about the git submodule at\n{path}")] | ||
#[diagnostic(help("Does a submodule exist at that path? Has it been fetched with `git submodule update --init`?"))] | ||
GitSubmoduleCommitError { | ||
/// The path we failed to fetch | ||
|
@@ -465,6 +465,18 @@ pub enum DistError { | |
/// Error messsage details | ||
message: String, | ||
}, | ||
|
||
/// Something has metadata.dist but shouldn't | ||
#[error("The metadata.dist entry in this Cargo.toml isn't being used:\n{manifest_path}")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. love this |
||
#[diagnostic(help( | ||
"You probably want to move them to the [dist] section in\n{dist_manifest_path}" | ||
))] | ||
UnusedMetadata { | ||
/// The manifest that had the metadata.dist | ||
manifest_path: Utf8PathBuf, | ||
/// The dist.toml/dist-workspace.toml that means it's ignored | ||
dist_manifest_path: Utf8PathBuf, | ||
}, | ||
} | ||
|
||
/// This error indicates we tried to deserialize some YAML with serde_yml | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it true that this is the same as
manifest_path
for apackage.json
/Cargo.toml
workspace?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "if this is ever set" clause is doing heavy lifting here. Basically this option is morally a boolean saying manifest_path might be a dist(-workspace).toml, but I decided to make it an option to make code that deals with the pacakge version of dist_manifest_path uniform.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or i guess to put it another way -- if this is ever set, it's shared/generic workspace.