diff --git a/Procfile b/Procfile.dev similarity index 100% rename from Procfile rename to Procfile.dev diff --git a/Procfile.start b/Procfile.start new file mode 100644 index 000000000000..a5108c2c7b44 --- /dev/null +++ b/Procfile.start @@ -0,0 +1,2 @@ +server: yarn start:server +web: yarn start:client diff --git a/README.md b/README.md index 41c0ae9d070b..bde0ef404d95 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,18 @@ To run Yari locally, you'll first need to install [git](https://git-scm.com/), [ git clone https://github.com/mdn/yari.git cd yari yarn - yarn start + yarn dev open http://localhost:3000 If you prefer, you can fork the repo first and do the `git clone` with _your_ fork instead of the `mdn` one. +The `yarn dev` command will compile and prepare certain files. This always +takes a little extra time. If you prefer you can use `yarn start` which +will re-use any previously compiled files which is "riskier" but faster. +The `yarn start` command will also start a server which doesn't automatically +reload when its source code files change, so use with caution. + ### How to stay up-to-date Periodically, the code and the content changes. Make sure you're staying @@ -25,7 +31,7 @@ up-to-date with these commands: git pull origin master yarn - yarn start + yarn dev These are also good steps to always take when you embark on making a change. Then, the only extra command needed is `git checkout -b my-new-branch` diff --git a/package.json b/package.json index d1de2f04a440..7d1ff8bcdf39 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,10 @@ "build:ssr": "cd ssr && webpack --config webpack.config.js --mode=production", "prepare-build": "yarn build:client && yarn build:ssr", "build": "cd build && cross-env NODE_ENV=production node cli.js", - "start": "yarn build:client && yarn build:ssr && nf start", + "start": "(test -f client/build/index.html || yarn build:client) && (test -f ssr/dist/main.js || yarn build:ssr) && nf -j Procfile.start start", + "dev": "yarn build:client && yarn build:ssr && nf -j Procfile.dev start", "start:client": "cd client && cross-env BROWSER=none PORT=3000 react-scripts start", + "start:server": "node server", "start:dev-server": "nodemon server --watch server --watch build --watch content --watch kumascript", "start:static-server": "cross-env ENV_FILE=testing/.env node server/static.js", "filecheck": "cd filecheck && node cli.js"