|
@@ -12,31 +12,27 @@
|
|
* @license MIT
|
|
* @license MIT
|
|
*/
|
|
*/
|
|
|
|
|
|
-const path = require('path')
|
|
|
|
-const sharp = require('sharp')
|
|
|
|
-const imagemin = require('imagemin')
|
|
|
|
-const pngquant = require('imagemin-pngquant')
|
|
|
|
-const optipng = require('imagemin-optipng')
|
|
|
|
-const zopfli = require('imagemin-zopfli')
|
|
|
|
-const png2icons = require('png2icons')
|
|
|
|
-const readChunk = require('read-chunk')
|
|
|
|
-const isPng = require('is-png')
|
|
|
|
-const logger = require('../helpers/logger')
|
|
|
|
|
|
+import { access, ensureDir, ensureFileSync, writeFileSync } from 'fs-extra'
|
|
|
|
+import imagemin, { Plugin } from 'imagemin'
|
|
|
|
+import optipng from 'imagemin-optipng'
|
|
|
|
+import pngquant from 'imagemin-pngquant'
|
|
|
|
+import zopfli from 'imagemin-zopfli'
|
|
|
|
+import isPng from 'is-png'
|
|
|
|
+import path from 'path'
|
|
|
|
+import png2icons from 'png2icons'
|
|
|
|
+import readChunk from 'read-chunk'
|
|
|
|
+import sharp from 'sharp'
|
|
|
|
+import { appDir, tauriDir } from '../helpers/app-paths'
|
|
|
|
+import logger from '../helpers/logger'
|
|
|
|
+import * as settings from '../helpers/tauricon.config'
|
|
|
|
+
|
|
const log = logger('app:spawn')
|
|
const log = logger('app:spawn')
|
|
const warn = logger('app:spawn', 'red')
|
|
const warn = logger('app:spawn', 'red')
|
|
|
|
|
|
-const settings = require('../helpers/tauricon.config.js')
|
|
|
|
-let image = false
|
|
|
|
|
|
+let image: boolean | sharp.Sharp = false
|
|
const spinnerInterval = false
|
|
const spinnerInterval = false
|
|
|
|
|
|
-const {
|
|
|
|
- access,
|
|
|
|
- writeFileSync,
|
|
|
|
- ensureDir,
|
|
|
|
- ensureFileSync
|
|
|
|
-} = require('fs-extra')
|
|
|
|
-
|
|
|
|
-const exists = async function (file) {
|
|
|
|
|
|
+const exists = async function(file: string | Buffer): Promise<boolean> {
|
|
try {
|
|
try {
|
|
await access(file)
|
|
await access(file)
|
|
return true
|
|
return true
|
|
@@ -53,7 +49,7 @@ const exists = async function (file) {
|
|
* @param {string} src - a folder to target
|
|
* @param {string} src - a folder to target
|
|
* @exits {error} if not a png, if not an image
|
|
* @exits {error} if not a png, if not an image
|
|
*/
|
|
*/
|
|
-const checkSrc = async function (src) {
|
|
|
|
|
|
+const checkSrc = async (src: string): Promise<boolean | sharp.Sharp> => {
|
|
if (image !== false) {
|
|
if (image !== false) {
|
|
return image
|
|
return image
|
|
} else {
|
|
} else {
|
|
@@ -83,13 +79,17 @@ const checkSrc = async function (src) {
|
|
* @param {object} options - a subset of the settings
|
|
* @param {object} options - a subset of the settings
|
|
* @returns {array} folders
|
|
* @returns {array} folders
|
|
*/
|
|
*/
|
|
-const uniqueFolders = function (options) {
|
|
|
|
|
|
+// TODO: proper type of options and folders
|
|
|
|
+const uniqueFolders = (options: { [index: string]: any }): any[] => {
|
|
let folders = []
|
|
let folders = []
|
|
for (const type in options) {
|
|
for (const type in options) {
|
|
- if (options[type].folder) {
|
|
|
|
- folders.push(options[type].folder)
|
|
|
|
|
|
+ const option = options[String(type)]
|
|
|
|
+ if (option.folder) {
|
|
|
|
+ folders.push(option.folder)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ // TODO: is compare argument required?
|
|
|
|
+ // eslint-disable-next-line @typescript-eslint/require-array-sort-compare
|
|
folders = folders.sort().filter((x, i, a) => !i || x !== a[i - 1])
|
|
folders = folders.sort().filter((x, i, a) => !i || x !== a[i - 1])
|
|
return folders
|
|
return folders
|
|
}
|
|
}
|
|
@@ -100,11 +100,18 @@ const uniqueFolders = function (options) {
|
|
* @param {string} hex - hex colour
|
|
* @param {string} hex - hex colour
|
|
* @returns {array} r,g,b
|
|
* @returns {array} r,g,b
|
|
*/
|
|
*/
|
|
-const hexToRgb = function (hex) {
|
|
|
|
|
|
+const hexToRgb = (
|
|
|
|
+ hex: string
|
|
|
|
+): { r: number, g: number, b: number } | undefined => {
|
|
// https://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb
|
|
// https://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb
|
|
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
|
|
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
|
|
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i
|
|
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i
|
|
- hex = hex.replace(shorthandRegex, function (m, r, g, b) {
|
|
|
|
|
|
+ hex = hex.replace(shorthandRegex, function(
|
|
|
|
+ m: string,
|
|
|
|
+ r: string,
|
|
|
|
+ g: string,
|
|
|
|
+ b: string
|
|
|
|
+ ) {
|
|
return r + r + g + g + b + b
|
|
return r + r + g + g + b + b
|
|
})
|
|
})
|
|
|
|
|
|
@@ -115,29 +122,29 @@ const hexToRgb = function (hex) {
|
|
g: parseInt(result[2], 16),
|
|
g: parseInt(result[2], 16),
|
|
b: parseInt(result[3], 16)
|
|
b: parseInt(result[3], 16)
|
|
}
|
|
}
|
|
- : null
|
|
|
|
|
|
+ : undefined
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* validate image and directory
|
|
* validate image and directory
|
|
- * @param {string} src
|
|
|
|
- * @param {string} target
|
|
|
|
- * @returns {Promise<void>}
|
|
|
|
*/
|
|
*/
|
|
-const validate = async function (src, target) {
|
|
|
|
|
|
+const validate = async (
|
|
|
|
+ src: string,
|
|
|
|
+ target: string
|
|
|
|
+): Promise<boolean | sharp.Sharp> => {
|
|
if (target !== undefined) {
|
|
if (target !== undefined) {
|
|
await ensureDir(target)
|
|
await ensureDir(target)
|
|
}
|
|
}
|
|
return checkSrc(src)
|
|
return checkSrc(src)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// TODO: should take end param?
|
|
/**
|
|
/**
|
|
* Log progress in the command line
|
|
* Log progress in the command line
|
|
*
|
|
*
|
|
- * @param {string} msg
|
|
|
|
* @param {boolean} end
|
|
* @param {boolean} end
|
|
*/
|
|
*/
|
|
-const progress = function (msg) {
|
|
|
|
|
|
+const progress = (msg: string): void => {
|
|
process.stdout.write(` ${msg} \r`)
|
|
process.stdout.write(` ${msg} \r`)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -149,9 +156,8 @@ const progress = function (msg) {
|
|
* const spinnerInterval = spinner()
|
|
* const spinnerInterval = spinner()
|
|
* // later
|
|
* // later
|
|
* clearInterval(spinnerInterval)
|
|
* clearInterval(spinnerInterval)
|
|
- * @returns {function} - the interval object
|
|
|
|
*/
|
|
*/
|
|
-const spinner = function () {
|
|
|
|
|
|
+const spinner = (): NodeJS.Timeout => {
|
|
return setInterval(() => {
|
|
return setInterval(() => {
|
|
process.stdout.write('/ \r')
|
|
process.stdout.write('/ \r')
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
@@ -166,22 +172,21 @@ const spinner = function () {
|
|
}, 500)
|
|
}, 500)
|
|
}
|
|
}
|
|
|
|
|
|
-const tauricon = exports.tauricon = {
|
|
|
|
- validate: async function (src, target) {
|
|
|
|
|
|
+const tauricon = (exports.tauricon = {
|
|
|
|
+ validate: async function(src: string, target: string) {
|
|
await validate(src, target)
|
|
await validate(src, target)
|
|
return typeof image === 'object'
|
|
return typeof image === 'object'
|
|
},
|
|
},
|
|
- version: function () {
|
|
|
|
- return require('../package.json').version
|
|
|
|
|
|
+ version: function() {
|
|
|
|
+ return __non_webpack_require__('../package.json').version
|
|
},
|
|
},
|
|
- /**
|
|
|
|
- *
|
|
|
|
- * @param {string} src
|
|
|
|
- * @param {string} target
|
|
|
|
- * @param {string} strategy
|
|
|
|
- * @param {object} options
|
|
|
|
- */
|
|
|
|
- make: async function (src, target, strategy, options) {
|
|
|
|
|
|
+ make: async function(
|
|
|
|
+ src: string = path.resolve(appDir, 'app-icon.png'),
|
|
|
|
+ target: string = path.resolve(tauriDir, 'icons'),
|
|
|
|
+ strategy: string,
|
|
|
|
+ // TODO: proper type for options
|
|
|
|
+ options: { [index: string]: any }
|
|
|
|
+ ) {
|
|
const spinnerInterval = spinner()
|
|
const spinnerInterval = spinner()
|
|
options = options || settings.options.tauri
|
|
options = options || settings.options.tauri
|
|
await this.validate(src, target)
|
|
await this.validate(src, target)
|
|
@@ -207,14 +212,25 @@ const tauricon = exports.tauricon = {
|
|
* @param {string} target - where to drop the images
|
|
* @param {string} target - where to drop the images
|
|
* @param {object} options - js object that defines path and sizes
|
|
* @param {object} options - js object that defines path and sizes
|
|
*/
|
|
*/
|
|
- build: async function (src, target, options) {
|
|
|
|
|
|
+ build: async function(
|
|
|
|
+ src: string,
|
|
|
|
+ target: string,
|
|
|
|
+ // TODO: proper type for options
|
|
|
|
+ options: { [index: string]: any }
|
|
|
|
+ ) {
|
|
await this.validate(src, target)
|
|
await this.validate(src, target)
|
|
const sharpSrc = sharp(src) // creates the image object
|
|
const sharpSrc = sharp(src) // creates the image object
|
|
- const buildify2 = async function (pvar) {
|
|
|
|
|
|
+ const buildify2 = async function(
|
|
|
|
+ pvar: [string, number, number]
|
|
|
|
+ ): Promise<void> {
|
|
try {
|
|
try {
|
|
const pngImage = sharpSrc.resize(pvar[1], pvar[1])
|
|
const pngImage = sharpSrc.resize(pvar[1], pvar[1])
|
|
if (pvar[2]) {
|
|
if (pvar[2]) {
|
|
- const rgb = hexToRgb(options.background_color)
|
|
|
|
|
|
+ const rgb = hexToRgb(options.background_color) || {
|
|
|
|
+ r: undefined,
|
|
|
|
+ g: undefined,
|
|
|
|
+ b: undefined
|
|
|
|
+ }
|
|
pngImage.flatten({
|
|
pngImage.flatten({
|
|
background: { r: rgb.r, g: rgb.g, b: rgb.b, alpha: 1 }
|
|
background: { r: rgb.r, g: rgb.g, b: rgb.b, alpha: 1 }
|
|
})
|
|
})
|
|
@@ -228,15 +244,19 @@ const tauricon = exports.tauricon = {
|
|
|
|
|
|
let output
|
|
let output
|
|
const folders = uniqueFolders(options)
|
|
const folders = uniqueFolders(options)
|
|
|
|
+ // eslint-disable-next-line @typescript-eslint/no-for-in-array
|
|
for (const n in folders) {
|
|
for (const n in folders) {
|
|
|
|
+ const folder = folders[Number(n)]
|
|
// make the folders first
|
|
// make the folders first
|
|
- ensureDir(`${target}${path.sep}${folders[n]}`)
|
|
|
|
|
|
+ // TODO: should this be ensureDirSync?
|
|
|
|
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
|
|
+ ensureDir(`${target}${path.sep}${folder}`)
|
|
}
|
|
}
|
|
for (const optionKey in options) {
|
|
for (const optionKey in options) {
|
|
- const option = options[optionKey]
|
|
|
|
|
|
+ const option = options[String(optionKey)]
|
|
// chain up the transforms
|
|
// chain up the transforms
|
|
for (const sizeKey in option.sizes) {
|
|
for (const sizeKey in option.sizes) {
|
|
- const size = option.sizes[sizeKey]
|
|
|
|
|
|
+ const size = option.sizes[String(sizeKey)]
|
|
if (!option.splash) {
|
|
if (!option.splash) {
|
|
const dest = `${target}/${option.folder}`
|
|
const dest = `${target}/${option.folder}`
|
|
if (option.infix === true) {
|
|
if (option.infix === true) {
|
|
@@ -244,7 +264,11 @@ const tauricon = exports.tauricon = {
|
|
} else {
|
|
} else {
|
|
output = `${dest}${path.sep}${option.prefix}${option.suffix}`
|
|
output = `${dest}${path.sep}${option.prefix}${option.suffix}`
|
|
}
|
|
}
|
|
- const pvar = [output, size, option.background]
|
|
|
|
|
|
+ const pvar: [string, number, number] = [
|
|
|
|
+ output,
|
|
|
|
+ size,
|
|
|
|
+ option.background
|
|
|
|
+ ]
|
|
await buildify2(pvar)
|
|
await buildify2(pvar)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -258,10 +282,20 @@ const tauricon = exports.tauricon = {
|
|
* @param {string} target - where to drop the images
|
|
* @param {string} target - where to drop the images
|
|
* @param {object} options - js object that defines path and sizes
|
|
* @param {object} options - js object that defines path and sizes
|
|
*/
|
|
*/
|
|
- splash: async function (src, splashSrc, target, options) {
|
|
|
|
|
|
+ splash: async function(
|
|
|
|
+ src: string,
|
|
|
|
+ splashSrc: string,
|
|
|
|
+ target: string,
|
|
|
|
+ // TODO: proper type for options
|
|
|
|
+ options: { [index: string]: any }
|
|
|
|
+ ) {
|
|
let output
|
|
let output
|
|
let block = false
|
|
let block = false
|
|
- const rgb = hexToRgb(options.background_color)
|
|
|
|
|
|
+ const rgb = hexToRgb(options.background_color) || {
|
|
|
|
+ r: undefined,
|
|
|
|
+ g: undefined,
|
|
|
|
+ b: undefined
|
|
|
|
+ }
|
|
|
|
|
|
// three options
|
|
// three options
|
|
// options: splashscreen_type [generate | overlay | pure]
|
|
// options: splashscreen_type [generate | overlay | pure]
|
|
@@ -280,37 +314,42 @@ const tauricon = exports.tauricon = {
|
|
process.exit(1)
|
|
process.exit(1)
|
|
}
|
|
}
|
|
sharpSrc = sharp(src)
|
|
sharpSrc = sharp(src)
|
|
- sharpSrc.extend({
|
|
|
|
- top: 726,
|
|
|
|
- bottom: 726,
|
|
|
|
- left: 726,
|
|
|
|
- right: 726,
|
|
|
|
- background: {
|
|
|
|
- r: rgb.r,
|
|
|
|
- g: rgb.g,
|
|
|
|
- b: rgb.b,
|
|
|
|
- alpha: 1
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ sharpSrc
|
|
|
|
+ .extend({
|
|
|
|
+ top: 726,
|
|
|
|
+ bottom: 726,
|
|
|
|
+ left: 726,
|
|
|
|
+ right: 726,
|
|
|
|
+ background: {
|
|
|
|
+ r: rgb.r,
|
|
|
|
+ g: rgb.g,
|
|
|
|
+ b: rgb.b,
|
|
|
|
+ alpha: 1
|
|
|
|
+ }
|
|
|
|
+ })
|
|
.flatten({ background: { r: rgb.r, g: rgb.g, b: rgb.b, alpha: 1 } })
|
|
.flatten({ background: { r: rgb.r, g: rgb.g, b: rgb.b, alpha: 1 } })
|
|
} else if (options.splashscreen_type === 'overlay') {
|
|
} else if (options.splashscreen_type === 'overlay') {
|
|
sharpSrc = sharp(splashSrc)
|
|
sharpSrc = sharp(splashSrc)
|
|
.flatten({ background: { r: rgb.r, g: rgb.g, b: rgb.b, alpha: 1 } })
|
|
.flatten({ background: { r: rgb.r, g: rgb.g, b: rgb.b, alpha: 1 } })
|
|
- .composite([{
|
|
|
|
- input: src
|
|
|
|
- // blend: 'multiply' <= future work, maybe just a gag
|
|
|
|
- }])
|
|
|
|
|
|
+ .composite([
|
|
|
|
+ {
|
|
|
|
+ input: src
|
|
|
|
+ // blend: 'multiply' <= future work, maybe just a gag
|
|
|
|
+ }
|
|
|
|
+ ])
|
|
} else if (options.splashscreen_type === 'pure') {
|
|
} else if (options.splashscreen_type === 'pure') {
|
|
- sharpSrc = sharp(splashSrc)
|
|
|
|
- .flatten({ background: { r: rgb.r, g: rgb.g, b: rgb.b, alpha: 1 } })
|
|
|
|
|
|
+ sharpSrc = sharp(splashSrc).flatten({
|
|
|
|
+ background: { r: rgb.r, g: rgb.g, b: rgb.b, alpha: 1 }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ // TODO: determine if this really could be undefined
|
|
|
|
+ // @ts-ignore
|
|
const data = await sharpSrc.toBuffer()
|
|
const data = await sharpSrc.toBuffer()
|
|
|
|
|
|
for (const optionKey in options) {
|
|
for (const optionKey in options) {
|
|
- const option = options[optionKey]
|
|
|
|
|
|
+ const option = options[String(optionKey)]
|
|
for (const sizeKey in option.sizes) {
|
|
for (const sizeKey in option.sizes) {
|
|
- const size = option.sizes[sizeKey]
|
|
|
|
|
|
+ const size = option.sizes[String(sizeKey)]
|
|
if (option.splash) {
|
|
if (option.splash) {
|
|
const dest = `${target}${path.sep}${option.folder}`
|
|
const dest = `${target}${path.sep}${option.folder}`
|
|
await ensureDir(dest)
|
|
await ensureDir(dest)
|
|
@@ -337,14 +376,22 @@ const tauricon = exports.tauricon = {
|
|
* @param {string} strategy - which minify strategy to use
|
|
* @param {string} strategy - which minify strategy to use
|
|
* @param {string} mode - singlefile or batch
|
|
* @param {string} mode - singlefile or batch
|
|
*/
|
|
*/
|
|
- minify: async function (target, options, strategy, mode) {
|
|
|
|
- let cmd
|
|
|
|
|
|
+ minify: async function(
|
|
|
|
+ target: string,
|
|
|
|
+ // TODO: proper type for options
|
|
|
|
+ options: { [index: string]: any },
|
|
|
|
+ strategy: string,
|
|
|
|
+ mode: string
|
|
|
|
+ ) {
|
|
|
|
+ let cmd: Plugin
|
|
const minify = settings.options.minify
|
|
const minify = settings.options.minify
|
|
if (!minify.available.find(x => x === strategy)) {
|
|
if (!minify.available.find(x => x === strategy)) {
|
|
strategy = minify.type
|
|
strategy = minify.type
|
|
}
|
|
}
|
|
switch (strategy) {
|
|
switch (strategy) {
|
|
case 'pngquant':
|
|
case 'pngquant':
|
|
|
|
+ // TODO: is minify.pngquantOptions the proper format?
|
|
|
|
+ // @ts-ignore
|
|
cmd = pngquant(minify.pngquantOptions)
|
|
cmd = pngquant(minify.pngquantOptions)
|
|
break
|
|
break
|
|
case 'optipng':
|
|
case 'optipng':
|
|
@@ -355,7 +402,7 @@ const tauricon = exports.tauricon = {
|
|
break
|
|
break
|
|
}
|
|
}
|
|
|
|
|
|
- const __minifier = async (pvar) => {
|
|
|
|
|
|
+ const __minifier = async (pvar: string[]): Promise<string | void> => {
|
|
await imagemin([pvar[0]], {
|
|
await imagemin([pvar[0]], {
|
|
destination: pvar[1],
|
|
destination: pvar[1],
|
|
plugins: [cmd]
|
|
plugins: [cmd]
|
|
@@ -365,17 +412,28 @@ const tauricon = exports.tauricon = {
|
|
}
|
|
}
|
|
switch (mode) {
|
|
switch (mode) {
|
|
case 'singlefile':
|
|
case 'singlefile':
|
|
|
|
+ // TODO: the __minifier function only accepts one arg, why is cmd passed?
|
|
|
|
+ // @ts-ignore
|
|
await __minifier([target, path.dirname(target)], cmd)
|
|
await __minifier([target, path.dirname(target)], cmd)
|
|
break
|
|
break
|
|
case 'batch':
|
|
case 'batch':
|
|
// eslint-disable-next-line no-case-declarations
|
|
// eslint-disable-next-line no-case-declarations
|
|
const folders = uniqueFolders(options)
|
|
const folders = uniqueFolders(options)
|
|
|
|
+ // eslint-disable-next-line @typescript-eslint/no-for-in-array
|
|
for (const n in folders) {
|
|
for (const n in folders) {
|
|
- log('batch minify:', folders[n])
|
|
|
|
- await __minifier([
|
|
|
|
- `${target}${path.sep}${folders[n]}${path.sep}*.png`,
|
|
|
|
- `${target}${path.sep}${folders[n]}`
|
|
|
|
- ], cmd)
|
|
|
|
|
|
+ const folder = folders[Number(n)]
|
|
|
|
+ // TODO: The log argument doesn't accept multiple args, should this be fixed?
|
|
|
|
+ // @ts-ignore
|
|
|
|
+ log('batch minify:', folder)
|
|
|
|
+ await __minifier(
|
|
|
|
+ [
|
|
|
|
+ `${target}${path.sep}${folder}${path.sep}*.png`,
|
|
|
|
+ `${target}${path.sep}${folder}`
|
|
|
|
+ ],
|
|
|
|
+ // TODO: the __minifier function only accepts one arg, why is this here?
|
|
|
|
+ // @ts-ignore
|
|
|
|
+ cmd
|
|
|
|
+ )
|
|
}
|
|
}
|
|
break
|
|
break
|
|
default:
|
|
default:
|
|
@@ -393,7 +451,13 @@ const tauricon = exports.tauricon = {
|
|
* @param {object} options
|
|
* @param {object} options
|
|
* @param {string} strategy
|
|
* @param {string} strategy
|
|
*/
|
|
*/
|
|
- icns: async function (src, target, options, strategy) {
|
|
|
|
|
|
+ icns: async function(
|
|
|
|
+ src: string,
|
|
|
|
+ target: string,
|
|
|
|
+ // TODO: proper type for options
|
|
|
|
+ options: { [index: string]: any },
|
|
|
|
+ strategy: string
|
|
|
|
+ ) {
|
|
try {
|
|
try {
|
|
if (!image) {
|
|
if (!image) {
|
|
process.exit(1)
|
|
process.exit(1)
|
|
@@ -403,10 +467,14 @@ const tauricon = exports.tauricon = {
|
|
const sharpSrc = sharp(src)
|
|
const sharpSrc = sharp(src)
|
|
const buf = await sharpSrc.toBuffer()
|
|
const buf = await sharpSrc.toBuffer()
|
|
|
|
|
|
|
|
+ // TODO: does this need to be awaited?
|
|
|
|
+ // eslint-disable-next-line @typescript-eslint/await-thenable
|
|
const out = await png2icons.createICNS(buf, png2icons.BICUBIC, 0)
|
|
const out = await png2icons.createICNS(buf, png2icons.BICUBIC, 0)
|
|
ensureFileSync(path.join(target, '/icon.icns'))
|
|
ensureFileSync(path.join(target, '/icon.icns'))
|
|
writeFileSync(path.join(target, '/icon.icns'), out)
|
|
writeFileSync(path.join(target, '/icon.icns'), out)
|
|
|
|
|
|
|
|
+ // TODO: does this need to be awaited?
|
|
|
|
+ // eslint-disable-next-line @typescript-eslint/await-thenable
|
|
const out2 = await png2icons.createICO(buf, png2icons.BICUBIC, 0, true)
|
|
const out2 = await png2icons.createICO(buf, png2icons.BICUBIC, 0, true)
|
|
ensureFileSync(path.join(target, '/icon.ico'))
|
|
ensureFileSync(path.join(target, '/icon.ico'))
|
|
writeFileSync(path.join(target, '/icon.ico'), out2)
|
|
writeFileSync(path.join(target, '/icon.ico'), out2)
|
|
@@ -414,7 +482,7 @@ const tauricon = exports.tauricon = {
|
|
console.error(err)
|
|
console.error(err)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+})
|
|
|
|
|
|
if (typeof exports !== 'undefined') {
|
|
if (typeof exports !== 'undefined') {
|
|
if (typeof module !== 'undefined' && module.exports) {
|
|
if (typeof module !== 'undefined' && module.exports) {
|