7.1.0 โ€ข Published 6 months ago

presetter-preset-react v7.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Logo

๐Ÿ„๐Ÿป A collection of opinionated configurations for a React project in typescript for presetter

โ€ขโ€ƒ โ€ƒQuick Startโ€ƒ โ€ƒโ€ขโ€ƒ โ€ƒProject Structureโ€ƒ โ€ƒโ€ขโ€ƒ โ€ƒCustomizationโ€ƒ โ€ƒโ€ขโ€ƒ โ€ƒScriptsโ€ƒ โ€ƒโ€ข

npm build maintainability coverage security dependencies license

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).

Demo

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 paths
  • run clean: Clean up any previously transpiled code
  • run develop -- <file path>: Create a service that run the specified file whenever the source has changed
  • run test: Run all tests
  • run watch: Rerun all tests whenever the source has change
  • run coverage: Run all test with coverage report
  • run release: Bump the version and automatically generate a change log
  • run release -- --prerelease <tag>: Release with a prerelease tag
6.1.0

7 months ago

6.0.0

8 months ago

6.2.0

6 months ago

7.0.0

6 months ago

7.0.2

6 months ago

7.1.0

6 months ago

7.0.1

6 months ago

5.0.0

12 months ago

4.7.2

1 year ago

4.7.1

1 year ago

4.7.0

1 year ago

4.6.0

1 year ago

4.5.0

2 years ago

4.4.1

2 years ago

4.4.0

2 years ago

4.3.1

2 years ago

4.4.2

2 years ago

4.3.0

2 years ago

4.2.0

2 years ago

4.1.0

2 years ago

4.0.1

2 years ago

4.0.0

2 years ago

4.1.2

2 years ago

4.1.1

2 years ago

3.5.3

2 years ago

3.5.2

2 years ago

3.5.1

2 years ago

3.5.5

2 years ago

3.5.4

2 years ago

3.5.0

3 years ago

3.4.0

3 years ago

3.3.0

3 years ago

3.2.0

3 years ago

3.4.1

3 years ago

3.1.1

4 years ago

3.1.0

4 years ago

3.0.3

4 years ago

3.0.2

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago