Skip to content

Commit

Permalink
chore(ci): replace inline release config with shared config
Browse files Browse the repository at this point in the history
makes use of @codedependant/release-config-npm
  • Loading branch information
esatterwhite committed May 2, 2021
1 parent b9df7f3 commit c15c301
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 88 deletions.
23 changes: 23 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
# root
- package-ecosystem: "npm"
directory: "/" # Location of package manifests
allow:
- dependency-type: "direct"
versioning-strategy: increase
commit-message:
prefix: "chore(deps):"
pull-request-branch-name:
separator: "-"
schedule:
interval: "daily"
labels:
- "npm"
- "dependencies"

7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,12 @@
"strip-ansi": "^6.0.0"
},
"devDependencies": {
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/exec": "^5.0.0",
"@semantic-release/git": "^9.0.0",
"@semantic-release/github": "^7.0.7",
"@codedependant/release-config-npm": "^1.0.3",
"@vuepress/plugin-back-to-top": "^1.5.4",
"cli-spinners": "^2.3.0",
"eslint": "^7.9.0",
"eslint-config-codedependant": "^2.1.1",
"semantic-release": "^17.3.9",
"semantic-release": "^17.4.2",
"tap": "^14.10.2",
"vuepress": "^1.8.2"
},
Expand Down
85 changes: 2 additions & 83 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -1,87 +1,6 @@
'use strict'

const now = new Date()
const year = now.getFullYear()
const day = String(now.getDate()).padStart(2, '0')
const month = String(now.getMonth() + 1).padStart(2, '0')

const COMMIT_TYPES = new Map([
['build', 'Build System']
, ['ci', 'Continuous Integration']
, ['chore', 'Chores']
, ['default', 'Miscellaneous']
, ['dep', 'Dependancies']
, ['doc', 'Documentation']
, ['docs', 'Documentation']
, ['feat', 'Features']
, ['fix', 'Bug Fixes']
, ['lint', 'Lint']
, ['perf', 'Performance Improvements']
, ['revert', 'Reverts']
, ['refactor', 'Code Refactoring']
, ['style', 'Style']
, ['test', 'Tests']
])

function typeOf(type) {
return COMMIT_TYPES.get(type) || COMMIT_TYPES.get('default')
}

function transform(commit) {
commit.type = typeOf(commit.type)
commit.shortHash = commit.hash.substring(0, 7)
return commit
}

module.exports = {
branches: [
'main'
]
, parserOpts: {
noteKeywords: ['BREAKING', 'BREAKING CHANGE', 'BREAKING CHANGES']
, headerPattern: /^(\w*)(?:\((.*)\))?!?: (.*)$/
, breakingHeaderPattern: /^(\w*)(?:\((.*)\))?!: (.*)$/
, headerCorrespondence: ['type', 'scope', 'subject']
, issuePrefixes: ['#', 'gh-']
, referenceActions: [
'close', 'closes', 'closed'
, 'fix', 'fixes', 'fixed'
, 'resolve', 'resolves', 'resolved'
]
}
, writerOpts: {transform: transform}
, releaseRules: [
{breaking: true, release: 'major'}
, {revert: true, release: 'patch'}
, {type: 'build', release: 'patch'}
, {type: 'ci', release: 'patch'}
, {type: 'release', release: 'patch'}
, {type: 'doc', release: 'patch'}
, {type: 'chore', release: 'patch'}
, {type: 'ci', release: 'patch'}
, {type: 'lib', release: 'patch'}
, {type: 'perf', release: 'minor'}
, {type: 'refactor', release: 'patch'}
, {type: 'release', release: false}
, {type: 'test', release: 'patch'}
, {type: 'fix', release: 'patch'}
]
, plugins: [
['@semantic-release/commit-analyzer', null],
, ['@semantic-release/release-notes-generator', null]
, ['@semantic-release/changelog', {
changelogTitle: '# Changlog'
, changelogFile: 'CHANGELOG.md'
}]
, ['@semantic-release/npm', null]
, ['@semantic-release/exec', {
prepareCmd: 'npm run docs:build'
}]
, ['@semantic-release/git', {
assets: ['package.json', 'package-lock.json', 'CHANGELOG.md', 'docs']
, message: `release: ${year}-${month}-${day}, `
+ 'Version <%= nextRelease.version %> [skip ci]'
}]
, ['@semantic-release/github', null]
]
'extends': '@codedependant/release-config-npm'
, 'branches': ['main']
}

0 comments on commit c15c301

Please sign in to comment.