- Node.js
- Docusaurus by Facebook / Meta
- GitHub
- AWS Amplify
-
System dependencies, common to most web development
- VS code, or similar editor
- Extension: Git Lens
- Extension: Prettier
- Extension: MDX
- Terminal configured to work with this GitHub repository
- Node.js is installed
- VS code, or similar editor
-
Clone this repository,
git clone https://github.com/clearpathrobotics/cpr-documentation.git
-
Open the folder
-
In a terminal, navigate to the root of the project folder and run
npm install
-
Start the local server by running
npm run start
-
A new tab should open in your prefered web browser once the site is running. Your terminal session should show the port the webpage is running on. The default address is http://localhost:3000/ but this may change if you are already using that port for another site.
-
If you want to test something on a mobile screensize; you can do this within your desktop's Chrome browser. When the site is running locally; enter Chrome's developer tools by selecting: 3 dots in the top right → More tools → Developer tools. You can then select the Device Toolbar button, and change the screensize, as shown in the two images below. We are designing to a smallest screen width of 320 px.
-
Clone or fork this repository,
git clone https://github.com/clearpathrobotics/cpr-documentation.git`
-
Create a branch from development. with a name indicating the purpose, such as feature_xxxxxx
-
Make changes to the relevant files
-
Test using your local server, using the steps mentioned Steps to run this on your computer locally
-
When ready, enter
ctrl-c
in your terminal to stop the server. Then runnpm run build
to test that the site builds corretly. -
Resolve any errors that the terminal reports, and rerun the command
npm run build
. -
Finally, check that your updates adhere to our code formatting standard, by running the command
npm run format-check
. The terminal will either report:- All matched files use Prettier code style!
- Code style issues found in the above file(s). Forgot to run Prettier?
You can fix the errors by running the command
npm run format-write
. This format all the files in the repository, and save them automatically.- Refer to the package.json to understand what this script calls.
- Refer to the .prettierrc.json to understand the rules Prettier is using when checking files.
- Alternativaly, you can format a single file by running
npx prettier --write <FILE PATH>
, such asnpx prettier --write README.md
-
You will need to confirm that
npm run format-write
code formatting did not make any functionality changes to your .mdx documentation. You may see files that claim to be updated in Source Control, but don't have any visible changes. You should run these commands in your terminal to prevent Git from noting these types of changes:git config --global core.filemode false git config --global core.autocrlf false
-
When ready, publish your branch on GitHub, and submit a Pull Request to merge your changes into the development branch. Pull Requests to the production branch will not merged. Also note that this GitHub repository has branch protection rules, that prevent you from committing directly to production and development.
-
The administrators of this documentation will review the website for any functional issues, and will periodically merge the latest commits in the development branch into the production branch.
The OutdoorNav User Manual is a "versioned" document, which means that a snapshot of the content is made to align with a release. This allows users to access version-specific copies of the documentation.
During the development phase, follow steps 1-10 of the workflow above. Note that the updates will not affect the default view of the user manual, only the "next" version of the manual (eg. http://docs.clearpathrobotics.com/docs_outdoornav_user_manual/next/index).
When it is time to publish a numbered release of the user manual:
-
Create a branch from development with a name indicating the purpose, such as release_xxxxxx
-
Run the versioning command, where new_version is aligned with the corresponding software release:
npm run docusaurus docs:version:outdoornav_user_manual <new_version>
-
Update /docs/software/navigation_packages.mdx to:
- Update the version number for the "Latest".
- Add an entry for the previous release.
-
Build and test the changes (see steps 4-8 from the standard workflow above).
-
When ready, publish your branch on GitHub, and submit a Pull Request to merge your changes into the development branch. Be sure to include the updates to the following:
- outdoornav_user_manual_versioned_docs/
- outdoornav_user_manual_versioned_sidebars/
- outdoornav_user_manual_versions.json
Follow the steps for the OutdoorNav User Manual workflow above, replacing outdoornav with indoornav.
- Refer to Markdown's guide for syntax
- Refer to Docusaurus's guide for supported Markdown features
- For advanced users, refer to Markdown MDX for adding React Components to a Markdown file
- for advanced users, you may create React pages using .js or .ts file types
All files should use lowercase letters for their names and file extensions. Our website's server is case sensitive, so it requires files case to match how it is called in your Markdown files. Your Windows build commands may not catch these issues since Windows is not case sensitive. Using lowercase letters minimizes the number of build issues.
- Good:
controller_1.png
- Bad:
Controller_1.png
- Bad:
controller_1.PNG
Downloadable assets like PDFs should say clearpath_robotics at the start of the name. This helps User's know where they downloaded the file from later, as the asset is saved to their Downloads folder.
-
Markdown page
/docs
-
Markdown component, like a section to be reused in multiple pages
/components
-
Images
/static/img
-
PDFs and similar customer facing files
/static/assets
We have this site deployed on AWS Amplify. Their server is monitoring the production and development branches of this repository. When AWS sees a new commit on either branch, it will rebuild the site. The image below shows the development branch rebuilding after the GitHub branch was updated by a Pull Request.
This example took 2 minutes and 14 seconds to deploy. If your feature branch change is large, we can deploy it as a temporary site on AWS to confirm that it builds before submitting a Pull Request into Development. The downsides of deploying more branches are:
- Possible time lost, though this may save time by preventing build errors on the production branch
- A small cost to AWS for using their Server. At the time of writing (May 2022), AWS charges $0.01 USD per build minute.
You can find templates in the directory /static/reference_pages
You can add equations using KaTex syntax. The packages have are installed in the package.json and imported into the project in docusaurus.config.js. You simply need to add your equations to your Markdown file, keeping all the elements between opening an closing tags $.
You can test equation syntax using this tool from KaTex.
We want images to convey information. The best way to do this is to have a consistent method notating images, and removing unnecessary content. The list below are not strict rules, but are considered good practice to keep images throughout the site looking consistent,
-
Highlight colours should be:
- Primary
- #BB0000
- RGB (187, 0, 0)
- Secondary
- #00C7A6
- RGB (0, 199, 166)
- Tertiary
- #4E7FFF
- RGB (78, 127, 255)
- Primary
-
Remove background colours when possible. This helps Users that have set the site to Dark Mode. Refer to SolidWorks image exports for the process of creating these images.
-
Avoid embedding text in images. This prevents Users from translating the webpage. Consider using arrows and circles to notate images, with the text included in your Markdown file.
Note: icons, logos, and symbols that are part of the physical product are exempt from this suggestion.
-
Open your assembly in SolidWorks. Orient the model to the view you want to capture. Click File → Save-As.
-
Select .png as the file type. Then click the Options button.
-
Make sure the Remove background box has a check mark. Click the Print capture box, so you can manually choose the image's width and height.
-
In the same window as Step 3; scroll down to the bottom. Change the Width and Height fields to adjust the bounding box around the SolidWorks model. 300 mm tall should be a good balance between image resolution and file size.
Finally, select OK, and Save