Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't overwrite all options previously specified when manifest is found (assign re-defined only) #1263

Closed
wants to merge 1 commit into from

Conversation

Black-Platypus
Copy link
Contributor

Keep anything the user specified in the options object and only overwrite things found in any manifest (package.json) found.

  • Assign manifest.app to options.app
  • Assign manifest to options
  • Restore options.app

Fixes: #1261

@@ -43,11 +43,15 @@ async function nwbuild(options) {

try {
// Parse options
options = await util.parse(options, manifest);
Copy link
Collaborator

@ayushmanchhabra ayushmanchhabra Oct 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember why I did this. If options.srcDir or options.glob is undefined, then getNodeManifest function will throw an error. This is why the parse function is called twice. If there's a better way to go about this, I'm all ears

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ayushmanchhabra
Copy link
Collaborator

Keep anything the user specified in the options object and only overwrite things found in any manifest (package.json) found.

Also nothing should be overwritten. If an option is undefined, the default value is used for it. If an option is being overwritten, then its probably an error in the parse function.

@Black-Platypus
Copy link
Contributor Author

Keep anything the user specified in the options object and only overwrite things found in any manifest (package.json) found.

Also nothing should be overwritten. If an option is undefined, the default value is used for it. If an option is being overwritten, then its probably an error in the parse function.

This completely overwrites options, no? Am I overlooking something?

options = manifest.nwbuild;

@ayushmanchhabra
Copy link
Collaborator

ayushmanchhabra commented Oct 21, 2024

Keep anything the user specified in the options object and only overwrite things found in any manifest (package.json) found.

Also nothing should be overwritten. If an option is undefined, the default value is used for it. If an option is being overwritten, then its probably an error in the parse function.

This completely overwrites options, no? Am I overlooking something?

options = manifest.nwbuild;

The options defined in a package.json (NW.js manifest) overwrite options defined in JavaScript API or CLI. The highlighted code checks if the options are defined in package.json. This is a feature not bug.

@Black-Platypus
Copy link
Contributor Author

Alright, sad to hear this won't be implemented.
(It felt wrong to discard information specifically set in JS or CLI just because I want to pass in some values via manifest)

@ayushmanchhabra
Copy link
Collaborator

I'm not against this but it would be a breaking change. Also having a priority makes it easier to maintain in the long term

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't discard information previously set by user when some nwbuilder manifest is found
2 participants