build: use node for build

sass-embedded causes more trouble with deno than it's worth.
This commit is contained in:
winston 2023-03-26 17:16:45 +02:00
parent 646955be47
commit 342fda0cde
No known key found for this signature in database
GPG key ID: 3786770EDBC2B481
12 changed files with 287 additions and 207 deletions

2
.gitignore vendored
View file

@ -1 +1,3 @@
node_modules/
/dist/ /dist/
*.tar.gz

29
build.js Normal file
View file

@ -0,0 +1,29 @@
const fs = require("fs");
const path = require("path");
const sass = require("sass");
const ctp = require("@catppuccin/palette");
const builder = (flavor, accent) => `
@import "@catppuccin/palette/scss/${flavor}";
$accent: $${accent};
$isDark: ${flavor !== "latte"};
@import "theme";
`;
for (const flavor of Object.keys(ctp.variants)) {
for (const accent of Object.keys(ctp.labels)) {
const input = builder(flavor, accent);
const result = sass.compileString(input, {
loadPaths: [
path.join(__dirname, "src"),
path.join(__dirname, "node_modules"),
],
});
fs.mkdirSync(path.join(__dirname, "dist"), { recursive: true });
fs.writeFileSync(
path.join(__dirname, "dist", `theme-catppuccin-${flavor}-${accent}.css`),
result.css
);
}
}

View file

@ -1,45 +0,0 @@
#!/usr/bin/env -S deno run --allow-read --allow-write --allow-run --allow-env
import { path, sass } from "./deps.ts";
const accents = [
"rosewater",
"flamingo",
"pink",
"mauve",
"red",
"maroon",
"peach",
"yellow",
"green",
"teal",
"sky",
"sapphire",
"blue",
"lavender",
];
const flavors = ["latte", "frappe", "macchiato", "mocha"];
const dirname = path.dirname(path.fromFileUrl(import.meta.url));
const builder = (flavor: string, accent: string) => `
@import "catppuccin/${flavor}";
$accent: $${accent};
$isDark: ${flavor !== "latte"};
@import "theme";
`;
for (const flavor of flavors) {
for (const accent of accents) {
const input = builder(flavor, accent);
const result = await sass.compileStringAsync(input, {
loadPaths: [path.join(dirname, "src")],
});
Deno.mkdirSync(path.join(dirname, "dist"), { recursive: true });
await Deno.writeTextFile(
path.join(dirname, "dist", `theme-catppuccin-${flavor}-${accent}.css`),
result.css
);
}
}

View file

@ -1,2 +0,0 @@
export * as path from "https://deno.land/std@0.180.0/path/mod.ts";
export * as sass from "npm:sass-embedded@1.59.3";

View file

@ -1,41 +0,0 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1678901627,
"narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1678987615,
"narHash": "sha256-lF4agoB7ysQGNHRXvOqxtSKIZrUZwClA85aASahQlYM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "194c2aa446b2b059886bb68be15ef6736d5a8c31",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,15 +0,0 @@
{
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = {
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
devShells.default = pkgs.mkShell {buildInputs = [pkgs.deno];};
}
);
}

247
package-lock.json generated Normal file
View file

