Skip to content

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

Closed

Description

@XMLHexagram

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

Activity

  1. VerteDinde commented on Oct 31, 2022

    @VerteDinde
    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?

  2. XMLHexagram commented on Oct 31, 2022

    @XMLHexagram
    Author

    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.

  3. XMLHexagram commented on Oct 31, 2022

    @XMLHexagram
    Author

    Also I think #3019 is the same problem.

  4. MarshallOfSound commented on Oct 31, 2022

    @MarshallOfSound
    Member

    Fixed in b5d0587

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions