* Update custom SVG files * Update linting and formatting * Remove build of external dependency * Format files * Update biome js * Update dependencies * Update project * Update lint staged * Update meta info * Remove SVGO config * Transform JS to TS * Update link to repo in footer * Update release workflow * Update dependencies * Update package json * Update workflow * Transform require to import * Replace node-fetch with native fetch * Replace parcel with ESBuild * Remove flakyness of build language script * Update release workflow for Edge * Update readme
30 lines
642 B
TypeScript
30 lines
642 B
TypeScript
import * as path from 'path';
|
|
import * as fs from 'fs-extra';
|
|
import sharp from 'sharp';
|
|
|
|
const svgPath: string = path.resolve(__dirname, '..', 'src', 'logo.svg');
|
|
const iconsPath: string = path.resolve(
|
|
__dirname,
|
|
'..',
|
|
'src',
|
|
'extensionIcons'
|
|
);
|
|
const targetSizes: number[] = [16, 32, 48, 128];
|
|
|
|
// Build extension icons.
|
|
fs.ensureDir(iconsPath).then(generateIcons);
|
|
|
|
/**
|
|
* Generate extension icons.
|
|
*
|
|
* @since 1.4.0
|
|
*/
|
|
function generateIcons(): void {
|
|
targetSizes.forEach((size: number) => {
|
|
sharp(svgPath)
|
|
.png()
|
|
.resize({ width: size, height: size })
|
|
.toFile(`${iconsPath}/icon-${size}.png`);
|
|
});
|
|
}
|