@ -0,0 +1,247 @@
{
"name": "gitea",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"devDependencies": {
"@catppuccin/palette": "^0.1.7",
"sass": "^1.60.0"
}
},
"node_modules/@catppuccin/palette": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/@catppuccin/palette/-/palette-0.1.7.tgz",
"integrity": "sha512-tgYE1PQLEs4Nz/OA28/kD0WhJKQEvXcuL2BPVdyHYQr0zb9l03lAwRXt7ZAP5PPuczFq0BgemPPdAdG+T2FZug==",
"dev": true,
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/catppuccin"
},
{
"type": "github",
"url": "https://github.com/sponsors/catppuccin"
}
]
},
"node_modules/anymatch": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
"integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
"dev": true,
"dependencies": {
"normalize-path": "^3.0.0",
"picomatch": "^2.0.4"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/binary-extensions": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/braces": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"dev": true,
"dependencies": {
"fill-range": "^7.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/chokidar": {
"version": "3.5.3",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
"integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
"dev": true,
"funding": [
{
"type": "individual",
"url": "https://paulmillr.com/funding/"
}
],
"dependencies": {
"anymatch": "~3.1.2",
"braces": "~3.0.2",
"glob-parent": "~5.1.2",
"is-binary-path": "~2.1.0",
"is-glob": "~4.0.1",
"normalize-path": "~3.0.0",
"readdirp": "~3.6.0"
},
"engines": {
"node": ">= 8.10.0"
},
"optionalDependencies": {
"fsevents": "~2.3.2"
}
},
"node_modules/fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"dev": true,
"dependencies": {
"to-regex-range": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/fsevents": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"hasInstallScript": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/glob-parent": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
"dev": true,
"dependencies": {
"is-glob": "^4.0.1"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/immutable": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.0.tgz",
"integrity": "sha512-0AOCmOip+xgJwEVTQj1EfiDDOkPmuyllDuTuEX+DDXUgapLAsBIfkg3sxCYyCEA8mQqZrrxPUGjcOQ2JS3WLkg==",
"dev": true
},
"node_modules/is-binary-path": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
"dev": true,
"dependencies": {
"binary-extensions": "^2.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/is-glob": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
"dev": true,
"dependencies": {
"is-extglob": "^2.1.1"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true,
"engines": {
"node": ">=0.12.0"
}
},
"node_modules/normalize-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/picomatch": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"dev": true,
"engines": {
"node": ">=8.6"
},
"funding": {
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/readdirp": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
"dev": true,
"dependencies": {
"picomatch": "^2.2.1"
},
"engines": {
"node": ">=8.10.0"
}
},
"node_modules/sass": {
"version": "1.60.0",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.60.0.tgz",
"integrity": "sha512-updbwW6fNb5gGm8qMXzVO7V4sWf7LMXnMly/JEyfbfERbVH46Fn6q02BX7/eHTdKpE7d+oTkMMQpFWNUMfFbgQ==",
"dev": true,
"dependencies": {
"chokidar": ">=3.0.0 <4.0.0",
"immutable": "^4.0.0",
"source-map-js": ">=0.6.2 <2.0.0"
},
"bin": {
"sass": "sass.js"
},
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/source-map-js": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
"integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"dependencies": {
"is-number": "^7.0.0"
},
"engines": {
"node": ">=8.0"
}
}
}
}

9
package.json Normal file
View file

@ -0,0 +1,9 @@
{
"devDependencies": {
"@catppuccin/palette": "^0.1.7",
"sass": "^1.60.0"
},
"scripts": {
"build": "node ./build.js"
}
}

View file

@ -1,26 +0,0 @@
$rosewater: #f2d5cf;
$flamingo: #eebebe;
$pink: #f4b8e4;
$mauve: #ca9ee6;
$red: #e78284;
$maroon: #ea999c;
$peach: #ef9f76;
$yellow: #e5c890;
$green: #a6d189;
$teal: #81c8be;
$sky: #99d1db;
$sapphire: #85c1dc;
$blue: #8caaee;
$lavender: #babbf1;
$text: #c6d0f5;
$subtext1: #b5bfe2;
$subtext0: #a5adce;
$overlay2: #949cbb;
$overlay1: #838ba7;
$overlay0: #737994;
$surface2: #626880;
$surface1: #51576d;
$surface0: #414559;
$base: #303446;
$mantle: #292c3c;
$crust: #232634;

View file

@ -1,26 +0,0 @@
$rosewater: #dc8a78;
$flamingo: #dd7878;
$pink: #ea76cb;
$mauve: #8839ef;
$red: #d20f39;
$maroon: #e64553;
$peach: #fe640b;
$yellow: #df8e1d;
$green: #40a02b;
$teal: #179299;
$sky: #04a5e5;
$sapphire: #209fb5;
$blue: #1e66f5;
$lavender: #7287fd;
$text: #4c4f69;
$subtext1: #5c5f77;
$subtext0: #6c6f85;
$overlay2: #7c7f93;
$overlay1: #8c8fa1;
$overlay0: #9ca0b0;
$surface2: #acb0be;
$surface1: #bcc0cc;
$surface0: #ccd0da;
$crust: #dce0e8;
$mantle: #e6e9ef;
$base: #eff1f5;

View file

@ -1,26 +0,0 @@
$rosewater: #f4dbd6;
$flamingo: #f0c6c6;
$pink: #f5bde6;
$mauve: #c6a0f6;
$red: #ed8796;
$maroon: #ee99a0;
$peach: #f5a97f;
$yellow: #eed49f;
$green: #a6da95;
$teal: #8bd5ca;
$sky: #91d7e3;
$sapphire: #7dc4e4;
$blue: #8aadf4;
$lavender: #b7bdf8;
$text: #cad3f5;
$subtext1: #b8c0e0;
$subtext0: #a5adcb;
$overlay2: #939ab7;
$overlay1: #8087a2;
$overlay0: #6e738d;
$surface2: #5b6078;
$surface1: #494d64;
$surface0: #363a4f;
$base: #24273a;
$mantle: #1e2030;
$crust: #181926;

View file

@ -1,26 +0,0 @@
$rosewater: #f5e0dc;
$flamingo: #f2cdcd;
$pink: #f5c2e7;
$mauve: #cba6f7;
$red: #f38ba8;
$maroon: #eba0ac;
$peach: #fab387;
$yellow: #f9e2af;
$green: #a6e3a1;
$teal: #94e2d5;
$sky: #89dceb;
$sapphire: #74c7ec;
$blue: #89b4fa;
$lavender: #b4befe;
$text: #cdd6f4;
$subtext1: #bac2de;
$subtext0: #a6adc8;
$overlay2: #9399b2;
$overlay1: #7f849c;
$overlay0: #6c7086;
$surface2: #585b70;
$surface1: #45475a;
$surface0: #313244;
$base: #1e1e2e;
$mantle: #181825;
$crust: #11111b;