Skip to content

Commit

Permalink
fix(monorepo): support disableDefaultLicenses property (#737)
Browse files Browse the repository at this point in the history
fix #736
  • Loading branch information
agdimech committed Mar 28, 2024
1 parent 9f34193 commit 8662693
Show file tree
Hide file tree
Showing 7 changed files with 506 additions and 3 deletions.
11 changes: 10 additions & 1 deletion packages/monorepo/src/components/nx-configurator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ export interface LicenseOptions {
* Arbitrary license text.
*/
readonly licenseText?: string;

/**
* Whether to disable the generation of default licenses.
*
* @default false
*/
readonly disableDefaultLicenses?: boolean;
}

/**
Expand Down Expand Up @@ -502,7 +509,9 @@ export class NxConfigurator extends Component implements INxProjectCore {
private _addLicenses() {
[this.project, ...this.project.subprojects]
.filter(
(p) => p.components.find((c) => c instanceof License) === undefined
(p) =>
!this.licenseOptions?.disableDefaultLicenses &&
p.components.find((c) => c instanceof License) === undefined
)
.forEach((p) => {
if (!this.licenseOptions) {
Expand Down
10 changes: 10 additions & 0 deletions packages/monorepo/src/projects/java/monorepo-java.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ const MVN_PLUGIN_PATH = "./.nx/plugins/nx_plugin.js";
*/
export interface MonorepoJavaOptions extends JavaProjectOptions {
readonly defaultReleaseBranch?: string;

/**
* Whether to disable the generation of default licenses.
*
* @default false
*/
readonly disableDefaultLicenses?: boolean;
}

/**
Expand Down Expand Up @@ -72,6 +79,9 @@ export class MonorepoJavaProject extends JavaProject implements INxProjectCore {

this.nxConfigurator = new NxConfigurator(this, {
defaultReleaseBranch: options.defaultReleaseBranch ?? "main",
licenseOptions: {
disableDefaultLicenses: options.disableDefaultLicenses,
},
});

// Setup maven nx plugin
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8662693

Please sign in to comment.