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 - Generate master `bitmaps.zip` inside `bin` directory
- `Makefile` binaries targets with variable - `Makefile` binaries targets with variable
- pling docs: size and support info updated - pling docs: size and support info updated
- `bigsur` cursor bitmapper as node package
### Changed ### Changed

View file

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

View file

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

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 { interface Config {
themeName: string; themeName: string;

View file

@ -1,14 +1,14 @@
import path from "path"; import path from "path";
import { BitmapsGenerator, SVGHandler } from "./core"; import { BitmapsGenerator, SVGHandler } from "core";
import { config } from "./config"; import { config } from "./config";
const root = path.resolve(__dirname, "../../"); const root = path.resolve(__dirname, "../../../../");
const svgDir = path.resolve(root, "svg"); const svgDir = path.resolve(root, "svg", "bigsur");
const main = async () => { const main = async () => {
for (const { themeName, color } of config) { for (const { themeName, color } of config) {
console.log("Generating bitmaps for", themeName); console.log("=>", themeName);
const bitmapsDir = path.resolve(root, "bitmaps", themeName); const bitmapsDir = path.resolve(root, "bitmaps", themeName);
const svg = new SVGHandler.SvgDirectoryParser(svgDir); const svg = new SVGHandler.SvgDirectoryParser(svgDir);
@ -17,14 +17,14 @@ const main = async () => {
const browser = await png.getBrowser(); const browser = await png.getBrowser();
for (let { key, content } of svg.getStatic()) { for (let { key, content } of svg.getStatic()) {
console.log(" ==> Saving", key, "..."); console.log(" -> Saving", key, "...");
content = SVGHandler.colorSvg(content, color); content = SVGHandler.colorSvg(content, color);
await png.generateStatic(browser, content, key); await png.generateStatic(browser, content, key);
} }
for (let { key, content } of svg.getAnimated()) { for (let { key, content } of svg.getAnimated()) {
console.log(" ==> Saving", key, "..."); console.log(" -> Saving", key, "...");
content = SVGHandler.colorSvg(content, color); content = SVGHandler.colorSvg(content, color);
await png.generateAnimated(browser, content, key); 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": { "compilerOptions": {
"strict": true, "target": "es2017",
"noUnusedLocals": true,
"strictNullChecks": true,
"esModuleInterop": true,
"target": "ES2015",
"module": "commonjs", "module": "commonjs",
"lib": ["es2015", "dom"], "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