Thank you for wanting to contribute to the Fluent State project. With your contributions we can ensure Fluent State remains a leading solution for implementing State Machines within JavaScript projects.
- Issues:
- Always work off of an Issue. Please do not submit a Pull Request that is not associated with an Issue (create the Issue if necessary).
- If you are beginning work on an Issue, please leave a comment on the issue letting us know, and we'll assign the Issue to you. This way somebody else won't start working on the same Issue.
- Branches:
- Always branch off of
main
, which contains the latest version of Fluent State
- Always branch off of
- Pull Request (PR):
- Make sure you run the following scripts in local, and that all of them pass, before submitting a PR:
npm run lint:fix
npm run format
npm test
- Make sure your PR is targeting the correct branch (see Step 2.i)
- At the top of your PR description write: "Fixes #n". Where n is the number of the Issue your PR is fixing (e.g.,
Fixes #33
). This will tell GitHub to associate your PR with the Issue.
- Make sure you run the following scripts in local, and that all of them pass, before submitting a PR:
- Node: Node 20+
- Clone the repo
- Change directories:
cd fluent-state
- Install dependencies:
npm i
Start app in watch mode: npm run local
When file changes are detected, the app will automatically rebuild/restart
- Check lint rules:
npm run lint
- Fix lint errors:
npm run lint:fix
- Fix formatting errors:
npm run format
The following section includes optional dev tools that enhance the Fluent State development experience, but are not necessary.
The Fluent State project includes an .nvmrc file, so you can run nvm use
to switch to the required version of Node.
- Install nvm: https://github.com/nvm-sh/nvm
- Install the Node.js version required by this app:
nvm install
- NVM will determine the required Node version using the .nvmrc file
- NVM will install the required Node version if it isn't installed
- NVM will set your current Node version to the one required
The Fluent State project includes Husky for running Git Hooks. Running git commit
will trigger lint-staged
which will lint all files currently staged in Git. If linting fails, the commit will be cancelled
chai
: we must use v4.x because v5.x is pure ESM, and we require CommonJS modules
Deployments to Prod consist of building and publishing the Fluent State lib to NPM, and are automated through our Continuous Deployment workflow.
- Checkout
main
. - Increment the version in package.json, using semantic versioning (e.g.,
1.1.0
). - Rebuild package-lock, to pick up the new version number:
npm i --package-lock-only
. - Push changes:
git add . git commit -m "Bump version to 1.1.0" git push
- Navigate to the CI workflow.
- Ensure the build checks for this push succeed.
- Navigate to Fluent State's releases.
- Click "Draft a new release":
- Choose a tag: enter version (e.g.,
v1.1.0
) and click "Create new tag" - Target:
main
- Previous tag:
auto
- Release title: (e.g.,
1.1.0
) - Description: click the "Generate release notes"
- Set as the latest release
- Choose a tag: enter version (e.g.,
- Click "Publish release".
This will trigger the CDP workflow, which will build and deploy the package to NPM: https://www.npmjs.com/package/@2toad/fluent-state