presetter-preset-react v7.1.0
๐๐ป A collection of opinionated configurations for a React project in typescript for presetter
โขโ โQuick Startโ โโขโ โProject Structureโ โโขโ โCustomizationโ โโขโ โScriptsโ โโข
Features
presetter-preset-react is an extension of presetter-preset-web with additional tools to help you to develop a React project with ease via presetter.
- โจ TSX support
- ๐งช @testing-library/react
- ๐ Recommended rules from eslint-plugin-react
Quick Start
FULL DOCUMENTATION IS AVAILABLE HERE
1. Bootstrap your project with presetter-preset-react
On your project root, create a presetter.config.ts
file with the following content:
// presetter.config.ts
import { preset } from 'presetter';
import esm from 'presetter-preset-esm';
import react from 'presetter-preset-react';
export default preset('project name', {
// NOTE
// you don't need to extends presetter-preset-web presets here since they are already included in the react preset
// however, you may need an additional preset like presetter-preset-esm for ESM support and other basic toolings
extends: [esm, react],
override: {
// override the configuration here
},
});
Then, install your project as usual with npm install
or any package manager you prefer.
2. Develop and run life cycle scripts provided by the preset
At this point, all development packages specified in the preset are installed, and now you can try to run some example life cycle scripts (e.g. run prepare).
Project Structure
After installation, your project file structure should resemble the following, or include more configuration files if you also installed other presets.
Implement your business logic under source
and prepare tests under spec
.
The .d.ts
files are handy type definitions for you to import .css
or image files in typescript.
NOTE You will notice there's no additional configuration file on your root folder like other presets such as presetter-preset-esm
.
It's because presetter-preset-react
extends presetter-preset-web
which is a bundle only preset, meaning it only helps you to install the development packages specified in this preset only.
TIPS You can always change the source directory to other (e.g. src) by setting the source
variable in presetter.config.ts
. See the customization section below for more details.
(root)
โโ .git
โโ presetter.config.ts
โโ node_modules
โโ source
โ โโ <folders>
โ โโ index.ts
โ โโ (auxiliary).ts
โโ spec
โ โโ *.spec.ts
โโ types
โ โโ image.d.ts
โ โโ style.d.ts
โ โโ (type).d.ts
โโ eslint.config.ts
โโ package.json
โโ tsconfig.json
Customization
By default, this preset exports a handy configuration set for a React project written in typescript.
You can further customize (either extending or replacing) the configuration by specifying the changes in the config file presetter.config.ts
.
Script Template Summary
run build
: Transpile source code from typescript and replace any mapped pathsrun clean
: Clean up any previously transpiled coderun develop -- <file path>
: Create a service that run the specified file whenever the source has changedrun test
: Run all testsrun watch
: Rerun all tests whenever the source has changerun coverage
: Run all test with coverage reportrun release
: Bump the version and automatically generate a change logrun release -- --prerelease <tag>
: Release with a prerelease tag
7 months ago
8 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago