From 342fda0cde12cd3015d5749f58b91449e4f19025 Mon Sep 17 00:00:00 2001 From: winston Date: Sun, 26 Mar 2023 17:16:45 +0200 Subject: [PATCH] build: use node for build sass-embedded causes more trouble with deno than it's worth. --- .gitignore | 2 + build.js | 29 ++++ build.ts | 45 ------ deps.ts | 2 - flake.lock | 41 ------ flake.nix | 15 -- package-lock.json | 247 +++++++++++++++++++++++++++++++++ package.json | 9 ++ src/catppuccin/_frappe.scss | 26 ---- src/catppuccin/_latte.scss | 26 ---- src/catppuccin/_macchiato.scss | 26 ---- src/catppuccin/_mocha.scss | 26 ---- 12 files changed, 287 insertions(+), 207 deletions(-) create mode 100644 build.js delete mode 100755 build.ts delete mode 100644 deps.ts delete mode 100644 flake.lock delete mode 100644 flake.nix create mode 100644 package-lock.json create mode 100644 package.json delete mode 100644 src/catppuccin/_frappe.scss delete mode 100644 src/catppuccin/_latte.scss delete mode 100644 src/catppuccin/_macchiato.scss delete mode 100644 src/catppuccin/_mocha.scss diff --git a/.gitignore b/.gitignore index 178135c..025a7f4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ +node_modules/ /dist/ +*.tar.gz diff --git a/build.js b/build.js new file mode 100644 index 0000000..fa39e44 --- /dev/null +++ b/build.js @@ -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 + ); + } +} diff --git a/build.ts b/build.ts deleted file mode 100755 index c637900..0000000 --- a/build.ts +++ /dev/null @@ -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 - ); - } -} diff --git a/deps.ts b/deps.ts deleted file mode 100644 index 010b57a..0000000 --- a/deps.ts +++ /dev/null @@ -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"; diff --git a/flake.lock b/flake.lock deleted file mode 100644 index e6b4aab..0000000 --- a/flake.lock +++ /dev/null @@ -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 -} diff --git a/flake.nix b/flake.nix deleted file mode 100644 index 1fac8ec..0000000 --- a/flake.nix +++ /dev/null @@ -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];}; - } - ); -} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..001a6aa --- /dev/null +++ b/package-lock.json @@ -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" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..2baecb2 --- /dev/null +++ b/package.json @@ -0,0 +1,9 @@ +{ + "devDependencies": { + "@catppuccin/palette": "^0.1.7", + "sass": "^1.60.0" + }, + "scripts": { + "build": "node ./build.js" + } +} diff --git a/src/catppuccin/_frappe.scss b/src/catppuccin/_frappe.scss deleted file mode 100644 index 49485fc..0000000 --- a/src/catppuccin/_frappe.scss +++ /dev/null @@ -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; diff --git a/src/catppuccin/_latte.scss b/src/catppuccin/_latte.scss deleted file mode 100644 index c1a01ca..0000000 --- a/src/catppuccin/_latte.scss +++ /dev/null @@ -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; diff --git a/src/catppuccin/_macchiato.scss b/src/catppuccin/_macchiato.scss deleted file mode 100644 index 9355e38..0000000 --- a/src/catppuccin/_macchiato.scss +++ /dev/null @@ -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; diff --git a/src/catppuccin/_mocha.scss b/src/catppuccin/_mocha.scss deleted file mode 100644 index 728949d..0000000 --- a/src/catppuccin/_mocha.scss +++ /dev/null @@ -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;