This document aims to describe the workflows and rules used for developing this project. This includes, but is not limited to:
- how to contribute code (coding standards, testing, documenting source code)
- how pull requests are handled
- how to file bug reports
Note: This general guide is referenced in every workspace-specific guide. Please read both guides before contributing to any workspace to prevent duplicated work and misunderstandings.
Getting Started
Contributing Code
Labels
Opening Issues
Pull Requests & Code Reviews
Merge Strategies
Releasing
People interacting with the flautoreview
project are grouped into 4
categories:
- owner:
flex-development
organization owners with full admin rights - maintainer: owners and people added to the organization who actively contribute to projects and have direct push access
- contributor: someone who has helped improve any projects, but does not have direct push access
- user: developers who use any
flex-development
projects and may or may not participate in discussions regarding a given project
- contribution:
- new features
- engaging in discussions for new feature requests
- documentation fixes
- bug reports with reproducible steps
- answering questions
- ticket: JIRA issue
The examples in this guide contain references to custom Git aliases.
Copy the starter Git global configuration to follow along fully, as well as begin extending your own workflow.
This project uses Yarn 2 (v3.0.0-rc.2
). The Yarn configuration for this
project can be found in .yarnrc.yml
. If you're already using
Yarn globally, see the Yarn 2 Migration docs.
Some workspaces depend on scoped packages (e.g: @flex-development
). Some of
those packages are published to the GitHub Package Registry, but not to
NPM. A GitHub Personal Access Token is required for installation.
Scopes, their registry servers, and required environment variables are defined
in .yarnrc.yml
under the npmScopes
field.
Before cloning and installing the project, you'll need to
add the PAT_GPR
variable to your shell:
- Retrieve
PAT_GPR
from a project maintainer - Open
~/.bash_profile
,~/.zprofile
,~/.zshenv
, or~/.zshrc
- Save file and re-launch shell
git clone https://github.com/flex-development/flautoreview
cd grease
yarn bootstrap
Note that if you have a global Yarn configuration (or any YARN_*
environment
variables set), an error will be displayed in the terminal if any settings
conflict with the project's Yarn configuration, or the Yarn 2 API. An error will
also be displayed if you're missing any environment variables.
All environment variables are documented in package.json
under the env.optional
and env.required
fields.
Running a ts-node
command? Conditionally require tsconfig-paths/register
to
run scripts that use path aliases:
-
Open
~/.bash_profile
,~/.zprofile
, or~/.zshrc
-
Conditionally append
-r <path/to/import>
if [ -f "$PWD/node_modules/tsconfig-paths/register.js" ]; then export NODE_OPTIONS="$NODE_OPTIONS -r tsconfig-paths/register" fi
-
Run your script:
ts-node scratchpad-with-path-aliases
instead of
NODE_OPTIONS='-r tsconfig-paths/register' ts-node scratchpad-with-path-aliases
Note: Workspaces that require custom option must use an .env.*
file to set
NODE_OPTIONS
.
Husky is used to run Git hooks that locally enforce coding and commit message standards, as well run tests associated with any files changed since the last commit.
Any code merged into the development and production branches must confront the following criteria:
- changes should be discussed prior to implementation
- changes have been tested properly
- changes should include documentation updates if applicable
- changes have an associated ticket and pull request
- Development:
next
- Production:
main
When creating a new branch, the name should match the following format:
[prefix]/<TICKET-ID>-<branch_name>
│ │ │
│ │ └─⫸ a short, memorable name (possibly the future PR title)
│ │
│ └─⫸ check jira issue
│
└─⫸ bugfix|feat|hotfix|release
For example:
git feat P011-1-repository-setup
will create a new branch titled feat/P011-1-repository-setup
.
This project follows Conventional Commit standards and uses commitlint to enforce those standards.
This means every commit must conform to the following format:
<type>[optional scope]: <description>
│ │ │
│ │ └─⫸ summary in present tense; lowercase without period at the end
│ │
│ └─⫸ see commitlint.config.js
│
└─⫸ build|ci|chore|docs|feat|fix|perf|refactor|revert|style|test|wip
[optional body]
[optional footer(s)]
<type>
must be one of the following values:
build
: Changes that affect the build system or external dependenciesci
: Changes to our CI configuration files and scriptschore
: Changes that don't impact external usersdocs
: Documentation only changesfeat
: New featuresfix
: Bug fixesperf
: Performance improvementsrefactor
: Code improvementsrevert
: Revert past changesstyle
: Changes that do not affect the meaning of the codetest
: Adding missing tests or correcting existing testswip
: Working on changes, but you need to go to bed 😉
For example:
git chore "add eslint configuration"
will produce the following commit: chore: add eslint configuration
To include an inline code snippet in your commit message, be sure to escape your backticks:
git ac "feat(lifecycles): \`greaser-notes\`"
See commitlint.config.js
for an exhasutive list of
valid commit scopes and types.
Prettier is used to format code, and ESLint to lint files.
Prettier Configuration
ESLint Configuration
All source code can be found in the src
directory.
The purpose of each file should be documented using the @file
annotation,
along with an accompanying @module
annotation.
- JavaScript & TypeScript: JSDoc, linted with
eslint-plugin-jsdoc
Before making a pull request, be sure your code is well documented, as it will be part of your code review.
This project uses Jest as its test runner. To run all the tests in this
project, run yarn test
from the project root.
Husky is configured to run tests before every push. Use describe.skip
or
it.skip
if you need to create a new issue regarding the test, or need to
make a wip
commit.
If you need help, make note of any issues in their respective files. Whenever
possible, create a test to reproduce the error. Make sure to label your issue as
type:question
and status:help-wanted
.
This project uses a well-defined list of labels to organize tickets and pull
requests. Most labels are grouped into different categories (identified by the
prefix, eg: status:
).
A list of labels can be found in .github/labels.yml
.
Before opening an issue please make sure, you have:
- read the documentation
- searched open issues for an existing issue with the same topic
- search closed issues for a solution or feedback
If you haven't found a related open issue, or feel that a closed issue should be re-visited, please open a new issue. A well-written issue has the following traits:
- follows an issue template
- is labeled appropriately
- contains a well-written summary of the feature, bug, or problem statement
- contains a minimal, inlined code example (if applicable)
- includes links to prior discussion if you've found any
When you're ready to have your changes reviewed, open a pull request against the
next
branch.
Every opened PR should:
- use this template
- reference it's ticket id
- be labeled appropriately
- be assigned to yourself
- give maintainers push access so quick fixes can be pushed to your branch
https://github.com/flex-development/flautoreview/compare/next...<branch>
where <branch>
is the name of the branch you'd like to merge into next
.
All pull requests are subject to code reviews before being merged into next
and main
. During code reviews, code-style and documentation will be reviewed.
If any changes are requested, those changes will need to be implemented and approved before the pull request is merged.
In every repository, the create a merge commit
and squash and merge
options
are enabled.
- if a PR has a single commit, or the changes across commits are logically
grouped, use
squash and merge
- if a PR has multiple commits, not logically grouped,
create a merge commit
When merging, please make sure to use the following commit message format:
merge: <TICKET-ID> (#pull-request-n)
│ │
│ └─⫸ check your pull request
│
└─⫸ check jira issue
e.g: merge: P011-1 (#1)
- Decide what version bump the release needs (major, minor, patch)
- versioning
yarn release
(determines bumps based on commits)yarn release --release-as major
yarn release --release-as minor
yarn release --release-as patch
- a new release will be drafted
- versioning
- Close issues with the
status:merged
label - Add the
status:released
label to newly closed issues - Publish release