feat: release design system engine, studio and component contracts
This commit is contained in:
1 parent
ff1065fb27
commit
3943b946d6
693 files changed
+175546
-3894
No files matched your search
@@ -1,24 +1,33 @@
|
||||
import {afterAll,expect,test} from "bun:test";
|
||||
import {mkdirSync,mkdtempSync,readFileSync,readdirSync,rmSync,writeFileSync} from "node:fs";
|
||||
import {join} from "node:path";
|
||||
import {runBuild} from "../src/build.ts";
|
||||
const scratch=join(import.meta.dir,".tmp-client-dependency");
|
||||
mkdirSync(scratch,{recursive:true});
|
||||
afterAll(()=>rmSync(scratch,{recursive:true,force:true}));
|
||||
test("changing a bundled dependency changes the immutable client URL",async()=>{
|
||||
const root=mkdtempSync(join(scratch,"app-"));
|
||||
mkdirSync(join(root,"app/pages"),{recursive:true});
|
||||
writeFileSync(join(root,"package.json"),JSON.stringify({name:"client-cache-fixture"}));
|
||||
writeFileSync(join(root,"wrnexus.config.ts"),"export default {};\n");
|
||||
writeFileSync(join(root,"app/pages/index.wrn"),'import {message} from "../message.ts"\npage Home { functions { client function show(){alert(message)} } view { <button type="button" on:click={show()}>Show message</button> } }');
|
||||
const files:string[]=[];
|
||||
for(const message of ["first dependency","updated dependency"]){
|
||||
writeFileSync(join(root,"app/message.ts"),`export const message=${JSON.stringify(message)};`);
|
||||
import { afterAll, expect, test } from "bun:test";
|
||||
import { mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { runBuild } from "../src/build.ts";
|
||||
const scratch = join(import.meta.dir, ".tmp-client-dependency");
|
||||
mkdirSync(scratch, { recursive: true });
|
||||
afterAll(() => rmSync(scratch, { recursive: true, force: true }));
|
||||
test("changing a bundled dependency changes the immutable client URL", async () => {
|
||||
const root = mkdtempSync(join(scratch, "app-"));
|
||||
mkdirSync(join(root, "app/pages"), { recursive: true });
|
||||
writeFileSync(join(root, "package.json"), JSON.stringify({ name: "client-cache-fixture" }));
|
||||
writeFileSync(join(root, "wrnexus.config.ts"), "export default {};\n");
|
||||
writeFileSync(
|
||||
join(root, "app/pages/index.wrn"),
|
||||
'import {message} from "../message.ts"\npage Home { functions { client function show(){alert(message)} } view { <button type="button" on:click={show()}>Show message</button> } }',
|
||||
);
|
||||
const files: string[] = [];
|
||||
for (const message of ["first dependency", "updated dependency"]) {
|
||||
writeFileSync(join(root, "app/message.ts"), `export const message=${JSON.stringify(message)};`);
|
||||
await runBuild(root);
|
||||
const file=readdirSync(join(root,"dist/client")).find(name=>name.startsWith("index-")&&readFileSync(join(root,"dist/client",name),"utf8").includes(message));
|
||||
const file = readdirSync(join(root, "dist/client")).find(
|
||||
(name) =>
|
||||
name.startsWith("index-") &&
|
||||
readFileSync(join(root, "dist/client", name), "utf8").includes(message),
|
||||
);
|
||||
expect(file).toBeDefined();
|
||||
files.push(file!);
|
||||
expect(readFileSync(join(root,"dist/server.js"),"utf8")).toContain(`/__wrnexus/client/${file}`);
|
||||
expect(readFileSync(join(root, "dist/server.js"), "utf8")).toContain(
|
||||
`/__wrnexus/client/${file}`,
|
||||
);
|
||||
}
|
||||
expect(files[0]).not.toBe(files[1]);
|
||||
},120000);
|
||||
}, 120000);
|
||||
Reference in new issue
Block a user