ztate
v2.0.1
Published
A simple state machine library for React
Downloads
3
Readme
Create TypeScript Package
A template project for creating TypeScript packages.
Configuration
Replace the package name, description, author, license, etc. in the package.json with your package's details
Update this README.md file to contain your package's documentation
Update the release.yml workflow to check for your username when publishing (this is used to prevent the workflow from running in forks):
if: startsWith(github.repository, '{your-username}/')
Configure
GITHUB_TOKEN
to have the permissions to create Pull Requests:- Go to https://github.com/{owner}/{repo}/settings/actions
- Check "Allow GitHub Actions to create and approve pull requests" under "Workflow permissions"
Add
NPM_TOKEN
to your Repository secrets:- Go to NPM's Access Tokens page
- Click "Generate New Token" -> "Classic Token" and follow the instructions (make sure to choose "Automation" for the token type)
- Go to https://github.com/{owner}/{repo}/settings/secrets/actions, and add the generated token as a secret named
NPM_TOKEN
Structure
src/
- TypeScript source files.**/__tests__/
- Test files.dist/
- Compiled JavaScript files.
Tools
This template uses tsup for transpiling & bundling, Vitest for testing, ESlint & TypeScript ESlint (with the strictest configuration) for linting, Prettier for formatting, and Changesets for versioning & publishing.
Development Flow
Add your code & tests to the
src/
directoryUse
npm run test
to run the testsUse
npm run lint
to lint the codeUse
npm run format
to format the codeUse
npm run build
to build the packageRun
npx changeset
each time you want to add a commit to the changelog (see Using Changesets for more info)Commit & push your changes
The CI will automatically open a PR with the changes, or add the changes to an existing PR
Review & merge the PR when you're ready to publish the package