mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-09-21 21:28:24 +03:00
refactor(cli.js): tauri icon
with positional arg for icon path (#1600)
This commit is contained in:
parent
cfa74ebf68
commit
1e0b41e155
5
.changes/tauri-icon-cli.md
Normal file
5
.changes/tauri-icon-cli.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"cli.js": patch
|
||||
---
|
||||
|
||||
The `tauri icon` command now accepts the icon path as the first positional argument instead of `--icon PATH`.
|
@ -25,7 +25,6 @@ const argv = parseArgs(process.argv.slice(2), {
|
||||
h: 'help',
|
||||
l: 'log',
|
||||
c: 'config',
|
||||
i: 'icon',
|
||||
t: 'target'
|
||||
},
|
||||
boolean: ['h', 'l']
|
||||
@ -35,14 +34,14 @@ if (argv.help) {
|
||||
console.log(`
|
||||
Description
|
||||
Create all the icons you need for your Tauri app.
|
||||
The icon path is the source icon (png, 1240x1240 with transparency).
|
||||
|
||||
Usage
|
||||
$ tauri icon
|
||||
$ tauri icon [ICON-PATH]
|
||||
|
||||
Options
|
||||
--help, -h Displays this message
|
||||
--log, l Logging [boolean]
|
||||
--icon, i Source icon (png, 1240x1240 with transparency)
|
||||
--target, t Target folder (default: 'src-tauri/icons')
|
||||
--compression, c Compression type [pngquant|optipng|zopfli]
|
||||
`)
|
||||
@ -50,7 +49,7 @@ if (argv.help) {
|
||||
}
|
||||
|
||||
tauricon
|
||||
.make(argv.i, argv.t, argv.c || 'optipng')
|
||||
.make(argv._[0], argv.t, argv.c || 'optipng')
|
||||
.then(() => {
|
||||
// TODO: use logger module for prettier output
|
||||
console.log('app:tauri (tauricon) Completed')
|
||||
|
@ -188,16 +188,19 @@ const tauricon = (exports.tauricon = {
|
||||
return version
|
||||
},
|
||||
make: async function (
|
||||
src: string = path.resolve(appDir, 'app-icon.png'),
|
||||
src: string | undefined,
|
||||
target: string = path.resolve(tauriDir, 'icons'),
|
||||
strategy: string,
|
||||
// TODO: proper type for options
|
||||
options: { [index: string]: any }
|
||||
) {
|
||||
if (!src) {
|
||||
src = path.resolve(appDir, 'app-icon.png')
|
||||
}
|
||||
const spinnerInterval = spinner()
|
||||
options = options || settings.options.tauri
|
||||
progress(`Building Tauri icns and ico from "${src}"`)
|
||||
await this.validate(src, target)
|
||||
progress('Building Tauri icns and ico')
|
||||
await this.icns(src, target, options, strategy)
|
||||
progress('Building Tauri png icons')
|
||||
await this.build(src, target, options)
|
||||
|
@ -42,7 +42,7 @@ module.exports = {
|
||||
},
|
||||
externals: [
|
||||
nodeExternals({
|
||||
allowlist: ['imagemin', 'is-png', 'p-pipe']
|
||||
allowlist: ['imagemin', 'is-png', 'p-pipe', 'file-type']
|
||||
})
|
||||
],
|
||||
externalsPresets: { node: true }
|
||||
|
Loading…
Reference in New Issue
Block a user