Skip to content

Commit 3d1c2d7

Browse files
author
Chance Strickland
authored
Replace custom build scripts w/ Preconstruct (#732)
1 parent 40ac99e commit 3d1c2d7

File tree

30 files changed

+1281
-1472
lines changed

30 files changed

+1281
-1472
lines changed

babel.config.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module.exports = {
2+
plugins: [
3+
"babel-plugin-annotate-pure-calls",
4+
"babel-plugin-dev-expression",
5+
["@babel/plugin-proposal-class-properties", { loose: true }],
6+
"babel-plugin-macros",
7+
],
8+
presets: [
9+
"@babel/preset-typescript",
10+
"@babel/preset-react",
11+
[
12+
"@babel/preset-env",
13+
{
14+
modules: false,
15+
loose: true,
16+
},
17+
],
18+
],
19+
};

package.json

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,29 @@
1010
},
1111
"scripts": {
1212
"start": "start-storybook -p 9001 -c .storybook",
13-
"dev": "yarn start",
1413
"test": "cross-env CI=true ts-node ./scripts/test packages",
1514
"test:pkg": "cross-env CI=true ts-node ./scripts/test --pkg",
1615
"test:watch": "ts-node ./scripts/test packages",
1716
"test:coverage": "yarn test --coverage",
18-
"build": "node -r ts-node/register --max-old-space-size=3049 scripts/build-all",
19-
"build:pkg": "ts-node --transpile-only scripts/build-package",
17+
"build": "yarn build:packages",
18+
"build:packages": "preconstruct build",
2019
"ver": "lerna version --no-push --exact",
2120
"changes": "dotenv lerna-changelog",
2221
"clean": "git clean -e '!/.env' -e '!/website-deploy-key' -e '!/website-deploy-key.pub' -fdX .",
2322
"lint": "eslint .",
23+
"fix": "manypkg fix && preconstruct fix",
24+
"dev": "yarn start",
25+
"postinstall": "manypkg check && preconstruct dev",
2426
"release": "lerna publish from-git --yes --pre-dist-tag next"
2527
},
2628
"dependencies": {
27-
"@babel/core": "^7.11.4",
28-
"@babel/plugin-proposal-class-properties": "^7.10.4",
29-
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.4",
30-
"@babel/plugin-proposal-optional-chaining": "^7.11.0",
31-
"@babel/preset-env": "^7.11.0",
32-
"@babel/preset-react": "^7.10.4",
29+
"@babel/core": "^7.12.10",
30+
"@babel/plugin-proposal-class-properties": "^7.12.1",
31+
"@babel/preset-env": "^7.12.11",
32+
"@babel/preset-react": "^7.12.10",
33+
"@babel/preset-typescript": "^7.12.7",
34+
"@manypkg/cli": "^0.17.0",
35+
"@preconstruct/cli": "^2.0.1",
3336
"@reach/router": "^1.3.4",
3437
"@rollup/plugin-commonjs": "^15.0.0",
3538
"@rollup/plugin-json": "^4.1.0",
@@ -66,13 +69,12 @@
6669
"@typescript-eslint/eslint-plugin": "^3.9.1",
6770
"@typescript-eslint/parser": "^3.9.1",
6871
"autoprefixer": "^9.8.6",
69-
"awesome-typescript-loader": "^5.2.1",
7072
"babel-eslint": "^10.1.0",
71-
"babel-jest": "^26.3.0",
72-
"babel-loader": "^8.1.0",
73+
"babel-jest": "^26.6.3",
74+
"babel-loader": "^8.2.2",
7375
"babel-plugin-annotate-pure-calls": "0.4.0",
7476
"babel-plugin-dev-expression": "0.2.2",
75-
"babel-plugin-macros": "^2.8.0",
77+
"babel-plugin-macros": "^3.0.1",
7678
"chalk": "^4.1.0",
7779
"cross-env": "^7.0.2",
7880
"dotenv-cli": "^3.2.0",
@@ -86,8 +88,8 @@
8688
"fs-extra": "^9.0.1",
8789
"husky": "^4.2.5",
8890
"jest": "^26.4.1",
89-
"jest-watch-typeahead": "0.6.0",
9091
"jest-axe": "^3.5.0",
92+
"jest-watch-typeahead": "0.6.0",
9193
"lerna": "^3.22.1",
9294
"lerna-changelog": "^1.0.1",
9395
"lerna-script": "^1.3.2",
@@ -105,11 +107,6 @@
105107
"react-router-dom": "^5.2.0",
106108
"react-spring": "^8.0.27",
107109
"react-test-renderer": "^16.13.1",
108-
"rollup": "^2.26.4",
109-
"rollup-plugin-babel": "^4.4.0",
110-
"rollup-plugin-sourcemaps": "0.6.2",
111-
"rollup-plugin-terser": "^7.0.0",
112-
"rollup-plugin-typescript2": "0.27.2",
113110
"sinon": "^9.0.3",
114111
"styled-components": "^5.1.1",
115112
"ts-jest": "^26.3.0",
@@ -182,5 +179,10 @@
182179
],
183180
"prettier": {
184181
"singleQuote": false
182+
},
183+
"preconstruct": {
184+
"packages": [
185+
"packages/*"
186+
]
185187
}
186188
}

