Skip to content

Commit 4b214dd

Browse files
committed
build: add lundle
1 parent eb5a542 commit 4b214dd

File tree

9 files changed

+3757
-1630
lines changed

9 files changed

+3757
-1630
lines changed

.eslintignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

.eslintrc

Lines changed: 0 additions & 59 deletions
This file was deleted.

.prettierignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.prettierrc

Lines changed: 0 additions & 7 deletions
This file was deleted.

babel.config.js

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1 @@
1-
module.exports = (api) => {
2-
const module = api.env('module')
3-
const esm = api.env('esm')
4-
const presetEnv = [
5-
'@lunde/es',
6-
{
7-
env: {
8-
modules: esm || module ? false : 'commonjs',
9-
targets: module
10-
? {
11-
browsers: '> 2%',
12-
}
13-
: {
14-
node: esm ? '12' : '10',
15-
},
16-
},
17-
restSpread: false,
18-
devExpression: false,
19-
objectAssign: false,
20-
},
21-
]
22-
23-
return {
24-
presets: [['@babel/preset-react', {useSpread: true}], presetEnv],
25-
plugins: ['optimize-react', 'annotate-pure-calls'],
26-
}
27-
}
1+
module.exports = require('lundle').babelConfig('test', {react: true})

jest.config.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

package.json

