@simonrelet/react-libraries
Configuration and scripts for React libraries.
Last updated 4 months ago by simonrelet .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @simonrelet/react-libraries 
SYNC missed versions from official npm registry.

@simonrelet/react-libraries

npm version latest npm version next

Configuration and scripts for React libraries.

⚠️ Warning: The current master can represent unreleased features. See lastest release.

Installation

npm

npm install --save-dev @simonrelet/react-libraries

yarn

yarn add @simonrelet/react-libraries -D

Scripts

build

Build the library JavaScript and styles.

Usage:

react-libraries build [options]

Options:

  • -i, --ignore=pattern: Glob pattern to ignore from JavaScript build. The files ignored by default are:
    • **/*.spec.js
    • **/*.test.js
    • **/*.stories.js
    • **/__tests__/**
    • **/__mocks__/**
    • src/setupTests.js
  • -c, --copy=pattern: Glob pattern to copy to the output folder.
  • -s, --sass=entryFile: The SASS entry point, src/index.scss by default.
  • -w, --watch: Watch the files and rebuild in case of changes.

In order to build in CommonJS the entry package.json#main must point to the output folder. Ex: "main": "build/cjs".

In order to build in ES modules the entry package.json#module must point to the output folder. Ex: "module": "build/es".

In order to build SASS styles the entry package.json#style must point to the output file. Ex: "style": "build/my-lib.css".

Examples:

react-libraries build
react-libraries build --watch
react-libraries build --copy "src/**/*.ts" --copy="src/_mixins.scss"
react-libraries build -s "src/main.scss"
react-libraries build -i "src/**/*.doc.js" --ignore "src/renderTests.js"

bump-version

Update the new version number in the project.

Usage:

react-libraries bump-version [options] <new-verison>

Options:

  • -r, --readme=templatePath: Path of the template file to use, README-template.md by default.
  • --skip-check: Allow version numbers lower than the current one.

The files that will be updated are:

  • package.json: The version field is updated.
  • package-lock.json (if it exists): The version field is updated.
  • CHANGELOG.md (if it exists): The "Unreleased" section is renamed to "<new-version> (date)".
  • README.md (if the template file exists): See the readme script.

Examples:

react-libraries bump-version 2.3.0
react-libraries bump-version -t "template-README.md" 5.0.0-alpha.2

clean

Clean the project.

Usage:

react-libraries clean [folders]

The folders removed by default are:

  • build/
  • build-storybook/
  • coverage/

Examples:

react-libraries clean
react-libraries clean .docz .tmp

readme

Generate a README.md file from a template.

Usage:

react-libraries readme [options]

Options:

  • -t, --template=templatePath: Path of the template file to use, README-template.md by default.

Examples:

react-libraries readme
react-libraries readme --template="template-README.md"

README template

The README.md file can be generated from a template file allowing you to inject values from your package.json. You can use the syntax {{path}} where path is any valid object path in package.json. An injection will be skipped if path isn't found in package.json or if the path is prefixed with a ! ({{!path}}). In which case the ! will be removed from the output.

Example:

package.json

{
  "name": "my-lib",
  "description": "Library of things.",
  "version": "1.0.0",
  "unpkg": "build/umd/my-lib.production.min.js",
  "unpkg-dev": "build/umd/my-lib.development.js",
  "repository": {
    "type": "git",
    "url": "https://github.com/me/my-lib"
  }
}

README-template.md

# {{name}}

{{description}}

## Installation

### npm

```sh
npm install --save {{name}}
```

### yarn

```sh
yarn add {{name}}
```

### UMD

- Production: https://unpkg.com/{{name}}@{{version}} or https://unpkg.com/{{name}}@{{version}}/{{unpkg}}
- Development: https://unpkg.com/{{name}}@{{version}}/{{unpkg-dev}}

## Documentation

The documentation can be found [here]({{repository.url}}/tree/{{version}}/docs).

README.md

# my-lib

Library of things.

## Installation

### npm

```sh
npm install --save my-lib
```

### yarn

```sh
yarn add my-lib
```

### UMD

- Production: https://unpkg.com/my-lib@1.0.0 or https://unpkg.com/my-lib@1.0.0/build/umd/my-lib.production.min.js
- Development: https://unpkg.com/my-lib@1.0.0/build/umd/my-lib.development.js

## Documentation

The documentation can be found [here](https://github.com/me/my-lib/tree/1.0.0/docs).

test

Launches the test with Jest.

Usage:

react-libraries test [options]

Options:

  • --coverage: Compute the coverage.

The default Jest coverage configuration can be overridden by adding any of the following supported keys to a Jest config in your package.json.

Supported overrides:

Example of package.json:

{
  "name": "my-lib",
  "jest": {
    "collectCoverageFrom": [
      "src/**/*.{js,jsx}",
      "!src/**/*.stories.js",
      "!src/**/*.doc.js",
      "!src/**/index.js"
    ],
    "coverageThreshold": {
      "global": {
        "branches": 90,
        "functions": 90,
        "lines": 90,
        "statements": 90
      }
    },
    "coverageReporters": ["text"],
    "snapshotSerializers": ["my-serializer-module"]
  }
}

Examples:

react-libraries test
react-libraries test --coverage
env CI=true react-libraries test

Current Tags

  • 1.0.0                                ...           latest (4 months ago)
  • 1.0.0-alpha.6                                ...           next (6 months ago)

37 Versions

  • 1.0.0                                ...           4 months ago
  • 1.0.0-alpha.6                                ...           6 months ago
  • 1.0.0-alpha.5                                ...           6 months ago
  • 1.0.0-alpha.4                                ...           6 months ago
  • 1.0.0-alpha.3                                ...           6 months ago
  • 1.0.0-alpha.2                                ...           6 months ago
  • 1.0.0-alpha.1                                ...           6 months ago
  • 0.17.0                                ...           9 months ago
  • 0.16.0                                ...           9 months ago
  • 0.16.0-6248375                                ...           9 months ago
  • 0.15.0                                ...           10 months ago
  • 0.14.0                                ...           a year ago
  • 0.14.0-6150b47                                ...           a year ago
  • 0.14.0-c18f756                                ...           a year ago
  • 0.14.0-16246b4                                ...           a year ago
  • 0.14.0-01c1c3d                                ...           a year ago
  • 0.14.0-00ba223                                ...           a year ago
  • 0.14.0-c1b06dc                                ...           a year ago
  • 0.13.1                                ...           a year ago
  • 0.14.0-ribpd                                ...           a year ago
  • 0.14.0-dlehf                                ...           a year ago
  • 0.14.0-dhakj                                ...           a year ago
  • 0.14.0-test                                ...           a year ago
  • 0.13.0                                ...           a year ago
  • 0.12.1                                ...           a year ago
  • 0.12.0                                ...           a year ago
  • 0.11.0                                ...           a year ago
  • 0.10.0                                ...           a year ago
  • 0.9.0                                ...           a year ago
  • 0.8.0                                ...           a year ago
  • 0.7.0                                ...           a year ago
  • 0.6.0                                ...           a year ago
  • 0.5.0                                ...           a year ago
  • 0.4.0                                ...           a year ago
  • 0.3.0                                ...           a year ago
  • 0.2.0                                ...           a year ago
  • 0.1.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 115
Dev Dependencies (9)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |