Git Product home page Git Product logo

tauricon's People

Contributors

fabianlars avatar github-actions[bot] avatar lucasfernog avatar lzdyes avatar nothingismagick avatar renovate[bot] avatar yeus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tauricon's Issues

Fix vulnerable dependencies

We're currently seeing 24 vulnerabilities (12 with severity "high") in our Tauri package, all of which are coming from @tauri-apps/tauricon. I know dealing with npm audit warnings is annoying, but for a tool focused on security, I think it's important to make sure your deps are clean. I hope we can expect a fix soon? Thanks!

Does not work on Apple Sillicon

Due to this tool depending on optipng it doesn't work with apple sillicon. This is due to optipng using operations that arent available on arm.

Error: Cannot find module '../src/helpers/icns.json'

There seems to be an issue with the latest release:

> [email protected] icon
> npx @tauri-apps/tauricon ./artwork/icon.png

node:internal/modules/cjs/loader:933
  const err = new Error(message);
              ^

Error: Cannot find module '../src/helpers/icns.json'
Require stack:
- C:\Users\Dan\AppData\Local\npm-cache\_npx\98c943a920688aff\node_modules\@tauri-apps\tauricon\dist\tauricon.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at file:///C:/Users/Dan/AppData/Local/npm-cache/_npx/98c943a920688aff/node_modules/@tauri-apps/tauricon/dist/tauricon.js:1:3428
    at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
    at async loadESM (node:internal/process/esm_loader:88:5)
    at async handleMainPromise (node:internal/modules/run_main:65:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\Dan\\AppData\\Local\\npm-cache\\_npx\\98c943a920688aff\\node_modules\\@tauri-apps\\tauricon\\dist\\tauricon.js'
  ]
}

I tried deleting then reinstalling, but that didn't fix the issue.

tauri info:

Environment
  › OS: Windows 10.0.22000 X64
  › Webview2: 100.0.1185.50
  › MSVC: 
  › Node.js: 16.13.1
  › npm: 8.3.2
  › pnpm: Not installed!
  › yarn: Not installed!
  › rustup: 1.24.3
  › rustc: 1.60.0
  › cargo: 1.60.0
  › Rust toolchain: stable-x86_64-pc-windows-msvc 

Packages
  › @tauri-apps/cli [NPM]: 1.0.0-rc.9
  › @tauri-apps/api [NPM]: 1.0.0-rc.4
  › tauri [RUST]: 1.0.0-rc.8,
  › tauri-build [RUST]: 1.0.0-rc.7,
  › tao [RUST]: 0.8.3,
  › wry [RUST]: 0.15.1,

App
  › build-type: bundle
  › CSP: default-src 'self'
  › distDir: ../dist
  › devPath: http://localhost:3000/
  › framework: Vue.js

App directory structure
  ├─ .git
  ├─ .github
  ├─ .vscode
  ├─ artwork
  ├─ dist
  ├─ node_modules
  ├─ scripts
  ├─ src
  └─ src-tauri

Generating from square icons fails due to strict transparency check

It seems that because of the following strict check it is impossible to convert perfectly square icons, because, obviously, they have no transparent pixels. Could we just remove this block or at least provide some CLI flag to disable it?

tauricon/src/tauricon.ts

Lines 94 to 103 in 5eea916

// just because PNG is sneaky, lets look at the
// individual pixels for something weird
const stats = await image.stats()
if (stats.isOpaque) {
if (spinnerInterval) clearInterval(spinnerInterval)
warn(
'[ERROR] Source image for tauricon could not be detected as transparent'
)
process.exit(1)
}

[bug] generate icons fail

Describe the bug

run script 'npx @tauri-apps/tauricon --help' will show intall @tauri-apps/tauricon every time even I have installed
微信截图_20220812170126

Reproduction

No response

Expected behavior

No response

Platform and versions

