Skip to content

Commit 8662693

Browse files
authored
fix(monorepo): support disableDefaultLicenses property (#737)
fix #736
1 parent 9f34193 commit 8662693

File tree

7 files changed

+506
-3
lines changed

7 files changed

+506
-3
lines changed

packages/monorepo/src/components/nx-configurator.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,13 @@ export interface LicenseOptions {
119119
* Arbitrary license text.
120120
*/
121121
readonly licenseText?: string;
122+
123+
/**
124+
* Whether to disable the generation of default licenses.
125+
*
126+
* @default false
127+
*/
128+
readonly disableDefaultLicenses?: boolean;
122129
}
123130

124131
/**
@@ -502,7 +509,9 @@ export class NxConfigurator extends Component implements INxProjectCore {
502509
private _addLicenses() {
503510
[this.project, ...this.project.subprojects]
504511
.filter(
505-
(p) => p.components.find((c) => c instanceof License) === undefined
512+
(p) =>
513+
!this.licenseOptions?.disableDefaultLicenses &&
514+
p.components.find((c) => c instanceof License) === undefined
506515
)
507516
.forEach((p) => {
508517
if (!this.licenseOptions) {

packages/monorepo/src/projects/java/monorepo-java.ts

+10
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ const MVN_PLUGIN_PATH = "./.nx/plugins/nx_plugin.js";
2525
*/
2626
export interface MonorepoJavaOptions extends JavaProjectOptions {
2727
readonly defaultReleaseBranch?: string;
28+
29+
/**
30+
* Whether to disable the generation of default licenses.
31+
*
32+
* @default false
33+
*/
34+
readonly disableDefaultLicenses?: boolean;
2835
}
2936

3037
/**
@@ -72,6 +79,9 @@ export class MonorepoJavaProject extends JavaProject implements INxProjectCore {
7279

7380
this.nxConfigurator = new NxConfigurator(this, {
7481
defaultReleaseBranch: options.defaultReleaseBranch ?? "main",
82+
licenseOptions: {
83+
disableDefaultLicenses: options.disableDefaultLicenses,
84+
},
7585
});
7686

7787
// Setup maven nx plugin

packages/monorepo/src/projects/python/python-project-options.ts

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/monorepo/src/projects/typescript/typescript-project-options.ts

+26
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)