Skip to content

Commit

Permalink
Deno update cache pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
rajsite committed Jul 21, 2024
1 parent 6fab26b commit f5320fa
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Deno/Packages/BuildTools/all-typescript-packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// to use with vendoring / lock file creation

import '../BuildTools/make-main.ts';
import '../BuildTools/make-vireo-dataurl.ts';
import '../TypeScript/Deno/deno.ts';
import '../TypeScript/DenoHTTP/deno-http.ts';
import '../TypeScript/Runtime/runtime-helper.ts';
import '../TypeScript/Runtime/runtime-helper.test.ts';
5 changes: 4 additions & 1 deletion Deno/Packages/BuildTools/make-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { DOMParser, Element, Node } from 'deno_dom/deno-dom-wasm.ts';

// Assumes main.html is at the root of the WebApp build output
const htmlUrl = new URL('../../Builds/Server_Default Web Server/main.html', import.meta.url);
await makeMain(htmlUrl);

interface ExtractedUrls {
vireoSource: string;
Expand Down Expand Up @@ -61,3 +60,7 @@ function extractUrls (html: string): ExtractedUrls {
};
return extractedUrls;
}

if (import.meta.main) {
await makeMain(htmlUrl);
}
6 changes: 4 additions & 2 deletions Deno/Packages/BuildTools/make-vireo-dataurl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ const encodedData = encode(data);
const vireoDataUrlContents = `export const vireoDataUrl = 'data:application/wasm;base64,${encodedData}';`;
const vireoDataUrlContentsPath = new URL('../TypeScript/Runtime/Support/vireo-data-url.js', import.meta.url);

await Deno.writeTextFile(vireoDataUrlContentsPath, vireoDataUrlContents);

function encode (data: Uint8Array) {
let binaryString = '';
for (let i = 0; i < data.length; i++) {
Expand All @@ -15,3 +13,7 @@ function encode (data: Uint8Array) {
const encodedData = btoa(binaryString);
return encodedData;
};

if (import.meta.main) {
await Deno.writeTextFile(vireoDataUrlContentsPath, vireoDataUrlContents);
}
3 changes: 2 additions & 1 deletion Deno/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"env": "export DENO_TLS_CA_STORE=mozilla,system",
"tool:rebuild-vireo-data-url": "deno run -A ./Packages/BuildTools/make-vireo-dataurl.ts",
"tool:deno-test": "deno test -A",
"tool:deno-compile": "deno task env && deno task build && deno compile -A \"./Builds/Server_Default Web Server/main.ts\""
"tool:deno-compile": "deno task env && deno task build && deno compile -A \"./Builds/Server_Default Web Server/main.ts\"",
"tool:deno-cache": "deno cache ./Packages/BuildTools/all-typescript-packages.ts"
},
"imports": {
"std/": "https://deno.land/std@0.194.0/",
Expand Down

0 comments on commit f5320fa

Please sign in to comment.