asciidoctor / asciidoctor-kroki

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

`node/asciidoctor-kroki.js` missing when running `yarn upgrade asciidoctor-kroki@0.10.0` #177

Closed mmattel closed 3 years ago

mmattel commented 3 years ago

I am investigating a strange issue. Using antora in our ownCloud docs environment, we get errors when trying to upgrade to 0.10.0 because of missing node/asciidoctor-kroki.js. Running:

yarn upgrade asciidoctor-kroki@0.8.2 respectively yarn upgrade asciidoctor-kroki@0.10.0

Comparing the directories node_modules/asciidoctor-kroki/dist you see an important difference: 0.8.2 --> has subdirectories browser and node 0.10.0 -- has only subdirectory browser...

I am no yarn specialist and hope I am not getting flamed, but this seems strange to me.

Any ideas?

ggrossetie commented 3 years ago

Hi @mmattel

That's correct, the Node.js entry point is now node_modules/asciidoctor-kroki/src/asciidoctor-kroki.js. How do you require/load the library?

The main field in the package.json describes the entry point:

https://github.com/Mogztter/asciidoctor-kroki/blob/1d205affe91e4e2b0abfc6e7e0886cd2ace36f45/package.json#L5

See: https://docs.npmjs.com/cli/v6/configuring-npm/package-json#main

Node will use this value to load the library when using require('asciidoctor-kroki').

ggrossetie commented 3 years ago

I am no yarn specialist and hope I am not getting flamed, but this seems strange to me.

No flame here, we are here to help each other :hugs:

mmattel commented 3 years ago

Many thanks for your help. I changed the path and it worked.

phil-davis commented 3 years ago

Note: the problem happened in https://github.com/owncloud/docs/pull/2867 which is auto-generated code by GitHub dependabot https://github.com/owncloud/docs/pull/2867/commits/9a8968e11d64c1f4dfabdc0f24a6eb0ea0c28c30

The reference to asciidoctor-kroki is in https://github.com/owncloud/docs/blob/master/site.yml extension section, and that has (had) a path ./node_modules/asciidoctor-kroki/dist/node/asciidoctor-kroki.js going through dist/node

ggrossetie commented 3 years ago

Many thanks for your help. I changed the path and it worked.

Awesome :+1:

The reference to asciidoctor-kroki is in https://github.com/owncloud/docs/blob/master/site.yml extension section, and that has (had) a path ./node_modules/asciidoctor-kroki/dist/node/asciidoctor-kroki.js going through dist/node

I think you can use the value asciidoctor-kroki in asciidoc.extensions. Behind the scene, Antora will use require to resolve the library. It will be more robust than using a relative path from the node_modules directory.

mmattel commented 3 years ago

Thanks for the hint, I will try that and see if I can make it work according your suggestion