Improvements to bring in line with nwjs-builder-phoenix
zkrige opened this issue · 6 comments
Issue Type
- Feature Request
Current/Missing Behaviour
There is no functionality to configure things like the icon, plist entries, company name, copyright, etc
Expected/Proposed Behaviour
add this functionality
Additional Info
here is a sample from my package.json for nwjs-builder-phoenix. We run a script to replace all the @@
variables before we do the build. After the new app is built we package and sign the installer. We need all these properties to be properly configured so that we can distribute our app
"build": {
"ffmpegIntegration": true,
"nwVersion": "0.78.1",
"nwFlavor": "normal",
"appId": "@@APP.NAMESPACE",
"output": "./../../builds/dist/",
"excludes": ["**/*.tar.gz"],
"win": {
"productName": "@@APP.EXECUTABLE",
"companyName": "@@APP.NAME",
"fileDescription": "@@APP.TITLE",
"productVersion": "@@APP.VERSION",
"copyright": "@@APPP.COPYRIGHT",
"icon": "../../output/white-label/icon.ico"
},
"mac": {
"productName": "@@APP.EXECUTABLE",
"companyName": "@@APP.NAME",
"copyright": "@@APPP.COPYRIGHT",
"version": "@@APP.VERSION",
"icon": "../../output/white-label/nw.icns",
"documentIcon": "../../output/white-label/nw.icns",
"plistStrings": {
"CFBundleIdentifier": "@@APP.NAMESPACE",
"LSApplicationCategoryType": "public.app-category.education"
}
}
},
@sysrage ah amazing - thank you
Would you perhaps happen to have a working example - bare API documentation is a little sparse, and a working example would go a long way to helping users get this working
Would you perhaps happen to have a working example - bare API documentation is a little sparse, and a working example would go a long way to helping users get this working
Adding the app
property to nw-builder args is all it takes. I modified the nw-react-example build script with the following and it worked (note icon.icns was taken from here: https://github.com/nwutils/nw-builder/tree/main/test/fixture/app).
const nwBuildArgs = {
glob: false,
srcDir: appBaseDir,
version: nwVersion,
flavor: 'normal',
platform: platform,
arch: process.arch,
outDir,
run: false,
zip: true,
app: {
name: "Test Name",
icon: "icon.icns",
NSHumanReadableCopyright: "Test Copyright"
}
};
It would be nice if there was one, copy-pastable, example of passing everything in. Every setting. And then if you have questions about what options can be passed in for specific part of the API, the docs can fill in the details. That would be one big object that would require manually updating any time we change the API. But would simplify usage a lot.
I try to do this on all my libraries:
Is there a way to pass app
arguments from CLI?
We use a single package.json and build for windows and macOS
The nwjs-builder-phoenix has seperate sections for each platform, so depending on which platform you build for, it reads from the relevant section.
As far as I can tell the app
section in nw-builder is not platform dependent and will be used for whichever platform you build for.
I suppose I could use a js script to handle the build for each platform - this way I wouldn't need to rely on a CLI implementation
Is there a way to pass
app
arguments from CLI?
One way is to pass all app.*
properties inside the package.json
:
package.json:
{
"nwbuild": {
"app":
"icon": "...", #the icon will be parsed for all platforms
"NSHumanReadableCopyright": "..." # only parsed for osx platform
"fileDescription": "...", # only parsed for Windows platform
}
}
The nwbuild
function does a single build for a single platform and architecture. You can reuse the same options from the package.json
and it will parse the ones necessary for the given platform.
I haven't used the options in package.json
in some time so it may not work as expected.
I suppose I could use a js script to handle the build for each platform - this way I wouldn't need to rely on a CLI implementation
This is what I usually do. Since there was demand for passing options in the package.json
, I added that too (a while ago might I add).