leoforfree / cz-customizable Goto Github PK
View Code? Open in Web Editor NEWA standalone commit message helper or customizable commitizen adapter for https://github.com/commitizen/cz-cli
License: MIT License
A standalone commit message helper or customizable commitizen adapter for https://github.com/commitizen/cz-cli
License: MIT License
The symlink is a way to getting around the require(../../.cz-config)
.
If you know a better way please let me know. I definitelly want to learn how to do this better
Linux ln -nsf ../../.cz-config.js node_modules/cz-customizable/.cz-config.js
Windows (something like this): mklink /D node_modules\cz-customizable\.cz-config.js ..\..\.cz-config.js
I usually work in a vscode workspace and there's always multiple repository folders that I am navigating. If you try to commit from a workspace, it will give you an error:
Logs the devtools:
Command failed: git commit -m build(fail): This will fail fatal: Not a git repository (or any of the parent directories): .git
If you use the standard commit package from vscode, the first thing it does is to ask for the repository. This might be a good additional feature to add to this project to support working in workspaces.
app should nicely handle when user doesn't specify this variable on .cz-config.js
. E.g.:
module.exports = {
types: [
{value: 'feat', name: 'feat: A new feature'},
{value: 'fix', name: 'fix: A bug fix'},
{value: 'docs', name: 'docs: Documentation only changes'},
{value: 'style', name: 'style: Changes that do not affect the meaning of the code\n (white-space, formatting, missing semi-colons, etc)'},
{value: 'refactor', name: 'refactor: A code change that neither fixes a bug nor adds a feature'},
{value: 'perf', name: 'perf: A code change that improves performance'},
{value: 'test', name: 'test: Adding missing tests'},
{value: 'chore', name: 'chore: Changes to the build process or auxiliary tools\n and libraries such as documentation generation'},
{value: 'revert', name: 'revert: Revert to a commit'},
{value: 'WIP', name: 'WIP: Work in progress'}
],
scopes: [
{name: 'whatever'},
],
// scopeOverrides: {
// }
}
Hy,
I'm having a problem using cz-customizable
. I followed the README but I'm receiving the following error:
[email protected], [email protected]
Line 1 will be cropped at 100 characters. All other lines will be wrapped after 100 characters.
(node:69005) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: You must provide a `choices` parameter
(node:69005) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
With configuration as:
package.json
"scripts": {
...,
"commit": "npx git-cz"
},
"devDependencies": {
...,
"commitizen": "^3.1.1",
"cz-conventional-changelog": "^2.1.0",
"cz-customizable": "^6.0.0",
},
"config": {
"commitizen": {
"path": "node_modules/cz-customizable"
}
}
.cz-config.js
module.exports = {
typePrefix: '[',
typeSuffix: ']'
};
postinstall scrip needs to create a file called .cz-config.js
expected file name: .cz-config.js
actual: .cz-config
As per commitizen/cz-cli#249
all adapters should add inquirer.js as a dependency. Commitizen will no longer supply inquirer from version 4.0.0 scheduled to be released on 3rd of Feb 17.
When defining scope in very small parts, an option would be helpful to have the Scope fill out with the current filename and or function entry point in the editor (VS Code).
cz-cli displays the '?' and the question on the same line so I assume you intended to keep that behavior. Because your menu config has newlines as the first character, it leaves the '?' on its own line and looks funny.
Otherwise, nice job. I think this project deserves a little more attention because it's definitely helpful.
I recently used cz-customizable
in a Typescript project. Instead of writing the config in javascript, I opted to write it in Typescript. I wrote the corresponding definition typings file to get type safety. Ideally these files live with and thus synced with their project, therefore I'd like to make a pull request to add them to cz-customizable
. If your config object changed going forward, we'd update these typing at the same time.
Changes would include:
typings
property added to the package.jsond.ts
file at rootIf this is outside the scope of your project, I'll add them to the official typings repo: DefinitelyTyped. This would just require consumers to add an additional dependency when consuming cz-customizable
with Typescript.
Maybe a simple nice to have:
if feat('app'): This is a new feature
change to
feat('app'): this is a new feature
It would be great if the location of the config could be customised. E.g.
//package.json
...
"config": {
"commitizen": {
"path": "node_modules/cz-customizable"
},
"cz-customizable": {
"config": "config/path/to/my/config.js"
}
}
...
This helps keep the project root directory less cluttered with config files.
As we have new features, it would be nice to document all options, add screenshots with images so people know straight away what this module does.
Hi @leonardoanalista , I've noticed that for a commit like this:
fix(radar): reimplement add blip function while in RFC mode
ISSUES CLOSED: #RAD-658
... the latest version of corp-semantic-release
does not create a link in the changelog (when using conventional-changelog-angular-bitbucket
, and I suspect, other presets)
If you see here, the keywords for detecting issues do not include 'ISSUES CLOSED:'.
After amending the commit to:
fix(radar): reimplement add blip function while in RFC mode
Closes #RAD-658
... I get the correct(?) output in the changelog:
* **radar:** reimplement add blip function while in RFC mode ([ab8fed2](https://repo.com.au/projects/in/repos/repo-name/commits/ab8fed2)), closes [#RAD-658](https://www.atlassian.net/browse/RAD-658)
In many projects jira or something similar is used.
It would be great to ask the user for the ticket number.
The result could be: fix(scope): Ticket-1234 subject
Thanks for this project 👍
There are some issues when project is fork on github:
commitizen/cz-conventional-changelog
as base for mergeFor some reason I always try to enter Scope first.
So I'd like an option to swap the order of the questions presented.
I’m also using cz-conventional-changelog
. Is it possible to use both alongside each other? This is my package.json
config:
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
},
"cz-customizable": {
"config": "internals/scripts/commitizen/commitizen-customizable.js"
}
},
add JS lint tool to pre-commit and travis
We can use cz-customizable
instead cz-conventional-changelog
. I will prepare a PR but I need list of scopes
Double backticks escaping was introduced in 99aa05b to fix #23 , but it's no longer required since [email protected]
has fixed it commitizen/cz-cli@5f7737f
Current code produces extra escaping for non win32
architectures:
feat(auth): CLOUD-1058 some \`stuff\`
Do you guys want me to open up a PR?
Rob @rpocklin,
What do you think could be the default answer when option askForBreakingChangeFirst
is set to true?
If we think that a breaking change is not going to happen very often, a sensible default answer would be in my opinion 'no'. This way, you get the question for breaking changes and if you hit enter, it assumes 'no' and go to next question. Do you think this is a good behaviour?
Leonardo
I would want to parse scopes from git history and write them to config. Is this possible?
Currently there's no option to skip { footerPrefix }
by setting it to empty string.
Sometimes commit only references (or partially fixes) specific issues without need to automatically close them as described in https://help.github.com/en/articles/closing-issues-using-keywords
Acceptance criteria:
Configuration should accept { footerPrefix: '' }
or { skipFooterPrefix: true }
and produce commit with following footer:
whatever developer typed here
Propose change prompted question from:
List any ISSUES CLOSED by this change (optional):,
to
``List any ISSUES CLOSED by this change. E.g.: #[number], #[n] and #[z] (optional):`
If user enters anything on close issues, this tool should automatically add the word "Closes:".
According to the changelog specs, footer is composed by 'breaking changes' and 'closed issues' in this order.
This is a possible breaking change as it changes the way uses enter footer info.
I’ve gone with the local install of commitizen for my project. It runs fine when I use the pure version, but when installing and implementing cz-customizable I get error messages regarding my configuration file.
[email protected], [email protected]
warn: Unable to find a configuration file. Please refer to documentation to learn how to ser up: https://github.com/leonardoanalista/cz-customizable#steps "
info:
Line 1 will be cropped at 100 characters. All other lines will be wrapped after 100 characters.
/Users/durham/Sites/hco-web-frontend/node_modules/cz-customizable/questions.js:17
config.scopeOverrides = config.scopeOverrides || {};
^
TypeError: Cannot read property 'scopeOverrides' of undefined
at Object.getQuestions (/Users/durham/Sites/hco-web-frontend/node_modules/cz-customizable/questions.js:17:35)
at prompter (/Users/durham/Sites/hco-web-frontend/node_modules/cz-customizable/index.js:42:44)
at /Users/durham/Sites/hco-web-frontend/node_modules/commitizen/dist/commitizen/commit.js:73:9
at /Users/durham/Sites/hco-web-frontend/node_modules/commitizen/node_modules/fs-extra/lib/mkdirs/mkdirs.js:54:16
at FSReqWrap.oncomplete (fs.js:123:15)
error Command failed with exit code 1.
I pasted the example config from this project into my project:
module.exports = {
types: [
{ value: 'feat', name: 'feat: A new feature' },
{ value: 'fix', name: 'fix: A bug fix' },
{ value: 'docs', name: 'docs: Documentation only changes' },
{ value: 'style', name: 'style: Changes that do not affect the meaning of the code\n (white-space, formatting, missing semi-colons, etc)' },
{ value: 'refactor', name: 'refactor: A code change that neither fixes a bug nor adds a feature' },
{ value: 'perf', name: 'perf: A code change that improves performance' },
{ value: 'test', name: 'test: Adding missing tests' },
{ value: 'chore', name: 'chore: Changes to the build process or auxiliary tools\n and libraries such as documentation generation' },
{ value: 'revert', name: 'revert: Revert to a commit' },
{ value: 'WIP', name: 'WIP: Work in progress' }
],
scopes: [
{ name: 'accounts' },
{ name: 'admin' },
{ name: 'exampleScope' },
{ name: 'changeMe' }
],
// it needs to match the value for field type. Eg.: 'fix'
/*
scopeOverrides: {
fix: [
{ name: 'merge' },
{ name: 'style' },
{ name: 'e2eTest' },
{ name: 'unitTest' }
]
},
*/
allowCustomScopes: true,
allowBreakingChanges: ['feat', 'fix']
};
This is located in an internals
directory just inside the root of the project.
then this is the config in my package.json
file:
"config": {
"commitizen": {
"path": "./node_modules/cz-customizable"
}
},
"cz-customizable": {
"config": "./internals/cz-config.js"
}
Is there anything I’m doing wrong?
没有找到这个 .cz-config.js 文件
We would like to explore Typescript and this project is open for suggestion on how to improve the code with types.
Is there a way to change the order of how the messages are put into the commit message?
For example if I want the appendBranchNameToCommitMessage right in the first line?
Hi,
I created a script that adds ticketNumberPrefix and ticketNumber automatically but ticketNumber is required otherwise the final commit appears to be empty.
cz-customizable standalone version
Line 1 will be cropped at 100 characters. All other lines will be wrapped after 100 characters.
? Select the type of change that you're committing: feat: A new feature
?
Choose the SCOPE of this change (optional): my-component
? Enter the ticket number:
? Write a SHORT, IMPERATIVE tense description of the change:
? List any BREAKING CHANGES (optional):
? List any ISSUES CLOSED by this change (optional). E.g.: #31, #34:
###--------------------------------------------------------###
feat(my-component):
###--------------------------------------------------------###
? Are you sure you want to proceed with the commit above? (Yneh)
In the buildCommit.js the if condition returns ''
const addTicketNumber = (ticketNumber, config) => {
if (!ticketNumber) {
return '';
}
...
};
Is it possible to have some sort of 'ticketNumberValue' that doesn't ask anything but instantiate the variable ticketNumber?
I think we could pass resulted commit message to git commit -m
postinstall
script in dev environment tries to create config file on 2 levels up. Seems it supposed to be a project root. But in dev environment (git clone [email protected]:leonardoanalista/cz-customizable.git
+ npm i
) it is not true since current folder is top level project. In my case it tries to write file at /home/.cz-config.js
and fails.
I mistakenly added a linebreak |
character in my footer message, which did not get converted into a linebreak. I looked at the code - this shouldn't be too hard to add. The spec (https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit?pref=2&pli=1#heading=h.j8e4paqkfz0q) indicates you can have multiple lines in the footer.
This project started as an adapter to commitizen. There is a possibility to run the same adapter in a stantd-alone version - without installing commitizen.
Here are requirements:
...
"build": "your build script"
"commit": "./node_modules/cz-customizable/standalone"
Intention of this story is document the implemented feature to add ticker number to commit message.
Here is the original PR:
#50
Looks like the referenced line mandates a \n between the prefix and the body of the breaking change.
The line break actually breaks some common semver parsing tools in gradle. Is it possible to make this optionally a space rather than a line-break?
Currently, adding a refactor
commit will not allow for a release. I don't like this behaviour, as it makes the assumption there are no bugs or other benefits in the refactor, which may be true, but you may need or want to bump the version.
This should be customisable so that the user can release a version even though it only has a 'refactor' commit in it.
Since, there's a rule https://conventional-changelog.github.io/commitlint/#/reference-rules?id=subject-case to enforce subject's case.
For people using cz-customizable
along with commitlint
it'd be nice to have possibility to leave subject as is (do not make it lowercase).
AC:
{ lowerCaseSubject }
with default true
to configuration.loweCaseSubject === false
do not transform subject from This is subject
to this is subject
I can push a PR for this soon if no one will pick this.
When you run corp-semantic-release
the first time in drymode, message is not very clear about what is going on.
Message should say it is the first time and a new tag will be created with version v1.0.0
.
This aligns with our father semantic-release
as the initial release should be always v1.0.0
@uglow thanks for the feedback
it is time to add a proper logging tool for this module
This up for a discussion so your opinion is important:
As we know, semantic-release will detect the word BREAKING CHANGE
and bump version to major.
Maybe cz-customizable should not allow the words BREAKING CHANGE
on footer if commit type is for example refactor
or docs
.
I think word closes
should be allowed but not BREAKING CHANGE
.
What do you guys think?
Hello,
I found this project really useful and hope to use it at my day job. I noticed that you don’t have any open source license in your repo. Any chance you’d consider adding one? MIT or Apache2 would likely be perfect.
Thanks so much!"
Since, there's a rule scope-empty here https://conventional-changelog.github.io/commitlint/#/reference-rules?id=scope-empty
For people using cz-customizable
along with commitlint
it'd be nice to have possibility to enforce scope.
AC:
{ allowEmptyScope }
with default true
to configuration.allowEmptyScope === false
don't make it possible to skip this question while commitingI can push a PR for this soon if no one will pick this.
Currently the type
and subject
are the only questions that require any input. I'd like to configure scope
as a required field and maybe conditionally require footer
when scope === 'feat'
.
string containing backticks is executed with shell
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.