Environment
› OS: Windows 10.0.22000 X64
› Webview2: 104.0.1293.47
› MSVC:
- Visual Studio ���ɹ��� 2019
- Visual Studio ���ɹ��� 2022
› Node.js: 16.14.2
› npm: 8.5.0
› pnpm: 6.32.3
› yarn: 1.22.18
› rustup: 1.24.3
› rustc: 1.62.0
› cargo: 1.62.0
› Rust toolchain: stable-x86_64-pc-windows-msvc

Packages
› @tauri-apps/cli [NPM]: 1.0.5
› @tauri-apps/api [NPM]: 1.0.2
› tauri [RUST]: 1.0.5,
› tauri-build [RUST]: 1.0.4,
› tao [RUST]: 0.12.2,
› wry [RUST]: 0.19.0,

App
› build-type: bundle
› CSP: unset
› distDir: ../dist
› devPath: http://localhost:3000/
› framework: Vue.js

App directory structure
├─ dist
├─ env
├─ node_modules
├─ public
├─ src
└─ src-tauri

Stack trace

No response

Additional context

No response

It is not available on Windows

last night, I wanted to set an icon for my app, so i see: https://tauri.studio/docs/guides/icons

yarn global add github:tauri-apps/tauricon

[1/4] Resolving packages...
warning github:tauri-apps/tauricon > imagemin-optipng > exec-buffer > tempfile > [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "@tauri-apps/[email protected]" with binaries:
      - tauricon
Done in 39.97s.

when i run it:

$ tauri

tauri Couldn't recognize the current folder as a part of a Tauri project. It must contain a `tauri.conf.json` file in any subfolder. +0ms

so, I clone the source code project.

run yarn test:

yarn run v1.22.18
$ yarn build
$ rimraf ./dist && rollup -c --silent
babelHelpers: 'bundled' option was used by default. It is recommended to configure this option explicitly, read more here: https://github.com/rollup/plugins/tree/master/packages/babel#babelhelpers
$ cross-env NODE_OPTIONS=--experimental-vm-modules jest --runInBand --forceExit --no-cache --testPathIgnorePatterns="(build|dev)"
(node:14632) ExperimentalWarning: VM Modules is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
  console.log
     tauri Couldn't recognize the current folder as a part of a Tauri project. It must contain a `tauri.conf.json` file in any subfolder. +0ms

      at warn (src/helpers/logger.ts:18:15)

  ●  process.exit called with "1"

      43 |       "Couldn't recognize the current folder as a part of a Tauri project. It must contain a `tauri.conf.json` file in any subfolder."
      44 |     )
    > 45 |     process.exit(1)
         |             ^
      46 |     return ''
      47 |   } else {
      48 |     return dirname(matches[0])

      at getTauriDir (src/helpers/app-paths.ts:45:13)
      at src/helpers/app-paths.ts:52:39
      at Object.<anonymous> (test/jest/__tests__/tauricon.spec.js:6:23)

 RUNS  test/jest/__tests__/tauricon.spec.js
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

i found this bug:

const getTauriDir = (): string => {
  const dir = process.env.__TAURI_TEST_APP_DIR ?? process.cwd()
  // eslint-disable-next-line
  const matches: string[] = glob.sync(join(dir, `**/tauri.conf.json`), {
    ignore: ['**/node_modules/**', '**/target/**']
  })

  if (matches.length === 0) {
    warn(
      "Couldn't recognize the current folder as a part of a Tauri project. It must contain a `tauri.conf.json` file in any subfolder."
    )
    process.exit(1)
    return ''
  } else {
    return dirname(matches[0])
  }
}

after modify code:

const getTauriDir = (): string => {
  const dir = process.env.__TAURI_TEST_APP_DIR ?? process.cwd()
  // eslint-disable-next-line
  const matches: string[] = glob.sync('**/tauri.conf.json', {
    cwd: dir,
    ignore: ['**/node_modules/**', '**/target/**']
  })

  if (matches.length === 0) {
    warn(
      "Couldn't recognize the current folder as a part of a Tauri project. It must contain a `tauri.conf.json` file in any subfolder."
    )
    process.exit(1)
    return ''
  } else {
    return resolve(dir, dirname(matches[0]))
  }
}

run test result:

yarn run v1.22.18
$ yarn build
$ rimraf ./dist && rollup -c --silent
babelHelpers: 'bundled' option was used by default. It is recommended to configure this option explicitly, read more here: https://github.com/rollup/plugins/tree/master/packages/babel#babelhelpers
$ cross-env NODE_OPTIONS=--experimental-vm-modules jest --runInBand --forceExit --no-cache --testPathIgnorePatterns="(build|dev)"
(node:6376) ExperimentalWarning: VM Modules is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
  console.log
     app:spawn batch minify:. +0ms

      at log (src/helpers/logger.ts:18:15)

  console.error
    [Error: Input file is missing]

      530 |       writeFileSync(path.join(target, '/icon.ico'), out2)
      531 |     } catch (err) {
    > 532 |       console.error(err)
          |               ^
      533 |       throw err
      534 |     }
      535 |   }

      at Object.icns (src/tauricon.ts:532:15)
      at Object.make (src/tauricon.ts:235:5)
      at Object.<anonymous> (test/jest/__tests__/tauricon.spec.js:26:7)

  console.log
     app:spawn batch minify:. +3s

      at log (src/helpers/logger.ts:18:15)

 PASS  test/jest/__tests__/tauricon.spec.js (15.699 s)
  [CLI] tauri-icon internals
    √ tells you the version (616 ms)
  [CLI] tauri-icon builder
    √ will still use default compression if missing compression chosen (11928 ms)
    √ will not validate a non-file (19 ms)
    √ makes a set of icons with optipng (2626 ms)

