mirror of
https://github.com/ful1e5/Bibata_Cursor.git
synced 2025-05-31 23:28:28 -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 {
|
export class BitmapsGenerator {
|
||||||
private readonly staticCurs: Cursors;
|
private readonly staticCurs: Cursors;
|
||||||
private readonly animatedCurs: Cursors;
|
private readonly animatedCurs: Cursors;
|
||||||
|
private infoFilePath = path.resolve(this.bitmapsDir, ".info");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param source `BitmapsGenerator` Class's object arguments.
|
* @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 browser `puppeteer` browser instance.
|
||||||
* @argument content `.svg` file code.
|
* @argument content `.svg` file code.
|
||||||
|
@ -174,27 +179,34 @@ export class BitmapsGenerator {
|
||||||
spinner.text = ` Preparing ${this.themeName} .svg files...`;
|
spinner.text = ` Preparing ${this.themeName} .svg files...`;
|
||||||
spinner.start();
|
spinner.start();
|
||||||
|
|
||||||
// About browser args => https://chromium.googlesource.com/chromium/src/+/master/docs/linux/suid_sandbox_development.md#disabling-the-sandbox
|
if (fs.existsSync(this.infoFilePath)) {
|
||||||
// Issue => https://github.com/ful1e5/Bibata_Cursor/issues/75#issuecomment-703236554
|
spinner.color = "white";
|
||||||
const browser = await puppeteer.launch({
|
spinner.succeed(`Skipping ${this.themeName} (Already rendered)`);
|
||||||
ignoreDefaultArgs: [" --single-process ", "--no-sandbox"],
|
} else {
|
||||||
headless: true
|
// 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({
|
||||||
|
ignoreDefaultArgs: [" --single-process ", "--no-sandbox"],
|
||||||
|
headless: true
|
||||||
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
spinner.color = "yellow";
|
spinner.color = "yellow";
|
||||||
await this.renderStaticCurs(browser, spinner);
|
await this.renderStaticCurs(browser, spinner);
|
||||||
await this.renderAnimatedCurs(browser, spinner);
|
await this.renderAnimatedCurs(browser, spinner);
|
||||||
|
|
||||||
spinner.text = ` ${chalk.blueBright(
|
spinner.text = ` ${chalk.blueBright(
|
||||||
this.themeName
|
this.themeName
|
||||||
)} bitmaps stored at ${chalk.greenBright(`${this.bitmapsDir}`)}`;
|
)} bitmaps stored at ${chalk.greenBright(`${this.bitmapsDir}`)}`;
|
||||||
|
|
||||||
spinner.succeed();
|
spinner.color = "white";
|
||||||
} catch (error) {
|
this.writeRenderInfo();
|
||||||
console.error(error);
|
spinner.succeed();
|
||||||
process.exit(1);
|
} catch (error) {
|
||||||
spinner.fail();
|
console.error(error);
|
||||||
|
spinner.fail();
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue