Compare commits

..

No commits in common. "6b68281ac0cfe4806021fe4c4dd909a6c47b9abd" and "334a0dd68d1a37e86eb499c08dcba1724c8d16e3" have entirely different histories.

9 changed files with 1277 additions and 38 deletions

View File

@ -1,8 +1,8 @@
import { articles } from "../lib/tasks/articles.js"; import { articles } from "../lib/tasks/articles.js";
import { css } from "../lib/tasks/css.js"; import { css } from "../lib/tasks.js";
import { fonts } from "../lib/tasks/fonts.js"; import { fonts } from "../lib/tasks.js";
import { images } from "../lib/tasks/images.js"; import { images } from "../lib/tasks.js";
import { svg } from "../lib/tasks/svg.js"; import { svg } from "../lib/tasks.js";
import { argv, exit } from "node:process"; import { argv, exit } from "node:process";
@ -13,6 +13,7 @@ const wrapTask = (name: string, task: () => Promise<void>) => async () => {
}; };
const TASKS = { const TASKS = {
all: wrapTask("all", () => fonts().then(images).then(svg).then(css).then(articles)),
articles: wrapTask("articles", articles), articles: wrapTask("articles", articles),
css: wrapTask("css", css), css: wrapTask("css", css),
fonts: wrapTask("fonts", fonts), fonts: wrapTask("fonts", fonts),

View File

@ -1,19 +0,0 @@
import { Worker } from "node:worker_threads";
import chokidar from "chokidar";
const watch = (glob: string | string[], task: string) =>
chokidar.watch(glob).on("change", (path: string) => {
console.log("[change]", path, "->", task);
return new Promise<void>((resolve) => {
const worker = new Worker(new URL(import.meta.resolve("./build.ts")), { argv: [task] });
worker.on("exit", () => resolve());
});
});
watch(["lib/views/*.tsx", "articles/**/*.asciidoc"], "articles");
watch("src/*.css", "css");
watch("src/*.avif", "images");
watch("src/*.svg", "svg");
watch("dist/_assets/fonts.manifest", "css");
watch("dist/_assets/css.manifest", "articles");

2
gulpfile.js Normal file
View File

@ -0,0 +1,2 @@
export * from "./lib/tasks.ts";
export { default } from "./lib/tasks.ts";

10
lib/tasks.ts Normal file
View File

@ -0,0 +1,10 @@
import { series } from "gulp";
import { articles } from "./tasks/articles.js";
import { css } from "./tasks/css.js";
import { fonts } from "./tasks/fonts.js";
import { images } from "./tasks/images.js";
import { svg } from "./tasks/svg.js";
import { watch } from "./tasks/watch.js";
export { articles, css, fonts, images, svg, watch };
export default series(fonts, images, svg, css, articles);

View File

@ -21,7 +21,7 @@ import { reloadAssets } from "../assets.js";
import { lastValueFrom, mergeMap, Observable, Subscriber } from "rxjs"; import { lastValueFrom, mergeMap, Observable, Subscriber } from "rxjs";
import { dest, fromGlob, onComplete } from "../rx-utils.js"; import { dest, fromGlob, onComplete } from "../rx-utils.js";
const Asciidoctor = (asciidoctor as unknown as () => asciidoctor.Asciidoctor)(); const Asciidoctor = asciidoctor();
const EXTENSION_REGISTRY = Asciidoctor.Extensions.create(); const EXTENSION_REGISTRY = Asciidoctor.Extensions.create();
EXTENSION_REGISTRY.inlineMacro("abbr", function () { EXTENSION_REGISTRY.inlineMacro("abbr", function () {
this.process(function (parent, target, attributes) { this.process(function (parent, target, attributes) {

16
lib/tasks/watch.ts Normal file
View File

@ -0,0 +1,16 @@
import gulp from "gulp";
import { articles } from "./articles.js";
import { css } from "./css.js";
import { images } from "./images.js";
import { svg } from "./svg.js";
export const watch = () => {
gulp.watch(["src/*.pug", "articles/**/*.asciidoc"], articles);
gulp.watch("src/*.css", css);
gulp.watch("src/*.avif", images);
gulp.watch("src/*.svg", svg);
gulp.watch("dist/_assets/fonts.manifest", css);
gulp.watch("dist/_assets/css.manifest", articles);
};

1233
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -5,11 +5,12 @@
"type": "module", "type": "module",
"dependencies": { "dependencies": {
"@mapbox/rehype-prism": "^0.9.0", "@mapbox/rehype-prism": "^0.9.0",
"@types/vinyl": "^2.0.12",
"asciidoctor": "^3.0.4", "asciidoctor": "^3.0.4",
"chokidar": "^3.6.0",
"cssnano": "^7.0.2", "cssnano": "^7.0.2",
"glob": "^10.4.2", "glob": "^10.4.2",
"gulp": "^5.0.0",
"gulp-cli": "^3.0.0",
"gulp-postcss": "^10.0.0",
"luxon": "^3.4.4", "luxon": "^3.4.4",
"postcss": "^8.4.38", "postcss": "^8.4.38",
"postcss-import": "^16.1.0", "postcss-import": "^16.1.0",
@ -22,18 +23,19 @@
"rxjs": "^7.8.1", "rxjs": "^7.8.1",
"tmp": "^0.2.3", "tmp": "^0.2.3",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"unified": "^11.0.4", "unified": "^11.0.4"
"vinyl": "^3.0.0"
}, },
"devDependencies": { "devDependencies": {
"@types/glob": "^8.1.0", "@types/glob": "^8.1.0",
"@types/gulp": "^4.0.17",
"@types/gulp-postcss": "^8.0.6",
"@types/luxon": "^3.4.2", "@types/luxon": "^3.4.2",
"@types/tmp": "^0.2.6", "@types/tmp": "^0.2.6",
"prettier": "^3.3.1" "prettier": "^3.3.1"
}, },
"scripts": { "scripts": {
"build": "node --import ./lib/ts-loader.js ./bin/build.ts", "build": "env NODE_OPTIONS='--import ./lib/ts-loader.js' gulp",
"watch": "node --import ./lib/ts-loader.js ./bin/watch.ts", "watch": "gulp watch",
"dev": "python -m http.server -d dist" "dev": "python -m http.server -d dist"
} }
} }

View File

@ -1,9 +1,13 @@
{ {
"ts-node": {
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "NodeNext"
}
},
"compilerOptions": { "compilerOptions": {
"esModuleInterop": true, "esModuleInterop": true,
"jsx": "react-jsx", "jsx": "react-jsx",
"jsxImportSource": "preact", "jsxImportSource": "preact"
"module": "NodeNext",
"moduleResolution": "NodeNext",
} }
} }