This project was bootstrapped with [Vite] (https://github.com/vitejs/vite) and modified by TSH team.
To start the development, run:
mkdir new-project
cd new-project/
git clone https://github.com/TheSoftwareHouse/react-starter-boilerplate.git .
sudo rm -r .git
git init
git remote add origin [your empty project repository]
git remote -v
git add .
git commit -m 'initial commit'
git push origin master
npm install
*for e2e Cypress*
cd e2e
npm install
cd ..
cp .env.dist .env
cp .env.e2e.dist ./e2e/.env
*for e2e Playwright*
cd e2e-playwirght
npm install
cp .env.dist .env
npm run test
cd ..
npm run lint:fix
npm run test
npm run e2e:ci
where new-project is your desired folder. This should result in cloning the project, setting up your repository as
origin and pushing the starter as your initial commit. The linter and tests will be run, to confirm that everything
works properly.
For E2E testing we are using one of two solutions: the Cypress framework and the Playwright framework.
The configuration is mostly isolated to the e2e folder (and e2e-playwright), to allow for easy removal when not needed and to avoid conflicts with any other testing libraries, as they tend to pollute the global namespace. We believe that proper e2e testing is extremely valuable, but we also recognize that it's not for everyone and it will probably be one of the most removed or ignored features in the boilerplate versions.
We also propose the second solution - e2e tests using Playwright, therefore the e2e-playwright folder has been created. When starting the project, if automatic tests will be written, you should stick to one solution (Cypress or Playwright) and remove redundant files and code. For example, if you choose Playwright, you should delete the e2e folder, rename e2e-playwright to e2e and remove all commented Cypress config code in CI configuration files.
To get rid of e2e testing simply delete the e2e and e2e-playwright directory, the e2e.dist env file, anything beginning with "e2e" from package.json's scripts field and the step named "e2e" from the bitbucket pipelines configuration.
The repository contains a .env.dist file with a list of all env variables used in the application and a .env.e2e.dist
file with variables used by the e2e framework. To use on local environment copy .env.dist to root folder as .env and
fill any missing variables (cp .env.dist .env), to use e2e testing copy .env.e2e.dist to e2e/ folder, rename to .env
(cp .env.e2e.dist ./e2e/.env) and fill any missing variables.
In the project directory, you can run:
Runs the linter (and fixes fixable issues)
Runs Plop JS used for generating custom hooks and react components.
Runs Cypress E2E tests in a headless mode (the browser window is not visible)
Opens the Cypress UI, allowing to run and watch E2E tests
Builds the app as a CI environment, sets up an html server with npm run serve and runs the E2E tests in a headless
mode. Useful when investigating pipeline failures.
Runs the app in the development mode.
Open http://localhost:3000 to view it in the
browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
Launches the test runner in the interactive watch mode.
See the section about
running tests for more information.
Launches the test runner in the coverage report generation mode.
See
this section for more information.
Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes
the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.