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

Forge cannot correctly detect working dir when use config file #3028

Closed
3 tasks done
XMLHexagram opened this issue Oct 31, 2022 · 4 comments
Closed
3 tasks done

Forge cannot correctly detect working dir when use config file #3028

XMLHexagram opened this issue Oct 31, 2022 · 4 comments

Comments

@XMLHexagram
Copy link

XMLHexagram commented Oct 31, 2022

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Electron Forge version

6.0.0-beta.70

Electron version

21.2.0

Operating system

macOS 13.0

Last known working Electron Forge version

No response

Expected behavior

A project has forge.config.ts but don't have config.forge in package.json can be treat as forge working dir.

Actual behavior

But not. Forge will look upper dir for packages.json. If you are use mono repo, forge will use package.json in project root.

Steps to reproduce

Forge demo yarn create electron-app my-new-app --template=typescript-webpack and make sure upper dir has an package.json file can reproduce this issue.

Additional information

No response

@VerteDinde
Copy link
Member

Hey @XMLHexagram, just want to make sure I understand your repro case correctly: you're creating multiple Forge projects inside of a monorepo, and each Forge project is trying to use the root directory package.json file instead of their individual forge.config.ts files?

@XMLHexagram
Copy link
Author

XMLHexagram commented Oct 31, 2022

Hey @XMLHexagram, just want to make sure I understand your repro case correctly: you're creating multiple Forge projects inside of a monorepo, and each Forge project is trying to use the root directory package.json file instead of their individual forge.config.ts files?

Well, the same, and they will use their forge.config.ts if they can find the right package.json.

The bug cause Could not find any Electron packages in devDependencies error because root package.json in project root doesn't have electron in devDependencies.

I review forge's source code and find resolve-dir function in core/utils does not fully adapt config file. I did a simple fix in #3029.

@XMLHexagram
Copy link
Author

Also I think #3019 is the same problem.

@MarshallOfSound
Copy link
Member

Fixed in b5d0587

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

No branches or pull requests

3 participants