Skip to content

Commit 8419f40

Browse files
committed
Updates build, fixes lint errors
1 parent d600cfa commit 8419f40

28 files changed

+2730
-2462
lines changed

.eslintignore

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

.eslintrc

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

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
dist
3-
coverage
3+
coverage
4+
*.log

.prettierignore

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

.prettierrc

Lines changed: 0 additions & 6 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 esm = api.env('esm')
3-
const module = api.env('module')
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-
devExpression: false,
18-
objectAssign: false,
19-
restSpread: 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 & 30 deletions
This file was deleted.

lundle.config.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
global.document = {}
2+
3+
export const rollup = (config) => {
4+
if (config.output[0].format === 'umd') {
5+
config.external = ['@dash-ui/styles', '@dash-ui/react', 'react']
6+
config.output[0].globals = {
7+
'@dash-ui/styles': 'Dash',
8+
'@dash-ui/react': 'DashReact',
9+
react: 'React',
10+
}
11+
}
12+
13+
return config
14+
}

package.json

Lines changed: 90 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"name": "@dash-ui/react-layout",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"homepage": "https://github.com/dash-ui/react-layout#readme",
55
"repository": "github:dash-ui/react-layout",
66
"bugs": "https://github.com/dash-ui/react-layout/issues",
7+
"author": "Jared Lunde <[email protected]> (https://jaredLunde.com)",
78
"license": "MIT",
8-
"description": "",
9+
"description": "Awesome layout primitives for React using dash-ui",
910
"keywords": [
1011
"react",
1112
"react component",
@@ -29,16 +30,18 @@
2930
],
3031
"main": "dist/main/index.js",
3132
"module": "dist/module/index.js",
33+
"unpkg": "dist/umd/dash-react-layout.js",
3234
"source": "src/index.tsx",
3335
"types": "types/index.d.ts",
3436
"exports": {
3537
".": {
3638
"browser": "./dist/module/index.js",
3739
"import": "./dist/esm/index.mjs",
3840
"require": "./dist/main/index.js",
39-
"default": "./dist/main/index.js",
41+
"umd": "./dist/umd/dash-react-layout.js",
4042
"source": "./src/index.tsx",
41-
"types": "./types/index.d.ts"
43+
"types": "./types/index.d.ts",
44+
"default": "./dist/main/index.js"
4245
},
4346
"./package.json": "./package.json",
4447
"./": "./"
@@ -50,71 +53,119 @@
5053
],
5154
"sideEffects": false,
5255
"scripts": {
53-
"build": "npm run build-esm && npm run build-main && npm run build-module && npm run build-types",
54-
"build-esm": "npm run compile -- -d dist/esm --env-name esm --out-file-extension .mjs",
55-
"build-main": "npm run compile -- -d dist/main --env-name main",
56-
"build-module": "npm run compile -- -d dist/module --env-name module",
57-
"build-types": "tsc -p tsconfig.json -d --outDir types --emitDeclarationOnly",
58-
"check-types": "tsc --noEmit -p tsconfig.json",
59-
"compile": "babel src -x .ts,.tsx --ignore \"**/*.test.ts\",\"**/test.ts\",\"**/*.test.tsx\",\"**/test.tsx\" --delete-dir-on-start",
60-
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,md,yml,json,eslintrc,prettierrc}\"",
56+
"build": "lundle build",
57+
"check-types": "lundle check-types",
58+
"dev": "lundle build -f module,cjs -w",
59+
"format": "prettier --write \"{,!(node_modules|dist|coverage)/**/}*.{ts,tsx,js,jsx,md,yml,json}\"",
6160
"lint": "eslint . --ext .ts,.tsx",
6261
"prepublishOnly": "npm run lint && npm run test && npm run build && npm run format",
6362
"test": "jest",
64-
"validate": "npm run check-types && npm run lint && npm run test -- --coverage"
63+
"validate": "lundle check-types && npm run lint && jest --coverage"
6564
},
6665
"husky": {
6766
"hooks": {
68-
"pre-commit": "npm run build-types && git add types && lint-staged"
67+
"pre-commit": "lundle check-types && lint-staged"
6968
}
7069
},
7170
"lint-staged": {
7271
"**/*.{ts,tsx,js,jsx}": [
7372
"eslint",
7473
"prettier --write"
7574
],
76-
"**/*.{md,yml,json,eslintrc,prettierrc}": [
75+
"**/*.{md,yml,json}": [
7776
"prettier --write"
7877
]
7978
},
79+
"eslintConfig": {
80+
"extends": [
81+
"lunde"
82+
],
83+
"overrides": [
84+
{
85+
"files": [
86+
"**/*.test.{ts,tsx}"
87+
],
88+
"settings": {
89+
"import/resolver": {
90+
"node": {
91+
"moduleDirectory": [
92+
"node_modules",
93+
"src/",
94+
"test/"
95+
]
96+
},
97+
"jest": {
98+
"jestConfigFile": "./package.json"
99+
}
100+
}
101+
}
102+
}
103+
]
104+
},
105+
"eslintIgnore": [
106+
"node_modules",
107+
"coverage",
108+
"dist",
109+
"test",
110+
"*.config.js"
111+
],
112+
"jest": {
113+
"moduleDirectories": [
114+
"node_modules",
115+
"src",
116+
"test"
117+
],
118+
"moduleNameMapper": {
119+
"^test-utils$": "<rootDir>/test/test-utils.tsx"
120+
},
121+
"collectCoverageFrom": [
122+
"**/src/**/*.{ts,tsx}"
123+
],
124+
"setupFilesAfterEnv": [
125+
"./test/setup.js"
126+
],
127+
"snapshotResolver": "./test/resolve-snapshot.js",
128+
"snapshotSerializers": [
129+
"@dash-ui/jest"
130+
],
131+
"globals": {
132+
"__DEV__": true
133+
}
134+
},
135+
"prettier": {
136+
"semi": false,
137+
"singleQuote": true,
138+
"jsxSingleQuote": true,
139+
"bracketSpacing": false
140+
},
80141
"devDependencies": {
81-
"@babel/preset-react": "latest",
82-
"@dash-ui/jest": "^1.0.1",
83-
"@dash-ui/react": "^0.3.3",
84-
"@dash-ui/styles": "^0.4.6",
85-
"@essentials/benchmark": "^1.0.5",
86-
"@lunde/babel-preset-es": "latest",
142+
"@dash-ui/jest": "^1.1.0",
143+
"@dash-ui/react": "^0.5.0",
144+
"@dash-ui/styles": "^0.5.0",
87145
"@testing-library/jest-dom": "latest",
88-
"@testing-library/react": "^10.0.4",
146+
"@testing-library/react": "latest",
89147
"@testing-library/react-hooks": "latest",
148+
"@testing-library/user-event": "latest",
90149
"@types/jest": "latest",
91150
"@types/react": "latest",
92-
"@types/react-dom": "^16.9.7",
93-
"@typescript-eslint/eslint-plugin": "^2.30.0",
94-
"@typescript-eslint/parser": "^2.30.0",
95-
"babel-plugin-annotate-pure-calls": "^0.4.0",
96-
"babel-plugin-optimize-react": "latest",
151+
"@types/react-dom": "latest",
152+
"babel-jest": "latest",
97153
"eslint": "latest",
98-
"eslint-import-resolver-jest": "latest",
99-
"eslint-plugin-jest": "^23.9.0",
100-
"eslint-plugin-react": "latest",
101-
"eslint-plugin-react-hooks": "^4.0.0",
154+
"eslint-config-lunde": "latest",
102155
"husky": "latest",
103-
"jest": "^25.5.4",
104-
"jest-styled-components": "^7.0.2",
105-
"lint-staged": "^10.2.2",
156+
"jest": "latest",
157+
"lint-staged": "latest",
158+
"lundle": "latest",
106159
"minify-css.macro": "^1.0.6",
107-
"prettier": "^2.0.5",
108-
"pretty-format": "^25.4.0",
160+
"prettier": "latest",
109161
"react": "latest",
110162
"react-dom": "latest",
111163
"react-test-renderer": "latest",
112-
"ts-jest": "latest",
113164
"typescript": "latest"
114165
},
115166
"dependencies": {
116-
"@dash-ui/mq": "^0.1.5",
117-
"clsx": "^1.1.0"
167+
"@dash-ui/mq": "^0.2.0",
168+
"clsx": "^1.1.1"
118169
},
119170
"peerDependencies": {
120171
"@dash-ui/react": ">=0.3.3",

0 commit comments

Comments
 (0)