-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(#2758): set exact-o3r-version as default for all schematics if pr…
…ovided when adding @o3r/core
- Loading branch information
1 parent
e6b654f
commit b8bef9b
Showing
10 changed files
with
92 additions
and
27 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
40 changes: 40 additions & 0 deletions
40
packages/@o3r/schematics/src/rule-factories/options/index.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,40 @@ | ||
import type { | ||
Rule, | ||
} from '@angular-devkit/schematics'; | ||
import { | ||
getDefaultOptionsForSchematic, | ||
getWorkspaceConfig, | ||
} from '../../utility'; | ||
|
||
/** | ||
* Factory of the schematic to wrap | ||
* @param options Options of the factory | ||
*/ | ||
type SchematicWrapperFn<S extends Record<string, any>> = (options: S) => Rule; | ||
|
||
/** | ||
* Wrapper method of a schematic to retrieve options from workspace and merge it with the one from the run of the schematic | ||
* @param schematicFn | ||
*/ | ||
export function createSchematicWithOptionsFromWorkspace<S extends Record<string, any>>(schematicFn: SchematicWrapperFn<S>): SchematicWrapperFn<S> { | ||
return (options) => (tree, context) => { | ||
const workspace = getWorkspaceConfig(tree); | ||
const workspaceOptions = getDefaultOptionsForSchematic( | ||
workspace, | ||
context.schematic.description.collection.name, | ||
context.schematic.description.name, | ||
{ projectName: undefined, ...options } | ||
); | ||
const schematicOptionsWithoutUndefined = Object.entries(options).reduce((acc: Record<string, any>, [key, value]) => { | ||
if (typeof value !== 'undefined') { | ||
acc[key] = value; | ||
} | ||
return acc; | ||
}, {}) as S; | ||
const schematicOptions = { | ||
...workspaceOptions, | ||
...schematicOptionsWithoutUndefined | ||
}; | ||
return schematicFn(schematicOptions satisfies S); | ||
}; | ||
} |
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
27 changes: 27 additions & 0 deletions
27
tools/github-actions/new-version/packaged-action/LICENSE.txt
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Empty file.