This project was bootstrapped with Create React App.
node
. $ git clone git@github.com:outintech/nbjc-webapp.git
$ cd nbjc-webapp
$ npm install
If you have issues with compiling with multiple versions of react-router-dom installed locally, downgrade to version 5 by using:
npm install react-router-dom@5 --save
The following will start the repo locally with watchers and hmr in localhost:3000
$ npm start
If 3030 is already in use it will prompt you to run in a different port like so. Hit Y
to allow
? Something is already running on port 3000. Probably:
...
Would you like to run the app on another port instead? (Y/n)
New standalone React components can be scaffolded using a plop script.
To run the generator:
$ npm run generate
In the prompt, provide a name to your compoenent in PascalCase The script will create :
src/components
Four new files:
.jsx
file for the component.md
file for styleguide.test.jsx
file for unit testingindex.js
file for ease of import. Example:
$ npm run generate component
nbjc-webapp@0.1.0 generate
$ plop component
? What is your component name? FilterDialog
✔ ++ /src/components/FilterDialog/FilterDialog.jsx
✔ ++ /src/components/FilterDialog/FilterDialog.md
✔ ++ /src/components/FilterDialog/FilterDialog.test.jsx
✔ ++ /src/components/FilterDialog/index.js
✨ Done in 6.64s.
react-styleguidist
to develop components locally. src/components
foldersrc/Provider.js
component to theme the stylguide according to the NBJC themeTo run the styleguide
$ npm run styleguide
go to localhost:6060 to see the styleguide and modify the examples.
To add styleguide to component in the src/components
folder simply add a .md
file with jsx
codeblocks.
npm run lint
to lint all .js and .jsx files in the src foldereslint
with airbnb
rules.npm run test
to run all tests with a watcher. .env
file into .env.local
REACT_APP_API_HOST
with host for the API server you wish to hit.REACT_APP_AUTH0_DOMAIN
and REACT_APP_AUTH0_CLIENT_ID
In the project directory, you can run:
npm start
Runs the app in the development mode.\ Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.\ You will also see any lint errors in the console.
npm run test
Launches the test runner in the interactive watch mode.\ See the section about running tests for more information.
npm run build
Builds the app for production to the build
folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.\ Your app is ready to be deployed!
See the section about deployment for more information.
npm run eject
Note: this is a one-way operation. Once you eject
, you can’t go back!
If you aren’t satisfied with the build tool and configuration choices, you can eject
at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject
will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
You don’t have to ever use eject
. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
You can learn more in the Create React App documentation.
To learn React, check out the React documentation.
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
npm run build
fails to minifyThis section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify