diff --git a/changelog.config.js b/changelog.config.js new file mode 100644 index 0000000..5419d4d --- /dev/null +++ b/changelog.config.js @@ -0,0 +1,88 @@ +module.exports = { + disableEmoji: false, + format: "{type}{scope}: {emoji}{subject}", + list: [ + "test", + "feat", + "fix", + "chore", + "docs", + "refactor", + "style", + "ci", + "perf", + ], + maxMessageLength: 64, + minMessageLength: 3, + questions: [ + "type", + "scope", + "subject", + "body", + "breaking", + "issues", + "lerna", + ], + scopes: ["js-plugins", "rust-plugins", "all", "none"], + types: { + chore: { + description: "Build process or auxiliary tool changes", + emoji: "🤖", + value: "chore", + }, + ci: { + description: "CI related changes", + emoji: "🎡", + value: "ci", + }, + docs: { + description: "Documentation only changes", + emoji: "✏️", + value: "docs", + }, + feat: { + description: "A new feature", + emoji: "🎸", + value: "feat", + }, + fix: { + description: "A bug fix", + emoji: "🐛", + value: "fix", + }, + perf: { + description: "A code change that improves performance", + emoji: "⚡️", + value: "perf", + }, + refactor: { + description: "A code change that neither fixes a bug or adds a feature", + emoji: "💡", + value: "refactor", + }, + release: { + description: "Create a release commit", + emoji: "🏹", + value: "release", + }, + style: { + description: "Markup, white-space, formatting, missing semi-colons...", + emoji: "💄", + value: "style", + }, + test: { + description: "Adding missing tests", + emoji: "💍", + value: "test", + }, + messages: { + type: "Select the type of change that you're committing:", + customScope: "Select the scope this component affects:", + subject: "Write a short, imperative mood description of the change:\n", + body: "Provide a longer description of the change:\n ", + breaking: "List any breaking changes:\n", + footer: "Issues this commit closes, e.g #123:", + confirmCommit: "The packages that this commit has affected\n", + }, + }, +}; diff --git a/commitlint.config.js b/commitlint.config.js index c41da71..2a522b8 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -6,7 +6,7 @@ const scoreRule = (parsed) => { return [ isValid, - `current scope is ${pc.yellow(parsed.scope)}, ${pc.green( + `current scope is ${pc.red(parsed.scope)}, ${pc.green( "because we need the right scope to do CI dispatch" )} .Mark ${pc.yellowBright( "js-plugins" diff --git a/package.json b/package.json index b018e70..ae86acf 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "packageManager": "pnpm@9.1.0", "scripts": { "release": "npx changeset && npx changeset version", - "prepare": "husky" + "prepare": "husky", + "commit": "git cz" }, "keywords": [], "author": "", @@ -14,7 +15,13 @@ "@changesets/cli": "^2.27.7", "@farmfe/plugin-tools": "latest", "commitlint": "^19.5.0", + "git-cz": "^4.9.0", "husky": "^9.1.6", "picocolors": "^1.1.0" + }, + "config": { + "commitizen": { + "path": "git-cz" + } } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 325adf4..a8374b2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13,6 +13,9 @@ importers: commitlint: specifier: ^19.5.0 version: 19.5.0(@types/node@22.6.1)(typescript@5.6.2) + git-cz: + specifier: ^4.9.0 + version: 4.9.0 husky: specifier: ^9.1.6 version: 9.1.6 @@ -1915,6 +1918,11 @@ packages: engines: {node: '>=10'} dev: true + /git-cz@4.9.0: + resolution: {integrity: sha512-cSRL8IIOXU7UFLdbziCYqg8f8InwLwqHezkiRHNSph7oZqGv0togId1kMTfKil6gzK0VaSXeVBb4oDl0fQCHiw==} + hasBin: true + dev: true + /git-raw-commits@4.0.0: resolution: {integrity: sha512-ICsMM1Wk8xSGMowkOmPrzo2Fgmfo4bMHLNX6ytHjajRJUqvHOw/TFapQ+QG75c3X/tTDDhOSRPGC52dDbNM8FQ==} engines: {node: '>=16'}