diff --git a/Makefile b/Makefile index 9dfb2cf512..48ce768766 100644 --- a/Makefile +++ b/Makefile @@ -56,7 +56,6 @@ integration: build build: node_modules binaries/client yarn run npm:fix-build-version $(MAKE) build-extensions -B - yarn run build:tray-icons yarn run compile ifeq "$(DETECTED_OS)" "Windows" # https://github.com/ukoloff/win-ca#clear-pem-folder-on-publish diff --git a/build/generate-tray-icons.ts b/build/generate-tray-icons.ts index c8ca4f1831..40d70f72e3 100644 --- a/build/generate-tray-icons.ts +++ b/build/generate-tray-icons.ts @@ -64,36 +64,78 @@ async function generateNormalImages(template: string, size: number, name: string } async function generateUpdateAvailableImages(template: string, size: number, name: string, noticeSvg: string) { + const circleSvg = new JSDOM(` +
+ + + + `).window.document.getElementsByTagName("svg")[0]; + + circleSvg.innerHTML += getSvgStyling("dark"); + + const circleBuffer = await sharp(Buffer.from(circleSvg.outerHTML)) + .resize({ + width: Math.floor(size/1.5), + height: Math.floor(size/1.5), + }) + .toBuffer(); + + await sharp(circleBuffer) + .toFile(path.join(outputFolder, "circle.png")); + await Promise.all([ sharp(Buffer.from(template)) - .composite([{ - input: ( - await sharp(Buffer.from(noticeSvg)) - .resize({ - width: Math.floor(size/1.5), - height: Math.floor(size/1.5), - }) - .toBuffer() - ), - top: Math.floor(size/2.5), - left: Math.floor(size/2.5), - }]) .resize({ width: size, height: size }) + .composite([ + { + input: circleBuffer, + gravity: "southeast", + /** + * The `clear` blend rule is buggy and currently doesn't work + * + * https://github.com/lovell/sharp/issues/3247 + */ + blend: "clear", + }, + { + input: ( + await sharp(Buffer.from(noticeSvg)) + .resize({ + width: Math.floor(size/1.5), + height: Math.floor(size/1.5), + }) + .toBuffer() + ), + gravity: "southeast", + }, + ]) .png() .toFile(path.join(outputFolder, `${name}.png`)), sharp(Buffer.from(template)) - .composite([{ - input: ( - await sharp(Buffer.from(noticeSvg)) - .resize({ - width: Math.floor((size * 2)/1.5), - height: Math.floor((size * 2)/1.5), - }) - .toBuffer() - ), - top: Math.floor((size * 2)/2.5), - left: Math.floor((size * 2)/2.5), - }]) + .composite([ + { + input: circleBuffer, + gravity: "southeast", + blend: "clear", + }, + { + input: ( + await sharp(Buffer.from(noticeSvg)) + .resize({ + width: Math.floor((size * 2)/1.5), + height: Math.floor((size * 2)/1.5), + }) + .toBuffer() + ), + gravity: "southeast", + }, + ]) .resize({ width: size*2, height: size*2 }) .png() .toFile(path.join(outputFolder, `${name}@2x.png`)), @@ -104,8 +146,6 @@ async function getNoticeSvg(): Promise