Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nuxt): add 'renovate' module #158

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/nuxt/src/runtime/core/setupPergel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ declare module 'h3' {
'urql',
'vitest',
'eslint',
'renovate',
],
projectNames,
nitroImports: {},
Expand Down
7 changes: 5 additions & 2 deletions packages/nuxt/src/runtime/core/types/nuxtModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import type { BoxOptions, ResolvedBoxOptions } from '../../modules/box/types'

import type { ComposeSpecification } from '../../../moduleTypes/compose-spec-type'
import type { IonicInterface, ResolvedIonicInterface } from '../../modules/ionic/types'
import type { ResolvedEslintConfig } from '../../modules/eslint/types'
import type { EslintConfig, ResolvedEslintConfig } from '../../modules/eslint/types'
import type { RenovateConfig, ResolvedRenovateConfig } from '../../modules/renovate/types'
import type { ResolvedPergelModuleOptions, UserModuleOptions } from './module'

// @MODULE
Expand All @@ -25,7 +26,8 @@ export interface PergelNuxtModules {
ionic?: true | IonicInterface
urql?: true
vitest?: true
eslint?: true | ResolvedEslintConfig
eslint?: true | EslintConfig
renovate?: true | RenovateConfig
}

export interface ResolvedPergelNuxtModuleConfig<T> {
Expand All @@ -42,6 +44,7 @@ export interface ResolvedPergelNuxtModuleConfig<T> {
urql?: true | T
vitest?: true | T
eslint?: true | ResolvedEslintConfig
renovate?: true | ResolvedRenovateConfig
}

export type PergelModuleNames = keyof PergelNuxtModules
Expand Down
17 changes: 17 additions & 0 deletions packages/nuxt/src/runtime/modules/renovate/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { join } from 'node:path'
import { cpSync, existsSync } from 'node:fs'
import { definePergelModule } from '../../core/definePergel'
import type { RenovateConfig, ResolvedRenovateConfig } from './types'

export default definePergelModule<RenovateConfig, ResolvedRenovateConfig>({
meta: {
name: 'renovate',
version: '0.1.0',
},
defaults: {
},
async setup({ nuxt }) {
if (!existsSync(join(nuxt.options.rootDir, 'renovate.json')))
cpSync(join(nuxt._pergel.pergelModuleRoot, 'templates', 'renovate.json'), join(nuxt.options.rootDir, 'renovate.json'))
},
})
7 changes: 7 additions & 0 deletions packages/nuxt/src/runtime/modules/renovate/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { PergelModuleOptions, ResolvedPergelModuleOptions } from '../../core/types/module'

export interface RenovateConfig extends PergelModuleOptions {
}

export interface ResolvedRenovateConfig extends ResolvedPergelModuleOptions {
}
97 changes: 97 additions & 0 deletions packages/nuxt/src/templates/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
],
"baseBranches": [
"main"
],
"ignoreDeps": [
"node",
"pnpm"
],
"rebaseWhen": "auto",
"rangeStrategy": "bump",
"packageRules": [
{
"groupName": "all digest updates",
"groupSlug": "all-digest",
"matchPackagePatterns": [
"*"
],
"matchDepTypes": [
"devDependencies",
"dependencies",
"peerDependencies",
"resolutions",
"overrides",
"packageManager"
],
"automerge": true,
"matchUpdateTypes": [
"digest"
],
"schedule": [
"every 1 month"
]
},
{
"groupName": "all patch updates",
"groupSlug": "all-patch",
"matchPackagePatterns": [
"*"
],
"matchUpdateTypes": [
"patch"
],
"matchDepTypes": [
"devDependencies",
"dependencies",
"peerDependencies",
"packageManager",
"resolutions",
"overrides"
],
"automerge": true,
"schedule": [
"every 1 month"
]
},
{
"groupName": "all minor updates",
"groupSlug": "all-minor",
"matchPackagePatterns": [
"*"
],
"matchUpdateTypes": [
"minor"
],
"matchDepTypes": [
"devDependencies",
"dependencies",
"peerDependencies",
"packageManager"
],
"automerge": true,
"schedule": [
"every 1 month"
]
},
{
"groupName": "all major updates",
"groupSlug": "all-major",
"matchPackagePatterns": [
"*"
],
"matchDepTypes": [
"devDependencies",
"dependencies",
"peerDependencies",
"packageManager"
],
"matchUpdateTypes": [
"major"
]
}
]
}
Loading