-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cascading] from release/9.4.0-rc to main (#992)
<!-- {"currentBranch":"release/9.4.0-rc","targetBranch":"main","bypassReviewers":true,"isConflicting":false} --> ## Cascading from release/9.4.0-rc to main The configuration requests the cascading to bypass reviewer in case of CI success. To not bypass the reviewing process, please check the following checkbox: - [ ] <!-- !cancel bypass! --> 🚫 stop reviewing process bypass for this Pull Request --- <small>This PR has been generated with ❤️ by the [Otter](https://github.com/AmadeusITGroup/otter) cascading tool.</small>
- Loading branch information
Showing
10 changed files
with
64 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './project-configs'; |
44 changes: 44 additions & 0 deletions
44
packages/@o3r/workspace/schematics/rule-factories/project-configs.ts
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import * as path from 'node:path'; | ||
import * as ts from 'typescript'; | ||
import { findConfigFileRelativePath } from '@o3r/schematics'; | ||
import type { Rule } from '@angular-devkit/schematics'; | ||
|
||
/** | ||
* Update the tsconfig generated by the Angular generators | ||
* * extends the base tsconfig | ||
* * force the outDir to ./dist | ||
* * update input compiler files if needed | ||
* @param targetPath | ||
* @param tsconfigName | ||
* @param options | ||
*/ | ||
export function updateProjectTsConfig(targetPath: string, tsconfigName: string, options = {updateInputFiles: false}): Rule { | ||
return (tree, context) => { | ||
const tsconfigPath = path.posix.join(targetPath, tsconfigName); | ||
if (!tree.exists(tsconfigPath)) { | ||
context.logger.warn(`The file ${tsconfigPath} was not found, the update will not be applied`); | ||
return tree; | ||
} | ||
|
||
const tsconfig = ts.parseConfigFileTextToJson(tsconfigPath, tree.readText(tsconfigPath)); | ||
if (!tsconfig || !tsconfig.config) { | ||
context.logger.error(`Error parsing ${tsconfigPath}, the update will not be applied`, tsconfig?.error as any); | ||
return tree; | ||
} | ||
|
||
if (options?.updateInputFiles) { | ||
tsconfig.config = Object.fromEntries(Object.entries(tsconfig.config).filter(([propName, _]) => propName !== 'files')); | ||
tsconfig.config.include = ['./src/**/*.ts']; | ||
} | ||
const baseTsConfig = findConfigFileRelativePath(tree, ['tsconfig.base.json', 'tsconfig.json'], targetPath); | ||
if (baseTsConfig) { | ||
tsconfig.config.extends = baseTsConfig; | ||
} | ||
|
||
tsconfig.config.compilerOptions ||= {}; | ||
tsconfig.config.compilerOptions.outDir = './dist'; | ||
tree.overwrite(tsconfigPath, JSON.stringify(tsconfig.config, null, 2)); | ||
return tree; | ||
}; | ||
} | ||
|
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