-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(type-safe-api): add commitGeneratedCode option to control genera…
…ted code (#814) This commit introduces a new `commitGeneratedCode` option to the TypeSafeApiProject, which allows controlling whether generated code should be committed or ignored for all generated projects. The main changes include: - Add a `commitGeneratedCode` option to the TypeSafeApiProject and related options interfaces. - Set the default value of `commitGeneratedCode` to `false`. - Conditionally add patterns to .gitignore based on the `commitGeneratedCode` option for all generated projects. - Update tests to cover the new `commitGeneratedCode` option. By default, the generated code will be ignored in the repository, except for Python projects where it will be included to allow for easier distribution and deployment of the generated artifacts using Poetry. Fixes: #813
- Loading branch information
Showing
15 changed files
with
308 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,6 +159,11 @@ export interface TypeSafeApiProjectOptions extends ProjectOptions { | |
* fully-fledged runtimes, for example react hooks or clients in languages that aren't supported as runtimes. | ||
*/ | ||
readonly library?: LibraryConfiguration; | ||
/** | ||
* Whether to commit the code generated by the OpenAPI Generator. | ||
* @default false | ||
*/ | ||
readonly commitGeneratedCode?: boolean; | ||
} | ||
|
||
/** | ||
|
@@ -265,16 +270,28 @@ export class TypeSafeApiProject extends Project { | |
ProjectUtils.isNamedInstanceOf(this.parent, NodeProject) | ||
? this.parent.package.packageManager | ||
: NodePackageManager.PNPM, | ||
commitGeneratedCode: | ||
options.runtime?.options?.typescript?.commitGeneratedCode ?? | ||
options.commitGeneratedCode ?? | ||
false, | ||
...options.runtime?.options?.typescript, | ||
}, | ||
pythonOptions: { | ||
authorName: "APJ Cope", | ||
authorEmail: "[email protected]", | ||
version: "0.0.0", | ||
commitGeneratedCode: | ||
options.runtime?.options?.python?.commitGeneratedCode ?? | ||
options.commitGeneratedCode ?? | ||
false, | ||
...options.runtime?.options?.python, | ||
}, | ||
javaOptions: { | ||
version: "0.0.0", | ||
commitGeneratedCode: | ||
options.runtime?.options?.java?.commitGeneratedCode ?? | ||
options.commitGeneratedCode ?? | ||
false, | ||
...options.runtime?.options?.java, | ||
}, | ||
}); | ||
|
@@ -327,6 +344,11 @@ export class TypeSafeApiProject extends Project { | |
ProjectUtils.isNamedInstanceOf(this.parent, NodeProject) | ||
? this.parent.package.packageManager | ||
: NodePackageManager.PNPM, | ||
commitGeneratedCode: | ||
options.library?.options?.typescriptReactQueryHooks | ||
?.commitGeneratedCode ?? | ||
options.commitGeneratedCode ?? | ||
false, | ||
...options.library?.options?.typescriptReactQueryHooks, | ||
}, | ||
}); | ||
|
@@ -396,16 +418,28 @@ export class TypeSafeApiProject extends Project { | |
ProjectUtils.isNamedInstanceOf(this.parent, NodeProject) | ||
? this.parent.package.packageManager | ||
: NodePackageManager.PNPM, | ||
commitGeneratedCode: | ||
options.handlers?.options?.typescript?.commitGeneratedCode ?? | ||
options.commitGeneratedCode ?? | ||
false, | ||
...options.handlers?.options?.typescript, | ||
}, | ||
pythonOptions: { | ||
authorName: "APJ Cope", | ||
authorEmail: "[email protected]", | ||
version: "0.0.0", | ||
commitGeneratedCode: | ||
options.handlers?.options?.python?.commitGeneratedCode ?? | ||
options.commitGeneratedCode ?? | ||
false, | ||
...options.handlers?.options?.python, | ||
}, | ||
javaOptions: { | ||
version: "0.0.0", | ||
commitGeneratedCode: | ||
options.handlers?.options?.java?.commitGeneratedCode ?? | ||
options.commitGeneratedCode ?? | ||
false, | ||
...options.handlers?.options?.java, | ||
}, | ||
generatedRuntimes: { | ||
|
@@ -470,16 +504,28 @@ export class TypeSafeApiProject extends Project { | |
ProjectUtils.isNamedInstanceOf(this.parent, NodeProject) | ||
? this.parent.package.packageManager | ||
: NodePackageManager.PNPM, | ||
commitGeneratedCode: | ||
options.infrastructure.options?.typescript?.commitGeneratedCode ?? | ||
options.commitGeneratedCode ?? | ||
false, | ||
...options.infrastructure.options?.typescript, | ||
}, | ||
pythonOptions: { | ||
authorName: "APJ Cope", | ||
authorEmail: "[email protected]", | ||
version: "0.0.0", | ||
commitGeneratedCode: | ||
options.infrastructure.options?.python?.commitGeneratedCode ?? | ||
options.commitGeneratedCode ?? | ||
false, | ||
...options.infrastructure.options?.python, | ||
}, | ||
javaOptions: { | ||
version: "0.0.0", | ||
commitGeneratedCode: | ||
options.infrastructure.options?.java?.commitGeneratedCode ?? | ||
options.commitGeneratedCode ?? | ||
false, | ||
...options.infrastructure.options?.java, | ||
}, | ||
generatedRuntimes: { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.