mirror of
https://github.com/ful1e5/Bibata_Cursor.git
synced 2025-05-30 14:55:21 -04:00
💾 Skip bitmaps render
This commit is contained in:
parent
093b4f6b17
commit
15cb724c50
1 changed files with 30 additions and 18 deletions
|
@ -15,6 +15,7 @@ import { matchImages } from "./utils/matchImages";
|
|||
export class BitmapsGenerator {
|
||||
private readonly staticCurs: Cursors;
|
||||
private readonly animatedCurs: Cursors;
|
||||
private infoFilePath = path.resolve(this.bitmapsDir, ".info");
|
||||
|
||||
/**
|
||||
* @param source `BitmapsGenerator` Class's object arguments.
|
||||
|
@ -46,6 +47,10 @@ export class BitmapsGenerator {
|
|||
}
|
||||
}
|
||||
|
||||
private writeRenderInfo() {
|
||||
fs.writeFileSync(this.infoFilePath, "", { encoding: "utf-8" });
|
||||
}
|
||||
|
||||
/**
|
||||
* @argument browser `puppeteer` browser instance.
|
||||
* @argument content `.svg` file code.
|
||||
|
@ -174,6 +179,10 @@ export class BitmapsGenerator {
|
|||
spinner.text = ` Preparing ${this.themeName} .svg files...`;
|
||||
spinner.start();
|
||||
|
||||
if (fs.existsSync(this.infoFilePath)) {
|
||||
spinner.color = "white";
|
||||
spinner.succeed(`Skipping ${this.themeName} (Already rendered)`);
|
||||
} else {
|
||||
// About browser args => https://chromium.googlesource.com/chromium/src/+/master/docs/linux/suid_sandbox_development.md#disabling-the-sandbox
|
||||
// Issue => https://github.com/ful1e5/Bibata_Cursor/issues/75#issuecomment-703236554
|
||||
const browser = await puppeteer.launch({
|
||||
|
@ -190,11 +199,14 @@ export class BitmapsGenerator {
|
|||
this.themeName
|
||||
)} bitmaps stored at ${chalk.greenBright(`${this.bitmapsDir}`)}`;
|
||||
|
||||
spinner.color = "white";
|
||||
this.writeRenderInfo();
|
||||
spinner.succeed();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
spinner.fail();
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue