2021-04-11 01:09:09 +03:00
|
|
|
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
2021-08-17 16:27:02 +03:00
|
|
|
import parseArgs from 'minimist'
|
|
|
|
import tauricon from '../dist/api/tauricon.js'
|
2019-11-18 00:30:14 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @type {object}
|
|
|
|
* @property {boolean} h
|
|
|
|
* @property {boolean} help
|
|
|
|
* @property {string|boolean} f
|
|
|
|
* @property {string|boolean} force
|
|
|
|
* @property {boolean} l
|
|
|
|
* @property {boolean} log
|
|
|
|
* @property {boolean} c
|
|
|
|
* @property {boolean} config
|
|
|
|
* @property {boolean} s
|
|
|
|
* @property {boolean} source
|
|
|
|
* @property {boolean} t
|
|
|
|
* @property {boolean} target
|
|
|
|
*/
|
|
|
|
const argv = parseArgs(process.argv.slice(2), {
|
|
|
|
alias: {
|
|
|
|
h: 'help',
|
|
|
|
l: 'log',
|
|
|
|
c: 'config',
|
|
|
|
t: 'target'
|
|
|
|
},
|
|
|
|
boolean: ['h', 'l']
|
|
|
|
})
|
|
|
|
|
|
|
|
if (argv.help) {
|
|
|
|
console.log(`
|
|
|
|
Description
|
|
|
|
Create all the icons you need for your Tauri app.
|
2021-04-23 17:10:49 +03:00
|
|
|
The icon path is the source icon (png, 1240x1240 with transparency).
|
2019-11-18 00:30:14 +03:00
|
|
|
|
|
|
|
Usage
|
2021-04-23 17:10:49 +03:00
|
|
|
$ tauri icon [ICON-PATH]
|
2019-11-18 00:30:14 +03:00
|
|
|
|
|
|
|
Options
|
|
|
|
--help, -h Displays this message
|
|
|
|
--log, l Logging [boolean]
|
|
|
|
--target, t Target folder (default: 'src-tauri/icons')
|
2021-05-03 01:02:58 +03:00
|
|
|
--compression, c Compression type [optipng|zopfli]
|
|
|
|
--ci Runs the script in CI mode
|
2019-11-18 00:30:14 +03:00
|
|
|
`)
|
|
|
|
process.exit(0)
|
|
|
|
}
|
|
|
|
|
2020-08-19 05:36:46 +03:00
|
|
|
tauricon
|
2021-04-23 17:10:49 +03:00
|
|
|
.make(argv._[0], argv.t, argv.c || 'optipng')
|
2020-08-19 05:36:46 +03:00
|
|
|
.then(() => {
|
|
|
|
// TODO: use logger module for prettier output
|
|
|
|
console.log('app:tauri (tauricon) Completed')
|
|
|
|
})
|
|
|
|
.catch((e) => {
|
|
|
|
// TODO: use logger module for prettier output
|
|
|
|
console.error('app:tauri (icon)', e)
|
|
|
|
})
|