Skip to content

Commit

Permalink
chore: add lundle
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredLunde committed Jul 20, 2020
1 parent a83d4ad commit 998b853
Show file tree
Hide file tree
Showing 11 changed files with 4,142 additions and 1,809 deletions.
5 changes: 0 additions & 5 deletions .eslintignore

This file was deleted.

59 changes: 0 additions & 59 deletions .eslintrc

This file was deleted.

2 changes: 0 additions & 2 deletions .prettierignore

This file was deleted.

7 changes: 0 additions & 7 deletions .prettierrc

This file was deleted.

459 changes: 352 additions & 107 deletions README.md

Large diffs are not rendered by default.

28 changes: 1 addition & 27 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,27 +1 @@
module.exports = (api) => {
const module = api.env('module')
const esm = api.env('esm')
const presetEnv = [
'@lunde/es',
{
env: {
modules: esm || module ? false : 'commonjs',
targets: module
? {
browsers: '> 2%',
}
: {
node: esm ? '12' : '10',
},
},
restSpread: false,
devExpression: false,
objectAssign: false,
},
]

return {
presets: [['@babel/preset-react', {useSpread: true}], presetEnv],
plugins: ['optimize-react', 'annotate-pure-calls'],
}
}
module.exports = require('lundle').babelConfig('test', {react: true})
26 changes: 0 additions & 26 deletions jest.config.js

This file was deleted.