Lines changed: 85 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"bugs": "https://github.com/accessible-ui/button/issues",
77
"author": "Jared Lunde <[email protected]> (https://jaredLunde.com)",
88
"license": "MIT",
9-
"description": "An accessible button component for React that provides interop between real `<button>` elements and fake ones, e.g. `<div role='button'>`",
9+
"description": "An accessible button component for React that provides interop between real <button> elements and fake ones, e.g. <div role='button'>",
1010
"keywords": [
1111
"react",
1212
"react component",
@@ -20,92 +20,143 @@
2020
"a11y",
2121
"react aria button",
2222
"aria",
23-
"aria button"
23+
"aria button",
24+
"a11y button hook",
25+
"usea11ybutton",
26+
"use-a11y-button"
2427
],
2528
"main": "dist/main/index.js",
2629
"module": "dist/module/index.js",
30+
"unpkg": "dist/umd/button.js",
2731
"source": "src/index.tsx",
2832
"types": "types/index.d.ts",
29-
"files": [
30-
"/dist",
31-
"/src",
32-
"/types"
33-
],
3433
"exports": {
3534
".": {
3635
"browser": "./dist/module/index.js",
3736
"import": "./dist/esm/index.mjs",
3837
"require": "./dist/main/index.js",
38+
"umd": "./dist/umd/button.js",
3939
"source": "./src/index.tsx",
4040
"types": "./types/index.d.ts",
4141
"default": "./dist/main/index.js"
4242
},
4343
"./package.json": "./package.json",
4444
"./": "./"
4545
},
46+
"files": [
47+
"/dist",
48+
"/src",
49+
"/types"
50+
],
4651
"sideEffects": false,
4752
"scripts": {
48-
"build": "npm run build-esm && npm run build-main && npm run build-module && npm run build-types",
49-
"build-esm": "npm run compile -- -d dist/esm --env-name esm --out-file-extension .mjs",
50-
"build-main": "npm run compile -- -d dist/main --env-name main",
51-
"build-module": "npm run compile -- -d dist/module --env-name module",
52-
"build-types": "tsc -p tsconfig.json -d --outDir types --emitDeclarationOnly",
53-
"check-types": "tsc --noEmit -p tsconfig.json",
54-
"compile": "babel src -x .ts,.tsx --ignore \"**/*.test.ts\",\"**/*.test.tsx\" --delete-dir-on-start",
55-
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,md,yml,json,eslintrc,prettierrc}\"",
53+
"build": "lundle build",
54+
"check-types": "lundle check-types",
55+
"dev": "lundle build -f module,cjs -w",
56+
"format": "prettier --write \"{,!(node_modules|dist|coverage)/**/}*.{ts,tsx,js,jsx,md,yml,json}\"",
5657
"lint": "eslint . --ext .ts,.tsx",
57-
"prepublishOnly": "npm run lint && npm run test && npm run build && npm run format",
58+
"prepublishOnly": "cli-confirm \"Did you run 'yarn release' first? (y/N)\"",
59+
"prerelease": "npm run validate && npm run build",
60+
"release": "git add . && standard-version -a",
5861
"test": "jest",
59-
"validate": "npm run check-types && npm run lint && npm run test -- --coverage"
62+
"validate": "lundle check-types && npm run lint && jest --coverage"
6063
},
6164
"husky": {
6265
"hooks": {
63-
"pre-commit": "npm run build-types && git add types && lint-staged"
66+
"pre-commit": "lundle check-types && lint-staged",
67+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
6468
}
6569
},
6670
"lint-staged": {
6771
"**/*.{ts,tsx,js,jsx}": [
6872
"eslint",
6973
"prettier --write"
7074
],
71-
"**/*.{md,yml,json,eslintrc,prettierrc}": [
75+
"**/*.{md,yml,json}": [
7276
"prettier --write"
7377
]
7478
},
79+
"commitlint": {
80+
"extends": [
81+
"@commitlint/config-conventional"
82+
]
83+
},
84+
"config": {
85+
"commitizen": {
86+
"path": "./node_modules/cz-conventional-changelog"
87+
}
88+
},
89+
"eslintConfig": {
90+
"extends": [
91+
"lunde"
92+
]
93+
},
94+
"eslintIgnore": [
95+
"node_modules",
96+
"coverage",
97+
"dist",
98+
"/types",
99+
"test",
100+
"*.config.js"
101+
],
102+
"jest": {
103+
"moduleDirectories": [
104+
"node_modules",
105+
"src",
106+
"test"
107+
],
108+
"testMatch": [
109+
"<rootDir>/src/**/?(*.)test.{ts,tsx}"
110+
],
111+
"collectCoverageFrom": [
112+
"**/src/**/*.{ts,tsx}"
113+
],
114+
"setupFilesAfterEnv": [
115+
"./test/setup.js"
116+
],
117+
"snapshotResolver": "./test/resolve-snapshot.js",
118+
"globals": {
119+
"__DEV__": true
120+
}
121+
},
122+
"prettier": {
123+
"semi": false,
124+
"singleQuote": true,
125+
"jsxSingleQuote": true,
126+
"bracketSpacing": false
127+
},
75128
"devDependencies": {
76-
"@babel/preset-react": "latest",
77-
"@lunde/babel-preset-es": "latest",
129+
"@commitlint/cli": "latest",
130+
"@commitlint/config-conventional": "latest",
78131
"@testing-library/jest-dom": "latest",
79132
"@testing-library/react": "latest",
80133
"@testing-library/react-hooks": "latest",
134+
"@testing-library/user-event": "latest",
81135
"@types/jest": "latest",
82136
"@types/react": "latest",
83137
"@types/react-dom": "latest",
84-
"@typescript-eslint/eslint-plugin": "latest",
85-
"@typescript-eslint/parser": "latest",
86-
"babel-plugin-annotate-pure-calls": "latest",
87-
"babel-plugin-optimize-react": "latest",
138+
"babel-jest": "latest",
139+
"cli-confirm": "latest",
140+
"cz-conventional-changelog": "latest",
88141
"eslint": "latest",
89-
"eslint-import-resolver-jest": "latest",
90-
"eslint-plugin-jest": "latest",
91-
"eslint-plugin-react": "latest",
92-
"eslint-plugin-react-hooks": "latest",
142+
"eslint-config-lunde": "latest",
93143
"husky": "latest",
94144
"jest": "latest",
95145
"lint-staged": "latest",
146+
"lundle": "latest",
96147
"prettier": "latest",
97148
"react": "latest",
98149
"react-dom": "latest",
99150
"react-test-renderer": "latest",
100-
"ts-jest": "latest",
151+
"standard-version": "latest",
101152
"typescript": "latest"
102153
},
103154
"dependencies": {
104-
"@accessible/use-keycode": "^4.0.1",
105-
"@react-hook/merged-ref": "^1.1.1"
155+
"@accessible/use-key": "^1.0.2",
156+
"@react-hook/event": "^1.2.2",
157+
"@react-hook/merged-ref": "^1.3.0"
106158
},
107159
"peerDependencies": {
108-
"react": ">=16.8",
109-
"react-dom": ">=16.8"
160+
"react": ">=16.8"
110161
}
111162
}

test/setup.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// This file is for setting up Jest test environments
2+
import '@testing-library/jest-dom/extend-expect'
3+
24
afterEach(() => {
35
jest.clearAllMocks()
46
})

0 commit comments

Comments
 (0)