packages/accordion/package.json

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,31 @@
99
"url": "git+https://github.com/reach/reach-ui.git",
1010
"directory": "packages/accordion"
1111
},
12-
"scripts": {
13-
"build": "ts-node --transpile-only ../../scripts/build-package $npm_package_name"
14-
},
1512
"dependencies": {
1613
"@reach/auto-id": "0.13.0",
1714
"@reach/descendants": "0.13.0",
1815
"@reach/utils": "0.13.0",
16+
"prop-types": "^15.7.2",
1917
"tslib": "^2.0.0"
2018
},
19+
"devDependencies": {
20+
"react": "^17.0.1",
21+
"react-dom": "^17.0.1"
22+
},
2123
"peerDependencies": {
2224
"react": "^16.8.0 || 17.x",
2325
"react-dom": "^16.8.0 || 17.x"
2426
},
25-
"main": "dist/index.js",
26-
"module": "dist/accordion.esm.js",
27-
"typings": "dist/index.d.ts",
27+
"main": "dist/reach-accordion.cjs.js",
28+
"module": "dist/reach-accordion.esm.js",
29+
"types": "dist/reach-accordion.cjs.d.ts",
2830
"files": [
2931
"README.md",
3032
"dist",
3133
"styles.css"
34+
],
35+
"eslintIgnore": [
36+
"node_modules",
37+
"dist"
3238
]
3339
}

packages/alert-dialog/package.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
"url": "git+https://github.com/reach/reach-ui.git",
1010
"directory": "packages/alert-dialog"
1111
},
12-
"scripts": {
13-
"build": "ts-node --transpile-only ../../scripts/build-package $npm_package_name"
14-
},
1512
"dependencies": {
1613
"@reach/auto-id": "0.13.0",
1714
"@reach/dialog": "0.13.0",
@@ -20,15 +17,23 @@
2017
"prop-types": "^15.7.2",
2118
"tslib": "^2.0.0"
2219
},
20+
"devDependencies": {
21+
"react": "^17.0.1",
22+
"react-dom": "^17.0.1"
23+
},
2324
"peerDependencies": {
2425
"react": "^16.8.0 || 17.x",
2526
"react-dom": "^16.8.0 || 17.x"
2627
},
27-
"main": "dist/index.js",
28-
"module": "dist/alert-dialog.esm.js",
29-
"typings": "dist/index.d.ts",
28+
"main": "dist/reach-alert-dialog.cjs.js",
29+
"module": "dist/reach-alert-dialog.esm.js",
30+
"types": "dist/reach-alert-dialog.cjs.d.ts",
3031
"files": [
3132
"README.md",
3233
"dist"
34+
],
35+
"eslintIgnore": [
36+
"node_modules",
37+
"dist"
3338
]
3439
}

