Coder Social home page Coder Social logo

idesigncode / template-esm-react Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 276 KB

Quickly setup ESM React repositories with preconfigured functionality.

License: MIT License

Shell 0.53% JavaScript 92.85% SCSS 1.20% MDX 5.42%
babel browserslist cleanup coverage-report eslint esm husky interaction-testing lint-staged mjs

template-esm-react's Introduction

template-esm-react

Quickly setup ESM React repositories with preconfigured functionality.

Installation

  1. Run npm init and answer the required prompts
  2. Run npm install

Usage

Remove/replace the sample source files in src & stories with your own.

When adding source files, remember to add the build output file details to the files & exports fields of package.json and .gitignore.

๐Ÿ› ๏ธ Build

npm run prepare runs all preparation clean & build scripts:

  • npm run prepare:clean removes any files as specified in the files fields of package.json
  • npm run prepare:css compiles SCSS files from src into CSS files in the root directory with PostCSS & Sass
  • npm run prepare:js compiles JavaScript source files into the root directory files with Babel

Note: the "prepare" Life Cycle Script runs automatically during publish, pack and on local install.

๐Ÿš€ Deployments

The GitHub action release.yml is used to automatically deploy a release to the NPM package registry. The action requires the NPM_TOKEN secrets to be set.

๐Ÿ“• Storybook
  • npm run storybook will run Storybook for local use
  • npm run storybook:build will build Storybook to ./storybook-static for deployment use
๐Ÿงช Testing

Code linting tests

The GitHub action node-tests.yml is used to run the code linting tests on pull requests and commit pushes into the main branch. The action requires the NPM_TOKEN secrets to be set.

npm run test runs the code linting tests:

  • npm run test:eslint runs the ESLint JavaScript linting checks
  • npm run test:prettier runs the Prettier code formatting checks

Storybook CI tests

The GitHub action storybook-tests.yml is used to run the Storybook CI tests on pull requests and commit pushes into the main branch. The action requires the following secrets to be set:

  • NETLIFY_SITE_ID
  • NETLIFY_TOKEN
  • NPM_TOKEN

These Storybook CI tests can also be run while running Storybook locally:

๐Ÿ•ต๏ธ Code linting

Husky & lint-staged are used to automatically run code linting checks on each file of a commit.

You can manually run linting error fixes with:

  • npm run eslint fixes JavaScript linting issues with ESLint
  • npm run prettier fixes code formatting issues with Prettier

Custom dev tooling

npm init
  • Automatically resets name with --scope arg (if given) and directory name (lowercased)
  • Automatically resets version to 0.0.0
  • Automatically sets repository, bugs & homepage from .git/config
  • Prompts user for description (required)
  • Prompts user for keywords, license & author (optional)
postprepare

npm run postprepare runs the following formatting:

  • Updates package.json:
    • Formats repository & bugs to shorthand urls
    • Sorts the order of keys - see KEYS_ORDER
    • Sorts the order of sub-keys alphabetically
    • Sorts the order of dependencies, devDependencies & peerDependencies fields to the end
  • Updates the README.md:
    • Uses the package name for the main title
    • Uses the package description for the first paragraph after the main title
    • Keeps anything from the second title and below

Note: the "postprepare" Life Cycle Script runs automatically on install.

template-esm-react's People

Contributors

idesigncode avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.