mirror of
https://github.com/ful1e5/apple_cursor.git
synced 2025-05-23 19:47:05 -04:00
💖 Compact Code
This commit is contained in:
parent
2e87551c91
commit
5cf3d9ee17
1 changed files with 7 additions and 4 deletions
11
src/index.ts
11
src/index.ts
|
@ -4,7 +4,7 @@ import puppeteer from "puppeteer";
|
||||||
|
|
||||||
import { generateRenderTemplate } from "./helpers/htmlTemplate";
|
import { generateRenderTemplate } from "./helpers/htmlTemplate";
|
||||||
import {
|
import {
|
||||||
staticSvgs,
|
staticCursors,
|
||||||
bitmapsDir,
|
bitmapsDir,
|
||||||
svgsDir,
|
svgsDir,
|
||||||
animatedCursors,
|
animatedCursors,
|
||||||
|
@ -21,7 +21,8 @@ const frameNumber = (number: number, length: number) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// --------------------------- Main
|
// --------------------------- Main
|
||||||
(async () => {
|
|
||||||
|
const main = async () => {
|
||||||
const browser = await puppeteer.launch({
|
const browser = await puppeteer.launch({
|
||||||
ignoreDefaultArgs: [" --single-process ", "--no-sandbox"],
|
ignoreDefaultArgs: [" --single-process ", "--no-sandbox"],
|
||||||
headless: true,
|
headless: true,
|
||||||
|
@ -30,7 +31,7 @@ const frameNumber = (number: number, length: number) => {
|
||||||
try {
|
try {
|
||||||
console.log("📸 Rendering Static Cursors...");
|
console.log("📸 Rendering Static Cursors...");
|
||||||
// Rendering satic .svg files
|
// Rendering satic .svg files
|
||||||
for (let svg of staticSvgs) {
|
for (let svg of staticCursors) {
|
||||||
const buffer = fs.readFileSync(path.resolve(svgsDir, svg), "utf8");
|
const buffer = fs.readFileSync(path.resolve(svgsDir, svg), "utf8");
|
||||||
if (!buffer) throw new Error(`${svg} File Read error`);
|
if (!buffer) throw new Error(`${svg} File Read error`);
|
||||||
|
|
||||||
|
@ -104,4 +105,6 @@ const frameNumber = (number: number, length: number) => {
|
||||||
console.log(`\nBitmaps stored at ${bitmapsDir}\n\n🎉 Render Done.`);
|
console.log(`\nBitmaps stored at ${bitmapsDir}\n\n🎉 Render Done.`);
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
})();
|
};
|
||||||
|
|
||||||
|
main();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue