* Add support for Azure DevOps and BitBucket * Remove `console.log` * Fix ESLint config - Fix the ESLint config - Fix all lint errors that cropped up as a result - Add scripts to lint - Add prettier format script - Add `husky` / `lint-staged` to lint/format files when they're pushed * Move provider configs to new file as requested * Fixes to meet maintainers specs * Fix remaining lint warns/errs * eslint fix * Update eslint/prettier packges Remove unused `@types/node-fetch` package * Add `eslint-plugin-jsdoc` * Add eslint rule for allowing providers to reassign params in their `replaceIcon` functions * Add sensible defaults for prettier to override any local editor settings * Some final cleanup * Loosen the required engines to allow for easier installing Co-authored-by: Claudio Santos <Claudiohbsantos@users.noreply.github.com>
32 lines
689 B
JavaScript
32 lines
689 B
JavaScript
/**
|
|
* External depedencies
|
|
*/
|
|
const path = require('path');
|
|
const sharp = require('sharp');
|
|
const fs = require('fs-extra');
|
|
|
|
/**
|
|
* Internal depedencies
|
|
*/
|
|
const svgPath = path.resolve(__dirname, '..', 'src', 'logo.svg');
|
|
const iconsPath = path.resolve(__dirname, '..', 'src', 'extensionIcons');
|
|
const targetSizes = [16, 32, 48, 128];
|
|
|
|
// Build extension icons.
|
|
fs.ensureDir(iconsPath).then(generateIcons);
|
|
|
|
/**
|
|
* Generate extension icons.
|
|
*
|
|
* @since 1.4.0
|
|
*/
|
|
function generateIcons() {
|
|
targetSizes.forEach((size) => {
|
|
sharp(svgPath)
|
|
.png()
|
|
.resize({ width: size, height: size })
|
|
.toFile(`${iconsPath}/icon-${size}.png`)
|
|
.catch(console.error);
|
|
});
|
|
}
|