asciidoctor / asciidoctor-kroki

Asciidoctor.js extension to convert diagrams to images using Kroki!
https://kroki.io/
MIT License
151 stars 51 forks source link

[kroki-fetch-diagram] cannot find module 'mkdirp' #47

Closed anb0s closed 4 years ago

anb0s commented 4 years ago

I've installed asciidoctor-kroki in node.js (windows) together with reveal.js. I set the attribute :kroki-fetch-diagram: true to fetch the diagram during convert to have the presentation for offline usage later. I've registered it with own convert-slides.js:

// Load Asciidoctor.js and the reveal.js converter
var asciidoctor = require('@asciidoctor/core')()
var asciidoctorRevealjs = require('@asciidoctor/reveal.js')
asciidoctorRevealjs.register()

// Load asciidoctor-kroki
var kroki = require('asciidoctor-kroki')
kroki.register(asciidoctor.Extensions)

// Convert the document 'presentation.adoc' using the reveal.js converter
var options = { safe: 'unsafe', backend: 'revealjs' }
asciidoctor.convertFile('presentation.adoc', options)

Now it coplains aboud missing dependency

Skipping plantuml block. Cannot find module 'mkdirp'
Require stack:
- d:\Project\docu\node_modules\asciidoctor-kroki\dist\node\node-fs.js
- d:\Project\docu\node_modules\asciidoctor-kroki\dist\node\fetch.js
- d:\Project\docu\node_modules\asciidoctor-kroki\dist\node\asciidoctor-kroki.js
- d:\Project\docu\convert-slides.js
anb0s commented 4 years ago

npm i --save mkdirp solves the issue

ggrossetie commented 4 years ago

Yes sorry about that the dependency is missing from the package.json I must have forgotten to add --save:

https://github.com/Mogztter/asciidoctor-kroki/blob/bf1f8edf813566f45c2a6c1dea3219853d2c4fbb/src/node-fs.js#L3

I will add the missing dependency and a test on the next release.

anb0s commented 4 years ago

It's not an issue for me, just to inform you. Thanks!

ggrossetie commented 4 years ago

Actually we had tests on this feature but the mkdirp package was a transitive development dependency so it was working... :sweat_smile: