fix(scripts/stylus-import): add calculated digest to userstyle entries (#1540)

This commit is contained in:
uncenter authored and GitHub committed 2024-12-28 19:40:43 -05:00
1 parent 699833e1a8
commit 21bec677c8
2 files changed
+12 -3

No files matched your search

Generated
+5 -1
View File
@@ -1219,8 +1219,12 @@
]
}
},
"redirects": {
"https://github.com/openstyles/stylus/raw/8fe35a4b90d85fb911bd7aa1deab4e4733c31150/src/js/sections-util.js": "https://raw.githubusercontent.com/openstyles/stylus/8fe35a4b90d85fb911bd7aa1deab4e4733c31150/src/js/sections-util.js"
},
"remote": {
"https://raw.githubusercontent.com/catppuccin/catppuccin/d4f2666c2b04337f0a8632713de0889d9a7d332d/resources/ports.schema.json": "39ce3bcd2dabd033010684df7caa82cc69c25584174eba0922e6435dce53f06a"
"https://raw.githubusercontent.com/catppuccin/catppuccin/d4f2666c2b04337f0a8632713de0889d9a7d332d/resources/ports.schema.json": "39ce3bcd2dabd033010684df7caa82cc69c25584174eba0922e6435dce53f06a",
"https://raw.githubusercontent.com/openstyles/stylus/8fe35a4b90d85fb911bd7aa1deab4e4733c31150/src/js/sections-util.js": "387e164ad40bc76048dccaafce6a032ac745616e7fc29f1873d7da33f5739502"
},
"workspace": {
"dependencies": [
+7 -2
View File
@@ -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");