Skip to content

Commit b65e18b

Browse files
committed
feat: 🔪 remove build script and related configuration
We don't use any of the build-related tooling that this library exports. This removes the script and all related configuration and dependencies and replaces the build process with a simple Babel CLI based build. BREAKING CHANGE: This removes the `hover-scripts build` script, the exported Babel configuration, and the exported Rollup configuration. It also removes the built-in Babel integration in the Jest configuation.
1 parent 67f6159 commit b65e18b

File tree

15 files changed

+202
-1320
lines changed

15 files changed

+202
-1320
lines changed

.babelrc.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"presets": [
3+
[
4+
"@babel/preset-env",
5+
{
6+
"targets": {
7+
"node": "10"
8+
}
9+
}
10+
]
11+
]
12+
}

babel.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

package.json

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"test": "node src test",
1515
"test:update": "node src test --updateSnapshot",
1616
"build": "run-p build:*",
17-
"build:source": "node src build",
17+
"build:source": "babel --source-maps --out-dir dist --ignore '**/__tests__/**','**/__mocks__/**' src",
1818
"build:types": "tsc -p src/",
1919
"lint": "node src lint",
2020
"format": "node src format",
@@ -36,7 +36,6 @@
3636
"api.js",
3737
"api.d.ts",
3838
"dist",
39-
"babel.js",
4039
"commitlint.js",
4140
"eslint.js",
4241
"eslint-react.js",
@@ -50,33 +49,13 @@
5049
"author": "Jamie Rolfs <jamie.rolfs@hover.to>",
5150
"license": "MIT",
5251
"dependencies": {
53-
"@babel/cli": "^7.11.6",
54-
"@babel/core": "^7.11.6",
55-
"@babel/plugin-proposal-class-properties": "^7.8.3",
56-
"@babel/plugin-transform-modules-commonjs": "^7.8.3",
57-
"@babel/plugin-transform-runtime": "^7.11.0",
58-
"@babel/preset-env": "^7.11.5",
59-
"@babel/preset-flow": "^7.8.3",
60-
"@babel/preset-react": "^7.8.3",
61-
"@babel/runtime": "^7.11.2",
6252
"@commitlint/cli": "^11.0.0",
6353
"@commitlint/config-conventional": "^9.1.2",
6454
"@commitlint/prompt": "^11.0.0",
65-
"@rollup/plugin-commonjs": "^15.0.0",
66-
"@rollup/plugin-json": "^4.0.2",
67-
"@rollup/plugin-node-resolve": "^7.1.1",
68-
"@rollup/plugin-replace": "^2.3.1",
6955
"@types/jest": "^26.0.14",
7056
"@typescript-eslint/eslint-plugin": "^4.4.0",
7157
"@typescript-eslint/parser": "^4.3.0",
7258
"arrify": "^2.0.1",
73-
"babel-jest": "^26.3.0",
74-
"babel-plugin-macros": "^2.8.0",
75-
"babel-plugin-minify-dead-code-elimination": "^0.5.1",
76-
"babel-plugin-module-resolver": "^4.0.0",
77-
"babel-plugin-transform-inline-environment-variables": "^0.4.3",
78-
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
79-
"browserslist": "^4.14.5",
8059
"chalk": "^4.1.0",
8160
"commitizen": "^4.2.1",
8261
"concurrently": "^5.1.0",
@@ -108,12 +87,6 @@
10887
"read-pkg-up": "^7.0.1",
10988
"resolve": "^1.15.1",
11089
"rimraf": "^3.0.2",
111-
"rollup": "^2.26.4",
112-
"rollup-plugin-babel": "^4.3.3",
113-
"rollup-plugin-node-builtins": "^2.1.2",
114-
"rollup-plugin-node-globals": "^1.4.0",
115-
"rollup-plugin-size-snapshot": "^0.12.0",
116-
"rollup-plugin-terser": "^7.0.2",
11790
"semver": "^7.1.3",
11891
"typescript": "^4.0.3",
11992
"which": "^2.0.2",
@@ -147,6 +120,10 @@
147120
},
148121
"homepage": "https://github.com/hoverinc/hover-javascript#readme",
149122
"devDependencies": {
123+
"@babel/cli": "^7.11.6",
124+
"@babel/core": "^7.11.6",
125+
"@babel/preset-env": "^7.11.5",
126+
"babel-jest": "^26.5.2",
150127
"jest-in-case": "^1.0.2",
151128
"npm-run-all": "^4.1.5",
152129
"slash": "^3.0.0"

src/__tests__/__snapshots__/index.js.snap

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,13 @@ Array [
1414
]
1515
`;
1616
17-
exports[`format logs for SIGTERM signal 1`] = `
18-
Array [
19-
Array [
20-
The script "build" failed because the process exited too early. Someone might have called \`kill\` or \`killall\`, or the system could be shutting down.,
21-
],
22-
]
23-
`;
24-
2517
exports[`format logs help with no args 1`] = `
2618
Array [
2719
Array [
2820
2921
Usage: ../ [script] [--flags]
3022
3123
Available Scripts:
32-
build
3324
ci-after-success
3425
commit-msg
3526
commit

src/__tests__/index.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@ cases(
7373
args: ['lint'],
7474
signal: 'SIGKILL',
7575
},
76-
'logs for SIGTERM signal': {
77-
args: ['build'],
78-
signal: 'SIGTERM',
79-
},
8076
'does not log for other signals': {
8177
args: ['test'],
8278
signal: 'SIGBREAK',

src/config/__tests__/umbrella.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
test('requiring some files does not blow up', () => {
2-
require('../babel-transform')
3-
require('../babelrc')
42
require('../eslintrc')
53
require('../eslintrc-react')
64
require('../jest.config')
75
require('../lintstagedrc')
86
require('../prettierrc')
9-
require('../rollup.config')
10-
require('../').getRollupConfig()
117
})

src/config/babel-transform.js

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

src/config/babelrc.js

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

src/config/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
module.exports = {
2-
babel: require('./babelrc'),
32
commitlint: require('./commitlint.config'),
43
eslint: require('./eslintrc'),
54
jest: require('./jest.config'),
65
lintStaged: require('./lintstagedrc'),
76
prettier: require('./prettierrc'),
8-
getRollupConfig: () => require('./rollup.config'),
97
}

src/config/jest.config.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
const path = require('path')
2-
const {ifAnyDep, hasAnyDep, hasFile, hasPkgProp, fromRoot} = require('../utils')
3-
4-
const here = p => path.join(__dirname, p)
5-
6-
const useBuiltInBabelConfig = !hasFile('.babelrc') && !hasPkgProp('babel')
1+
const {ifAnyDep, hasAnyDep, hasFile, fromRoot} = require('../utils')
72

83
const ignores = [
94
'/node_modules/',
@@ -50,7 +45,6 @@ const jestConfig = {
5045
require.resolve('jest-watch-typeahead/testname'),
5146
],
5247
globals: {},
53-
transform: {},
5448
}
5549

5650
if (hasAnyDep('ts-jest')) {
@@ -66,10 +60,4 @@ if (hasFile('tests/setup-env.js')) {
6660
jestConfig.setupFilesAfterEnv = [fromRoot('tests/setup-env.js')]
6761
}
6862

69-
if (useBuiltInBabelConfig) {
70-
Object.assign(jestConfig.transform, {
71-
'^.+\\.js$': here('./babel-transform'),
72-
})
73-
}
74-
7563
module.exports = jestConfig

0 commit comments

Comments
 (0)