fix(scripts/stylus-import): add calculated digest to userstyle entries (#1540)
This commit is contained in:
1 parent
699833e1a8
commit
21bec677c8
2 files changed
+12
-3
No files matched your search
@@ -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,
|
||||
@@ -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,
|
||||
@@ -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");
|
||||
|
||||
Reference in new issue
Block a user