-
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.
feat: split and export renovate presets
- Loading branch information
Showing
15 changed files
with
552 additions
and
172 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
{ | ||
"$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
"extends": [ | ||
"github>AmadeusITGroup/otter//tools/renovate/base", | ||
"github>AmadeusITGroup/otter//tools/renovate/design-factory", | ||
"github>AmadeusITGroup/otter//tools/renovate/otter-project", | ||
"github>AmadeusITGroup/otter//tools/renovate/sdk" | ||
], | ||
"ignorePaths": [ | ||
"**/node_modules/**", | ||
"**/templates/**" | ||
], | ||
"enabledManagers": [ | ||
"npm", | ||
"github-actions", | ||
"gradle" | ||
], | ||
"labels": [ | ||
"upgrade" | ||
], | ||
"baseBranches": [ | ||
"main", | ||
"/^release\\/.*-next$/" | ||
], | ||
"packageRules": [ | ||
{ | ||
"matchPackageNames": [ | ||
"typescript", | ||
"eslint", | ||
"@yarnpkg/sdks" | ||
], | ||
"postUpgradeTasks": { | ||
"commands": [ | ||
"yarn install", | ||
"yarn sdks" | ||
], | ||
"executionMode": "branch", | ||
"fileFilters": [ | ||
".yarn/sdks/**" | ||
] | ||
} | ||
}, | ||
{ | ||
// Update of bootstrap disabled as it is not supported by design-factory (Can be removed when upgrading design-factory to v17) | ||
"matchCurrentVersion": "<=5.2.0", | ||
"matchPackageNames": [ | ||
"bootstrap" | ||
], | ||
"enabled": false | ||
}, | ||
{ | ||
//Major update of chalk disabled as it drops support on CommonJS | ||
"matchUpdateTypes": [ | ||
"major" | ||
], | ||
"matchCurrentVersion": "<5", | ||
"matchPackageNames": [ | ||
"chalk" | ||
], | ||
"enabled": false | ||
}, | ||
{ | ||
//Major update of globby disabled as it drops support on CommonJS | ||
"matchUpdateTypes": [ | ||
"major" | ||
], | ||
"matchCurrentVersion": "<14", | ||
"matchPackageNames": [ | ||
"globby" | ||
], | ||
"enabled": false | ||
}, | ||
{ | ||
// This rule disable the upgrade of the gaurav-nelson/github-action-markdown-link-check | ||
// TODO: re-activate the upgrade when the following issue is fixed: gaurav-nelson/github-action-markdown-link-check#200 | ||
"matchPackagePatterns": [ | ||
".*markdown-link-check" | ||
], | ||
"enabled": false | ||
} | ||
] | ||
} |
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,31 @@ | ||
# Renovate Presets | ||
|
||
The Otter library provides a set of custom [Renovate Presets](https://docs.renovatebot.com/config-presets/) to facilitate the configuration of automated dependency updates. | ||
|
||
## Usage | ||
|
||
To be able to benefit from the Renovate Presets exposed by the Otter Framework, you can add the configurations in the `extends` field in your `.renovaterc.json` file as described in the following example: | ||
|
||
```json5 | ||
{ | ||
"extends": [ | ||
"config:base" | ||
"github>AmadeusITGroup/otter//tools/renovate/base", | ||
"github>AmadeusITGroup/otter//tools/renovate/otter-project" | ||
], | ||
"packageRules": [ | ||
// ... | ||
] | ||
} | ||
``` | ||
|
||
> [!NOTE] | ||
> The Otter Renovate presets are always prefixed with `github>AmadeusITGroup/otter//tools/renovate/` to target the specific configuration files hosted in the Otter repository. | ||
## Available presets | ||
|
||
- **base**: Base configuration recommended to an Otter base project. | ||
- **otter-project**: Configuration to be used in a project to facilitate and regroup the upgrades of Otter dependencies. | ||
- **sdk**: Configuration to ensure the upgrade of the dependencies of a generated SDK | ||
- **sdk-spec-upgrade**: Setup an auto-regeneration of the SDK based on a given Swagger/OAS specification dependency (as first [parameter](https://docs.renovatebot.com/config-presets/#preset-parameters)). | ||
- **design-factory**: Renovate configuration to ensure the dependency upgrade of the Design Factory dependencies are following the Design Factory constraints. |
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
23 changes: 23 additions & 0 deletions
23
packages/@ama-sdk/schematics/schematics/ng-update/typescript/v10.1/add-presets-renovate.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,23 @@ | ||
import type { Rule } from '@angular-devkit/schematics'; | ||
|
||
const renovatePresets = [ | ||
'github>AmadeusITGroup/otter//tools/renovate/base', | ||
'github>AmadeusITGroup/otter//tools/renovate/sdk' | ||
]; | ||
|
||
export const addPresetsRenovate = (): Rule => { | ||
return (tree, context) => { | ||
if (tree.exists('.renovaterc.json')) { | ||
const renovateConfig = tree.readJson('.renovaterc.json') as any; | ||
renovateConfig.extends ||= []; | ||
renovatePresets | ||
.filter((preset) => !renovateConfig.extends.includes(preset)) | ||
.forEach((preset) => renovateConfig.extends.push(preset)); | ||
tree.overwrite('renovate.json', JSON.stringify(renovateConfig, null, 2)); | ||
} else { | ||
context.logger.debug('renovate.json not found, skipping preset addition'); | ||
} | ||
// eslint-disable-next-line max-len | ||
context.logger.info('To activate the auto-generation based on a dependency package, replace "my-specification-package", in your Renovate configuration, by your specification dependency package name.'); | ||
}; | ||
}; |
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 |
---|---|---|
@@ -1,6 +1,10 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/angular/angular-cli/master/packages/angular_devkit/schematics/collection-schema.json", | ||
"schematics": { | ||
|
||
"migration-v10_0": { | ||
"version": "10.1.0-alpha.0", | ||
"description": "Updates of @o3r/workspace to v10.1.*", | ||
"factory": "./schematics/ng-update/index#updateV10_1" | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1 +1,21 @@ | ||
export type {}; | ||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
/* eslint-disable camelcase */ | ||
|
||
import { chain, type Rule } from '@angular-devkit/schematics'; | ||
import { createSchematicWithMetricsIfInstalled } from '@o3r/schematics'; | ||
import { addPresetsRenovate } from './v10.1/add-presets-renovate'; | ||
|
||
/** | ||
* Update of Otter Workspace V10.1 | ||
*/ | ||
function updateV10_1Fn(): Rule { | ||
const updateRules: Rule[] = [ | ||
addPresetsRenovate() | ||
]; | ||
return chain(updateRules); | ||
} | ||
|
||
/** | ||
* Update of Otter Workspace V10.1 | ||
*/ | ||
export const updateV10_1 = createSchematicWithMetricsIfInstalled(updateV10_1Fn); |
21 changes: 21 additions & 0 deletions
21
packages/@o3r/workspace/schematics/ng-update/v10.1/add-presets-renovate.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,21 @@ | ||
import type { Rule } from '@angular-devkit/schematics'; | ||
|
||
const renovatePresets = [ | ||
'github>AmadeusITGroup/otter//tools/renovate/base', | ||
'github>AmadeusITGroup/otter//tools/renovate/otter-project' | ||
]; | ||
|
||
export const addPresetsRenovate = (): Rule => { | ||
return (tree, context) => { | ||
if (tree.exists('.renovaterc.json')) { | ||
const renovateConfig = tree.readJson('.renovaterc.json') as any; | ||
renovateConfig.extends ||= []; | ||
renovatePresets | ||
.filter((preset) => !renovateConfig.extends.includes(preset)) | ||
.forEach((preset) => renovateConfig.extends.push(preset)); | ||
tree.overwrite('renovate.json', JSON.stringify(renovateConfig, null, 2)); | ||
} else { | ||
context.logger.info('renovate.json not found, skipping preset addition'); | ||
} | ||
}; | ||
}; |
Oops, something went wrong.