Skip to content

Commit d837e11

Browse files
committed
build: add lundle
1 parent 09e9c20 commit d837e11

14 files changed

Lines changed: 3779 additions & 1657 deletions

.eslintignore

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

.eslintrc

Lines changed: 0 additions & 58 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.

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ import {
4141
} from '@accessibile/using-keyboard'
4242

4343
const App = (props) => (
44-
<UsingKeyboard className="using-keyboard">
45-
<div className="my-app">
44+
<UsingKeyboard className='using-keyboard'>
45+
<div className='my-app'>
4646
// This will have the class name 'my-app using-keyboard' // when a
4747
keyboard drew the last focus in a document. // That is, during keyboard
4848
navigation
@@ -53,16 +53,20 @@ const App = (props) => (
5353

5454
## API
5555

56-
### `useUsingKeyboard(defaultUsingKeyboard?: boolean): boolean`
56+
### useUsingKeyboard(defaultUsingKeyboard)
5757

5858
A React hook that returns `true` when the keyboard was used more recently than the mouse for
5959
focusing an element.
6060

61+
#### Arguments
62+
6163
| Argument | Type | Required | Default | Description |
6264
| -------------------- | --------- | -------- | ------- | --------------------------------------- |
6365
| defaultUsingKeyboard | `boolean` | `false` | `false` | Sets the default value of usingKeyboard |
6466

65-
### `<BodyUsingKeyboard />`
67+
#### Returns `boolean`
68+
69+
### &lt;BodyUsingKeyboard&gt;
6670

6771
A React component that adds a `using-keyboard` class to the `<body>` when the keyboard was used more recently
6872
than the mouse for focusing an element. It removes the class each time a `mousedown` event fires.
@@ -73,7 +77,7 @@ than the mouse for focusing an element. It removes the class each time a `moused
7377
| defaultUsingKeyboard | `boolean` | `false` | `false` | Sets the default value of usingKeyboard |
7478
| children | `React.ReactElement` | `false` | `undefined` | By default this renders no children, but it will render any children you provide here. |
7579

76-
### `<UsingKeyboard />`
80+
### &lt;UsingKeyboard&gt;
7781

7882
A React component that adds a `using-keyboard` class to its child element when the keyboard was used more recently
7983
than the mouse for focusing an element. It removes the class each time a `mousedown` event fires.

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: 'cover 80% in US',
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: 80 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,149 @@
11
{
22
"name": "@accessible/using-keyboard",
3-
"version": "2.1.0",
3+
"version": "0.1.0",
44
"homepage": "https://github.com/accessible-ui/using-keyboard#readme",
55
"repository": "github:accessible-ui/using-keyboard",
66
"bugs": "https://github.com/accessible-ui/using-keyboard/issues",
77
"author": "Jared Lunde <jared.lunde@gmail.com> (https://jaredLunde.com)",
88
"license": "MIT",
9-
"description": "React utilities for adding accessible focus styles to elements when using keyboard navigation",
9+
"description": "React utilities for adding accessible focus styles to elements when only someone is using keyboard navigation.",
1010
"keywords": [
1111
"react",
1212
"react component",
13-
"a11y",
14-
"aria",
15-
"accessibility",
16-
"accessible",
17-
"accessible focus",
18-
"a11y focus",
19-
"aria focus",
20-
"accessible keyboard navigation",
21-
"a11y keyboard navigation",
22-
"aria keyboard navigation",
2313
"using keyboard"
2414
],
2515
"main": "dist/main/index.js",
2616
"module": "dist/module/index.js",
17+
"unpkg": "dist/umd/using-keyboard.js",
2718
"source": "src/index.tsx",
2819
"types": "types/index.d.ts",
29-
"files": [
30-
"/dist",
31-
"/src",
32-
"/types"
33-
],
3420
"exports": {
3521
".": {
3622
"browser": "./dist/module/index.js",
3723
"import": "./dist/esm/index.mjs",
3824
"require": "./dist/main/index.js",
25+
"umd": "./dist/umd/using-keyboard.js",
3926
"source": "./src/index.tsx",
4027
"types": "./types/index.d.ts",
4128
"default": "./dist/main/index.js"
4229
},
4330
"./package.json": "./package.json",
4431
"./": "./"
4532
},
33+
"files": [
34+
"/dist",
35+
"/src",
36+
"/types"
37+
],
4638
"sideEffects": false,
4739
"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}\"",
40+
"build": "lundle build",
41+
"check-types": "lundle check-types",
42+
"dev": "lundle build -f module,cjs -w",
43+
"format": "prettier --write \"{,!(node_modules|dist|coverage)/**/}*.{ts,tsx,js,jsx,md,yml,json}\"",
5644
"lint": "eslint . --ext .ts,.tsx",
57-
"prepublishOnly": "npm run lint && npm run test && npm run build && npm run format",
45+
"prepublishOnly": "cli-confirm \"Did you run 'yarn release' first? (y/N)\"",
46+
"prerelease": "npm run validate && npm run build",
47+
"release": "git add . && standard-version -a",
5848
"test": "jest",
59-
"validate": "npm run check-types && npm run lint && npm run test -- --coverage"
49+
"validate": "lundle check-types && npm run lint && jest --coverage"
6050
},
6151
"husky": {
6252
"hooks": {
63-
"pre-commit": "npm run build-types && git add types && lint-staged"
53+
"pre-commit": "lundle check-types && lint-staged",
54+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
6455
}
6556
},
6657
"lint-staged": {
6758
"**/*.{ts,tsx,js,jsx}": [
6859
"eslint",
6960
"prettier --write"
7061
],
71-
"**/*.{md,yml,json,eslintrc,prettierrc}": [
62+
"**/*.{md,yml,json}": [
7263
"prettier --write"
7364
]
7465
},
66+
"commitlint": {
67+
"extends": [
68+
"@commitlint/config-conventional"
69+
]
70+
},
71+
"config": {
72+
"commitizen": {
73+
"path": "./node_modules/cz-conventional-changelog"
74+
}
75+
},
76+
"eslintConfig": {
77+
"extends": [
78+
"lunde"
79+
]
80+
},
81+
"eslintIgnore": [
82+
"node_modules",
83+
"coverage",
84+
"dist",
85+
"/types",
86+
"test",
87+
"*.config.js"
88+
],
89+
"jest": {
90+
"moduleDirectories": [
91+
"node_modules",
92+
"src",
93+
"test"
94+
],
95+
"testMatch": [
96+
"<rootDir>/src/**/?(*.)test.{ts,tsx}"
97+
],
98+
"collectCoverageFrom": [
99+
"**/src/**/*.{ts,tsx}"
100+
],
101+
"setupFilesAfterEnv": [
102+
"./test/setup.js"
103+
],
104+
"snapshotResolver": "./test/resolve-snapshot.js",
105+
"globals": {
106+
"__DEV__": true
107+
}
108+
},
109+
"prettier": {
110+
"semi": false,
111+
"singleQuote": true,
112+
"jsxSingleQuote": true,
113+
"bracketSpacing": false
114+
},
75115
"devDependencies": {
76-
"@babel/preset-react": "latest",
77-
"@lunde/babel-preset-es": "latest",
116+
"@commitlint/cli": "latest",
117+
"@commitlint/config-conventional": "latest",
78118
"@testing-library/jest-dom": "latest",
79119
"@testing-library/react": "latest",
80120
"@testing-library/react-hooks": "latest",
81121
"@testing-library/user-event": "latest",
82122
"@types/jest": "latest",
83123
"@types/react": "latest",
84124
"@types/react-dom": "latest",
85-
"@typescript-eslint/eslint-plugin": "latest",
86-
"@typescript-eslint/parser": "latest",
87-
"babel-plugin-annotate-pure-calls": "latest",
88-
"babel-plugin-optimize-react": "latest",
125+
"babel-jest": "latest",
126+
"cli-confirm": "latest",
127+
"cz-conventional-changelog": "latest",
89128
"eslint": "latest",
90-
"eslint-import-resolver-jest": "latest",
91-
"eslint-plugin-jest": "latest",
92-
"eslint-plugin-react": "latest",
93-
"eslint-plugin-react-hooks": "latest",
129+
"eslint-config-lunde": "latest",
94130
"husky": "latest",
95131
"jest": "latest",
96132
"lint-staged": "latest",
133+
"lundle": "latest",
97134
"prettier": "latest",
98135
"react": "latest",
99136
"react-dom": "latest",
100137
"react-test-renderer": "latest",
101-
"ts-jest": "latest",
138+
"standard-version": "latest",
102139
"typescript": "latest"
103140
},
104141
"dependencies": {
105-
"@react-hook/event": "^1.1.0",
106-
"@react-hook/passive-layout-effect": "^1.0.3",
142+
"@react-hook/event": "^1.2.2",
143+
"@react-hook/passive-layout-effect": "^1.2.0",
107144
"clsx": "^1.1.1"
108145
},
109146
"peerDependencies": {
110-
"react": ">=16.8",
111-
"react-dom": ">=16.8"
147+
"react": ">=16.8"
112148
}
113149
}

0 commit comments

Comments
 (0)