mirror of
https://github.com/ful1e5/Bibata_Cursor.git
synced 2025-05-25 20:44:32 -04:00
🏷️ Typing of Config
This commit is contained in:
parent
f45f878445
commit
6224558c9c
1 changed files with 5 additions and 10 deletions
|
@ -19,7 +19,7 @@ type AnimatedClip = {
|
||||||
};
|
};
|
||||||
|
|
||||||
interface Config {
|
interface Config {
|
||||||
staticSvgs: Array<string>;
|
staticCursors: Array<string>;
|
||||||
bitmapsDir: string;
|
bitmapsDir: string;
|
||||||
svgsDir: string;
|
svgsDir: string;
|
||||||
animatedCursors: AnimatedCursors;
|
animatedCursors: AnimatedCursors;
|
||||||
|
@ -37,7 +37,7 @@ const frameNumber = (number: number, length: number) => {
|
||||||
|
|
||||||
// --------------------------- Render Func
|
// --------------------------- Render Func
|
||||||
export const renderCursors = async ({
|
export const renderCursors = async ({
|
||||||
staticSvgs,
|
staticCursors,
|
||||||
bitmapsDir,
|
bitmapsDir,
|
||||||
svgsDir,
|
svgsDir,
|
||||||
animatedCursors,
|
animatedCursors,
|
||||||
|
@ -45,17 +45,13 @@ export const renderCursors = async ({
|
||||||
}: Config) => {
|
}: Config) => {
|
||||||
const browser = await puppeteer.launch({
|
const browser = await puppeteer.launch({
|
||||||
ignoreDefaultArgs: [" --single-process ", "--no-sandbox"],
|
ignoreDefaultArgs: [" --single-process ", "--no-sandbox"],
|
||||||
executablePath:
|
|
||||||
process.env.NODE_ENV == "development"
|
|
||||||
? "/usr/bin/google-chrome-stable"
|
|
||||||
: "",
|
|
||||||
headless: true
|
headless: true
|
||||||
});
|
});
|
||||||
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), "utf-8");
|
||||||
if (!buffer) throw new Error(`${svg} File Read error`);
|
if (!buffer) throw new Error(`${svg} File Read error`);
|
||||||
|
|
||||||
const data = buffer.toString();
|
const data = buffer.toString();
|
||||||
|
@ -85,7 +81,7 @@ export const renderCursors = async ({
|
||||||
|
|
||||||
// Rendering animated .svg files
|
// Rendering animated .svg files
|
||||||
for (let [svg, { frames }] of Object.entries(animatedCursors)) {
|
for (let [svg, { frames }] of Object.entries(animatedCursors)) {
|
||||||
const buffer = fs.readFileSync(path.resolve(svgsDir, svg), "utf8");
|
const buffer = fs.readFileSync(path.resolve(svgsDir, svg), "utf-8");
|
||||||
if (!buffer) throw new Error(`${svg} File Read error`);
|
if (!buffer) throw new Error(`${svg} File Read error`);
|
||||||
|
|
||||||
const data = buffer.toString();
|
const data = buffer.toString();
|
||||||
|
@ -125,7 +121,6 @@ export const renderCursors = async ({
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
} finally {
|
} finally {
|
||||||
console.log(`\nBitmaps stored at ${bitmapsDir}\n\n🎉 Render Done.`);
|
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue