Closed moshen closed 1 year ago
Alternatively, postinstall scripts are generally best avoided unless absolutely required. The grammar generation could be moved into a prepack or pretest script. Looking at other examples of nearley it looks like it still needs to be a dependency, but generating the js at build time seems acceptable.
This is probably the best idea. I've ceased using nearly in other projects due to its lack of maintenance and inability to install in some environments.
The
postinstall
script inpackage.json
: https://github.com/haraka/node-address-rfc2821/blob/57c9347226dbd4f3b8d3d97c6651d346fb3348bc/package.json#L33Is triggering a
nearley
package install in our systems during the bootstrap phase of our repo. I'm not exactly sure why, as thenearley
package should already exist. This only appeared after upgrading Haraka to the latest version. For us this breaks things (probably because of locking down npm installs).I thought I would log this as an issue as others may have run into it.
If you add the
--no-install
flag (or simply--no
for npm >= 7, though--no-install
still works), the localnearley
should be used.Alternatively,
postinstall
scripts are generally best avoided unless absolutely required. The grammar generation could be moved into aprepack
orpretest
script. Looking at other examples ofnearley
it looks like it still needs to be a dependency, but generating the js at build time seems acceptable.