packages/alert/package.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,29 @@
99
"url": "git+https://github.com/reach/reach-ui.git",
1010
"directory": "packages/alert"
1111
},
12-
"scripts": {
13-
"build": "ts-node --transpile-only ../../scripts/build-package $npm_package_name"
14-
},
1512
"dependencies": {
1613
"@reach/utils": "0.13.0",
1714
"@reach/visually-hidden": "0.13.0",
1815
"prop-types": "^15.7.2",
1916
"tslib": "^2.0.0"
2017
},
18+
"devDependencies": {
19+
"react": "^17.0.1",
20+
"react-dom": "^17.0.1"
21+
},
2122
"peerDependencies": {
2223
"react": "^16.8.0 || 17.x",
2324
"react-dom": "^16.8.0 || 17.x"
2425
},
25-
"main": "dist/index.js",
26-
"module": "dist/alert.esm.js",
27-
"typings": "dist/index.d.ts",
26+
"main": "dist/reach-alert.cjs.js",
27+
"module": "dist/reach-alert.esm.js",
28+
"types": "dist/reach-alert.cjs.d.ts",
2829
"files": [
2930
"README.md",
3031
"dist"
32+
],
33+
"eslintIgnore": [
34+
"node_modules",
35+
"dist"
3136
]
3237
}

packages/auto-id/package.json

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,27 @@
99
"url": "git+https://github.com/reach/reach-ui.git",
1010
"directory": "packages/auto-id"
1111
},
12-
"scripts": {
13-
"build": "ts-node --transpile-only ../../scripts/build-package $npm_package_name"
12+
"dependencies": {
13+
"@reach/utils": "0.13.0",
14+
"tslib": "^2.0.0"
15+
},
16+
"devDependencies": {
17+
"react": "^17.0.1",
18+
"react-dom": "^17.0.1"
1419
},
1520
"peerDependencies": {
1621
"react": "^16.8.0 || 17.x",
1722
"react-dom": "^16.8.0 || 17.x"
1823
},
19-
"main": "dist/index.js",
20-
"module": "dist/auto-id.esm.js",
21-
"typings": "dist/index.d.ts",
24+
"main": "dist/reach-auto-id.cjs.js",
25+
"module": "dist/reach-auto-id.esm.js",
26+
"types": "dist/reach-auto-id.cjs.d.ts",
2227
"files": [
2328
"README.md",
2429
"dist"
2530
],
26-
"dependencies": {
27-
"@reach/utils": "0.13.0",
28-
"tslib": "^2.0.0"
29-
}
31+
"eslintIgnore": [
32+
"node_modules",
33+
"dist"
34+
]
3035
}

packages/checkbox/package.json

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,31 @@
1010
"url": "git+https://github.com/reach/reach-ui.git",
1111
"directory": "packages/checkbox"
1212
},
13-
"scripts": {
14-
"build": "ts-node --transpile-only ../../scripts/build-package $npm_package_name"
15-
},
1613
"dependencies": {
1714
"@reach/auto-id": "0.13.0",
1815
"@reach/machine": "0.13.0",
1916
"@reach/utils": "0.13.0",
17+
"prop-types": "^15.7.2",
2018
"tslib": "^2.0.0"
2119
},
20+
"devDependencies": {
21+
"react": "^17.0.1",
22+
"react-dom": "^17.0.1"
23+
},
2224
"peerDependencies": {
2325
"react": "^16.8.0 || 17.x",
2426
"react-dom": "^16.8.0 || 17.x"
2527
},
26-
"main": "dist/index.js",
27-
"module": "dist/checkbox.esm.js",
28-
"typings": "dist/index.d.ts",
28+
"main": "dist/reach-checkbox.cjs.js",
29+
"module": "dist/reach-checkbox.esm.js",
30+
"types": "dist/reach-checkbox.cjs.d.ts",
2931
"files": [
3032
"README.md",
3133
"dist",
3234
"styles.css"
35+
],
36+
"eslintIgnore": [
37+
"node_modules",
38+
"dist"
3339
]
3440
}

