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

[FEATURE] make affected.defaultBase configurable in nx.json #167

Closed
2 tasks
ktfleming opened this issue Sep 20, 2022 · 1 comment · Fixed by #169
Closed
2 tasks

[FEATURE] make affected.defaultBase configurable in nx.json #167

ktfleming opened this issue Sep 20, 2022 · 1 comment · Fixed by #169

Comments

@ktfleming
Copy link

Describe the feature

Right now affected.defaultBase in the generated nx.json is hardcoded to mainline:

https://github.com/aws/aws-prototyping-sdk/blob/4881808bdccb2f3e53df5fc96acc186612634bed/packages/nx-monorepo/src/nx-monorepo.ts#L300-L302

It would be nice if this could be configured in the projen config file.

Use Case

When not using a mainline branch, some nx commands will fail. For example, npx nx print-affected fails with

Error: Command failed: git merge-base --fork-point "mainline" "HEAD"
fatal: No such ref: 'mainline'

Proposed Solution

The branch could be specified as a new parameter in the projen file, or it could be set to options.defaultReleaseBranch (I'm new to nx and not sure which is more appropriate).

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

PDK version used

v0.11.1

What languages will this feature affect?

No response

Environment details (OS name and version, etc.)

Mac OS 12.3.1

@cogwirrel
Copy link
Member

Hey, thanks for the feature request!

I can definitely see it being useful to set the affected branch :) defaultReleaseBranch could be a good candidate, though it could also be added to the nxConfig option so it's colocated with other NX options. I'll discuss with dimecha@ when he's back!

As a workaround you can actually customise your nx.json (or other projen managed files) prior to the call to synth(). For example:

const monorepo = new NxMonorepoProject({
  ...
});

monorepo.tryFindObjectFile('nx.json')!.addOverride('affected.defaultBase', 'my-branch');

monorepo.synth();

Hope that helps!

Thanks,
Jack

agdimech added a commit that referenced this issue Sep 26, 2022
fix #167

Co-authored-by: Dimech <dimecha@bcd07403f081.ant.amazon.com>
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 a pull request may close this issue.

2 participants