Skip to content

Commit e0ebca7

Browse files
author
Kent C. Dodds
committed
fix(deps): upgrade all deps
Closes #107
1 parent bfb5b21 commit e0ebca7

File tree

6 files changed

+47
-42
lines changed

6 files changed

+47
-42
lines changed

other/babel-config.js

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
const babelConfig = require('kcd-scripts/babel')
2-
31
// we don't want to use babel-macros inside babel-macros...
42
// and until kcd-scripts gets upgraded to babel-plugin-macros
53
// we'll have both of those referenced here...
6-
babelConfig.plugins = babelConfig.plugins.filter(
7-
pluginPath =>
8-
!pluginPath.includes('babel-macros/') &&
9-
!pluginPath.includes('babel-plugin-macros/'),
10-
)
11-
const envPreset = babelConfig.presets.find(
12-
p => p[0] && p[0].includes('preset-env'),
13-
)
14-
envPreset[1].modules = 'commonjs'
15-
module.exports = babelConfig
4+
const getBabelConfig = require('kcd-scripts/babel')
5+
6+
module.exports = (...args) => {
7+
const babelConfig = getBabelConfig(...args)
8+
babelConfig.plugins = babelConfig.plugins.filter(
9+
pluginPath =>
10+
!pluginPath.includes('babel-macros/') &&
11+
!pluginPath.includes('babel-plugin-macros/'),
12+
)
13+
const envPreset = babelConfig.presets.find(
14+
p => p[0] && p[0].includes('preset-env'),
15+
)
16+
envPreset[1].modules = 'commonjs'
17+
return babelConfig
18+
}

