A monorepo containing exercises, challenges, demos and starters for the neue fische web bootcamps. All of the exercises are designed to work locally.
- web exercises
A session is a collection of exercises that are used in a specific bootcamp session.
An exercise is any form of exercise, challenge, demo or starter that is used in the web bootcamps.
The folder structure is as follows:
sessions/<session-name>/<exercise-name>
Warning
Avoid nesting exercises in folders below this level. It makes it harder to discover exercises and to update them using tooling.
A template is a folder from which a new exercise can be created but than can also be used as a starter for a new project outside of this repository.
The folder structure is as follows:
templates/<template-name>
Warning
Never edit templates directly. They are created from recipes.
A recipe is used to create (cook) templates. It contains instructions and files that are used by the cook
script. If you want to change a template, you have to change its recipe instead.
The folder structure is as follows:
recipes/<recipe-name>
Read more about recipes to learn how to create and edit them.
The branches in this repository follow the following naming convention:
<session-name>_<exercise-name>
Note
You can do multiple exercises in one branch (e.g.demo-start
anddemo-end
) if it makes sense. Pick a unique branch like<session-name>_demo
. Note that thecreate
script will not be able to automatically detect the correct exercise name in that case.
To create a new exercise run the following command:
npm run create
Note
Make sure to run this command from the root of the repository and to runnpm i
before.
This will ask you for the session name, exercise name and exercise type.
Note
If you follow the branch naming convention (session-name_exercise-name
), the create script will automatically detect the session and exercise name from the branch name.
This repository contains templates for most types of exercises.
To make it less cumbersome to create a PR for a new exercise once you're done, you can use the following command that copies all the necessary information to your clipboard. (You have to select the session and exercise folder.)
npm run get-pr
You can obtain a copyable markdown snippet for an exercise by running the following command:
npm run get
Note
You usally don't need this command as the markdown for the curriculum is already included in the PR markdown.
The following types of templates are available.
created via recipes/empty
A template that does not contain any code.
π Create a new exercise inside this repository
npm run create
β Select type Empty
β Use this template as a starter
created via recipes/html-css-js
A template that contains HTML, CSS and JavaScript files with jest support.
π Create a new exercise inside this repository
npm run create
β Select type HTML, CSS and JavaScript (with Jest support)
β Use this template as a starter
created via recipes/html-css
A template that contains HTML and CSS files.
π Create a new exercise inside this repository
npm run create
β Select type HTML and CSS
β Use this template as a starter
created via recipes/js
A template that contains only JavaScript files with jest support.
π Create a new exercise inside this repository
npm run create
β Select type JavaScript (with Jest support)
β Use this template as a starter
created via recipes/react-minimal
A template that contains a minimal React app. It uses react-scripts
but only contains the bare minimum files from Create React App.
π Create a new exercise inside this repository
npm run create
β Select type Minimal React
β Use this template as a starter
created via recipes/react
A template from executing create-react-app
to create a new React app.[^1]
π Create a new exercise inside this repository
npm run create
β Select type Create React App
β Use this template as a starter
created via recipes/next
A template from executing npx create-next-app
to create a new Next.js app. Our variant also includes Styled Components, Jest and SVGR.
π Create a new exercise inside this repository
npm run create
β Select type Next.js (incl. Styled Components and Jest)
β Use this template as a starter
created via recipes/node-server
A template that contains a Node.js server with Jest support.
π Create a new exercise inside this repository
npm run create
β Select type Node.js Server (with Jest support)
β Use this template as a starter
All exercises must at least contain:
- A
README.md
file with title and a description how to solve the exercise - A
package.json
file with thename
field that follows the naming convention (session-name_exercise-name
)
All exercises must be reviewed before they are merged into the main
branch. Create a pull request on GitHub and add the needs review
label.
Exercises must be reviewed by at least one neue fische web coach.
Note
Exercises deliberately do not have to have passing tests to be merged. It is also fine to merge exercises with linting errors. Failing tests and linting errors can be part of the exercise itself.
There a two ways to access the exercises or templates:
We are using ghcd
(GitHub Clone Directory) which is a tool that "clones" (or rather downloads) a subdirectory of a GitHub repository. You can share the command containing the URL to the exercise folder on GitHub.
npx ghcd@latest neuefische/web-exercises/tree/main/sessions/js-array-methods/map
Note
While reviewing an exercise, you can share the command pointing to the respective branch. This way exercises can be reviewed locally before they are merged into the main branch.
Warning
ghcd
does not support branch names containing slashes.
You can append the -i
flag to the command to let ghcd
initialize a new git repository in the "cloned" folder. This is recommended for all exercises in from the curriculum after git has been introduced.
To run commands in a workspace of the monorepo (an exercise folder) on your local machine:
- make sure you have run
npm i
in the root of this repository cd
into the folder (cd sessions/session-name/exercise-name
)- run the script of you choice (
npm run test
)