feat(ci): improve ci

- added semantic-version package to automate CHANGELOG.md creation and version bumping
- added husky commit message hook to prevent commit messages not parsable by semantic-version package
This commit is contained in:
iOSonntag 2023-09-24 06:59:18 +02:00
parent 84652705d5
commit 70c4688bbd
No known key found for this signature in database
6 changed files with 2532 additions and 3 deletions

View file

@ -15,6 +15,9 @@
},
"rules": {
"no-unused-vars": "off",
"no-underscore-dangle": ["error", {
"allowAfterSuper": true
}],
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
"@typescript-eslint/ban-ts-comment": "off",
"no-prototype-builtins": "off",

3
.husky/commit-msg Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npm run commitlint ${1}

64
.releaserc.js Normal file
View file

@ -0,0 +1,64 @@
module.exports = {
"branches": [
"+([0-9])?(.{+([0-9]),x}).x",
"main",
"master",
"next",
"next-major",
{
"name": "beta",
"prerelease": true
},
{
"name": "alpha",
"prerelease": true
}
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "angular",
"releaseRules": [
{
"type": "breaking",
"release": "major"
}
]
}
],
// [
// "@semantic-release/exec",
// {
// "verifyReleaseCmd": "echo \"NEXT_RELEASE_VERSION=${nextRelease.version}\" >> $GITHUB_OUTPUT"
// }
// ],
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
[
"@semantic-release/npm",
{
"npmPublish": false
}
],
// "@semantic-release/github",
// [
// "@semantic-release/git",
// {
// "assets": [
// "package.json",
// "package-lock.json",
// "CHANGELOG.md"
// ],
// "message": "chore(release): v${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
// }
// ]
],
"dryRun": true,
"preset": "angular"
};

33
commitlint.config.js Normal file
View file

@ -0,0 +1,33 @@
/**
* @type {import('@commitlint/types').UserConfig}
*
* Commit Message Guidelines
*
* All commit message MUST follow https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit
*
* Format as:
*
* ```
* <type>(<scope>): <subject>
* <BLANK LINE>
* <body>
* <BLANK LINE>
* <footer>
* ```
* Note: The **&lt;type&gt;** can be found in **./commitlint.config.js** file.
*/
module.exports = {
rules: {
'body-leading-blank': [1, 'always'],
'footer-leading-blank': [1, 'always'],
'header-max-length': [2, 'always', 72],
'scope-case': [2, 'always', 'lower-case'],
'subject-case': [2, 'never', ['sentence-case', 'start-case', 'pascal-case', 'upper-case']],
'subject-empty': [2, 'never'],
'subject-full-stop': [2, 'never', '.'],
'type-case': [2, 'always', 'lower-case'],
'type-empty': [2, 'never'],
'type-enum': [2, 'always', ['breaking', 'build', 'chore', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test']],
},
};

View file

@ -5,21 +5,30 @@
"main": "main.js",
"scripts": {
"dev": "node esbuild.config.mjs",
"tsc": "tsc -noEmit -skipLibCheck",
"tsc": "tsc -noEmit -skipLibCheck",
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production",
"version": "node version-bump.mjs && git add manifest.json versions.json"
"semantic-release": "semantic-release",
"version": "node version-bump.mjs && git add manifest.json versions.json",
"prepare": "husky install",
"commitlint": "commitlint --edit"
},
"keywords": [],
"author": "iOSonntag",
"homepage": "https://iOSonntag.com",
"homepage": "https://iOSonntag.com",
"license": "MIT",
"devDependencies": {
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@types/node": "^16.11.6",
"@typescript-eslint/eslint-plugin": "5.29.0",
"@typescript-eslint/parser": "5.29.0",
"builtin-modules": "3.3.0",
"commitlint": "^17.7.1",
"esbuild": "0.17.3",
"husky": "^8.0.3",
"obsidian": "latest",
"semantic-release": "^22.0.4",
"tslib": "2.4.0",
"typescript": "4.7.4"
},

File diff suppressed because it is too large Load diff