Installation Process
- Install node & npm
- Install yarn
- Install packages & dependencies
TripFinder is based on Create React App and Create Next App. It would be better if you can check their website too.There are lot of tricks that can help your app, like API connection, Deployment etc.
https://create-react-app.dev (for hotel cra).
https://nextjs.org (for hotel next).
Installing Node & NPM:
To work with TripFinder
the first thing you need is to have stable Node version install on your system. To make sure you have already Node js installed on your system you may follow the below instructions :-
As Node will make sure you have node and npm commands are available via command line, just run the below command on your terminal.
node -v
npm -v
Note that if you find the npm version less than 5.0.0 you need to update it to the latest version using the below command. you may need to usesudo
to grant permission
npm install npm@latest -g
or
sudo npm install npm@latest -g
Installing YARN:
You will need to Install Yarn for the Fast, Reliable, and Secure Dependency Management. Before you start using Yarn, you'll first need to install it on your system. And to make sure it running on your system with latest version run the below command.
yarn --version
Installing Packages & Dependencies :
This Product is based on monorepo structure. To provide easy access to different item we provide some command line scripts to begin with -
$ yarn
NB: make sure you use yarn for installing packages, dependencies and running script
Run the project in dev mode:
To run all the item at same time :
$ yarn start:all
Which is start development version of every item on different port :
hotel: at localhost:3000
hotel-next: at localhost:3001
etc.
To Run Individual Item:(ex: hotel / hotel-next)
$ yarn start:hotel
$ yarn start:hotel-next
for others scripts just follow this
"scripts": {
"clean": "lerna clean --yes && rimraf node_modules",
"clean:build": "lerna exec -- rimraf \"{.next,dist,out,build,.docz}\"",
"start:all": "lerna run --parallel start",
"start:hotel": "yarn workspace hotel run start",
"start:hotel-next": "yarn workspace hotel-next run dev",
"build:hotel": "yarn workspace hotel run build",
"build:hotel-next": "yarn workspace hotel-next run build",
"serve:hotel": "yarn workspace hotel run serve",
"serve:hotel-next": "yarn workspace hotel-next run serve"
},
Google Map Api Key:
For Hotel version:
First go to .env file, Put your google map api key inside this code,
REACT_APP_GOOGLE_MAP_API_KEY=https://maps.googleapis.com/maps/api/js?v=3.exp&key=YOUR_GOOGLE_MAP_API_KEY&libraries=geometry,drawing,placesyou need to put your google map api key between &key= and &libraries=geometry like this
place your map api key in place of
YOUR_GOOGLE_MAP_API_KEY
For Hotel Next version:
go to next.config.json then change the highlighted code
YOUR_GOOGLE_MAP_API_KEY
with your google map api key