bennymeg / nx-electron

Electron schematics for nrwl nx platform
Apache License 2.0
309 stars 82 forks source link

Inconsistant Behaviour #228

Closed HealMah closed 11 months ago

HealMah commented 12 months ago

Describe the bug The source code for generating package,json claims that "If a package.json exists in the project, it will reuse that.", but that is not the case when the project dir is "apps/project-name/package.json" - which is similar to output of "${options.projectRoot}/package.json`".

To Reproduce The existing code for that is like:

packageJson['author'] = rootPackageJson.author || '';
packageJson['description'] = rootPackageJson.description || '';

Expected behavior Shouldn't it be:

packageJson['author'] = packageJson['author'] || rootPackageJson.author || '';
packageJson['description'] = packageJson['description'] || rootPackageJson.description || '';

for that to be the expected behaviour? Or is this intended??

MOREOVER: It looks like during packaging or making process, it's using workspace root package.json dependencies instead of the calculated /generated dependencies for the local project. This:

  1. affects local project package.json configuration or fields. E.g. descriptions, versions, etc.
  2. leads to warnings like: "description is missed in the package.json", even though these fields were set in the local project.

How can we set the "appPackageFile" to use "dist/apps/project-name/package.json" that was generated? Or am I doing it wrong?? THANKS

bennymeg commented 11 months ago

You are right. I'll update it as you suggested.

Nevertheless, on v16, I migrated to nx solution instead.