🔧 Tooling: The project uses node.js and yarn "classic". You must have both installed.
git clone https://github.com/nearform/orion.git
cd orion
yarn
🔧 Tooling: The repo uses lerna and yarn workspaces to work as monorepo. The individual packages are located in the packages
sub directory.
Orion uses the xo linter 🐛. It is very strict and is intended to eliminate all style debates.
Developers are assumed to be using VSCode. Use other IDEs at your own risk.
🚀 Install the XO extension for VSCode
ℹ️ Info: There are xo extensions for other IDEs. Use them at your own risk.
{
"editor.formatOnSave": true,
"xo.enable": true,
"xo.format.enable": true
}
💡 Pro tip: The linter only works in VSCode when opening the project from the root of the the monorepo. Opening individual packages will lead to headaches 🤕💊.
Configuration happens through environment variables.
🔧 Tooling: Environment variables are loaded with env-cmd or dotenv depending on the pacakage.
Required environment variables for each package are documented in the .env.sample
files inside the associated packages.
The following packages distinguish between .env.development
and .env.production
when running in development mode or building for production:
gatsby-plugin-orion-edit
gatsby-plugin-orion-view
The package hasura
does not make a distinction and has a single .env
file.
- Run hasura and postgres in local docker container and run
view
andedit
websites. This is the right script to have everything running in you local environment.
run start:dev
- Run hasura and postgres in local docker container (no clients running)
run start:db
- Stop hasura docker container, drop all docker volumes and drop postgres db
run stop:db
- Start
view
client (no db connection unless you set up your own)
yarn start:view
- Start
edit
client (no db connection unless you set up your own)
yarn start:edit
Once Gatsby successfully builds and starts the development server(s) the sites can be debugged in your browser.
🚀 Navigate to http://localhost:8000 (view), or http://localhost:8001 (edit) as required.
As you are running Orion in Bypass authentication mode you need to set up your develoment user credentials as environment variables. Please refer to .env.development.sample
files to get more info
As appropriate, individual components should be demo'able in storybook.
yarn storybook
🚀 View the staging version of storybook at https://orion-storybook.nearform.com
🚀 Pick a story to work on from the clubhouse project.
🚀 Work on a new branch, using the name suggested by clubhouse by clicking on the github helpers button on your story.
Clubhouse will suggest the convention {username}/ch{story number}/{story-summary}
. For example codyzu/ch81/poc-automatic-versioning-in-ci
.
👆 This is the easy way to commit and will guide you through the commit conventions!
Staged changes and commit messages are linted. You have been warned. Seemingly incoherent linting problems during commits could be due to missing changes in the git staging area.
💡 Pro Tip: If your commit fails (linting or other problems), it can retried with yarn commit --retry
(see commitizen's docs for details).
💡 Pro Tip: When prompted for "Issues this commit closes" using the format [ch1234]
. This will link your commit to your story.
n
or none
will result in a new major version and a corresponding note in the changelog!
🚑 In case of emergency (or when rebasing), you can disable commit linting by deactivating git hooks with either of the following:
yarn commit --no-verify
git commit --no-verify ...
HUSKY_SKIP_HOOKS=1 git ...
🚀 Ensure your branch is built successfully by Circle CI
Deploying master into staging can be done by anyone.