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

Using a custom badge template breaks badge replacement #120

Closed
simbas opened this issue Dec 21, 2018 · 5 comments · Fixed by #210
Closed

Using a custom badge template breaks badge replacement #120

simbas opened this issue Dec 21, 2018 · 5 comments · Fixed by #210

Comments

@simbas
Copy link

simbas commented Dec 21, 2018

  • all-contributors-cli version: 5.4.1
  • node version: v11.4.0
  • npm (or yarn) version: 6.4.1

Relevant code or config

{
  "projectName": "test",
  "projectOwner": "me",
  "repoType": "github",
  "repoHost": "https://github.com",
  "files": [
    "README.md"
  ],
  "imageSize": 100,
  "commit": false,
  "badgeTemplate": "![Contributors](https://img.shields.io/badge/contributors-<%= contributors.length %>-orange.svg)",
  "contributors": []
}

What you did:

npm init -y
npm i --save-dev all-contributors-cli
touch README.md
npx all-contributors init # with default params

# then adds a custom badge template
awk '/contributors/{print "  \"badgeTemplate\": \"![Contributors](https://img.shields.io/badge/contributors-<%= contributors.length %>-orange.svg)\","}1' .all-contributorsrc | tee .all-contributorsrc

npx all-contributors add jfmengels code
cat README.md # the badge has been updated

npx all-contributors add simbas code
cat README.md # the badge has not been updated

What happened:
The badge regex /\[!\[All Contributors\]\([a-zA-Z0-9\-./_:?=]+\)\]\(#\w+\)/; is not working with custom badge template.

Suggested solution:

  • badge regex as a property of the .all-contributorsrc file
  • use the badge template to find the badge (generate the regex from the template?)
@jakebolam
Copy link
Collaborator

I'd feel happy with either solution. @simbas want to do what you think is best and put up a PR on the project?

@simbas
Copy link
Author

simbas commented Jan 4, 2019

Hello @jakebolam, thank you for your reply.

Maybe there is a third solution which is using tags to find the badge:

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
<!-- ALL-CONTRIBUTORS-BADGE:END -->

What do you think about that?

@jakebolam
Copy link
Collaborator

@simbas sounds like a great idea :)

@jakebolam
Copy link
Collaborator

Similar issue: codingblocks/qit.cloud#307

@all-contributors-release-bot
Copy link
Member

🎉 This issue has been resolved in version 6.9.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

3 participants