Test Suites: 1 passed, 1 total
Tests:       4 passed, 4 total
Snapshots:   0 total
Time:        15.776 s
Ran all test suites.
Force exiting Jest: Have you considered using `--detectOpenHandles` to detect async operations that kept running after all tests finished?
Done in 21.54s.

my tauri info:

$ tauri info

Environment
  › OS: Windows 10.0.19044 X64
  › Webview2: 100.0.1185.36
  › MSVC: 
      - Visual Studio ���ɹ��� 2019
  › Node.js: 14.18.3
  › npm: 6.14.15
  › pnpm: Not installed!
  › yarn: 1.22.18
  › rustup: 1.24.3
  › rustc: 1.60.0
  › cargo: 1.60.0
  › Rust toolchain: stable-x86_64-pc-windows-msvc 

Packages
  › @tauri-apps/cli [NPM]: 1.0.0-rc.7
  › @tauri-apps/api [NPM]: 1.0.0-rc.3
  › tauri [RUST]: 1.0.0-rc.6,
  › tauri-build [RUST]: 1.0.0-rc.5,
  › tao [RUST]: 0.7.0,
  › wry [RUST]: 0.14.0,

App
  › build-type: bundle
  › CSP: unset
  › distDir: ../dist
  › devPath: http://localhost:8000/
  › framework: Vue.js

App directory structure
  ├─ .git
  ├─ .github
  ├─ .vscode
  ├─ dist
  ├─ docs
  ├─ node_modules
  ├─ scripts
  ├─ src
  └─ src-tauri
Done in 50.19s.

allow logo in svg-format

would be nice to allow the logo to be svg-format, from my understanding it's technically possible with the libraries used, now I work around it by having sharp-cli installed and running this

sharp -i ./logo.svg -o ./app-icon.png resize 1240 1240 && tauricon --target ./src-tauri/icons && rm -f ./app-icon.png

I'm also open to creating a pull request for this feature

[bug] problem using tauricon

Describe the bug

I am trying to use tauricon but failing. Installation seems to work fine... I did both:

globall:

yarn global add @tauri-apps/tauricon

and locally:

yarn add @tauri-apps/tauricon

I can start tauricon in both cases. But getting this error message, and at the same time my mouse turns into this funny cross...
I am really not sure whats going on here?

