I've created two workflows to manage an open source NPM package of mine.
This workflow runs tests and creates a test coverage report when pushing code or creating/updating pull requests.
This workflow publishes a package to NPM for you. The cool thing is that all you have to do is create a release on GitHub.
It updates the version in package.json for you automatically. The workflow also let's you publish multiple versions (Say your project is on version 2 but you still want the possibility to publish patches to version 1).
Given you have logical, procedural, "hard to visualize" code like this:
// given we have const path = 'App/Controllers/user.js' const filename = path.substring(path.lastIndexOf('/') + 1) let name = filename.substring(0, filename.lastIndexOf('.')) if (!name.endsWith('Controller')) name+= 'Controller' return name.substring(0, 1).toUpperCase() + name.substring(1)
refactor it into plain English
// given we have const path = 'App/Controllers/user.js' given.string(path) .betweenLast('/').andLast('.') .endWith('Controller') .capitalize(…
I've posted three articles describing the set up and what I learned along the way: