diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-08-16 09:12:52 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-16 13:12:52 +0000 |
commit | 57cd2951f193b02cbd3fb15f0ee14d83107a2855 (patch) | |
tree | 129294ae1f462a40bd75de5c88efa7982aed19c5 /cli/tools/registry/diagnostics.rs | |
parent | 105d27bc7db5c0d2fd18cb26f41bd3193be74639 (diff) |
feat(config/jsr): add license field (#25056)
1. Adds a new "license" field.
1. Adds this field by default when doing `deno init --lib`
Diffstat (limited to 'cli/tools/registry/diagnostics.rs')
-rw-r--r-- | cli/tools/registry/diagnostics.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/cli/tools/registry/diagnostics.rs b/cli/tools/registry/diagnostics.rs index e1c6e4e65..69434f1ea 100644 --- a/cli/tools/registry/diagnostics.rs +++ b/cli/tools/registry/diagnostics.rs @@ -120,8 +120,7 @@ pub enum PublishDiagnostic { }, SyntaxError(ParseDiagnostic), MissingLicense { - /// This only exists because diagnostics require a location. - expected_path: PathBuf, + config_specifier: Url, }, } @@ -214,7 +213,7 @@ impl Diagnostic for PublishDiagnostic { MissingConstraint { specifier, .. } => Cow::Owned(format!("specifier '{}' is missing a version constraint", specifier)), BannedTripleSlashDirectives { .. } => Cow::Borrowed("triple slash directives that modify globals are not allowed"), SyntaxError(diagnostic) => diagnostic.message(), - MissingLicense { .. } => Cow::Borrowed("missing license file"), + MissingLicense { .. } => Cow::Borrowed("missing license field or file"), } } @@ -282,8 +281,8 @@ impl Diagnostic for PublishDiagnostic { text_info: Cow::Borrowed(text_info), }, SyntaxError(diagnostic) => diagnostic.location(), - MissingLicense { expected_path } => DiagnosticLocation::Path { - path: expected_path.clone(), + MissingLicense { config_specifier } => DiagnosticLocation::Module { + specifier: Cow::Borrowed(config_specifier), }, } } @@ -400,7 +399,7 @@ impl Diagnostic for PublishDiagnostic { ), SyntaxError(diagnostic) => diagnostic.hint(), MissingLicense { .. } => Some( - Cow::Borrowed("add a LICENSE file to the package and ensure it is not ignored from being published"), + Cow::Borrowed("add a \"license\" field. Alternatively, add a LICENSE file to the package and ensure it is not ignored from being published"), ), } } |