it doesn't matter what I do with tauricon I am always getting the same error:

  • tauricon --help
  • tauricon
  • tauricon /somepath

image

after clicking around a bit, the mouse turns back to normal and I get this error message:

/home/laptop/.yarn/bin/tauricon: line 1: //: Is a directory
/home/laptop/.yarn/bin/tauricon: line 2: //: Is a directory
/home/laptop/.yarn/bin/tauricon: line 3: //: Is a directory
import-im6.q16: unable to grab mouse `': No such file or directory @ error/xwindow.c/XSelectWindow/9187.
import-im6.q16: unable to grab mouse `': No such file or directory @ error/xwindow.c/XSelectWindow/9187.
/home/laptop/.yarn/bin/tauricon: line 8: /bin: Is a directory
/home/laptop/.yarn/bin/tauricon: line 9: babel.config.js: command not found
/home/laptop/.yarn/bin/tauricon: line 10: babel.config.js: command not found
/home/laptop/.yarn/bin/tauricon: line 11: babel.config.js: command not found
/home/laptop/.yarn/bin/tauricon: line 12: boolean}: command not found
/home/laptop/.yarn/bin/tauricon: line 12: babel.config.js: command not found
/home/laptop/.yarn/bin/tauricon: line 13: babel.config.js: command not found
/home/laptop/.yarn/bin/tauricon: line 13: boolean}: command not found
/home/laptop/.yarn/bin/tauricon: line 14: babel.config.js: command not found
/home/laptop/.yarn/bin/tauricon: line 15: babel.config.js: command not found
/home/laptop/.yarn/bin/tauricon: line 16: babel.config.js: command not found
/home/laptop/.yarn/bin/tauricon: line 17: babel.config.js: command not found
/home/laptop/.yarn/bin/tauricon: line 18: babel.config.js: command not found
/home/laptop/.yarn/bin/tauricon: line 19: babel.config.js: command not found
/home/laptop/.yarn/bin/tauricon: line 20: babel.config.js: command not found
/home/laptop/.yarn/bin/tauricon: line 21: babel.config.js: command not found
/home/laptop/.yarn/bin/tauricon: line 22: dist/: Is a directory
/home/laptop/.yarn/bin/tauricon: line 23: syntax error near unexpected token `('
/home/laptop/.yarn/bin/tauricon: line 23: `const argv = parseArgs(process.argv.slice(2), {'

I am really not sure whats going on here... does anybody have an idea?

Reproduction

not sure how to reproduce... I simply installed tauricon through yarn.

Expected behavior

No response

Platform and versions

Operating System - Ubuntu, version 20.04 X64

Node.js environment
  Node.js - 17.7.1
  @tauri-apps/cli - 1.0.0-rc.6
  @tauri-apps/api - 1.0.0-rc.2

Global packages
  npm - 8.5.2
  pnpm - Not installed
  yarn - 1.22.17

Rust environment
  rustup - Not installed
  rustc - 1.57.0
  cargo - 1.57.0
  toolchain - Not installed

App directory structure
/src-pwa
/node_modules
/public
/.vscode
/dist
/src-ssr
/.quasar
/src-electron
/src
/src-tauri

App
  tauri - 1.0.0-rc.4
  tauri-build - 1.0.0-rc.4
  tao - 0.6.4
  wry - 0.13.3
  build-type - bundle
  CSP - unset
  distDir - ../dist/spa
  devPath - http://localhost:8080/
  framework - Vue.js (Quasar)
  bundler - Webpack

Stack trace

No response

Additional context

I am not sure, but I think this might be caused by some error in the script. like a missing shebang...

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency @rollup/plugin-commonjs to v22.0.2
  • chore(deps): update dependency @types/inquirer to v8.2.3
  • chore(deps): update dependency eslint-plugin-promise to v6.0.1
  • fix(deps): update dependency png-to-ico to v2.1.7
  • fix(deps): update dependency read-chunk to v4.0.3
  • chore(deps): update dependency lockfile-lint to v4.8.0
  • chore(deps): update dependency prettier to v2.7.1
  • chore(deps): update dependency promise to v8.2.0
  • fix(deps): update dependency got to v12.4.1
  • chore(deps): update actions/checkout action to v3
  • chore(deps): update dependency @types/glob to v8
  • chore(deps): update dependency eslint-config-standard-with-typescript to v22
  • chore(deps): update jest monorepo to v29 (major) (@jest/globals, babel-jest, jest)
  • chore(deps): update peter-evans/create-pull-request action to v4
  • fix(deps): update dependency inquirer to v9 (inquirer, @types/inquirer)
  • fix(deps): update dependency update-notifier to v6
  • 🔐 Create all rate-limited PRs at once 🔐

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/audit.yml
  • actions/checkout v2
.github/workflows/covector-status.yml
  • actions/checkout v2
.github/workflows/covector-version-or-publish.yml
  • actions/checkout v2
  • actions/setup-node v3
  • peter-evans/create-pull-request v3
.github/workflows/format.yml
  • actions/checkout v3
  • actions/setup-node v3
.github/workflows/lint.yml
  • actions/checkout v3
  • actions/setup-node v3
.github/workflows/test.yml
  • actions/checkout v3
  • actions/setup-node v3
npm
package.json
  • @fiahfy/icns 0.0.7
  • chalk 5.0.1
  • cross-env 7.0.3
  • cross-spawn 7.0.3
  • find-up 6.3.0
  • fs-extra 10.1.0
  • glob 8.0.3
  • global-agent 3.0.0
  • got 12.1.0
  • imagemin 8.0.1
  • imagemin-optipng 8.0.0
  • imagemin-zopfli 7.0.0
  • inquirer 8.2.4
  • is-png 3.0.1
  • minimist 1.2.6
  • ms 2.1.3
  • png-to-ico 2.1.4
  • read-chunk 4.0.2
  • semver 7.3.7
  • sharp 0.30.5
  • update-notifier 5.1.0
  • @babel/core 7.18.0
  • @babel/preset-env 7.18.0
  • @babel/preset-typescript 7.17.12
  • @jest/globals 28.1.0
  • @rollup/plugin-babel 5.3.1
  • @rollup/plugin-commonjs 22.0.0
  • @rollup/plugin-node-resolve 13.3.0
  • @rollup/plugin-typescript 8.3.2
  • @types/cross-spawn 6.0.2
  • @types/fs-extra 9.0.13
  • @types/glob 7.2.0
  • @types/global-agent 2.1.1
  • @types/imagemin 8.0.0
  • @types/imagemin-optipng 5.2.1
  • @types/inquirer 8.2.1
  • @types/ms 0.7.31
  • @types/semver 7.3.9
  • @types/sharp 0.30.2
  • @typescript-eslint/eslint-plugin 5.26.0
  • @typescript-eslint/parser 5.26.0
  • babel-jest 28.1.0
  • covector 0.7.3
  • eslint 8.16.0
  • eslint-config-prettier 8.5.0
  • eslint-config-standard-with-typescript 21.0.1
  • eslint-plugin-import 2.26.0
  • eslint-plugin-lodash-template 0.21.0
  • eslint-plugin-node 11.1.0
  • eslint-plugin-promise 6.0.0
  • eslint-plugin-security 1.5.0
  • is-running 2.1.0
  • jest 28.1.0
  • jest-transform-toml 1.0.0
  • lockfile-lint 4.7.4
  • prettier 2.6.2
  • promise 8.1.0
  • rimraf 3.0.2
  • rollup 2.74.1
  • rollup-plugin-terser 7.0.2
  • tslib 2.4.0
  • typescript 4.6.4
  • node >= 12.13.0
  • npm >= 6.6.0
  • yarn >= 1.19.1
  • semver-regex 4.0.3
  • trim-newlines 4.0.2

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.