My personal, minimal setup for building and releasing npm packages. Please note that I'm using this on MacOS and I haven't tested it on other systems.
Read the introductory blog post. Name comes from a fictional character Commander Keen.
- Uses TypeScript by default.
- Generates both ESM and CJS modules, as well as type definitions.
- Simple system for creating a demo/docs page and deploying it to the GitHub pages.
- Minimal - only two dev dependencies:
esbuild
andtypescript
. - Builds everything automatically before
npm publish
.
To rename a package you can run this command:
sed -i '' 's/keen/new-package-name/' *.json *.md src/* docs/*
You probably want to replace my GitHub handle as well:
sed -i '' 's/Stanko/your-github-handle/' package.json
And the last thing, open docs/index.html and swap my domain muffinman.io
for yours.
npm start
Runs a development server on http://localhost:8000
npm run build
Builds the package and the demo/docs page.
Fist build and commit docs/build
folder. Then in GitHub Pages settings select your branch and /docs
folder.