4.7.2 โ€ข Published 2 months ago

presetter-preset-react v4.7.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 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 opinionated preset for you to setup a React project in a fraction of time you usually take 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-esm & presetter-preset-react
npx presetter use presetter-preset presetter-preset-react

That's. One command and you're set.

  1. 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 with more configuration files if you also installed other presets such as presetter-preset-esm.

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.

TIPS You can always change the source directory to other (e.g. src) by setting the source variable in .presetterrc.json. See the customization section below for more details.

(root)
 โ”œโ”€ .eslintrc.json
 โ”œโ”€ .git
 โ”œโ”€ .presetterrc.json
 โ”œโ”€ node_modules
 โ”œโ”€ source
 โ”‚   โ”œโ”€ <folders>
 โ”‚   โ”œโ”€ index.ts
 โ”‚   โ”œโ”€ (auxiliary).ts
 โ”œโ”€ spec
 โ”‚   โ”œโ”€ *.spec.ts
 โ”œโ”€ types
 โ”‚   โ”œโ”€ image.d.ts
 โ”‚   โ”œโ”€ style.d.ts
 โ”‚   โ”œโ”€ (type).d.ts
 โ”œโ”€ package.json
 โ””โ”€ tsconfig.json

Customization

By default, this preset exports a handy configuration set for a React project written in typescript. But you can further customize (either extending or replacing) the configuration by specifying the change in the config file (.presetterrc or .presetterrc.json).

These settings are available in the config field in the config file. For directories, the setting is specified in the variable field.

The structure of .presetterrc should follow the interface below:

interface PresetterRC {
  /** name(s) of the preset e.g. presetter-preset-react */
  name: string | string[];
  /** additional configuration passed to the preset for generating the configuration files */
  config?: {
    //  โ”Œโ”€ configuration for other tools via other presets (e.g. presetter-preset-esm)
    // ...

    /** configuration to be merged with .eslintrc */
    eslint?: Record<string, unknown>;
    /** configuration to be merged with tsconfig.json */
    tsconfig?: Record<string, unknown>;
    /** variables to be substituted in templates */
    variable?: {
      /** the directory containing all source code (default: source) */
      source?: string;
      /** the directory containing all typing files (default: types) */
      types?: string;
      /** the directory containing all output tile (default: source) */
      output?: string;
    };
  };
}
4.7.2

2 months ago

4.7.1

2 months ago

4.7.0

3 months ago

4.6.0

4 months ago

4.5.0

4 months ago

4.4.1

7 months ago

4.4.0

7 months ago

4.3.1

7 months ago

4.4.2

7 months ago

4.3.0

8 months ago

4.2.0

8 months ago

4.1.0

10 months ago

4.0.1

11 months ago

4.0.0

11 months ago

4.1.2

10 months ago

4.1.1

10 months ago

3.5.3

1 year ago

3.5.2

1 year ago

3.5.1

1 year ago

3.5.5

1 year ago

3.5.4

1 year ago

3.5.0

2 years ago

3.4.0

2 years ago

3.3.0

2 years ago

3.2.0

2 years ago

3.4.1

2 years ago

3.1.1

2 years ago

3.1.0

2 years ago

3.0.3

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago