Sample of React app illustrating technical aspect of Flagship - React SDK
-
Node.js: version 6.0.0 or later.
-
Npm: version 5.2.0 or later.
- Install the node module:
examples/react-dev-demo$ npm install
- Start the project:
examples/react-dev-demo$ npm start
Two possible ways exist.
-
You need to create a local package of
@flagship.io/react-sdk:-
1 - At the root level (=
PATH/TO/flagship-react-sdk), run:npm i && npm run build && npm pack -
2 - You supposed to have a
.tgzfile freshly created, with following nameflagship.io-react-sdk-x.x.x.tgzwherex.x.xcorresponding to last version of the Flagship React SDK. -
3 - Move this
.tgzfile to the example that you want to run locally, in our casereact-dev-demo:mv ./flagship.io-react-sdk-x.x.x.tgz ./examples/react-dev-demo -
4 - [Skip this step if first time following 1st option steps] As npm keeps some cache of node modules, we must rename the
.tgzfile so npm will consider our package as a new one:mv ./flagship.io-react-sdk-x.x.x.tgz ./flagship.io-react-sdk-x.x.x_UNIQUE_VALUE.tgzand also delete previous version:
rm -r ./node_modules/@flagship.io && rm ./package-lock.json -
6 - Edit the
package.jsonto consider the.tgzfor Flagship React SDK, it should look like this:"@flagship.io/js-sdk": "flagship.io-react-sdk-x.x.x_UNIQUE_VALUE.tgz", -
7 - Install the modules:
npm i -
8 - Start the project, it's ready:
npm run start
-
-
You need to link
@flagship.io/react-sdk:-
1 - At the root level (=
PATH/TO/flagship-react-sdk), run:flagship-react-sdk$ npm link -
2 - Then, move to
examples/react-dev-demo:examples/react-dev-demo$ npm link PATH/TO/flagship-react-sdk -
3 - Start the project like this:
rm -fr ./node_modules/react && npm start
-
-
Unzip the file
.zipfile -
Open a terminal, and go to the path where you unzipped. (We'll assume, you unzipped in
Downloadsfolder) -
Now follow this path by running :
cd NAME_OF_THE_UNZIPPED_FOLDER/examples/react-dev-demo -
Run :
npm install -
Run :
npm start -
The QA app is now running locally on your computer, you're ready !
