These are the build tools I prefer to use when starting a new JavaScript or TypeScript library. Most libraries I write run both in the browser and in node.js. Each project needs to be lightweight, and to minimize maintenance. And I need build chains for those libraries to pretty much "just work". That last part has become more important over time, as I've maintained more libraries and generally had less time to deal with dependencies and build system issues. For web applications, as opposed to libraries consumed in other projects, these choices may or may not make sense. These are opinionated choices, and will probably change over time.
Almost always:
microbundle
: Zero-config Rollup bundler, with optional TypeScript supporttape
: Test runnertap-spec
: Clean test output
Occasionally:
tape-run
: Headless test runnernyc
: Test coveragesource-map-support
: Debug with sourcemaps in node.js
package.json:
"source": "src/index.js",
"main": "dist/<package>.js",
"module": "dist/<package>.module.js",
"unpkg": "dist/<package>.umd.js",
"types": "dist/<package>.d.ts",
"scripts": {
"dist": "microbundle",
"dev": "microbundle watch",
"test": "tape test/*.test.js | tap-spec",
"preversion": "npm run dist && npm test && git add -A dist",
"postversion": "git push && git push --tags && npm publish"
},
Created a GitHub repository template, along these lines: https://github.com/donmccurdy/typescript-library-template.