Skip to content

Commit

Permalink
Merge pull request #431 from dhis2/renovate-support
Browse files Browse the repository at this point in the history
feat(renovate): add renovate configuration setup
  • Loading branch information
varl authored Sep 28, 2021
2 parents e7af278 + 89c9cc9 commit 0a66c8e
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/commands/actions/renovate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
const log = require('@dhis2/cli-helpers-engine').reporter
const cfg = require('../../utils/config.js')

exports.command = 'renovate [type]'

exports.desc = 'Lint file and directory names.'

exports.builder = yargs =>
yargs
.positional('type', {
describe: 'Configuration template to use for Renovate',
type: 'string',
default: 'base',
})
.option('overwrite', {
describe: 'Overwrite the existing configuration.',
type: 'boolean',
})
.example(
'$0 add renovate',
'Adds the standard configuration to renovate.json'
)

exports.handler = argv => {
const { add, type, overwrite } = argv

log.info(`renovate > ${add ? 'add' : 'remove'}`)

if (add) {
cfg.add({
tool: 'renovate',
type: type ? type : 'base',
overwrite,
})
} else {
cfg.remove({ tool: 'renovate', type: type ? type : 'base' })
}
}
2 changes: 2 additions & 0 deletions src/utils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const projectConfigs = {
editorconfig: path.join(PROJECT_ROOT, '.editorconfig'),
eslint: path.join(PROJECT_ROOT, '.eslintrc.js'),
prettier: path.join(PROJECT_ROOT, '.prettierrc.js'),
renovate: path.join(PROJECT_ROOT, 'renovate.json'),
github: {
dependabot: path.join(PROJECT_ROOT, '.github', 'dependabot.yml'),
semantic: path.join(PROJECT_ROOT, '.github', 'semantic.yml'),
Expand Down Expand Up @@ -95,6 +96,7 @@ const templateConfigs = {
react: path.join(TEMPLATE_DIR, 'eslint-react.js'),
},
prettier: path.join(TEMPLATE_DIR, 'prettier-base.js'),
renovate: path.join(TEMPLATE_DIR, 'renovate-base.json'),
github: {
dependabot: path.join(TEMPLATE_DIR, 'github-dependabot.yml'),
semantic: path.join(TEMPLATE_DIR, 'github-semantic.yml'),
Expand Down
4 changes: 4 additions & 0 deletions templates/renovate-base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["local>dhis2/.github:renovate-config"]
}

0 comments on commit 0a66c8e

Please sign in to comment.