https://medium.com/@joeldenning/an-esm-bundle-for-any-npm-package-5f850db0e04d
You need to install pnpm.
- Create a github issue, following the template
- Make sure you know the name of the Github repo that you will create. This should be exactly the same as the package name on npm. If the package has an npm scope (
@
), use the syntax used by DefinitelyTyped (__
) to name the package. Do not put@
in the repo name. - An esm-bundle maintainer will create a new repository for your package, by using the Github template repository https://github.com/esm-bundle/autopublish-template. This is done by going there and clicking on "Use this template." Make sure to create the new repo under the esm-bundle organization instead of your personal Github
- Fork the repo. Clone your fork.
- Ensure you are using node@>=13.2.0. You can check by doing
node --version
. If you use nvm, you can switch to the correct version of node vianvm use
pnpm install
pnpm uninstall autopublish-template
pnpm install --dev name-of-your-repo
- Find and replace all instances of
autopublish-template
withname-of-your-repo
- Find and replace all instances of
index.js
with the desired name of the output file- It is encouraged to match the upstream package's output and naming convention for its UMD bundles
- Modify the Readme to point to the correct "upstream repo"
- Modify the
version
in the package.json to0.0.0-unpublished.0
in order to trigger release-it plugin on first merge - Modify description in package.json
- Modify rollup config however is needed. Run
pnpm run build
to test that the build works - Modify tests until
pnpm run test:unit
andpnpm run test:browser
both work - If you are publishing multiple files, link to them in the readme
- Add a github branch protection rule for the master branch. This is required by Kodiak. You should protect the master branch by requiring a pull request approval and successful CI before merges. See picture below for what that configuration looks like.
- Push a branch to your fork. Create a pull request. Tag @joeldenning or another maintainer of esm-bundle, to ensure they get a notification to review the pull request. They will merge the PR which will cause the first version to be published. From then on, new versions will be automatically published.