An application/tutorial/workshop based on rock, paper, scissors.
Branches:
main
is at the start of the workshop.- Run
make install
thenmake test
and finallymake run
. - Alternatively, reference the setup instructions below to recreate this from scratch.
- Run
solution
contains a worked solution to the workshop exercises
The main
branch is already setup. Skip this section unless you'd like to start yourself from scratch.
mkdir rps
cd rps
npm init -y # accept defaults
npm install --save-dev @babel/core @babel/preset-env babel-jest jest
babel.config.json
{
"presets": [
"@babel/preset-env"
]
}
Add this topackage.json
{
"scripts": {
"test": "node_modules/.bin/jest"
}
}
Test this with
npm test # Should see one passing test
mkdir web
cd web
npm init -y # accept defaults
npm install --save-dev @babel/core @babel/preset-env @babel/preset-react babel-loader babel-jest jest webpack webpack-cli
npm install --save ../rps react react-dom react-app-polyfill
Add this topackage.json
{
"scripts": {
"start": "NODE_ENV=development webpack --mode development --watch",
"test": "node_modules/.bin/jest"
}
}
See the contents of these files:
- The babel config
- The webpack config
- The jest config
- The index.html
- The index page
Next you can run and open the file in the browser:
npm start
open index.html
There is more information about writing the first wiring tests for each module.