esm-bundle / new-repo-instructions

MIT License
8 stars 1 forks source link

Instructions for creating a new repo

What is this?

https://medium.com/@joeldenning/an-esm-bundle-for-any-npm-package-5f850db0e04d

Okay how do I do it

You need to install pnpm.

  1. Create a github issue, following the template
  2. 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.
  3. 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
  4. Fork the repo. Clone your fork.
  5. 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 via nvm use
  6. pnpm install
  7. pnpm uninstall autopublish-template
  8. pnpm install --dev name-of-your-repo
  9. Find and replace all instances of autopublish-template with name-of-your-repo
  10. 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
  11. Modify the Readme to point to the correct "upstream repo"
  12. Modify the version in the package.json to 0.0.0-unpublished.0 in order to trigger release-it plugin on first merge
  13. Modify description in package.json
  14. Modify rollup config however is needed. Run pnpm run build to test that the build works
  15. Modify tests until pnpm run test:unit and pnpm run test:browser both work
  16. If you are publishing multiple files, link to them in the readme
  17. 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.
  18. 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.

Protecting the main branch

image