feat: add update.ts script (#706)
This commit adds an update.ts tool that makes it easy to upgrade existing Fresh projects to the latest version of Fresh. This tool updates dependency versions in the import map, and includes some code mods: 1. update projects from classic JSX to automatic JSX 2. update projects from legacy twind integration to twind plugin Both of these code mods get you about 95% of the way there most of the time. Users might still need to do some manual work to get their projects fully updated.
This commit is contained in:
@@ -10,3 +10,6 @@ export {
|
||||
export { walk } from "https://deno.land/std@0.150.0/fs/walk.ts";
|
||||
export { parse } from "https://deno.land/std@0.150.0/flags/mod.ts";
|
||||
export { gte } from "https://deno.land/std@0.150.0/semver/mod.ts";
|
||||
|
||||
// ts-morph
|
||||
export { Node, Project } from "https://deno.land/x/ts_morph@16.0.0/mod.ts";
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
export const RECOMMENDED_PREACT_VERSION = "10.10.6";
|
||||
export const RECOMMENDED_PREACT_RTS_VERSION = "5.2.2";
|
||||
export const RECOMMENDED_TWIND_VERSION = "0.16.17";
|
||||
|
||||
export function freshImports(imports: Record<string, string>) {
|
||||
imports["$fresh/"] = new URL("../../", import.meta.url).href;
|
||||
imports["preact"] = `https://esm.sh/preact@${RECOMMENDED_PREACT_VERSION}`;
|
||||
imports["preact/"] = `https://esm.sh/preact@${RECOMMENDED_PREACT_VERSION}/`;
|
||||
imports["preact-render-to-string"] =
|
||||
`https://esm.sh/*preact-render-to-string@${RECOMMENDED_PREACT_RTS_VERSION}/`;
|
||||
}
|
||||
|
||||
export function twindImports(imports: Record<string, string>) {
|
||||
imports["twind"] = `https://esm.sh/twind@${RECOMMENDED_TWIND_VERSION}`;
|
||||
imports["twind/"] = `https://esm.sh/twind@${RECOMMENDED_TWIND_VERSION}/`;
|
||||
}
|
||||
Reference in New Issue
Block a user