Skip to content

Commit

Permalink
fix(scripts/stylus-import): add calculated digest to userstyle entries (
Browse files Browse the repository at this point in the history
  • Loading branch information
uncenter authored Dec 29, 2024
1 parent 699833e commit 21bec67
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions scripts/stylus-import/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { REPO_ROOT } from "@/constants.ts";
import * as path from "@std/path";
import usercssMeta from "usercss-meta";
import { ensureDir, walk } from "@std/fs";
import { calcStyleDigest } from "https://github.com/openstyles/stylus/raw/8fe35a4b90d85fb911bd7aa1deab4e4733c31150/src/js/sections-util.js";

const stylesheets = walk(path.join(REPO_ROOT, "styles"), {
includeFiles: true,
Expand All @@ -27,7 +28,7 @@ for await (const entry of stylesheets) {
const content = await Deno.readTextFile(entry.path);
const { metadata } = usercssMeta.parse(content);

data.push({
const userstyle = {
enabled: true,
name: metadata.name,
description: metadata.description,
Expand All @@ -36,7 +37,11 @@ for await (const entry of stylesheets) {
updateUrl: metadata.updateURL,
usercssData: metadata,
sourceCode: content,
});
} as Record<string, unknown>;

userstyle.originalDigest = await calcStyleDigest(userstyle);

data.push(userstyle);
}

await ensureDir("dist");
Expand Down

0 comments on commit 21bec67

Please sign in to comment.