Skip to content

Commit

Permalink
fix(deps): upgrade all deps
Browse files Browse the repository at this point in the history
Closes #107
  • Loading branch information
Kent C. Dodds committed Mar 29, 2019
1 parent bfb5b21 commit e0ebca7
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 42 deletions.
27 changes: 15 additions & 12 deletions other/babel-config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
const babelConfig = require('kcd-scripts/babel')

// we don't want to use babel-macros inside babel-macros...
// and until kcd-scripts gets upgraded to babel-plugin-macros
// we'll have both of those referenced here...
babelConfig.plugins = babelConfig.plugins.filter(
pluginPath =>
!pluginPath.includes('babel-macros/') &&
!pluginPath.includes('babel-plugin-macros/'),
)
const envPreset = babelConfig.presets.find(
p => p[0] && p[0].includes('preset-env'),
)
envPreset[1].modules = 'commonjs'
module.exports = babelConfig
const getBabelConfig = require('kcd-scripts/babel')

module.exports = (...args) => {
const babelConfig = getBabelConfig(...args)
babelConfig.plugins = babelConfig.plugins.filter(
pluginPath =>
!pluginPath.includes('babel-macros/') &&
!pluginPath.includes('babel-plugin-macros/'),
)
const envPreset = babelConfig.presets.find(
p => p[0] && p[0].includes('preset-env'),
)
envPreset[1].modules = 'commonjs'
return babelConfig
}
26 changes: 16 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@
"test": "kcd-scripts test",
"test:update": "npm test -- --updateSnapshot",
"validate": "kcd-scripts validate",
"setup": "npm install && npm run validate -s",
"precommit": "kcd-scripts precommit"
"setup": "npm install && npm run validate -s"
},
"husky": {
"hooks": {
"pre-commit": "kcd-scripts pre-commit"
}
},
"files": [
"dist"
Expand All @@ -28,17 +32,19 @@
"author": "Kent C. Dodds <[email protected]> (http://kentcdodds.com/)",
"license": "MIT",
"dependencies": {
"cosmiconfig": "^5.0.5",
"resolve": "^1.8.1"
"@babel/runtime": "^7.4.2",
"cosmiconfig": "^5.2.0",
"resolve": "^1.10.0"
},
"devDependencies": {
"@babel/core": "^7.1.0",
"@babel/parser": "^7.1.0",
"@babel/types": "^7.0.0",
"@babel/core": "^7.4.0",
"@babel/parser": "^7.4.2",
"@babel/types": "^7.4.0",
"ast-pretty-print": "^2.0.1",
"babel-plugin-tester": "^5.0.0",
"cpy": "^7.0.0",
"kcd-scripts": "^0.32.1"
"babel-plugin-tester": "^6.0.1",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
"cpy": "^7.1.0",
"kcd-scripts": "^1.1.3"
},
"eslintConfig": {
"extends": "./node_modules/kcd-scripts/eslint.js"
Expand Down
30 changes: 12 additions & 18 deletions src/__tests__/__snapshots__/index.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const Div = STYLED.div\`
↓ ↓ ↓ ↓ ↓ ↓
const red = "background-color: red;";
const Div = STYLED.div\`undefined\`;
`;
Expand All @@ -50,7 +49,7 @@ errorThrower('hi')
↓ ↓ ↓ ↓ ↓ ↓
Error: babel-plugin-macros-test-error-thrower/macro: not helpful Learn more: https://www.npmjs.com/package/babel-plugin-macros-test-error-thrower
Error: not helpful Learn more: https://www.npmjs.com/package/babel-plugin-macros-test-error-thrower
`;

Expand All @@ -61,7 +60,7 @@ errorThrower('hi')
↓ ↓ ↓ ↓ ↓ ↓
Error: babel-plugin-macros-test-error-thrower.macro: not helpful Learn more: https://www.npmjs.com/package/babel-plugin-macros-test-error-thrower.macro
Error: not helpful Learn more: https://www.npmjs.com/package/babel-plugin-macros-test-error-thrower.macro
`;

Expand Down Expand Up @@ -92,10 +91,12 @@ exports[`macros macros can set their configName and get their config: macros can
import configured from './configurable.macro'
// eslint-disable-next-line babel/no-unused-expressions
configured\`stuff\`
↓ ↓ ↓ ↓ ↓ ↓
// eslint-disable-next-line babel/no-unused-expressions
configured\`stuff\`;
`;
Expand All @@ -120,6 +121,7 @@ const red = macro('noop');
↓ ↓ ↓ ↓ ↓ ↓
const macro = require('./fixtures/keep-imports.macro');
const red = macro('noop');
`;
Expand All @@ -131,15 +133,8 @@ const red = macro('noop')
↓ ↓ ↓ ↓ ↓ ↓
"use strict";
var _keepImports = require("./fixtures/keep-imports.macro");
var _keepImports2 = _interopRequireDefault(_keepImports);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var red = (0, _keepImports2.default)('noop');
import macro from './fixtures/keep-imports.macro';
const red = macro('noop');
`;

Expand All @@ -150,7 +145,7 @@ errorThrower('hey')
↓ ↓ ↓ ↓ ↓ ↓
Error: ./fixtures/error-thrower.macro: very unhelpful
Error: very unhelpful
`;

Expand Down Expand Up @@ -182,7 +177,6 @@ const Div = styled.div\`
const red = css\`
background-color: red;
\`;
const Div = styled.div\`
composes: \${red}
color: blue;
Expand All @@ -208,7 +202,7 @@ unwrapped('hey')
↓ ↓ ↓ ↓ ↓ ↓
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
Error: https://github.com/kentcdodds/babel-plugin-macros/blob/master/other/docs/author.md#writing-a-macro
`;
Expand All @@ -223,7 +217,6 @@ global.result = result
↓ ↓ ↓ ↓ ↓ ↓
const result = ("foobar", 42);
global.result = result;
`;
Expand All @@ -238,6 +231,7 @@ exports[`macros when there is an error reading the config, a helpful message is
import configured from './configurable.macro'
// eslint-disable-next-line babel/no-unused-expressions
configured\`stuff\`
↓ ↓ ↓ ↓ ↓ ↓
Expand All @@ -250,10 +244,12 @@ exports[`macros when there is no config to load, then no config is passed: when
import configured from './configurable.macro'
// eslint-disable-next-line babel/no-unused-expressions
configured\`stuff\`
↓ ↓ ↓ ↓ ↓ ↓
// eslint-disable-next-line babel/no-unused-expressions
configured\`stuff\`;
`;
Expand Down Expand Up @@ -295,7 +291,6 @@ const Div = STYLED.div\`
↓ ↓ ↓ ↓ ↓ ↓
const red = "background-color: red;";
const Div = STYLED.div\`undefined\`;
`;
Expand All @@ -315,7 +310,6 @@ const Div = styled.div\`
↓ ↓ ↓ ↓ ↓ ↓
const red = "background-color: red;";
const Div = styled.div\`undefined\`;
`;
Expand Down
1 change: 1 addition & 0 deletions src/__tests__/fixtures/config/code.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import configured from './configurable.macro'

// eslint-disable-next-line babel/no-unused-expressions
configured`stuff`
4 changes: 3 additions & 1 deletion src/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ pluginTester({
const red = macro('noop')
`,
babelOptions: {
presets: ['babel-preset-env'],
plugins: [
require.resolve('babel-plugin-transform-es2015-modules-commonjs'),
],
},
},
{
Expand Down
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ function applyMacros({
const macro = interopRequire(requirePath)
if (!macro.isBabelMacro) {
throw new Error(
// eslint-disable-next-line prefer-template
`The macro imported from "${source}" 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`,
Expand Down

0 comments on commit e0ebca7

Please sign in to comment.