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

command-line option "template" requires a value. #303

Closed
lorenzoromagnoli opened this issue Feb 16, 2023 · 11 comments
Closed

command-line option "template" requires a value. #303

lorenzoromagnoli opened this issue Feb 16, 2023 · 11 comments
Labels
bug jsdoc2md Concerns the jsdoc2md CLI app

Comments

@lorenzoromagnoli
Copy link

Most time, when running the command to generate the doc with a custom template it fails throwing this error.

If I change the template file and run the command again it works but every time I rerun the script with the same template file I get the same error:

command-line option "template" requires a value.

this is my script
"scripts": { "docs": "jsdoc2md \"./library/*.js\" > \"./docs/api.md\" -t \"./docs/api-template.hbs\"" },

and a very simple template

---
layout: default
title: api
nav_order: 5
---
# MLTK API
* * *
{{>main}}

@75lb
Copy link
Member

75lb commented Feb 16, 2023

If I change the template file and run the command again it works

Hmm, sounds like a cache thing.. how about if you run jsdoc2md with the --no-cache flag?

@75lb
Copy link
Member

75lb commented Mar 5, 2023

Any update?

@lorenzoromagnoli
Copy link
Author

Unfortunately that does not seem to have any effect.

@chris48s
Copy link

chris48s commented Aug 5, 2024

I also have this issue. Running with --no-cache and doing a --clear don't fix it for me.

I do have some extra information though.

This issue only reproduces for me if my template starts with front-matter (i.e: ---). If I use a template that doesn't start with front-matter, everything is fine. Note the OP also has the same condition in their template file.

I think there is something about the parsed template starting with --.

I can also give you a stack trace:

Uncaught:
JSDOC_ERROR: The command-line option "template" requires a value.
    at ExplainSync.verifyOutput (/home/chris/repositories/github_chris48s/v8r/docs/node_modules/jsdoc-api/lib/jsdoc-command.js:106:19)
    at ExplainSync._runJsdoc (/home/chris/repositories/github_chris48s/v8r/docs/node_modules/jsdoc-api/lib/explain-sync.js:34:32)
    at ExplainSync.getOutput (/home/chris/repositories/github_chris48s/v8r/docs/node_modules/jsdoc-api/lib/explain-sync.js:12:21)
    at ExplainSync.execute (/home/chris/repositories/github_chris48s/v8r/docs/node_modules/jsdoc-api/lib/jsdoc-command.js:49:24)
    at Object.explainSync (/home/chris/repositories/github_chris48s/v8r/docs/node_modules/jsdoc-api/index.js:20:18)
    at JsdocToMarkdown.getJsdocDataSync (/home/chris/repositories/github_chris48s/v8r/docs/node_modules/jsdoc-to-markdown/index.js:131:21)
    at JsdocToMarkdown.getTemplateDataSync (/home/chris/repositories/github_chris48s/v8r/docs/node_modules/jsdoc-to-markdown/index.js:101:28)
    at JsdocToMarkdown.renderSync (/home/chris/repositories/github_chris48s/v8r/docs/node_modules/jsdoc-to-markdown/index.js:72:23)

Is there any extra info I could provide that might help?

@75lb
Copy link
Member

75lb commented Aug 26, 2024

Hi, I was able to reproduce this issue (using a template with front-matter) in jsdoc2md v7 but not in v8.. could you try it again with the latest jsdoc2md please?

@chris48s
Copy link

Yes. This happens with version 8.

Given you're having trouble reproducing it, I've created a repo with a minimal repro in it: https://github.com/chris48s/jsdoc-to-markdown-287-repro

The key thing here really is this section of the workflow

https://github.com/chris48s/jsdoc-to-markdown-287-repro/blob/56bfba29fb99acd9e54b1bac08d6033c6422a801/.github/workflows/build.yml#L17-L24

and the build

https://github.com/chris48s/jsdoc-to-markdown-287-repro/actions/runs/10603208483/job/29386997461

If you can't see the individual outputs of the workflow steps, you can fork or copy the repo, push it up and run it yourself to get a repro you can inspect.

Does that help?

@75lb
Copy link
Member

75lb commented Aug 29, 2024

Nice reproduction case, thanks for that.. I have a feeling the issue is related to a fix in jsdoc-api that is implemented but not yet live.. Could you do me a favour and test your repro case using this prerelease version please.. install:

npm install jsdoc-to-markdown@next

This version is not complete nor public yet, I just knocked it up especially - hopefully it includes the fix you need..

@75lb 75lb transferred this issue from jsdoc2md/jsdoc-to-markdown Aug 29, 2024
@75lb 75lb transferred this issue from jsdoc2md/jsdoc-api Aug 29, 2024
@75lb 75lb added bug jsdoc2md Concerns the jsdoc2md CLI app labels Aug 29, 2024
@75lb
Copy link
Member

75lb commented Aug 29, 2024

Hi, I have isolated the bug and can confirm the fix has been implemented and will be included in the next release of jsdoc2md.. Let me know if you still have any issues using the prerelease mentioned in my last message..

@75lb 75lb closed this as completed Aug 29, 2024
@chris48s
Copy link

chris48s commented Sep 1, 2024

Sorry I didn't get a chance to have a look at this for few days.

Trying to install jsdoc-to-markdown@next gave me npm ERR! notarget No matching version found for jsdoc-to-markdown@next. but I just tried 9.0.0 and that seems to have resolved the issue. 👍

Thanks

@75lb
Copy link
Member

75lb commented Sep 1, 2024

Great, thanks for confirming. 👍

@75lb
Copy link
Member

75lb commented Sep 1, 2024

And yes, the pre-release version I mentioned before is now live.. Release notes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug jsdoc2md Concerns the jsdoc2md CLI app
Development

No branches or pull requests

3 participants