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

feat: deduplicate log #275

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Changes from all commits
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
44 changes: 23 additions & 21 deletions src/cli/cmd-add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ export function makeAddCmd(
if (envResult.isErr()) return envResult;
const env = envResult.value;

if (typeof env.editorVersion === "string")
log.warn(
"editor.version",
`${env.editorVersion} is unknown, the editor version check is disabled`
);

const tryAddToManifest = async function (
manifest: UnityProjectManifest,
pkg: PackageReference
Expand Down Expand Up @@ -173,31 +179,27 @@ export function makeAddCmd(
const targetEditorVersion = targetEditorVersionResult.value;

// verify editor version
if (targetEditorVersion !== null) {
if (typeof env.editorVersion === "string") {
log.warn(
"editor.version",
`${env.editorVersion} is unknown, the editor version check is disabled`
);
} else if (
compareEditorVersion(env.editorVersion, targetEditorVersion) < 0
) {
log.warn(
"editor.version",
`requires ${targetEditorVersion} but found ${stringifyEditorVersion(
env.editorVersion
)}`
if (
targetEditorVersion !== null &&
typeof env.editorVersion !== "string" &&
compareEditorVersion(env.editorVersion, targetEditorVersion) < 0
) {
log.warn(
"editor.version",
`requires ${targetEditorVersion} but found ${stringifyEditorVersion(
env.editorVersion
)}`
);
if (!options.force) {
log.notice(
"suggest",
`upgrade the editor to ${targetEditorVersion}, or run with option -f to ignore the warning`
);
if (!options.force) {
log.notice(
"suggest",
`upgrade the editor to ${targetEditorVersion}, or run with option -f to ignore the warning`
);
return Err(new EditorIncompatibleError());
}
return Err(new EditorIncompatibleError());
}
}
}

// pkgsInScope
if (!isUpstreamPackage) {
log.verbose(
Expand Down
Loading