Skip to content

dwjohnston/ultimate-react-package-template

Repository files navigation

Ultimate react package template

Documentation page: https://ultimate-react-package-template.netlify.app/

NPM: https://www.npmjs.com/package/an-example-react-package-built-with-nextjs-tooling

A template for creating and publishing open source React packages.

Feel free to open pull requests against this repository!

A good way to see how everything is behaving, is to update the component package yourself and raise a pull request.

I'll merge anything that isn't too crazy, and adheres to the versioning strategy.

Features

  • Branch deploys to Netlify
  • Tests with Storybook
  • Release management with changesets
    • PRs will be prompted to provide a changeset
    • On successful merge to main, a prerelease package will be published
    • On successful merge to main, a release PR will automatically be created

Instructions

  • Fork/clone the repo.
  • Update package.json:
    • Change the author details
    • Change the package name
    • Change the repository details
  • Update LICENSE:
    • Change the copyright name
  • Log in to Netlify, create new project and add your repository
  • In Github, set NETLIFY_SITE_ID as a repository variable, and NETLIFY_TOKEN as a repository secret. (Generate PAT here)
  • In Github, set the NPM_TOKEN repository secret
  • Install the changeset-bot to your repository

Notes

  • I would prefer to deploy to Github pages, but branch deploys are not supported.

  • Currently the behaviour is that merging to master will update the 'master docs' (ie. the published docs people will see in regular use), create a prerelease package, and create a release PR.

    • This means that until the release PR is merged, your master docs will be ahead of what's actually in the published package.
    • I'm working on this, basically I need a way of getting Netlify to only publish the main branch if it has a release tag. Related discussion: https://answers.netlify.com/t/deploy-on-git-tags-only/43759
  • The prerelease packages are actually snapshots marked 0.0.0-commitsha-date

To come

  • Automated documentation generation

About

A template for publishing public react packages

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •