Generator: Basic usage for html md

Created on 29 Mar 2020  路  10Comments  路  Source: asyncapi/generator

Hello,

I'm new to node and js.

I am trying to generate the htm and markdown rendering for the streetlights.yml example file.
After installing @asyncpi/generator and html and markdown templates with npm, I ran cli as

$ ag -o ./out streetlights.yml html`
$ ls out
LICENSE  index.js  readme.md

But not able to figure out what to do next to generate html from yml.

Any help is appreciated.

Thanks

bug released

Most helpful comment

:tada: This issue has been resolved in version 0.35.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

All 10 comments

Welcome to AsyncAPI. Thanks a lot for reporting your first issue.

Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

With the docker image:

$ docker pull asyncapi/generator
$ git clone --depth 1 https://github.com/asyncapi/generator.git
$ cd asyncapi/
$ git log
commit 859f11d31fd6d622c2c243ade4e6811993eb7435
Author: asyncapi-bot <[email protected]>
Date:   Fri Mar 27 13:24:02 2020 +0100

    chore(release): 0.35.0 (#268)

    chore(release): 0.35.0
````
then
```bash
$ docker run --rm -it \
> -v ${PWD}/test/docs/streetlights.yml:/app/asyncapi.yml \
> -v ${PWD}/output:/app/output \
> asyncapi/generator -o ./output asyncapi.yml markdown
npm http fetch GET 200 https://registry.npmjs.org/markdown 324ms
npm http fetch GET 200 https://registry.npmjs.org/markdown/-/markdown-0.5.0.tgz 107ms
npm http fetch GET 200 https://registry.npmjs.org/nopt 77ms
npm http fetch GET 200 https://registry.npmjs.org/nopt/-/nopt-2.1.2.tgz 76ms
npm http fetch GET 200 https://registry.npmjs.org/abbrev 72ms
npm http fetch GET 200 https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz 79ms
npm WARN [email protected] requires a peer of semantic-release@>=11.0.0 <16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

Something went wrong:
Error: invalid bin entry for package [email protected]. key=nopt, value=bin/nopt.js
    at /usr/local/lib/node_modules/npm/node_modules/bin-links/index.js:86:13
    at tryCatcher (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
    at MappingPromiseArray._promiseFulfilled (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/map.js:61:38)
    at MappingPromiseArray.PromiseArray._iterate (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise_array.js:114:31)
    at MappingPromiseArray.init (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise_array.js:78:10)
    at MappingPromiseArray._asyncInit (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/map.js:30:10)
    at _drainQueueStep (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:142:12)
    at _drainQueue (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:131:9)
    at Async._drainQueues (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:147:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14)
    at processImmediate (internal/timers.js:456:21)

Hi @uraala, we just released a new version of the generator that supports remote templates, they are no longer a part of the generator but stored remotely, on npm or git or tar file. So you should no longer refer to remplates as html or markdown but after their npm names like @asyncapi/html-template or @asyncapi/markdown-template. I see we forgot to update README with proper docker example but look at the other examples.

So you should do ag -o ./out streetlights.yml @asyncapi/html-template

Hi @derberg, thanks for the info.
I tried the suggestion

$ docker run --rm -it \
> -v ${PWD}/test/docs/streetlights.yml:/app/asyncapi.yml \
> -v ${PWD}/output:/app/output \
> asyncapi/generator asyncapi.yml @asyncapi/markdown-template -o output --install

install log

npm http fetch GET 200 https://registry.npmjs.org/@asyncapi%2fmarkdown-template 1404ms
npm http fetch GET 200 https://registry.npmjs.org/@asyncapi/markdown-template/-/markdown-template-0.2.0.tgz 97ms
npm http fetch GET 200 https://registry.npmjs.org/markdown-it 1316ms
npm http fetch GET 200 https://registry.npmjs.org/openapi-sampler 1335ms
npm http fetch GET 200 https://registry.npmjs.org/openapi-sampler/-/openapi-sampler-1.0.0-beta.15.tgz 84ms
npm http fetch GET 200 https://registry.npmjs.org/markdown-it/-/markdown-it-10.0.0.tgz 132ms
npm http fetch GET 200 https://registry.npmjs.org/entities 73ms
npm http fetch GET 200 https://registry.npmjs.org/entities/-/entities-2.0.0.tgz 85ms
npm http fetch GET 200 https://registry.npmjs.org/json-pointer 1178ms
npm http fetch GET 200 https://registry.npmjs.org/json-pointer/-/json-pointer-0.6.0.tgz 85ms
npm http fetch GET 200 https://registry.npmjs.org/foreach 86ms
npm http fetch GET 200 https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz 88ms
npm WARN [email protected] requires a peer of semantic-release@>=11.0.0 <16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

trace

Something went wrong:
Error: invalid bin entry for package [email protected]. key=markdown-it, value=bin/markdown-it.js
    at /usr/local/lib/node_modules/npm/node_modules/bin-links/index.js:86:13
    at tryCatcher (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
    at MappingPromiseArray._promiseFulfilled (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/map.js:61:38)
    at MappingPromiseArray.PromiseArray._iterate (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise_array.js:114:31)
    at MappingPromiseArray.init (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise_array.js:78:10)
    at MappingPromiseArray._asyncInit (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/map.js:30:10)
    at _drainQueueStep (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:142:12)
    at _drainQueue (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:131:9)
    at Async._drainQueues (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:147:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14)
    at processImmediate (internal/timers.js:456:21)

Hope it helps.

@fmvilas you see the error? it is exactly the same I had during the review. I think this template works only on node 13.11 and if you try on other versions, like in Docker we have 12, it fails.

@uraala for this specific template the only workaround for now is to use it with node 13.11, sorry

Thanks for raising the issue, @uraala. I just pushed a fix: https://github.com/asyncapi/generator/pull/273.

:tada: This issue has been resolved in version 0.35.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

Thanks for raising the issue, @uraala. I just pushed a fix: #273.

@fmvilas : welcome!

I really liked how it is possible to define a schema for mqtt events and payloads.
Looking forwards for the same for NATS

@fmvilas you see the error? it is exactly the same I had during the review. I think this template works only on node 13.11 and if you try on other versions, like in Docker we have 12, it fails.

@uraala for this specific template the only workaround for now is to use it with node 13.11, sorry

@derberg : Thanks for the update

@uraala You can probably lend a hand to @jonaslagoni on this template: github.com/asyncapi/ts-nats-template/. The first PR is here: https://github.com/asyncapi/ts-nats-template/pull/1.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bali182 picture bali182  路  11Comments

GodsBoss picture GodsBoss  路  4Comments

ymarillet picture ymarillet  路  9Comments

derberg picture derberg  路  8Comments

jonaslagoni picture jonaslagoni  路  5Comments