eirslett / frontend-maven-plugin

"Maven-node-grunt-gulp-npm-node-plugin to end all maven-node-grunt-gulp-npm-plugins." A Maven plugin that downloads/installs Node and NPM locally, runs NPM install, Grunt, Gulp and/or Karma.
Apache License 2.0
4.22k stars 868 forks source link

New Mojo to run node with arbitrary arguments #997

Open cmarchand opened 2 years ago

cmarchand commented 2 years ago

New Mojo to execute arbitrary node commands

As explained in issue #996 I need a new Mojo to run node command with arbitrary parameters

Tests and Documentation

README.md contains an example to use NodeMojo plugin.

eirslett commented 2 years ago

A few people have asked for this feature, but perhaps not many enough. What people usually do is npm run your-script from Maven, and then in package.json add "your-script": "node something.js" inside the scripts block. You then get the additional benefit of being able to do npm run your-script directly from the command line (without Maven) which can be convenient if your command is somewhat complex (node some/kind/of/script.js --foo bar ./bla --etc).

cmarchand commented 2 years ago

Yes, that's a solution. In my situation, at this point, I do not have anymore need of npm, so adding a package.json in my maven project is not very useful. But yes, it's a good workaround. Thanks.