Skip to content

Instantly share code, notes, and snippets.

@CyriacBr
Created June 15, 2020 09:44
Show Gist options
  • Select an option

  • Save CyriacBr/0587edeef5abbc7d4feeefbddd2622c5 to your computer and use it in GitHub Desktop.

Select an option

Save CyriacBr/0587edeef5abbc7d4feeefbddd2622c5 to your computer and use it in GitHub Desktop.
React + TS Library Config

React-Lib

CI npm bundle size

Documentation

Lorem ipsum.

Features

  • Lorem
  • Ipsum

Installation

npm i [react-lib]
# or
yarn add [react-lib]

Usage

#!/usr/bin/env sh
# abort on errors
set -e
# build
yarn docz:build
# navigate into the build output directory
cd .docz/dist
# if you are deploying to a custom domain
# echo 'www.example.com' > CNAME
git init
git remote add origin https://github.com/CyriacBr/[react-lib].git
git checkout -b gh-pages
git add -A
git commit -m 'deploy'
# if you are deploying to https://<USERNAME>.github.io
# git push -f git@github.com:<USERNAME>/<USERNAME>.github.io.git master
# if you are deploying to https://<USERNAME>.github.io/<REPO>
git push origin gh-pages -f
cd -
export default {
typescript: true,
files: 'docs/**/*.{md,markdown,mdx}',
base: '/[react-lib]/',
};
name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Begin CI...
uses: actions/checkout@v2
- name: Use Node 12
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Use cached node_modules
uses: actions/cache@v1
with:
path: node_modules
key: nodeModules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
nodeModules-
- name: Install dependencies
run: yarn install --frozen-lockfile
env:
CI: true
- name: Lint
run: yarn lint
env:
CI: true
- name: Test
run: yarn test:ci
env:
CI: true
- name: Build
run: yarn build
env:
CI: true
{
"version": "1.0.0",
"license": "MIT",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"files": [
"dist",
"src"
],
"engines": {
"node": ">=10"
},
"scripts": {
"start": "tsdx watch",
"build": "tsdx build",
"test": "tsdx test --passWithNoTests && yarn size",
"lint": "tsdx lint",
"docz:dev": "docz dev",
"docz:build": "docz build",
"docz:serve": "docz build && docz serve",
"size": "size-limit",
"release:first": "standard-version --first-release",
"release": "standard-version",
"release:publish": "git push --follow-tags origin develop && yarn publish --access=public",
"release:docs": "./docs-deploy.sh",
"prepublish": "yarn build && pkg-ok",
"test:ci": "tsdx test --passWithNoTests --ci --coverage --maxWorkers=2 && yarn size"
},
"peerDependencies": {
"react": ">=16"
},
"name": "[react-lib]",
"author": "CyriacBr",
"module": "dist/[react-lib].esm.js",
"keywords": [
"react",
"typescript",
"split",
"text",
"wrap",
"animation",
"framer",
"motion"
],
"homepage": "https://github.com/CyriacBr/[react-lib]",
"repository": {
"url": "https://github.com/CyriacBr/[react-lib].git"
},
"devDependencies": {
"@commitlint/cli": "^8.3.4",
"@commitlint/config-conventional": "^8.3.4",
"@size-limit/preset-small-lib": "^4.5.0",
"@types/enzyme": "^3.10.5",
"@types/enzyme-adapter-react-16": "^1.0.6",
"@types/react": "^16.9.35",
"@types/react-dom": "^16.9.8",
"@typescript-eslint/eslint-plugin": "^2.16.0",
"@typescript-eslint/parser": "^2.16.0",
"docz": "^2.3.1",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.9.0",
"eslint-plugin-import": "^2.20.0",
"eslint-plugin-jest": "^23.6.0",
"eslint-plugin-jest-formatting": "^1.2.0",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.20.0",
"husky": "^4.2.5",
"lint-staged": "^10.2.10",
"pkg-ok": "^2.3.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"size-limit": "^4.5.0",
"standard-version": "^8.0.0",
"tsdx": "^0.13.2",
"tslib": "^2.0.0",
"typescript": "^3.9.3"
},
"resolutions": {
"react-docgen-typescript": "latest",
"gatsby": "2.23.2"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"pre-push": "git diff HEAD --quiet && yarn test"
}
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"lint-staged": {
"**/*.{js,jsx,ts,tsx}": [
"eslint --fix"
]
},
"eslintConfig": {
"env": {
"browser": true,
"es6": true,
"node": true,
"jest/globals": true
},
"extends": [
"eslint:recommended",
"plugin:prettier/recommended",
"plugin:react/recommended",
"plugin:jest-formatting/recommended"
],
"ignorePatterns": [
"node_modules/",
"docs/"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"jest"
],
"rules": {
"no-unused-vars": "off",
"react/prop-types": "off"
}
},
"prettier": {
"printWidth": 80,
"semi": true,
"singleQuote": true,
"trailingComma": "es5"
},
"jest": {
"setupFilesAfterEnv": [
"<rootDir>test/setup.ts"
]
},
"size-limit": [
{
"limit": "1.5 KB",
"path": "dist/[react-lib].cjs.production.min.js"
}
]
}
{
"include": ["src", "types"],
"compilerOptions": {
"module": "esnext",
"lib": ["dom", "esnext"],
"importHelpers": true,
"declaration": true,
"sourceMap": true,
"rootDir": "./src",
"strict": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"moduleResolution": "node",
"baseUrl": "./",
"paths": {
"*": ["src/*", "node_modules/*"]
},
"jsx": "react",
"esModuleInterop": true,
"downlevelIteration": true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment