feat: switching from Deno to Node for packaging
This commit is contained in:
parent
fab981ebbd
commit
b12b009b2a
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,4 +1,6 @@
|
||||||
.direnv
|
.direnv/
|
||||||
|
dist/
|
||||||
|
node_modules/
|
||||||
|
|
||||||
# nixago: ignore-linked-files
|
# nixago: ignore-linked-files
|
||||||
/treefmt.toml
|
/treefmt.toml
|
||||||
|
|
15
Justfile
Normal file
15
Justfile
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
@default:
|
||||||
|
just --choose
|
||||||
|
|
||||||
|
format:
|
||||||
|
treefmt
|
||||||
|
just --fmt --unstable
|
||||||
|
|
||||||
|
build: generate-colors generate-theme
|
||||||
|
|
||||||
|
generate-colors: format
|
||||||
|
node src/generate.mjs
|
||||||
|
|
||||||
|
generate-theme: format
|
||||||
|
mkdir -p dist
|
||||||
|
cp src/theme.css dist/
|
|
@ -29,7 +29,8 @@
|
||||||
# Shell
|
# Shell
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
packages = [
|
packages = [
|
||||||
pkgs.deno
|
pkgs.just
|
||||||
|
pkgs.nodejs_20
|
||||||
]
|
]
|
||||||
++ project-config.packages;
|
++ project-config.packages;
|
||||||
|
|
||||||
|
|
30
package-lock.json
generated
Normal file
30
package-lock.json
generated
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"name": "@priduck-color-theme/base",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "@priduck-color-theme/base",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"mkdirp": "^3.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/mkdirp": {
|
||||||
|
"version": "3.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz",
|
||||||
|
"integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==",
|
||||||
|
"bin": {
|
||||||
|
"mkdirp": "dist/cjs/src/bin.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/isaacs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
22
package.json
Normal file
22
package.json
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"name": "@priduck-color-theme/base",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"description": "A color-theme based on a single hue in the LCH colorspace.",
|
||||||
|
"main": "dist/index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://src.mfgames.com/priduck-color-theme/priduck-color-theme-base-css.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"css",
|
||||||
|
"color"
|
||||||
|
],
|
||||||
|
"author": "D. Moonfire",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"mkdirp": "^3.0.1"
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +1,18 @@
|
||||||
// We need an empty export for top-level await.
|
import { mkdirp } from "mkdirp";
|
||||||
export {};
|
import { fileURLToPath } from "url";
|
||||||
|
import path from "path";
|
||||||
|
import fs from "node:fs/promises";
|
||||||
|
|
||||||
|
// Figure out where we need to write the files.
|
||||||
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
const distPath = __dirname + "/../dist";
|
||||||
|
|
||||||
|
console.log("writing", distPath);
|
||||||
|
|
||||||
|
await mkdirp(distPath);
|
||||||
|
|
||||||
// Start with the basic CSS header.
|
// Start with the basic CSS header.
|
||||||
let lines: string[] = [":root {"];
|
let lines = [":root {"];
|
||||||
|
|
||||||
// We have ten colors, with 0 being the base hue and the others being evenly
|
// We have ten colors, with 0 being the base hue and the others being evenly
|
||||||
// rotated around the color wheel.
|
// rotated around the color wheel.
|
||||||
|
@ -14,7 +24,7 @@ for (let color = 0; color < 10; color++) {
|
||||||
// to very light.
|
// to very light.
|
||||||
for (let brightness = 0; brightness < 10; brightness++) {
|
for (let brightness = 0; brightness < 10; brightness++) {
|
||||||
// We use a standard code (--color-cXbY) for our codes.
|
// We use a standard code (--color-cXbY) for our codes.
|
||||||
const code = `--color-c${color}b${brightness}`;
|
const code = `--color-priduck-c${color}b${brightness}`;
|
||||||
|
|
||||||
// Figure out the ramps we are using for brighteness.
|
// Figure out the ramps we are using for brighteness.
|
||||||
const l = brightness * 11;
|
const l = brightness * 11;
|
||||||
|
@ -24,7 +34,7 @@ for (let color = 0; color < 10; color++) {
|
||||||
lines.push(
|
lines.push(
|
||||||
` ${code}: lch(${l.toFixed(1)} ${s.toFixed(
|
` ${code}: lch(${l.toFixed(1)} ${s.toFixed(
|
||||||
1,
|
1,
|
||||||
)} calc(var(--color-hue) + ${rotation}));`,
|
)} calc(var(--color-priduck-hue) + ${rotation}));`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +43,8 @@ for (let color = 0; color < 10; color++) {
|
||||||
lines.push("}");
|
lines.push("}");
|
||||||
|
|
||||||
// Write out the files.
|
// Write out the files.
|
||||||
const text = new TextEncoder().encode(lines.join("\n"));
|
const colorsPath = path.join(distPath, "colors.css");
|
||||||
|
|
||||||
await Deno.writeFile("src/colors.css", text, { mode: 0o644 });
|
await fs.writeFile(colorsPath, Buffer.from(lines.join("\n")));
|
||||||
|
|
||||||
|
console.log("wrote", colorsPath);
|
Loading…
Reference in a new issue