packages/combobox/package.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
"url": "git+https://github.com/reach/reach-ui.git",
1010
"directory": "packages/combobox"
1111
},
12-
"scripts": {
13-
"build": "ts-node --transpile-only ../../scripts/build-package $npm_package_name"
14-
},
1512
"dependencies": {
1613
"@reach/auto-id": "0.13.0",
1714
"@reach/descendants": "0.13.0",
@@ -22,16 +19,24 @@
2219
"prop-types": "^15.7.2",
2320
"tslib": "^2.0.0"
2421
},
22+
"devDependencies": {
23+
"react": "^17.0.1",
24+
"react-dom": "^17.0.1"
25+
},
2526
"peerDependencies": {
2627
"react": "^16.8.0 || 17.x",
2728
"react-dom": "^16.8.0 || 17.x"
2829
},
29-
"main": "dist/index.js",
30-
"module": "dist/combobox.esm.js",
31-
"typings": "dist/index.d.ts",
30+
"main": "dist/reach-combobox.cjs.js",
31+
"module": "dist/reach-combobox.esm.js",
32+
"types": "dist/reach-combobox.cjs.d.ts",
3233
"files": [
3334
"README.md",
3435
"dist",
3536
"styles.css"
37+
],
38+
"eslintIgnore": [
39+
"node_modules",
40+
"dist"
3641
]
3742
}

packages/component-component/package.json

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,25 @@
99
"url": "git+https://github.com/reach/reach-ui.git",
1010
"directory": "packages/component-component"
1111
},
12-
"scripts": {
13-
"build": "ts-node --transpile-only ../../scripts/build-package $npm_package_name"
14-
},
1512
"dependencies": {
1613
"prop-types": "^15.7.2"
1714
},
15+
"devDependencies": {
16+
"react": "^17.0.1",
17+
"react-dom": "^17.0.1"
18+
},
1819
"peerDependencies": {
19-
"react": "^16.4.0",
20-
"react-dom": "^16.4.0"
20+
"react": "^16.4.0 || 17.x",
21+
"react-dom": "^16.4.0 || 17.x"
2122
},
22-
"main": "dist/index.js",
23-
"module": "dist/component-component.esm.js",
23+
"main": "dist/reach-component-component.cjs.js",
24+
"module": "dist/reach-component-component.esm.js",
2425
"files": [
2526
"README.md",
2627
"dist"
28+
],
29+
"eslintIgnore": [
30+
"node_modules",
31+
"dist"
2732
]
2833
}

packages/descendants/package.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,27 @@
99
"url": "git+https://github.com/reach/reach-ui.git",
1010
"directory": "packages/descendants"
1111
},
12-
"scripts": {
13-
"build": "ts-node --transpile-only ../../scripts/build-package $npm_package_name"
14-
},
1512
"dependencies": {
1613
"@reach/utils": "0.13.0",
1714
"tslib": "^2.0.0"
1815
},
16+
"devDependencies": {
17+
"react": "^17.0.1",
18+
"react-dom": "^17.0.1"
19+
},
1920
"peerDependencies": {
2021
"react": "^16.8.0 || 17.x",
2122
"react-dom": "^16.8.0 || 17.x"
2223
},
23-
"main": "dist/index.js",
24-
"module": "dist/descendants.esm.js",
25-
"typings": "dist/index.d.ts",
24+
"main": "dist/reach-descendants.cjs.js",
25+
"module": "dist/reach-descendants.esm.js",
26+
"types": "dist/reach-descendants.cjs.d.ts",
2627
"files": [
2728
"README.md",
2829
"dist"
30+
],
31+
"eslintIgnore": [
32+
"node_modules",
33+
"dist"
2934
]
3035
}

0 commit comments

Comments
 (0)