Skip to content

Latest commit

 

History

History
32 lines (18 loc) · 1.64 KB

22-05-2019-gh-pages-demo-page.md

File metadata and controls

32 lines (18 loc) · 1.64 KB

ghpages demo page - draft

npm run deploy:ghpages in npm scripts deploys a demo build of the React client onto the github pages branch.

"deploy:ghpages": "rimraf build && cross-env REACT_APP_NODE_ENV=demo npm run build && gh-pages -d build"

In terminal gh-pages -d build pushes build folder in github pages branch.

Uses cross-env when building React to pass ENV - as it's compatible with windows dev environment as well.

##cross-env

cross-env (mentioned in yarn workspaces)

Run scripts that set and use environment variables across platforms

Most Windows command prompts will choke when you set environment variables with NODE_ENV=production like that. (The exception is Bash on Windows, which uses native Bash.) Similarly, there's a difference in how windows and POSIX commands utilize environment variables. With POSIX, you use: $ENV_VAR and on windows you use %ENV_VAR%.

cross-env makes it so you can have a single command without worrying about setting or using the environment variable properly for the platform. Just set it like you would if it's running on a POSIX system, and cross-env will take care of setting it properly.

see their README for more info

## Links