scaffold script started
This commit is contained in:
parent
a9ecc4672a
commit
7cf382777e
@ -84,10 +84,10 @@ Deno.serve({ port }, async (req: Request) => {
|
|||||||
const watcher = Deno.watchFs(".");
|
const watcher = Deno.watchFs(".");
|
||||||
for await (const event of watcher) {
|
for await (const event of watcher) {
|
||||||
if (event.kind === "modify") {
|
if (event.kind === "modify") {
|
||||||
console.log("reload", event.paths);
|
|
||||||
for (const ws of sockets) {
|
for (const ws of sockets) {
|
||||||
if (ws.readyState === WebSocket.OPEN) {
|
if (ws.readyState === WebSocket.OPEN) {
|
||||||
ws.send("reload");
|
ws.send("reload");
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
31
scaffold.ts
Normal file
31
scaffold.ts
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import { resolve, basename } from "https://deno.land/std/path/mod.ts";
|
||||||
|
|
||||||
|
const hostDir = "./scaffold/";
|
||||||
|
|
||||||
|
const filePaths = [
|
||||||
|
"index.html",
|
||||||
|
"app.js",
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
for (const filePath of filePaths)
|
||||||
|
{
|
||||||
|
// Resolve the file path relative to the script's directory
|
||||||
|
const fileUrl = import.meta.resolve(hostDir + filePath);
|
||||||
|
|
||||||
|
// Determine the destination path in the current working directory
|
||||||
|
const destinationPath = resolve(Deno.cwd(), basename(filePath));
|
||||||
|
|
||||||
|
console.log(`Downloading ${fileUrl} to ${destinationPath}`);
|
||||||
|
try {
|
||||||
|
const response = await fetch(fileUrl);
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to fetch ${fileUrl}: ${response.statusText}`);
|
||||||
|
}
|
||||||
|
const fileData = await response.arrayBuffer();
|
||||||
|
await Deno.writeFile(destinationPath, new Uint8Array(fileData));
|
||||||
|
console.log(`Successfully downloaded ${filePath}`);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Error downloading ${filePath}:`, error);
|
||||||
|
}
|
||||||
|
}
|
47
scaffold/app.js
Normal file
47
scaffold/app.js
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
const {DOM} = Gale({
|
||||||
|
Button: {
|
||||||
|
padding: "20px",
|
||||||
|
background: "orange",
|
||||||
|
".Inner": {
|
||||||
|
fontSize: "10rem"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Outline: {
|
||||||
|
border: "2px solid orange"
|
||||||
|
},
|
||||||
|
Window:{
|
||||||
|
height: "100vh",
|
||||||
|
border: "2px solid black",
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "row",
|
||||||
|
alignItems: "end",
|
||||||
|
justifyContent: "center",
|
||||||
|
gap: "10px"
|
||||||
|
},
|
||||||
|
Ability:{
|
||||||
|
width: "50px",
|
||||||
|
height: "50px",
|
||||||
|
background: "red",
|
||||||
|
transition: "all 0.4s",
|
||||||
|
":hover":{
|
||||||
|
transform:"scale(1.1)"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Orange:{
|
||||||
|
background:"orange"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const UI =()=>
|
||||||
|
{
|
||||||
|
return DOM.div.Window(
|
||||||
|
DOM.div.Ability(),
|
||||||
|
DOM.div.Ability(),
|
||||||
|
DOM.div.Ability(),
|
||||||
|
DOM.div.Ability.Orange(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
van.add(document.body, UI());
|
Loading…
Reference in New Issue
Block a user