Files
Bartek IwańczukandClaude Opus 4.6 c0a866d027 fix: improve update tool output for Fresh 2 projects (#3754)
## Summary
- Detects whether a project is already on Fresh 2 by checking
`deno.json` imports
- Shows "Updating Fresh to X.Y.Z..." instead of "Starting Fresh 1 to
Fresh 2 migration..." for existing Fresh 2 projects
- Only shows "Breaking changes may require additional manual updates"
warning for actual Fresh 1→2 migrations
- Summary/completion messages adapt accordingly ("Update" vs
"Migration")

Closes #3688

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 09:48:38 +02:00

45 lines
1.1 KiB
TypeScript

import { parseArgs } from "@std/cli/parse-args";
import * as path from "@std/path";
import { ensureMinDenoVersion, error } from "./utils.ts";
import { updateProject } from "./update.ts";
import * as colors from "@std/fmt/colors";
const MIN_DENO_VERSION = "1.43.1";
const HELP = `@fresh/update
Update a Fresh project. This updates dependencies and optionally performs code
mods to update a project's source code to the latest recommended patterns.
To upgrade a project in the current directory, run:
deno run -A jsr:@fresh/update .
USAGE:
@fresh/update [DIRECTORY]
`;
ensureMinDenoVersion(MIN_DENO_VERSION);
const flags = parseArgs(Deno.args, {});
// deno-lint-ignore no-console
console.log(colors.bgRgb8(
colors.rgb8(" 🍋 Fresh Updater ", 0),
121,
));
// deno-lint-ignore no-console
console.log();
let unresolvedDirectory = Deno.args[0];
if (flags._.length !== 1) {
const userInput = prompt("Where is the project directory?", ".");
if (!userInput) {
error(HELP);
}
unresolvedDirectory = userInput;
}
const dir = path.resolve(unresolvedDirectory);
await updateProject(dir);