package.json

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@
1010
"test": "kcd-scripts test",
1111
"test:update": "npm test -- --updateSnapshot",
1212
"validate": "kcd-scripts validate",
13-
"setup": "npm install && npm run validate -s",
14-
"precommit": "kcd-scripts precommit"
13+
"setup": "npm install && npm run validate -s"
14+
},
15+
"husky": {
16+
"hooks": {
17+
"pre-commit": "kcd-scripts pre-commit"
18+
}
1519
},
1620
"files": [
1721
"dist"
@@ -28,17 +32,19 @@
2832
"author": "Kent C. Dodds <[email protected]> (http://kentcdodds.com/)",
2933
"license": "MIT",
3034
"dependencies": {
31-
"cosmiconfig": "^5.0.5",
32-
"resolve": "^1.8.1"
35+
"@babel/runtime": "^7.4.2",
36+
"cosmiconfig": "^5.2.0",
37+
"resolve": "^1.10.0"
3338
},
3439
"devDependencies": {
35-
"@babel/core": "^7.1.0",
36-
"@babel/parser": "^7.1.0",
37-
"@babel/types": "^7.0.0",
40+
"@babel/core": "^7.4.0",
41+
"@babel/parser": "^7.4.2",
42+
"@babel/types": "^7.4.0",
3843
"ast-pretty-print": "^2.0.1",
39-
"babel-plugin-tester": "^5.0.0",
40-
"cpy": "^7.0.0",
41-
"kcd-scripts": "^0.32.1"
44+
"babel-plugin-tester": "^6.0.1",
45+
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
46+
"cpy": "^7.1.0",
47+
"kcd-scripts": "^1.1.3"
4248
},
4349
"eslintConfig": {
4450
"extends": "./node_modules/kcd-scripts/eslint.js"

src/__tests__/__snapshots__/index.js.snap

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ const Div = STYLED.div\`
2727
↓ ↓ ↓ ↓ ↓ ↓
2828
2929
const red = "background-color: red;";
30-
3130
const Div = STYLED.div\`undefined\`;
3231
3332
`;
@@ -50,7 +49,7 @@ errorThrower('hi')
5049
5150
↓ ↓ ↓ ↓ ↓ ↓
5251
53-
Error: babel-plugin-macros-test-error-thrower/macro: not helpful Learn more: https://www.npmjs.com/package/babel-plugin-macros-test-error-thrower
52+
Error: not helpful Learn more: https://www.npmjs.com/package/babel-plugin-macros-test-error-thrower
5453
5554
`;
5655

@@ -61,7 +60,7 @@ errorThrower('hi')
6160
6261
↓ ↓ ↓ ↓ ↓ ↓
6362
64-
Error: babel-plugin-macros-test-error-thrower.macro: not helpful Learn more: https://www.npmjs.com/package/babel-plugin-macros-test-error-thrower.macro
63+
Error: not helpful Learn more: https://www.npmjs.com/package/babel-plugin-macros-test-error-thrower.macro
6564
6665
`;
6766

@@ -92,10 +91,12 @@ exports[`macros macros can set their configName and get their config: macros can
9291
9392
import configured from './configurable.macro'
9493
94+
// eslint-disable-next-line babel/no-unused-expressions
9595
configured\`stuff\`
9696
9797
↓ ↓ ↓ ↓ ↓ ↓
9898
99+
// eslint-disable-next-line babel/no-unused-expressions
99100
configured\`stuff\`;
100101
101102
`;
@@ -120,6 +121,7 @@ const red = macro('noop');
120121
↓ ↓ ↓ ↓ ↓ ↓
121122
122123
const macro = require('./fixtures/keep-imports.macro');
124+
123125
const red = macro('noop');
124126
125127
`;
@@ -131,15 +133,8 @@ const red = macro('noop')
131133
132134
↓ ↓ ↓ ↓ ↓ ↓
133135
134-
"use strict";
135-
136-
var _keepImports = require("./fixtures/keep-imports.macro");
137-
138-
var _keepImports2 = _interopRequireDefault(_keepImports);
139-
140-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
141-
142-
var red = (0, _keepImports2.default)('noop');
136+
import macro from './fixtures/keep-imports.macro';
137+
const red = macro('noop');
143138
144139
`;
145140

@@ -150,7 +145,7 @@ errorThrower('hey')
150145
151146
↓ ↓ ↓ ↓ ↓ ↓
152147
153-
Error: ./fixtures/error-thrower.macro: very unhelpful
148+
Error: very unhelpful
154149
155150
`;
156151

@@ -182,7 +177,6 @@ const Div = styled.div\`
182177
const red = css\`
183178
background-color: red;
184179
\`;
185-
186180
const Div = styled.div\`
187181
composes: \${red}
188182
color: blue;
@@ -208,7 +202,7 @@ unwrapped('hey')
208202
209203
↓ ↓ ↓ ↓ ↓ ↓
210204
211-
Error: The macro imported from "./fixtures/non-wrapped.macro" must be wrapped in "createMacro" which you can get from "babel-plugin-macros". Please refer to the documentation to see how to do this properly: https://github.com/kentcdodds/babel-plugin-macros/blob/master/other/docs/author.md#writing-a-macro
205+
Error: https://github.com/kentcdodds/babel-plugin-macros/blob/master/other/docs/author.md#writing-a-macro
212206
213207
`;
214208
@@ -223,7 +217,6 @@ global.result = result
223217
↓ ↓ ↓ ↓ ↓ ↓
224218
225219
const result = ("foobar", 42);
226-
227220
global.result = result;
228221
229222
`;
@@ -238,6 +231,7 @@ exports[`macros when there is an error reading the config, a helpful message is
238231
239232
import configured from './configurable.macro'
240233
234+
// eslint-disable-next-line babel/no-unused-expressions
241235
configured\`stuff\`
242236
243237
↓ ↓ ↓ ↓ ↓ ↓
@@ -250,10 +244,12 @@ exports[`macros when there is no config to load, then no config is passed: when
250244
251245
import configured from './configurable.macro'
252246
247+
// eslint-disable-next-line babel/no-unused-expressions
253248
configured\`stuff\`
254249
255250
↓ ↓ ↓ ↓ ↓ ↓
256251
252+
// eslint-disable-next-line babel/no-unused-expressions
257253
configured\`stuff\`;
258254
259255
`;
@@ -295,7 +291,6 @@ const Div = STYLED.div\`
295291
↓ ↓ ↓ ↓ ↓ ↓
296292
297293
const red = "background-color: red;";
298-
299294
const Div = STYLED.div\`undefined\`;
300295
301296
`;
@@ -315,7 +310,6 @@ const Div = styled.div\`
315310
↓ ↓ ↓ ↓ ↓ ↓
316311
317312
const red = "background-color: red;";
318-
319313
const Div = styled.div\`undefined\`;
320314
321315
`;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
import configured from './configurable.macro'
22

3+
// eslint-disable-next-line babel/no-unused-expressions
34
configured`stuff`

src/__tests__/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,9 @@ pluginTester({
208208
const red = macro('noop')
209209
`,
210210
babelOptions: {
211-
presets: ['babel-preset-env'],
211+
plugins: [
212+
require.resolve('babel-plugin-transform-es2015-modules-commonjs'),
213+
],
212214
},
213215
},
214216
{

src/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ function applyMacros({
178178
const macro = interopRequire(requirePath)
179179
if (!macro.isBabelMacro) {
180180
throw new Error(
181-
// eslint-disable-next-line prefer-template
182181
`The macro imported from "${source}" must be wrapped in "createMacro" ` +
183182
`which you can get from "babel-plugin-macros". ` +
184183
`Please refer to the documentation to see how to do this properly: https://github.com/kentcdodds/babel-plugin-macros/blob/master/other/docs/author.md#writing-a-macro`,

0 commit comments

Comments
 (0)