econsult-frontend v1.27.0-beta.168
Setting Up Locally
In order to run this project locally you will need to have Yarn and LTS Node version v20.11.1 on your machine.
Yarn
To check whether you have Yarn installed locally run yarn --version
If you do not have Yarn, follow the instructions here to install it. (I recommend using the Homebrew method)
Node Version Manager (nvm)
nvm is necessary to easily install and switch between versions of node.
To check whether you have nvm run nvm --version
If you do not have nvm, follow the installation instructions here.
NOTE: You will also have to add the following to your ~/.bash_profile
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
Node
If you have Yarn and nvm you will likely have a version of node installed. To check run node --version
To run this project you need to be using node v20.11.1.
Run nvm install v20.11.1
This should install the correct version of node, and begin using it. To verify, run node --version
If it returns a version number other than 20.11.1
, run nvm use v20.11.1
.
Using Node
Future projects may require different versions of node:
• use nvm ls
to view all installed versions of node;
• use nvm install <desiredNodeVersion>
to install the desired version of node;
• use nvm use <installedVersionYouWantToSwitchTo>
;
Running The Project
Once you have everything you need installed, you can clone this repo.
cd
into the project's directory.
Run yarn install
. This will fetch all the dependencies outlined in the package.json
(and the dependencies' dependencies) and add them to a folder named node_modules
.
It will also generate a yarn.lock
file, this is where the versions of the dependencies are locked in.
(If you switch branch you may have to run yarn install
again)
You can now run the project with yarn start
If you have any issues, try rm -rf node_modules
, checking your node version node --version
, and re-installing with yarn install
Deployment
The template-testing-tool branch auto deploys on commit.
To deploy to aws from your machine you must install the AWS Command Line Interface. The instructions can be found here.
You can then use yarn deploy:develop
to deploy to the development s3 bucket.
The following contains out-the-box instructions from Create React App
This project was bootstrapped with Create React App.
Run using node v20.11.1 Run using yarn - not npm
Available Scripts
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 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.
Learn More
You can learn more in the Create React App documentation.
To learn React, check out the React documentation.
Code Splitting
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
Analyzing the Bundle Size
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
Making a Progressive Web App
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
Advanced Configuration
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
Deployment
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
npm run build
fails to minify
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
Publishing storybook package
https://webgphealth.atlassian.net/wiki/spaces/TECH/pages/2104721413/Storybook
First you should update the version number in the package.json file
Next run
yarn build:package
this will delete the /dist folder and use babel to compile modern JS into backwards compatible JS in the /dist folder
Add a .env file in the root of the package. This will be available locally only (it is mentioned in the .gitignore list). In this file you’ll need to add GitHub and NPM personal access tokens. You can get one of those on this page for GitHub. The token will need the repo scope.
For npm, you can create a token at the URL: https://www.npmjs.com/settings//tokens.
You’ll need a token with “Read and Publish” permissions.
Let’s add those tokens to a file called .env in our project:
GH_TOKEN= NPM_TOKEN=
Run npm publish. The reason we use npm here instead of the favoured yarn is because the permissions system is different and npm handles publishing better. If you receive a ENEEDAUTH error, use npm whoami and you may find you're not logged into npm. Use npm login to do so.
Test the build/npm package/build locally
You can move the dist folder from project to project, after building instead of publishing every time. So where you yarn install, go to node modules and swap the dist folder of the package
We keep the same package name econsult-frontend, but we modify the version for npm builds with a -beta. extension for package builds. So for webapp/fe > 1.27.0 and for elite/fe > 1.27.0-beta.0 (we use the npm package version here) https://www.npmjs.com/package/econsult-frontend
yarn deploy:package npm publish
latest - 1.27.0-beta.168
3 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago