These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. You'll also find information on making a pull request.
Prerequisites
Installing
Making Changes
Testing
Documentation
Making a Pull Request
You'll need to have Node, Git, and Firebase CLI set up on your local machine.
Follow the steps below to get your development environment set up.
-
Open the terminal and and run the following:
git clone https://github.com/flex-development/ltcollinstimeline.git -
Run
npm installto install the project dependencies.
This project uses React, Sass, and Babel.
Branch Naming Convention
<your_initials>/, followed by: feature-, bug-, hotfix-, or release-.
For example:
git checkout -b ld/feature-docs
git commit -am "added documentation"
git push- 2 spaces – for indentation
- No unused variables – this one catches tons of bugs!
- No semicolons – It's fine. Really!
- Never start a line with
(,[, or `````- This is the only gotcha with omitting semicolons – automatically checked for you!
- Space after keywords
if (condition) { ... } - Always use
===instead of==– butobj == nullis allowed to checknull || undefined.
For a detailed overview of our JavaScript style, visit StandardJS. You'll find not only an overview of Standard Style, but a list of editor plugins as well.
To configure the linting options for this project, make changes to
.eslintrc.json and .eslintignore in the project root.
Reference: Configuring ESLint
To configure the Babel options for this project, make changes to
babel.config.js in the project root.
Reference: Configure Babel - babel.config.js
Make your changes under the src directory.
-
Run
npm run devto view the site indevelopmentNode environment. Your JSX and Sass files will be compiled and watched for changes, and ESLint will lint your code as you develop. -
If successful, you'll see something similar to the following in your terminal:
Compiled successfully! You can now view @flexdevelopment/ltcollinstimeline in the browser. Local: http://localhost:3000/ On Your Network: http://10.105.184.99:3000/ Note that the development build is not optimized. To create a production build, use npm run build.
To learn more about using Sass with React, please consult Adding a Sass Stylesheet from the React docs.
public/index.html: HTML templatesrc/api: Firebase configuration. Exports the databasesrc/api/data: Event datasrc/assets: Project fonts, images, and iconssrc/components: React components, organized in an Atomic Design patternsrc/sass: Application stylesheets, built with Sass, and organized in an Atomic Design patternsrc/utils: Frontend utility functionssrc/index.js: Exports our web appsrc/manifest.json: Web application config
For generating sample test data, use Mockaroo.
Snapshot Testing
Under tests/__snapshots__, add *.snap file to test your component spec
against. For information on creating Jest Snapshots, please visit this link.
Running Tests When you're ready to test your changes, you have two options:
- Run
npm testin your project directory. This run your tests, as well as all the tests in the tests in thetestsdirectory. - Run
jest <test_pattern> --detectOpenHandles. This will run all tests with a name matchingtest_pattern. Example:jest foo --detectOpenHandles
Following JSDoc standards, be sure to document any functions, classes, and other code you write. It will be reviewed by a reviewer during your code review, and your pull request will be denied if any code is improperly documented.
Note: Before creating a pull request for your changes, make sure your build passes all unit tests. If you need help, please create a test file and leave a comment in the test body, making note of any issues in their respective files. Make sure to label your pull request "help wanted."
If you're ready to have your changes reviewed, make sure your code is well
documented and run npm run lint to check your code for syntax + styling errors.
- Use this template
- Label your pull request as
pull requestandneeds review - Prefix your pull request title with
PR - - Assign the task to yourself and the appropriate reviewer