111 changes: 79 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"bugs": "https://github.com/accessible-ui/drawer/issues",
"author": "Jared Lunde <jared.lunde@gmail.com> (https://jaredLunde.com)",
"license": "MIT",
"description": "An accessible and versatile drawer component for React",
"description": "🅰 An accessible and versatile drawer component for React",
"keywords": [
"react",
"react component",
Expand All @@ -24,85 +24,132 @@
],
"main": "dist/main/index.js",
"module": "dist/module/index.js",
"unpkg": "dist/umd/drawer.js",
"source": "src/index.tsx",
"types": "types/index.d.ts",
"files": [
"/dist",
"/src",
"/types"
],
"exports": {
".": {
"browser": "./dist/module/index.js",
"import": "./dist/esm/index.mjs",
"require": "./dist/main/index.js",
"umd": "./dist/umd/drawer.js",
"source": "./src/index.tsx",
"types": "./types/index.d.ts",
"default": "./dist/main/index.js"
},
"./package.json": "./package.json",
"./": "./"
},
"files": [
"/dist",
"/src",
"/types"
],
"sideEffects": false,
"scripts": {
"build": "npm run build-esm && npm run build-main && npm run build-module && npm run build-types",
"build-esm": "npm run compile -- -d dist/esm --env-name esm --out-file-extension .mjs",
"build-main": "npm run compile -- -d dist/main --env-name main",
"build-module": "npm run compile -- -d dist/module --env-name module",
"build-types": "tsc -p tsconfig.json -d --outDir types --emitDeclarationOnly",
"check-types": "tsc --noEmit -p tsconfig.json",
"compile": "babel src -x .ts,.tsx --ignore \"**/*.test.ts\",\"**/*.test.tsx\" --delete-dir-on-start",
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,md,yml,json,eslintrc,prettierrc}\"",
"build": "lundle build",
"check-types": "lundle check-types",
"dev": "lundle build -f module,cjs -w",
"format": "prettier --write \"{,!(node_modules|dist|coverage)/**/}*.{ts,tsx,js,jsx,md,yml,json}\"",
"lint": "eslint . --ext .ts,.tsx",
"prepublishOnly": "npm run lint && npm run test && npm run build && npm run format",
"prepublishOnly": "cli-confirm \"Did you run 'yarn release' first? (y/N)\"",
"prerelease": "npm run validate && npm run build",
"release": "git add . && standard-version -a",
"test": "jest",
"validate": "npm run check-types && npm run lint && npm run test -- --coverage"
"validate": "lundle check-types && npm run lint && jest --coverage"
},
"husky": {
"hooks": {
"pre-commit": "npm run build-types && git add types && lint-staged"
"pre-commit": "lundle check-types && lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"lint-staged": {
"**/*.{ts,tsx,js,jsx}": [
"eslint",
"eslint --fix",
"prettier --write"
],
"**/*.{md,yml,json,eslintrc,prettierrc}": [
"**/*.{md,yml,json}": [
"prettier --write"
]
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"eslintConfig": {
"extends": [
"lunde"
]
},
"eslintIgnore": [
"node_modules",
"coverage",
"dist",
"/types",
"test",
"*.config.js"
],
"jest": {
"moduleDirectories": [
"node_modules",
"src",
"test"
],
"testMatch": [
"<rootDir>/src/**/?(*.)test.{ts,tsx}"
],
"collectCoverageFrom": [
"**/src/**/*.{ts,tsx}"
],
"setupFilesAfterEnv": [
"./test/setup.js"
],
"snapshotResolver": "./test/resolve-snapshot.js",
"globals": {
"__DEV__": true
}
},
"prettier": {
"semi": false,
"singleQuote": true,
"jsxSingleQuote": true,
"bracketSpacing": false
},
"devDependencies": {
"@babel/preset-react": "latest",
"@lunde/babel-preset-es": "latest",
"@commitlint/cli": "latest",
"@commitlint/config-conventional": "latest",
"@testing-library/jest-dom": "latest",
"@testing-library/react": "latest",
"@testing-library/react-hooks": "latest",
"@testing-library/user-event": "^10.4.0",
"@testing-library/user-event": "latest",
"@types/jest": "latest",
"@types/react": "latest",
"@types/react-dom": "latest",
"@typescript-eslint/eslint-plugin": "latest",
"@typescript-eslint/parser": "latest",
"babel-plugin-annotate-pure-calls": "latest",
"babel-plugin-optimize-react": "latest",
"babel-jest": "latest",
"cli-confirm": "latest",
"cz-conventional-changelog": "latest",
"eslint": "latest",
"eslint-import-resolver-jest": "latest",
"eslint-plugin-jest": "latest",
"eslint-plugin-react": "latest",
"eslint-plugin-react-hooks": "latest",
"eslint-config-lunde": "latest",
"husky": "latest",
"jest": "latest",
"lint-staged": "latest",
"lundle": "latest",
"prettier": "latest",
"react": "latest",
"react-dom": "latest",
"react-test-renderer": "latest",
"ts-jest": "latest",
"standard-version": "latest",
"typescript": "latest"
},
"dependencies": {
"@accessible/disclosure": "^1.1.3"
"@accessible/disclosure": "^3.0.1"
},
"peerDependencies": {
"react": ">=16.8",
Expand Down
15 changes: 12 additions & 3 deletions test/resolve-snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,23 @@ const snapshots = '__snapshots__'
module.exports = {
resolveSnapshotPath: (testPath, snapshotExtension) =>
path.join(
testPath.split('/').slice(0, -1).join('/'),
testPath
.split('/')
.slice(0, -1)
.join('/'),
snapshots,
testPath.split('/').pop() + snapshotExtension
),
resolveTestPath: (snapshotFilePath, snapshotExtension) =>
path.join(
snapshotFilePath.split('/').slice(0, -2).join('/'),
snapshotFilePath.split('/').pop().slice(0, -snapshotExtension.length)
snapshotFilePath
.split('/')
.slice(0, -2)
.join('/'),
snapshotFilePath
.split('/')
.pop()
.slice(0, -snapshotExtension.length)
),
testPathForConsistencyCheck: 'src/foo.test.js',
}
2 changes: 2 additions & 0 deletions test/setup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// This file is for setting up Jest test environments
import '@testing-library/jest-dom/extend-expect'

afterEach(() => {
jest.clearAllMocks()
})

0 comments on commit 998b853

Please sign in to comment.