Pkg: Allow customizing the generated executable icon with --icon

Created on 29 Dec 2019  路  2Comments  路  Source: vercel/pkg

Hi,
Could you add a native way for us to customize the icon of generated executable package (i.e Windows and MacOS)?

I tried using Resource Hacker to swap the default Node icon set with my own icon set (the same sizes for each of six icons packed by Node), but my icon file has different size to the icon set embedded by Node/pkg and my executable file gets corrupted (has different size to original and internal pointer references probably don't get updated) and terminates instantly (however it shows my customized icon fine in file preview).

The reasons I'm asking for --icon parameter to be supported natively by pkg is that the post-packaging icon modification is unreliable and more troublesome than it ought o be. Since pkg is assembling all the resources into the executable already, allowing us to submit our own icon would be natural feature.
I anticipate quite few users would find this feature useful for their executable branding.

Thank you in advance.

All 2 comments

Hi,
Could you add a native way for us to customize the icon of generated executable package (i.e Windows and MacOS)?

I tried using Resource Hacker to swap the default Node icon set with my own icon set (the same sizes for each of six icons packed by Node), but my icon file has different size to the icon set embedded by Node/pkg and my executable file gets corrupted (has different size to original and internal pointer references probably don't get updated) and terminates instantly (however it shows my customized icon fine in file preview).

The reasons I'm asking for --icon parameter to be supported natively by pkg is that the post-packaging icon modification is unreliable and more troublesome than it ought o be. Since pkg is assembling all the resources into the executable already, allowing us to submit our own icon would be natural feature.
I anticipate quite few users would find this feature useful for their executable branding.

Thank you in advance.

you may try a new toy pkgx

Studied this topic for while. Well it seams that every attempt to patch executable resources lead to damage file unless new resource binary size does not match original size. after path . After succesfull patch the exe errors with such as

pkg/prelude/bootstrap.js:7
                return;
                ^^^^^^

SyntaxError: Illegal return statement
    at new Script (vm.js:89:7)
    at readPrelude (internal/bootstrap/pkg.js:29:13)
    at internal/bootstrap/pkg.js:36:18
    at internal/bootstrap/pkg.js:43:4
    at internal/bootstrap/pkg.js:44:2

So, might it be so easy that we just need to patch pkg entry point informations regarding new resource binary size?

@Zireael did found out more?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

telunc picture telunc  路  4Comments

hellower picture hellower  路  3Comments

serzhiio picture serzhiio  路  3Comments

ByeongYeon picture ByeongYeon  路  4Comments

asaf050 picture asaf050  路  3Comments