File tree Expand file tree Collapse file tree 5 files changed +17
-5
lines changed
Expand file tree Collapse file tree 5 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -10,3 +10,5 @@ export const DAY = HOUR * 24;
1010export const WEEK = DAY * 7 ;
1111
1212export const ASSET_CACHE_BUST_KEY = "__frsh_c" ;
13+
14+ export const UPDATE_INTERVAL = DAY ;
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ import { parseDirPath } from "../config.ts";
2525import { pathToExportName , UniqueNamer } from "../utils.ts" ;
2626import { checkDenoCompilerOptions } from "./check.ts" ;
2727import { crawlFsItem } from "./fs_crawl.ts" ;
28- import { DAY } from "../constants.ts" ;
28+ import { UPDATE_INTERVAL } from "../constants.ts" ;
2929
3030export interface BuildOptions {
3131 /**
@@ -158,7 +158,7 @@ export class Builder<State = any> {
158158 options : ListenOptions = { } ,
159159 ) : Promise < void > {
160160 // Run update check in background
161- updateCheck ( DAY ) . catch ( ( ) => { } ) ;
161+ updateCheck ( UPDATE_INTERVAL ) . catch ( ( ) => { } ) ;
162162
163163 this . config . mode = "development" ;
164164
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ function getFreshCacheDir(): string | null {
4040 return null ;
4141}
4242
43- async function fetchLatestVersion ( ) {
43+ async function fetchLatestVersion ( ) : Promise < string > {
4444 const res = await fetch ( "https://dl.deno.land/fresh/release-latest.txt" ) ;
4545 if ( res . ok ) {
4646 return ( await res . text ( ) ) . trim ( ) . replace ( / ^ v / , "" ) ;
@@ -49,7 +49,7 @@ async function fetchLatestVersion() {
4949 throw new Error ( `Could not fetch latest version.` ) ;
5050}
5151
52- function readCurrentVersion ( ) {
52+ function readCurrentVersion ( ) : string {
5353 return CURRENT_FRESH_VERSION ;
5454}
5555
Original file line number Diff line number Diff line change @@ -10,3 +10,5 @@ export {
1010} from "./dev/dev_build_cache.ts" ;
1111export { specToName } from "./dev/builder.ts" ;
1212export { pathToSpec , UniqueNamer } from "./utils.ts" ;
13+ export { updateCheck } from "./dev/update_check.ts" ;
14+ export { UPDATE_INTERVAL } from "./constants.ts" ;
Original file line number Diff line number Diff line change @@ -14,7 +14,12 @@ import { clientSnapshot } from "./plugins/client_snapshot.ts";
1414import { serverSnapshot } from "./plugins/server_snapshot.ts" ;
1515import { patches } from "./plugins/patches.ts" ;
1616import process from "node:process" ;
17- import { specToName , UniqueNamer } from "@fresh/core/internal-dev" ;
17+ import {
18+ specToName ,
19+ UniqueNamer ,
20+ UPDATE_INTERVAL ,
21+ updateCheck ,
22+ } from "@fresh/core/internal-dev" ;
1823import { checkImports } from "./plugins/verify_imports.ts" ;
1924import { isBuiltin } from "node:module" ;
2025
@@ -147,6 +152,9 @@ export function fresh(config?: FreshViteConfig): Plugin[] {
147152 } ;
148153 } ,
149154 configResolved ( vConfig ) {
155+ // Run update check in background
156+ updateCheck ( UPDATE_INTERVAL ) . catch ( ( ) => { } ) ;
157+
150158 fConfig . islandsDir = pathWithRoot ( fConfig . islandsDir , vConfig . root ) ;
151159 fConfig . routeDir = pathWithRoot ( fConfig . routeDir , vConfig . root ) ;
152160
You can’t perform that action at this time.
0 commit comments