refactor: bigsur cursor bitmapper as node package

This commit is contained in:
ful1e5 2021-11-21 16:04:42 +05:30
parent c171d176ff
commit eca8cb5760
9 changed files with 99 additions and 784 deletions

View file

@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Generate master `bitmaps.zip` inside `bin` directory
- `Makefile` binaries targets with variable
- pling docs: size and support info updated
- `bigsur` cursor bitmapper as node package
### Changed

View file

@ -2,17 +2,17 @@ all: install render
.PHONY: all
install: node_modules package.json
@yarn install
render:
@yarn render
watch:
@yarn watch
clean:
@find . -type f -name "yarn.lock" -exec rm -rf "{}" +;
@find . -type d -name "node_modules" -exec rm -rf "{}" +;
node_modules:
@mkdir -p $@
clean:
@rm -rf node_modules yarn.lock
install: node_modules package.json
@yarn install
render_bigsur:
@yarn render:bigsur
render: render_bigsur

View file

@ -1,25 +1,15 @@
{
"name": "apple_cursor_bitmapper",
"version": "1.2.2",
"name": "apple-cursor",
"version": "1.1.2",
"description": "OpenSource macOS cursors.",
"main": "index.js",
"scripts": {
"render": "yarn ts-node src/index.ts"
},
"repository": "git@github.com:ful1e5/apple_cursor.git",
"author": "Kaiz Khatri",
"license": "GPL-3.0",
"private": true,
"devDependencies": {
"@types/pixelmatch": "^5.2.2",
"@types/pngjs": "^3.4.2",
"@types/puppeteer": "^5.4.2",
"nodemon": "^2.0.7",
"ts-node": "^9.1.1",
"typescript": "^4.1.3"
"scripts": {
"render:bigsur": "yarn workspace bigsur render"
},
"dependencies": {
"pixelmatch": "^5.2.1",
"pngjs": "^6.0.0",
"puppeteer": "^5.5.0"
}
"workspaces": [
"packages/*"
]
}

View file

@ -0,0 +1,17 @@
{
"name": "bigsur",
"version": "1.2.2",
"description": "macOS Big Sur cursors",
"main": "dist/index.js",
"scripts": {
"build": "npx tsc --build",
"render": "yarn build && node dist/index.js"
},
"author": "Kaiz Khatri",
"license": "GPL-3.0",
"private": true,
"devDependencies": {
"ts-node": "^9.1.1",
"typescript": "^4.1.5"
}
}

View file

@ -1,4 +1,4 @@
import { Colors } from "./core/types";
import { Colors } from "core/src/types";
interface Config {
themeName: string;

View file

@ -1,14 +1,14 @@
import path from "path";
import { BitmapsGenerator, SVGHandler } from "./core";
import { BitmapsGenerator, SVGHandler } from "core";
import { config } from "./config";
const root = path.resolve(__dirname, "../../");
const svgDir = path.resolve(root, "svg");
const root = path.resolve(__dirname, "../../../../");
const svgDir = path.resolve(root, "svg", "bigsur");
const main = async () => {
for (const { themeName, color } of config) {
console.log("Generating bitmaps for", themeName);
console.log("=>", themeName);
const bitmapsDir = path.resolve(root, "bitmaps", themeName);
const svg = new SVGHandler.SvgDirectoryParser(svgDir);
@ -17,14 +17,14 @@ const main = async () => {
const browser = await png.getBrowser();
for (let { key, content } of svg.getStatic()) {
console.log(" ==> Saving", key, "...");
console.log(" -> Saving", key, "...");
content = SVGHandler.colorSvg(content, color);
await png.generateStatic(browser, content, key);
}
for (let { key, content } of svg.getAnimated()) {
console.log(" ==> Saving", key, "...");
console.log(" -> Saving", key, "...");
content = SVGHandler.colorSvg(content, color);
await png.generateAnimated(browser, content, key);

View file

@ -0,0 +1,10 @@
{
"references": [{ "path": "../core" }],
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist"
},
"include": ["src"]
}

View file

@ -1,12 +1,15 @@
{
"compilerOptions": {
"strict": true,
"noUnusedLocals": true,
"strictNullChecks": true,
"esModuleInterop": true,
"target": "ES2015",
"target": "es2017",
"module": "commonjs",
"lib": ["es2015", "dom"],
"noUnusedParameters": true
"strict": true,
"typeRoots": ["./node_modules/@types"],
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"resolveJsonModule": true,
"noFallthroughCasesInSwitch": true,
"esModuleInterop": true
}
}

File diff suppressed because it is too large Load diff