Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing @gitmoji/parser-opts to allow for - and / #674

Open
jebarpg opened this issue Mar 1, 2024 · 10 comments
Open

Fixing @gitmoji/parser-opts to allow for - and / #674

jebarpg opened this issue Mar 1, 2024 · 10 comments

Comments

@jebarpg
Copy link

jebarpg commented Mar 1, 2024

I use types in the form of fix-ci and ci/cd, which doesn't get picked up by the regex \w* due to the - and / in-between the words
I propose changing (?\w*) to (?[a-zA-z-,/]+) on this line:
https://github.com/arvinxx/gitmoji-commit-workflow/blob/master/packages/parser-opts/src/index.ts#L10

so it becomes this

headerPattern: new RegExp("^(?:".concat(gitmojiCodeStr, "|(?:").concat(gitmojiUnicodeStr, ")|(?:").concat(emojiStr, "))\s(?[a-zA-z-,/]+)(?:\((?.)\))?!?:\s(?(?:(?!#).)(?:(?!\s).))(?:\s\(?(?#\d*)\)?)?$")),

@arvinxx
Copy link
Owner

arvinxx commented Mar 1, 2024

what's your commit for example?

@jebarpg
Copy link
Author

jebarpg commented Mar 2, 2024

` 💚 fix-ci(ci/cd): added release rules for all cz-emojis

body text here

`

@jebarpg
Copy link
Author

jebarpg commented Mar 2, 2024

I made the modification locally in my install of the @gitmoji/parser-opts, but this will probably not work with github action CI when it tries to install the original.

o also I have an additional template hbs file for cz-emoji, as well as organized release rules for all 75 emoji types. I think it could be useful to have them as an additional default template inside the lib assets directory where the commit and default templates are. let me know if you would like a copy of them and I'll make a PR request.

@jebarpg
Copy link
Author

jebarpg commented Mar 2, 2024

