kach / nearley

📜🔜🌲 Simple, fast, powerful parser toolkit for JavaScript.
https://nearley.js.org
MIT License
3.59k stars 232 forks source link

docs suggest installing globally and shouldn't #609

Open msimerson opened 2 years ago

msimerson commented 2 years ago

On the Getting started page, it says:

To use the nearley compiler, you need to additionally install nearley globally.

and shows: npm install -g nearley.

Since a few years back when npx shipped, there's a much better way to run the nearly scripts: npx nearley-{test|unparse|railroad}. The docs should be updated to suggest that instead.

msfeldstein commented 1 year ago

Is there a way to install it locally and have an npm script be able to run nearleyc? I installed via npm install --save-dev nearley and then have a script "compile-expression-grammar": "nearleyc path/to/grammar.ne -o path/to/grammar.js" but running npm run compile-expression-grammar fails with /var/folders/2p/3f9_b05n3hvc2yxnzqwwswmm0000gp/T/compile-expression-grammar-9adeceb5.sh: line 1: nearleyc: command not found