Skip to content

Commit

Permalink
fix(sdk): generate the correct renovate config for sdk (#1850)
Browse files Browse the repository at this point in the history
## Proposed change

In generated SDK, ` .renovaterc.json` file should match the
recommendation defined here:
https://github.com/AmadeusITGroup/otter/blob/main/tools/renovate/README.md#otter-sdk

## Related issues

- 🐛 Fixes #(issue)
- 🚀 Feature #(issue)

<!-- Please make sure to follow the contributing guidelines on
https://github.com/amadeus-digital/Otter/blob/main/CONTRIBUTING.md -->
  • Loading branch information
fpaul-1A authored Jun 4, 2024
2 parents 7798d7c + 6c6a2ba commit 270a223
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,63 @@ describe('Typescript Shell Generator', () => {
const {name} = tree.readJson('/package.json') as PackageJson;
expect(name).toEqual('test-sdk');
});

it('should generate renovate config with otter presets for npm', () => {
const renovateConfig = npmTree.readJson('/.renovaterc.json') as PackageJson;
const renovatePresets = renovateConfig.extends;
expect(renovatePresets).toEqual([
'github>AmadeusITGroup/otter//tools/renovate/base',
'github>AmadeusITGroup/otter//tools/renovate/group/otter',
'github>AmadeusITGroup/otter//tools/renovate/tasks/base',
'github>AmadeusITGroup/otter//tools/renovate/tasks/sdk-regenerate(npm)'
]);
});

it('should generate renovate config with otter presets for npm with packageName', async () => {
const runner = new SchematicTestRunner('@ama-sdk/schematics', collectionPath);
const tree = await runner.runSchematic('typescript-shell', {
name: 'test-scope',
package: 'test-sdk',
skipInstall: true,
packageManager: 'npm',
specPackageName: '@my-spec-scope/my-spec'
}, Tree.empty());
const renovateConfig = tree.readJson('/.renovaterc.json') as PackageJson;
const renovatePresets = renovateConfig.extends;
expect(renovatePresets).toEqual([
'github>AmadeusITGroup/otter//tools/renovate/base',
'github>AmadeusITGroup/otter//tools/renovate/group/otter',
'github>AmadeusITGroup/otter//tools/renovate/tasks/base',
'github>AmadeusITGroup/otter//tools/renovate/tasks/sdk-regenerate(npm)',
'github>AmadeusITGroup/otter//tools/renovate/group/sdk-spec(@my-spec-scope/my-spec)',
'github>AmadeusITGroup/otter//tools/renovate/tasks/sdk-spec-regenerate(npm, @my-spec-scope/my-spec)'
]);
});

it('should generate renovate config with otter presets for yarn', () => {
const renovateConfig = yarnTree.readJson('/.renovaterc.json') as PackageJson;
const renovatePresets = renovateConfig.extends;
expect(renovatePresets).toEqual([
'github>AmadeusITGroup/otter//tools/renovate/base',
'github>AmadeusITGroup/otter//tools/renovate/sdk'
]);
});

it('should generate renovate config with otter presets for yarn with packageName', async () => {
const runner = new SchematicTestRunner('@ama-sdk/schematics', collectionPath);
const tree = await runner.runSchematic('typescript-shell', {
name: 'test-scope',
package: 'test-sdk',
skipInstall: true,
packageManager: 'yarn',
specPackageName: '@my-spec-scope/my-spec'
}, Tree.empty());
const renovateConfig = tree.readJson('/.renovaterc.json') as PackageJson;
const renovatePresets = renovateConfig.extends;
expect(renovatePresets).toEqual([
'github>AmadeusITGroup/otter//tools/renovate/base',
'github>AmadeusITGroup/otter//tools/renovate/sdk',
'github>AmadeusITGroup/otter//tools/renovate/sdk-spec-upgrade(@my-spec-scope/my-spec)'
]);
});
});
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"github>AmadeusITGroup/otter//tools/renovate/base",
"github>AmadeusITGroup/otter//tools/renovate/sdk",
"github>AmadeusITGroup/otter//tools/renovate/sdk-spec-upgrade(my-specification-package)"
"github>AmadeusITGroup/otter//tools/renovate/base",<% if (packageManager === 'yarn') { %>
"github>AmadeusITGroup/otter//tools/renovate/sdk"<% if (specPackageName) { %>,
"github>AmadeusITGroup/otter//tools/renovate/sdk-spec-upgrade(<%= specPackageName %>)"<% } %><% } else { %>
"github>AmadeusITGroup/otter//tools/renovate/group/otter",
"github>AmadeusITGroup/otter//tools/renovate/tasks/base",
"github>AmadeusITGroup/otter//tools/renovate/tasks/sdk-regenerate(npm)"<% if (specPackageName) { %>,
"github>AmadeusITGroup/otter//tools/renovate/group/sdk-spec(<%= specPackageName %>)",
"github>AmadeusITGroup/otter//tools/renovate/tasks/sdk-spec-regenerate(npm, <%= specPackageName %>)"<% } %><% } %>
],
"prConcurrentLimit": 0,
"prHourlyLimit": 0,
Expand Down

0 comments on commit 270a223

Please sign in to comment.