I worked out a few things as I was building my own first plugin and decided to extract the reusable bits into a new plugin skeleton so others can use it too.
Here’s the link with freshly added instructions: https://github.com/fkleuver/aurelia-plugin-skeleton-ts-webpack
This skeleton addresses/offers a few things that I missed in the original TypeScript plugin skeleton (which by the way was a great starting point, though I can’t recall exactly which one).
- Karma and webpack configuration in TypeScript
- Karma unit tests running with webpack 4 (fast!)
- Accurate, source-mapped code coverage that shows word-for-word which pieces of code are covered by tests or not
- Debug TypeScript code from the unit test runner directly in VS Code
- An integrated test/demo app to directly test the plugin in during development
- A clean
package.jsonwith short scripts that defer to more robust + configurable
- A single script to build the demo app and get it published to github pages (github has the convention of automatically creating a page for you with whatever is on the
- A single script to test, build, bump the version, push (to github) and publish (to npmjs)
(with a dry-run option of course)
All in all I’ve found this help me do more frequent, small incremental releases. Even simply updating the readme and making sure it’s visible on npmjs isn’t out of the question. A quick
npm run publish-patch is only a few seconds work.
If any step in the process fails (test, build, w/e) the whole process cancels. No need to worry about publishing an inconsistent state.
The TypeScript and tslint configuration is fairly strict and opinionated, but you can easily toss that out if you don’t like it.
Feel free to give it a go, and go out there and create some plugins!