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

Bug report: cli not working #15

Closed
fritx opened this issue Oct 21, 2022 · 10 comments
Closed

Bug report: cli not working #15

fritx opened this issue Oct 21, 2022 · 10 comments

Comments

@fritx
Copy link

fritx commented Oct 21, 2022

Hi, I'm trying with the cli but seems the bin command is not specified:

npm i -g generated-badges
generated-badges ...
>> command not found: generated-badges

If I try to modify this line (adding .js extension), and npm link in the cloned repo, it works:

  "bin": {
-    "generated-badges": "lib/bin",
+    "generated-badges": "lib/bin.js",
-    "generated-badges-cli": "lib/bin"
+    "generated-badges-cli": "lib/bin.js"
  },

Btw, the entire lib directory is not published since 1.0.1

https://unpkg.com/browse/[email protected]/
https://unpkg.com/browse/[email protected]/

What node package manager are you using?
I've tried both npm and pnpm and got the problem above

jaywcjlove added a commit that referenced this issue Oct 21, 2022
jaywcjlove added a commit that referenced this issue Oct 21, 2022
@jaywcjlove
Copy link
Owner

@fritx Upgrade v1.0.7

@fritx
Copy link
Author

fritx commented Oct 21, 2022

You are so 🚀 !

@fritx
Copy link
Author

fritx commented Oct 21, 2022

Also, finally get it to work with two more patches:

generated-badges -l foobar -s 666 --output build/badges/foobar.svg
-  if (argvs.gradient.length === 1) {
+  if (argvs.gradient && argvs.gradient.length === 1) {
    argvs.color = argvs.gradient[0];
  }

fixing:

/Users/fritx/g/generated-badges/lib/bin.js:48
    if (argvs.gradient.length === 1) {
                       ^

TypeError: Cannot read properties of undefined (reading 'length')
    at run (/Users/fritx/g/generated-badges/lib/bin.js:48:24)
    at Object.<anonymous> (/Users/fritx/g/generated-badges/lib/bin.js:73:1)
  let svgString = badgen({
    label: argvs.label,
    labelColor: argvs.labelColor,
-    status: argvs.status,
+    status: String(argvs.status),

fixing:

TypeError: <status> must be string
    at L (/Users/fritx/g/generated-badges/node_modules/badgen/dist/index.js:57:257)
    at V (/Users/fritx/g/generated-badges/node_modules/badgen/dist/index.js:1:26491)
    at run (/Users/fritx/g/generated-badges/lib/bin.js:54:41)

jaywcjlove added a commit that referenced this issue Oct 21, 2022
jaywcjlove added a commit that referenced this issue Oct 21, 2022
@jaywcjlove
Copy link
Owner

@fritx Upgrade v1.0.8

@fritx
Copy link
Author

fritx commented Oct 21, 2022

image

hey @jaywcjlove the problem is not fixed. I guess you should also execute npm run build before npm-publish in the automated workflow
https://github.com/jaywcjlove/generated-badges/blob/main/.github/workflows/ci.yml#L163-L164

otherwise, the dist files still missing in the published npm-package

@jaywcjlove
Copy link
Owner

image

https://unpkg.com/browse/[email protected]/

Maybe I'm too fast

@fritx

@jaywcjlove
Copy link
Owner

@fritx problem found

jaywcjlove added a commit that referenced this issue Oct 21, 2022
@jaywcjlove
Copy link
Owner

@fritx https://unpkg.com/browse/[email protected]/

@jaywcjlove
Copy link
Owner

@fritx Upgrade v1.0.9

@fritx
Copy link
Author

fritx commented Oct 21, 2022

@fritx Upgrade v1.0.9

Thanks. It works for me now. @jaywcjlove

@fritx fritx closed this as completed Oct 21, 2022
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