Expired Study Project on Committizen
- [Git]
^2.
+
Run in your terminal
xc help
or the shortcut
xc h
- output
NAME:
xc - X Conventional is a cli tool to generate conventional commits and versioning.
USAGE:
xc [-h] {init,commit,example,info,tag,schema,bump,changelog,version}
AUTHOR:
Rocha da Silva, Daniel <rochadaniel@acad.ifma.edu.br>
COMMANDS:
init, i init xconv configuration
commit, c create new commit
changelog, ch generate changelog (note that it will overwrite existing file)
bump, b bump semantic version based on the git log
rollback, r revert commit to a specific tag
tag, t show tags
schema, s show commit schema
example, e show commit example
version, v get the version of the installed xconv or the current project
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--help, -h show help (default: false)
COPYRIGHT:
(c) 2022 MIT
xc commit
or the shortcut
xc c
xc rollback
or the shortcut
xc r
xc tag
or the shortcut
xc t
Select the tag for rollback and confirm
rule:
changelog_file: CHANGELOG.md
active_profile: xconv_default
profiles:
- name: xconv_default
extends: nil
tag:
restricted: true
mode: standard
format: v$version
bump:
map:
'BREAKING CHANGE': MAJOR
feature: MINOR
bugfix: PATCH
hotfix: PATCH
pattern: ^(BREAKING[\-\ ]CHANGE|feature|hotfix|docs|bugfix|refactor|perf)(\(.+\))?(!)?
changelog_pattern: ^(feature|bugfix|hotfix|perf|refactor)?(!)?
change_type_map:
feature: Feature
bugfix: Bugfix
hotfix: Hotfix
perf: Performance
docs: Documentation
refactor: Refactor
change_type_order:
- BREAKING[\-\ ]CHANGE
- feature
- bugfix
- hotfix
- refactor
- perf
commit_parser: ^(?P<change_type>docs|feature|bugfix|hotfix|refactor|perf|BREAKING CHANGE)(?:\((?P<scope>[^()\r\n]*)\)|\()?(?P<breaking>!)?:\s(?P<message>.*)
version_parser: (?P$version([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?(\w+)?)
schema_pattern: (build|ci|docs|feature|bugfix|hotfix|perf|refactor|style|test|chore|revert|bump):(\(\S+\))?!?:(\s.*)
schema: |
<prefix>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
(BREAKING CHANGE: <footer> )
<footer>
example: |
bugfix: correct minor typos in code
see the work item for details on the typos fixed
related work items #12
info: This is default info from xconv
info_path: xconv_info.txt
message_template: |
{{prefix}}({{scope}}): {{subject}}
{% if body != '' %}
{{body}}
{% endif %}
{% if is_breaking_change %}
BREAKING CHANGE:
{% endif %}
{% if footer != '' %}
Related work items: #{{footer}}
{% endif %}
questions:
- type: list
message: "Select the type of change you are committing:"
name: prefix
choices:
- value: feature
key: f
name: "feature: A new feature."
- value: bugfix
name: "bugfix: A bug fix. Correlates with PATCH in SemVer"
key: b
- value: hotfix
name: "hotfix: A bug fix in PROD"
key: h
- value: docs
name: "docs: Documentation only changes"
key: d
- value: style
name: "style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)"
key: s
- value: refactor
name: "refactor: A code change that neither fixes a bug nor adds a feature"
key: r
- value: perf
name: "perf: A code change that improves performance"
key: p
- value: test
name: "test: Adding missing or correcting existing tests"
key: t
- value: chore
name: "chore: Changes to configuration files (example scopes: .gitignore, .xconv.yaml)"
key: z
- value: build
name: "build: Changes that affect the build system or external dependencies (example scopes: pip, docker, npm)"
key: x
- value: ci
name: "ci: Changes to our CI configuration files and scripts (example scopes: AzureDevOps)"
key: c
- type: input
message: "What is the scope of this change? (class or file name): (press [enter] to skip): "
name: scope
middleware:
- to lower case
- trim
filter: is empty
- type: input
message: "Write a short and imperative summary of the code changes: (lower case and no period): "
name: subject
middleware:
- to lower case
- trim
filter: is empty
- type: input
message: "Provide additional contextual information about the code changes: (press [enter] to skip): "
name: body
middleware:
- to lower case
- type: confirm
name: is_breaking_change
message: "Is this a BREAKING CHANGE? Correlates with MAJOR in SemVer (press [enter] to skip): "
default: false
- type: input
message: "Related work items (PBI, Task IDs, Issue): (press [enter] to skip)"
name: footer
middleware:
- to lower case
script:
filters:
- name: is empty
retry: true
enable: true
message:
content: "[ALERT]: this field cannot be empty or only contain spaces"
color: true
script: |
function run(argument)
return argument == nil or argument == ''
end
middlewares:
- name: to lower case
enable: true
script: |
function run(argument)
return string.lower(argument)
end
- name: trim
enable: true
script: |
function run(argument)
return (string.gsub(argument, "^%s*(.-)%s*$", "%1"))
end
tasks:
- name: push current tag
enable: true
language: sh
bind: bump
when: after
script: |
CURRENT_TAG=$(xc tag current --format=%V)
git push origin $CURRENT_TAG
rule:
changelog_file: CHANGELOG.md
active_profile: alpha profile
profiles:
- name: alpha profile
extends: xconv_default
tag:
stamp: xconv
mode: alpha # alpha beta | default: standard
format: v$version # v$major.$minor.$patch$"
message_template: |
{{prefix}}({{scope}}): {{subject}}
{% if body != '' %}
{{body}}
{% endif %}
{% if is_breaking_change %}
BREAKING CHANGE:
{% endif %}
{% if footer != '' %}
issue: {{footer}}
{% endif %}
script:
tasks:
- name: log bump
enable: true
language: sh
bind: bump
when: after
script: |
CURRENT_TAG=$(xc tag current --format=%V)
if [ ! -e log-version.txt ]
then
echo $CURRENT_TAG > log-version.txt
exit
fi
echo $CURRENT_TAG >> log-version.txt
- name: remote script
enable: true
language: sh
bind: example
when: after
script: |
TMP=".xconv/tmp"
if [ -e $TMP/lazy.sh ]
then
./$TMP/lazy.sh --version
exit
fi
mkdir -p $TMP
wget https://raw.githubusercontent.com/dannRocha/lazy/master/lazy.sh -qO $TMP/lazy.sh
chmod +x $TMP/lazy.sh
echo "-- Remote script:"
./$TMP/lazy.sh --version
# remove this command to enable 'cache'
rm -fr .xconv
-
Rule
Variable Type Default implemented Description changelog_file string CHANGELOG.md ❌ active_profile string xconv_default ✔️ profiles list<profile> ✔️ -
Profile
Variable Type Default implemented Description name string xconv_default ✔️ extends string nil ✔️ tag object ✔️ bump object ✔️ changelog_pattern string ^(feature|bugfix|hotfix|perf|refactor)?(!)? ❌ change_type_map map<string, string> { feature: Feature, bugfix: Bugfix, hotfix: Hotfix, perf: Performance, docs: Documentation, refactor: Refactor } ❌ change_type_order list<string> BREAKING[-\ ]CHANGE, feature, bugfix, hotfix, refactor, perf ❌ commit_parser string ^(?P<change_type>docs|feature|bugfix|hotfix|refactor|perf|BREAKING CHANGE)(?:\((?P[^()\r\n]))|()?(?P!)?:\s(?P.) ❌ version_parser string (?P$version([0-9]+).([0-9]+).([0-9]+)(?:-\([0-9A-Za-z-]+(?:.[0-9A-Za-z-]+)*))?(?:+[0-9A-Za-z-]+)?(\w+)?) ✔️ schema_pattern string (build|ci|docs|feature|bugfix|hotfix|perf|refactor|style|test|chore|revert|bump):\(\(\S+))?!?:\(\s.*) ❌ schema string <prefix>(<scope>): <subject><BLANK LINE>
<body>
<BLANK LINE>(BREAKING CHANGE: <footer> )<footer>✔️ example string bugfix(main.go): correct minor typos in code
see the work item for details on the typos fixed
related work items #12✔️ info string xconv_default ✔️ info_path string xconv_default ✔️ message_template string {{prefix}}({{scope}}): {{subject}}
{% if body != '' %}{{body}}{% endif %}
{% if is_breaking_change %}
BREAKING CHANGE:
{% endif %}
{% if footer != '' %}
Related work items: #{{footer}}
{% endif %}✔️ questions list ✔️ -
Tag
Variable Type Default implemented Description stamp string xconv ✔️ mode string standard ✔️ format object v$version ✔️ -
Bump
Variable Type Default implemented Description map map<string, string> {'BREAKING CHANGE': MAJOR, feature: MINOR, bugfix: PATCH, hotfix: PATCH } ✔️ pattern string "^(BREAKING[- ]CHANGE|feature|hotfix|docs|bugfix|refactor|perf)((.+))?(!)?" ✔️ -
Questions
Variable Type Default implemented Description type string list|input
✔️ message string ✔️ name string ✔️
-
-
script
Variable Type Default implemented Description filter list<filter> ✔️ middleware list<middleware> ✔️ task list<task> ✔️ -
filter
Variable Type Default implemented Description name string ✔️ retry boolean false ✔️ enable boolean false ✔️ message object ✔️ script string ✔️ -
middleware
Variable Type Default implemented Description name string ✔️ enable boolean false ✔️ script string ✔️ -
task
Variable Type Default implemented Description name string ✔️ enable boolean false ✔️ language string lua
✔️ bind string ✔️ when string after
✔️ script string ✔️
-