badgen/badgen

Create a CLI for this?

tunnckoCore opened this issue · 7 comments

It would be pretty easy, just pass parsed argv as options to the library and output the svg?

I'm working on setuping huge monorepo of all my packages - both scoped and non-scoped ones. And so, I have idea to generate build badges on successful build per package.

For example

{
  "scripts": {
    "build": "(yarn build:dist && yarn build:status) || yarn build:status",
    "build:dist": "babel src -d dist -x .js,.jsx,.ts,.tsx,.mjs --delete-dir-on-start",
    "build:status": "echo \"Result(${npm_package_name}): $?\"",
  }
}

Which will be called from CI after all linting, typechecking, testing, coverage, and build. So in that build:status script I want to generate a badge which I will put in a directory, so I can show separate build status badge on the readme of each package.

So if we have badgen-cli, I can do

{
  "scripts": {
    "build": "(yarn build:dist && yarn build:success) || yarn build:failed",
    "build:dist": "babel src -d dist -x .js,.jsx,.ts,.tsx,.mjs --delete-dir-on-start",
    "build:status": "badgen --subject build",
    "build:success": "yarn build:status --status success --color green > dist/build-status.svg",
    "build:failed": "yarn build:status --status failed --color red > dist/build-status.svg"
  }
}

The badgen/badgen.net#222 is related to all that too. I will have build, npm and github badges for each package in the monorepo. The only missing part is coverage badge, but I may figure it out in future.


Btw, what about creating monorepo for Badgen - the cli, the lib, the web, and the service. Actually the CLI doesn't need to be as separate package. We can add it here, with just one dependency - mri or minimist.

amio commented

Cool idea! Use badgen-cli directly in CI process 👍

For the monorepo thoughts, since the cli, lib, service have different release schedules, I prefer to keep them in separated repos. But I'm planning to put them under the org https://github.com/badgen

a9 commented

it is good idea!

I'll be happy to help on that front, but I can't open PR as long as the repo doesn't exists. Does badgen-cli still planned to exists ?

amio commented

@GMartigny Thanks for helping! I created the repo https://github.com/badgen/badgen-cli

I dont think separate is needed. CLI is including only 1 package.

People could want to install Badgen without the CLI. It could be a mono repo, but it's basically the same as 2 repos.

yes but one flat dependency isn't a big problem, that's why I always prefer it that way, if it does not need bigger functionality and deps. : )