plugins: [
    [
      'semantic-release-gitmoji', {
        //NOTE: Chatgpt was used to help organize these. These all can be subjective.
        releaseRules: {
          major: [
            ':ambulance:', //Critical hotfix.
            ':boom:', //Introducing breaking changes.
            ':building_construction:', //Making architectural changes.
            ':heavy_minus_sign:', //Removing a dependency.
            ':wastebasket:', //Deprecate code that needs to be cleaned up.
          ],
          premajor: [
            ':rewind:', //Reverting changes.
            ':see_no_evil:', //Adding or updating a .gitignore file.
            ':tada:', //Initial commit.
          ],
          minor: [
            ':alembic:', //Experimenting new things.
            ':bulb:', //Documenting source code.
            ':camera_flash:', //Adding or updating snapshots.
            ':chart_with_upwards_trend:', //Adding analytics or tracking code.
            ':dizzy:', //Adding or updating animations and transitions.
            ':globe_with_meridians:', //Internationalization and localization.
            ':heavy_plus_sign:', //Adding a dependency.
            ':iphone:', //Working on responsive design.
            ':recycle:', //Refactoring code.
            ':seedling:', //Adding or updating seed files.
            ':sparkles:', //Introducing new features.
            ':triangular_flag_on_post:', //Adding, updating, or removing feature flags.
            ':whale:', //Work about Docker.
            ':wheel_of_dharma:', //Work about Kubernetes.
            ':white_check_mark:', //Adding tests.
            ':wrench:', //Changing configuration files.
            ':zap:', //Improving performance.
          ],
          preminor: [
            ':clown_face:', //Mocking things.
            ':egg:', //Adding an easter egg.
            ':label:', //Adding or updating types (Flow, TypeScript).
            ':ok_hand:', //Updating code due to code review changes.
          ],
          patch: [
            ':adhesive_bandage:', //Simple fix for a non-critical issue.
            ':alien:', //Updating code due to external API changes.
            ':apple:', //Fixing something on macOS.
            ':bug:', //Fixing a bug.
            ':checkered_flag:', //Fixing something on Windows.
            ':coffin:', //Remove dead code.
            ':fire:', //Removing code or files.
            ':green_apple:', //Fixing something on iOS.
            ':lipstick:', //Updating the UI and style files.
            ':lock:', //Fixing security issues.
            ':loud_sound:', //Adding logs.
            ':monocle_face:', //Data exploration/inspection.
            ':mute:', //Removing logs.
            ':package:', //Updating compiled files or packages.
            ':page_facing_up:', //Adding or updating license.
            ':pencil:', //Writing docs.
            ':penguin:', //Fixing something on Linux.
            ':poop:', //Writing bad code that needs to be improved.
            ':robot:', //Fixing something on Android.
            ':rocket:', //Deploying stuff.
            ':rotating_light:', //Removing linter warnings.
            ':test_tube:', //Add a failing test.
            ':truck:', //Moving or renaming files.
            ':twisted_rightwards_arrows:', //Merging branches.
            ':wheelchair:', //Improving accessibility.
          ],
          prepatch: [
            ':beers:', //Writing code drunkenly.
            ':busts_in_silhouette:', //Adding contributor(s).
            ':pencil2:', //Fixing typos.
            ':speech_balloon:', //Updating text and literals.
          ],
          prerelease: [
            ':arrow_down:', //Downgrading dependencies.
            ':arrow_up:', //Upgrading dependencies.
            ':bento:', //Adding or updating assets.
            ':construction:', //Work in progress.
            ':construction_worker:', //Adding CI build system.
            ':green_heart:', //Fixing CI Build.
            ':mag:', //Improving SEO.
            ':pushpin:', //Pinning dependencies to specific versions.
          ]
        },
        releaseNotes: {
          template,
          partials: { commitTemplate },
          helpers: {
            datetime: function (format = 'UTC:yyyy-mm-dd') {
              return dateFormat(new Date(), format)
            }
          },
          issueResolution: {
            template: '{baseUrl}/{owner}/{repo}/issues/{ref}',
            baseUrl: 'https://github.com',
            source: 'github.com',
            removeFromCommit: false,
            regex: /#\d+/g //example matches: #2341 or #8
          }
        }
      }
    ],

@jebarpg
Copy link
Author

jebarpg commented Mar 2, 2024

{{#if compareUrl}}
# [v{{nextRelease.version}}]({{compareUrl}}) ({{datetime "UTC:yyyy-mm-dd"}})
{{else}}
# v{{nextRelease.version}} ({{datetime "UTC:yyyy-mm-dd"}})
{{/if}}

{{#with commits}}
{{#if art}}
## 🎨 Improving structure / format of the code
{{#each art}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if zap}}
## ⚡️ Improving performance
{{#each zap}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if fire}}
## 🔥 Removing code or files
{{#each fire}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if bug}}
## 🐛 Fixing a bug
{{#each bug}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if ambulance}}
## 🚑 Critical hotfix
{{#each ambulance}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if sparkles}}
## ✨ Introducing new features
{{#each sparkles}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if pencil}}
## 📝 Writing docs
{{#each pencil}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if rocket}}
## 🚀 Deploying stuff
{{#each rocket}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if lipstick}}
## 💄 Updating the UI and style files
{{#each lipstick}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if tada}}
## 🎉 Initial commit
{{#each tada}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if white_check_mark}}
## ✅ Adding tests
{{#each white_check_mark}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if lock}}
## 🔒 Fixing security issues
{{#each lock}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if apple}}
## 🍎 Fixing something on macOS
{{#each apple}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if penguin}}
## 🐧 Fixing something on Linux
{{#each penguin}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if checkered_flag}}
## 🏁 Fixing something on Windows
{{#each checkered_flag}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if robot}}
## 🤖 Fixing something on Android
{{#each robot}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if green_apple}}
## 🍏 Fixing something on iOS
{{#each green_apple}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if bookmark}}
## 🔖 Releasing / Version tags
{{#each bookmark}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if rotating_light}}
## 🚨 Removing linter warnings
{{#each rotating_light}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if construction}}
## 🚧 Work in progress
{{#each construction}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if green_heart}}
## 💚 Fixing CI Build
{{#each green_heart}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if arrow_down}}
## ⬇️ Downgrading dependencies
{{#each arrow_down}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if arrow_up}}
## ⬆️ Upgrading dependencies
{{#each arrow_up}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if pushpin}}
## 📌 Pinning dependencies to specific versions
{{#each pushpin}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if construction_worker}}
## 👷 Adding CI build system
{{#each construction_worker}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if chart_with_upwards_trend}}
## 📈 Adding analytics or tracking code
{{#each chart_with_upwards_trend}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if recycle}}
## ♻️ Refactoring code
{{#each recycle}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if whale}}
## 🐳 Work about Docker
{{#each whale}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if heavy_plus_sign}}
## ➕ Adding a dependency
{{#each heavy_plus_sign}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if heavy_minus_sign}}
## ➖ Removing a dependency
{{#each heavy_minus_sign}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if wrench}}
## 🔧 Changing configuration files
{{#each wrench}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if globe_with_meridians}}
## 🌐 Internationalization and localization
{{#each globe_with_meridians}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if pencil2}}
## ✏️ Fixing typos
{{#each pencil2}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if poop}}
## 💩 Writing bad code that needs to be improved
{{#each poop}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if rewind}}
## ⏪ Reverting changes
{{#each rewind}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if twisted_rightwards_arrows}}
## 🔀 Merging branches
{{#each twisted_rightwards_arrows}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if package}}
## 📦 Updating compiled files or packages
{{#each package}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if alien}}
## 👽 Updating code due to external API changes
{{#each alien}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if truck}}
## 🚚 Moving or renaming files
{{#each truck}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if page_facing_up}}
## 📄 Adding or updating license
{{#each page_facing_up}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if boom}}
## 💥 Introducing breaking changes
{{#each boom}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if bento}}
## 🍱 Adding or updating assets
{{#each bento}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if ok_hand}}
## 👌 Updating code due to code review changes
{{#each ok_hand}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if wheelchair}}
## ♿️ Improving accessibility
{{#each wheelchair}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if bulb}}
## 💡 Documenting source code
{{#each bulb}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if beers}}
## 🍻 Writing code drunkenly
{{#each beers}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if speech_balloon}}
## 💬 Updating text and literals
{{#each speech_balloon}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if card_file_box}}
## 🗃️ Performing database related changes
{{#each card_file_box}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if loud_sound}}
## 🔊 Adding logs
{{#each loud_sound}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if mute}}
## 🔇 Removing logs
{{#each mute}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if busts_in_silhouette}}
## 👥 Adding contributor(s)
{{#each busts_in_silhouette}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if children_crossing}}
## 🚸 Improving user experience / usability
{{#each children_crossing}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if building_construction}}
## 🏗️ Making architectural changes
{{#each building_construction}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if iphone}}
## 📱 Working on responsive design
{{#each iphone}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if clown_face}}
## 🤡 Mocking things
{{#each clown_face}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if egg}}
## 🥚 Adding an easter egg
{{#each egg}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if see_no_evil}}
## 🙈 Adding or updating a .gitignore file
{{#each see_no_evil}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if camera_flash}}
## 📸 Adding or updating snapshots
{{#each camera_flash}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if alembic}}
## ⚗️ Experimenting new things
{{#each alembic}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if mag}}
## 🔍 Improving SEO
{{#each mag}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if wheel_of_dharma}}
## ☸️ Work about Kubernetes
{{#each wheel_of_dharma}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if label}}
## 🏷️ Adding or updating types (Flow, TypeScript)
{{#each label}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if seedling}}
## 🌱 Adding or updating seed files
{{#each seedling}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if triangular_flag_on_post}}
## 🚩 Adding, updating, or removing feature flags
{{#each triangular_flag_on_post}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if dizzy}}
## 💫 Adding or updating animations and transitions
{{#each dizzy}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if wastebasket}}
## 🗑️ Deprecate code that needs to be cleaned up
{{#each wastebasket}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if passport_control}}
## 🛂 Work on code related to authorization, roles and permissions
{{#each passport_control}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if adhesive_bandage}}
## 🩹 Simple fix for a non-critical issue
{{#each adhesive_bandage}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if monocle_face}}
## 🧐 Data exploration/inspection
{{#each monocle_face}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if coffin}}
## ⚰️ Remove dead code
{{#each coffin}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if test_tube}}
## 🧪 Add a failing test
{{#each test_tube}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if necktie}}
## 👔 Add or update business logic
{{#each necktie}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if stethoscope}}
## 🩺 Add or update healthcheck
{{#each stethoscope}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if bricks}}
## 🧱 Infrastructure related changes
{{#each bricks}}
- {{> commitTemplate}}
{{/each}}
{{/if}}

{{#if technologist}}
## 🧑‍💻 Improve developer experience
{{#each technologist}}
- {{> commitTemplate}}
{{/each}}
{{/if}}
{{/with}}

@jebarpg
Copy link
Author

jebarpg commented Mar 2, 2024

you can see all the types at this url here:
https://github.com/ngryman/cz-emoji/blob/master/lib/types.json

@arvinxx
Copy link
Owner

arvinxx commented Mar 2, 2024

I think add - and / is reasonable, are you willing to make a pr for it?

@jebarpg jebarpg mentioned this issue Mar 2, 2024
@jebarpg
Copy link
Author

jebarpg commented Mar 2, 2024

I think add - and / is reasonable, are you willing to make a pr for it?

made the PR.

@jebarpg
Copy link
Author

jebarpg commented Mar 2, 2024

deleted my first pull request and made a second one with an updated example of the regex101 link. Also added the bug emoji to the beginning of my commit message

@jebarpg
Copy link
Author

jebarpg commented Mar 8, 2024

@arvinxx any update on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants