-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #910 from thefrontside/cl/www-sitemap
✨ Add sitemap.xml to website
- Loading branch information
Showing
11 changed files
with
711 additions
and
445 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"tasks": { | ||
"dev": "deno run -A lib/watch.ts components docs lib plugins routes -- deno run -A --lock-write main.tsx" | ||
"dev": "deno run -A lib/watch.ts components docs lib plugins routes -- deno run -A main.tsx" | ||
}, | ||
"lint": { | ||
"exclude": ["docs/esm"], | ||
|
@@ -17,8 +17,8 @@ | |
"jsxImportSource": "revolution" | ||
}, | ||
"imports": { | ||
"effection": "https://deno.land/x/[email protected].0-beta.2/mod.ts", | ||
"revolution": "https://deno.land/x/revolution@0.5.2/mod.ts", | ||
"revolution/jsx-runtime": "https://deno.land/x/revolution@0.5.2/jsx-runtime.ts" | ||
"effection": "https://deno.land/x/[email protected].3/mod.ts", | ||
"revolution": "https://deno.land/x/revolution@0.6.0/mod.ts", | ||
"revolution/jsx-runtime": "https://deno.land/x/revolution@0.6.0/jsx-runtime.ts" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
import { call, type Operation, resource, type Task, useScope } from "effection"; | ||
import structure from "./structure.json" assert { type: "json" }; | ||
import { | ||
all, | ||
call, | ||
type Operation, | ||
resource, | ||
type Task, | ||
useScope, | ||
} from "effection"; | ||
import structure from "./structure.json" with { type: "json" }; | ||
|
||
import { basename } from "https://deno.land/[email protected]/path/posix/basename.ts"; | ||
|
||
|
@@ -19,6 +26,7 @@ export interface DocModule { | |
} | ||
|
||
export interface Docs { | ||
all(): Operation<Doc[]>; | ||
getDoc(id?: string): Operation<Doc | undefined>; | ||
} | ||
|
||
|
@@ -102,6 +110,12 @@ export function loadDocs(): Operation<Docs> { | |
} | ||
|
||
yield* provide({ | ||
*all() { | ||
if (!loaders) { | ||
loaders = yield* load(); | ||
} | ||
return yield* all([...loaders.values()]); | ||
}, | ||
*getDoc(id) { | ||
if (id) { | ||
if (!loaders) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
import { | ||
action, | ||
filter, | ||
first, | ||
pipe, | ||
call, | ||
main, | ||
resource, | ||
run, | ||
sleep, | ||
type Stream, | ||
stream, | ||
|
@@ -15,7 +12,7 @@ import { parse } from "https://deno.land/[email protected]/flags/mod.ts"; | |
|
||
import { useCommand } from "./use-command.ts"; | ||
|
||
await run(function* () { | ||
await main(function* () { | ||
let scriptargs = parse(Deno.args, { | ||
"--": true, | ||
}); | ||
|
@@ -28,49 +25,36 @@ await run(function* () { | |
console.log(`watch: ${JSON.stringify(paths)}`); | ||
console.log(`run: ${cmd} ${args.join(" ")}`); | ||
|
||
yield* action<void>(function* (resolve) { | ||
Deno.addSignalListener("SIGINT", resolve); | ||
try { | ||
while (true) { | ||
yield* action(function* (restart) { | ||
let change = pipe( | ||
useFsWatch(paths), | ||
filter(function* (event) { | ||
return !event.paths.some((path) => | ||
ignores.some((ignore) => path.includes(ignore)) | ||
); | ||
}), | ||
); | ||
|
||
yield* useCommand(cmd, { args }); | ||
|
||
yield* first(change); | ||
while (true) { | ||
yield* call(function* () { | ||
let changes = yield* useFsWatch(paths); | ||
|
||
yield* sleep(100); | ||
yield* useCommand(cmd, { args }); | ||
|
||
console.log("changes detected, restarting..."); | ||
|
||
restart(); | ||
}); | ||
while (true) { | ||
let { value: change } = yield* changes.next(); | ||
if ( | ||
!change.paths.some((path) => | ||
ignores.some((ignore) => path.includes(ignore)) | ||
) | ||
) { | ||
break; | ||
} | ||
} | ||
} finally { | ||
Deno.removeSignalListener("SIGINT", resolve); | ||
} | ||
}); | ||
yield* sleep(100); | ||
console.log("changes detected, restarting..."); | ||
}); | ||
} | ||
}); | ||
|
||
function useFsWatch(paths: string | string[]): Stream<Deno.FsEvent, never> { | ||
return { | ||
subscribe() { | ||
return resource(function* (provide) { | ||
let watcher = Deno.watchFs(paths); | ||
try { | ||
let subscription = yield* stream(watcher).subscribe(); | ||
yield* provide(subscription as Subscription<Deno.FsEvent, never>); | ||
} finally { | ||
watcher.close(); | ||
} | ||
}); | ||
}, | ||
}; | ||
return resource(function* (provide) { | ||
let watcher = Deno.watchFs(paths); | ||
try { | ||
let subscription = yield* stream(watcher); | ||
yield* provide(subscription as Subscription<Deno.FsEvent, never>); | ||
} finally { | ||
watcher.close(); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.