bafolts / plantcode

Provides a javascript utility to generate code in various languages given a plantuml class diagram.
https://segmentationfaults.com/plantcode
MIT License
217 stars 42 forks source link

npx not working due to missing dependencies #21

Closed adelin-b closed 4 years ago

adelin-b commented 4 years ago

This does not work, I think it is because packages dependencies like pegjs are set as devDependencies

npx plantcode -l coffescript tests/car.pegjs > tests/car.coffee
internal/modules/cjs/loader.js:783
    throw err;
    ^

Error: Cannot find module '/home/adelin/.npm/_npx/1104692/lib/node_modules/plantcode/node_modules/pegjs/bin/pegjs'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:780:15)
    at Function.Module._load (internal/modules/cjs/loader.js:685:27)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1014:10)
    at internal/main/run_main_module.js:17:11 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
bafolts commented 4 years ago

I will get together a fix for this. Handlebars introduced a change which was security related. Supposedly how this project uses handlebars was deemed insecure.

https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access

While increasing the project version and generating the new package-lock.json this security risk is being inherited. I will fix the security risk and push for the change to move pegjs to devDependencies. The issue is that after install the plantuml.js file is being generated. I will store that in source instead of requiring it to always be generated.

bafolts commented 4 years ago

This should work now.