This pull request is trying to merge into changeToGridView-#45, not master.
If you're too lazy to read this, then please at least just follow my instructions at the bottom so I know this stuff is working for everybody. I recommend reading the diffs using the split view.
I wiped away all of our frontend stuff except for our two images and our css font and replaced it with a stupid simple hello world example using react.
Background info : When you type npm run scriptName in the terminal, node will look in the package.json and run the command contained in the value of scripts.scriptName. Weirdly enough, unless you install our npm dependencies globally via npm install -g or add some new paths, you will get command not found errors if you try to run the command directly in the terminal. For example, the babel command will not be found.
Two operations have been added to our deploy process to accomodate react.
The first operation compiles the react code itself (babel-src/index.js) which uses Babel as recommended by the react docs. It can be run manually outside the deploy script via npm run babel (see /package.json:7). It generates a new javascript file inside /src/main/webapp/babel-out which cannot run in the browser without additional processing.
React recommends to use either browserify or webpack in order to package the generated code from babel-out into a single obfuscated js file which can run the the browser. This is the second operation and can be run manually via npm run browserify or npm run browserify-prod to generate this final js file for dev or prod respectively. I chose to use browserify since it's simpler and was pretty easy to add into the project. I don't believe we need anything more sophisticated than this but if ya'll wanna switch to webpack, say it now before it's too late.
I added a temporary option to deploy.sh which lets you put a second argument. Basically if you do sh deploy.sh david it deploys using a slow dev version of react with good dev tools for like bug testing and stuff, and if you do sh deploy.sh david x it deploys with a faster and more lightweight prod version of react. We shall replace this feature soon enough by always using the dev version unless youre doing sh deply.sh prod, I just wanted to make sure the prod thing is working for everyone.
This pull request is trying to merge into
changeToGridView-#45
, notmaster
.If you're too lazy to read this, then please at least just follow my instructions at the bottom so I know this stuff is working for everybody. I recommend reading the diffs using the split view.
Hello
react.js
I wiped away all of our frontend stuff except for our two images and our css font and replaced it with a stupid simple hello world example using react.
Background info : When you type
npm run scriptName
in the terminal,node
will look in thepackage.json
and run the command contained in the value ofscripts.scriptName
. Weirdly enough, unless you install our npm dependencies globally vianpm install -g
or add some new paths, you will getcommand not found
errors if you try to run the command directly in the terminal. For example, thebabel
command will not be found.Two operations have been added to our deploy process to accomodate react.
The first operation compiles the react code itself (
babel-src/index.js
) which uses Babel as recommended by the react docs. It can be run manually outside the deploy script vianpm run babel
(see/package.json:7
). It generates a new javascript file inside/src/main/webapp/babel-out
which cannot run in the browser without additional processing.React recommends to use either
browserify
orwebpack
in order to package the generated code frombabel-out
into a single obfuscated js file which can run the the browser. This is the second operation and can be run manually vianpm run browserify
ornpm run browserify-prod
to generate this final js file for dev or prod respectively. I chose to usebrowserify
since it's simpler and was pretty easy to add into the project. I don't believe we need anything more sophisticated than this but if ya'll wanna switch towebpack
, say it now before it's too late.I added a temporary option to
deploy.sh
which lets you put a second argument. Basically if you dosh deploy.sh david
it deploys using a slow dev version of react with good dev tools for like bug testing and stuff, and if you dosh deploy.sh david x
it deploys with a faster and more lightweight prod version of react. We shall replace this feature soon enough by always using the dev version unless youre doingsh deply.sh prod
, I just wanted to make sure the prod thing is working for everyone.Please try it yourself
git pull
git checkout reactHelloWorld-#45
npm install
sh deploy.sh name
- check with React Developper Tools that a development version of React is being used onindex.html
sh deploy.sh name x
- check that a production version of React is being used