nss-run in 2018 (or what did change over the last 2 years)
What is nss-run
Async by default
The first (and biggest change so far) was rewriting the complete plugin to make everything work async by default. To make the API a bit easier instead of relaying on callbacks it uses Promises for all async functionality. This has the second benefit that if you use modern NodeJS versions you can use the async/await pattern to make your nss-runfile even more readable and maintainable.
Even tho making everything Promise based to my surprise the API stayed extremely simple and most of my nss-runfile’s didn’t had to change a lot.
One of the biggest flaws was always the lack of proper in-code documentation for the important API methods. I’ve documented everything in the project’s README. But when you where using more advanced editors like Webstorm you do not get the full power when modifying your nss-runfile. In addition to that I can now generate a simple documentation website to help you discover and explore the API faster. If you want to checkout the new documentation head over to github.
You might wonder what I mean by answering questions. During my latest use of the plugin I run into a unique (or maybe not so unique?) problem. I had a CLI tool that I needed to use which asked me questions. And there was no way to specify the answers for that questions as an argument. Further it was not just one question I had to specify multiple interactive answers which is not good for an automated build tool that should work without any user interactions.
To accommodate that the run command now has a new option called autoAnswer which allows you to scan the command output for certain texts. When that text appears nss-run will supply the specified answer to the commands stain. This works extremely well and solved a huge issue I run into for one of my projects.
As you can see there where quiet some significant changes based on real world experiences. Currently I am very happy with the build tool and will use it for more and more of my web projects. But as always I am happy for any feedback. Are you using it already or planning todo so? If yes what issues do you run into and would like to have solved with a simple solution? Let me know in the comments or create a ticket on github.