From e872e0f3a947b197366b34b0afaf49190ba3141f Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Tue, 14 May 2019 13:49:34 -0600 Subject: [PATCH] feat: upgrade all deps --- package.json | 58 ++++++++++++++++++------------------- src/__tests__/utils.js | 20 ++++++------- src/config/rollup.config.js | 5 +++- src/utils.js | 2 +- 4 files changed, 44 insertions(+), 41 deletions(-) diff --git a/package.json b/package.json index db83ce04..4cb81de4 100644 --- a/package.json +++ b/package.json @@ -34,58 +34,58 @@ "author": "Kent C. Dodds (http://kentcdodds.com/)", "license": "MIT", "dependencies": { - "@babel/cli": "^7.2.0", - "@babel/core": "^7.4.0", - "@babel/plugin-proposal-class-properties": "^7.4.0", - "@babel/plugin-transform-modules-commonjs": "^7.4.0", - "@babel/plugin-transform-runtime": "^7.4.0", - "@babel/preset-env": "^7.4.2", + "@babel/cli": "^7.4.4", + "@babel/core": "^7.4.4", + "@babel/plugin-proposal-class-properties": "^7.4.4", + "@babel/plugin-transform-modules-commonjs": "^7.4.4", + "@babel/plugin-transform-runtime": "^7.4.4", + "@babel/preset-env": "^7.4.4", "@babel/preset-flow": "^7.0.0", "@babel/preset-react": "^7.0.0", - "@babel/runtime": "^7.4.2", - "arrify": "^1.0.1", + "@babel/runtime": "^7.4.4", + "arrify": "^2.0.1", "babel-core": "^7.0.0-0", - "babel-jest": "^24.5.0", - "babel-plugin-macros": "^2.4.2", + "babel-jest": "^24.8.0", + "babel-plugin-macros": "^2.5.1", "babel-plugin-minify-dead-code-elimination": "^0.5.0", "babel-plugin-module-resolver": "^3.1.1", "babel-plugin-transform-inline-environment-variables": "^0.4.0", "babel-plugin-transform-react-remove-prop-types": "^0.4.21", - "browserslist": "^4.5.2", + "browserslist": "^4.6.0", "concurrently": "^4.1.0", "cross-env": "^5.1.4", "cross-spawn": "^6.0.5", "doctoc": "^1.4.0", - "eslint": "^5.15.3", - "eslint-config-kentcdodds": "^14.3.1", - "eslint-config-prettier": "^4.1.0", - "glob": "^7.1.2", - "husky": "^1.2.0", + "eslint": "^5.16.0", + "eslint-config-kentcdodds": "^14.3.2", + "eslint-config-prettier": "^4.2.0", + "glob": "^7.1.4", + "husky": "^2.3.0", "is-ci": "^2.0.0", - "jest": "^24.5.0", - "jest-watch-typeahead": "^0.2.1", - "lint-staged": "^8.1.0", + "jest": "^24.8.0", + "jest-watch-typeahead": "^0.3.1", + "lint-staged": "^8.1.6", "lodash.camelcase": "^4.3.0", "lodash.has": "^4.5.2", "lodash.omit": "^4.5.0", "mkdirp": "^0.5.1", - "prettier": "^1.15.3", - "read-pkg-up": "^5.0.0", - "resolve": "^1.6.0", + "prettier": "^1.17.1", + "read-pkg-up": "^6.0.0", + "resolve": "^1.10.1", "rimraf": "^2.6.2", - "rollup": "^1.7.3", + "rollup": "^1.11.3", "rollup-plugin-babel": "^4.0.0", - "rollup-plugin-commonjs": "^9.2.2", + "rollup-plugin-commonjs": "^9.3.4", "rollup-plugin-json": "^4.0.0", "rollup-plugin-node-builtins": "^2.1.2", "rollup-plugin-node-globals": "^1.4.0", - "rollup-plugin-node-resolve": "^4.0.1", - "rollup-plugin-replace": "^2.1.1", + "rollup-plugin-node-resolve": "^4.2.4", + "rollup-plugin-replace": "^2.2.0", "rollup-plugin-size-snapshot": "^0.8.0", "rollup-plugin-terser": "^4.0.4", - "semver": "^5.6.0", + "semver": "^6.0.0", "which": "^1.3.0", - "yargs-parser": "^13.0.0" + "yargs-parser": "^13.1.0" }, "eslintConfig": { "extends": [ @@ -116,6 +116,6 @@ "homepage": "https://github.com/kentcdodds/kcd-scripts#readme", "devDependencies": { "jest-in-case": "^1.0.2", - "slash": "^2.0.0" + "slash": "^3.0.0" } } diff --git a/src/__tests__/utils.js b/src/__tests__/utils.js index e2462759..e812bffe 100644 --- a/src/__tests__/utils.js +++ b/src/__tests__/utils.js @@ -1,5 +1,5 @@ jest.mock('read-pkg-up', () => ({ - sync: jest.fn(() => ({pkg: {}, path: '/blah/package.json'})), + sync: jest.fn(() => ({package: {}, path: '/blah/package.json'})), })) jest.mock('which', () => ({sync: jest.fn(() => {})})) @@ -11,9 +11,9 @@ beforeEach(() => { readPkgUpSyncMock = require('read-pkg-up').sync }) -test('pkg is the package.json', () => { +test('package is the package.json', () => { const myPkg = {name: 'blah'} - mockPkg({pkg: myPkg}) + mockPkg({package: myPkg}) expect(require('../utils').pkg).toBe(myPkg) }) @@ -24,14 +24,14 @@ test('appDirectory is the dirname to the package.json', () => { }) test('resolveKcdScripts resolves to src/index.js when in the kcd-scripts package', () => { - mockPkg({pkg: {name: 'kcd-scripts'}}) + mockPkg({package: {name: 'kcd-scripts'}}) expect(require('../utils').resolveKcdScripts()).toBe( require.resolve('../').replace(process.cwd(), '.'), ) }) test('resolveKcdScripts resolves to kcd-scripts if not in the kcd-scripts package', () => { - mockPkg({pkg: {name: 'not-kcd-scripts'}}) + mockPkg({package: {name: 'not-kcd-scripts'}}) whichSyncMock.mockImplementationOnce(() => require.resolve('../')) expect(require('../utils').resolveKcdScripts()).toBe('kcd-scripts') }) @@ -106,7 +106,7 @@ test(`parseEnv returns the default if the environment variable doesn't exist`, ( }) test('ifAnyDep returns the true argument if true and false argument if false', () => { - mockPkg({pkg: {peerDependencies: {react: '*'}}}) + mockPkg({package: {peerDependencies: {react: '*'}}}) const t = {a: 'b'} const f = {c: 'd'} expect(require('../utils').ifAnyDep('react', t, f)).toBe(t) @@ -114,7 +114,7 @@ test('ifAnyDep returns the true argument if true and false argument if false', ( }) test('ifAnyDep works with arrays of dependencies', () => { - mockPkg({pkg: {peerDependencies: {react: '*'}}}) + mockPkg({package: {peerDependencies: {react: '*'}}}) const t = {a: 'b'} const f = {c: 'd'} expect(require('../utils').ifAnyDep(['preact', 'react'], t, f)).toBe(t) @@ -122,7 +122,7 @@ test('ifAnyDep works with arrays of dependencies', () => { }) test('ifScript returns the true argument if true and the false argument if false', () => { - mockPkg({pkg: {scripts: {build: 'echo build'}}}) + mockPkg({package: {scripts: {build: 'echo build'}}}) const t = {e: 'f'} const f = {g: 'h'} expect(require('../utils').ifScript('build', t, f)).toBe(t) @@ -137,6 +137,6 @@ test('ifFile returns the true argument if true and the false argument if false', expect(require('../utils').ifFile('does-not-exist.blah', t, f)).toBe(f) }) -function mockPkg({pkg = {}, path = '/blah/package.json'}) { - readPkgUpSyncMock.mockImplementationOnce(() => ({pkg, path})) +function mockPkg({package: pkg = {}, path = '/blah/package.json'}) { + readPkgUpSyncMock.mockImplementationOnce(() => ({package: pkg, path})) } diff --git a/src/config/rollup.config.js b/src/config/rollup.config.js index 0737db85..268b5efe 100644 --- a/src/config/rollup.config.js +++ b/src/config/rollup.config.js @@ -143,7 +143,10 @@ module.exports = { plugins: [ isNode ? nodeBuiltIns() : null, isNode ? nodeGlobals() : null, - nodeResolve({preferBuiltins: isNode, jsnext: true, main: true}), + nodeResolve({ + preferBuiltins: isNode, + mainFields: ['module', 'main', 'jsnext', 'browser'], + }), commonjs({include: 'node_modules/**'}), json(), rollupBabel({ diff --git a/src/utils.js b/src/utils.js index ff2e9aa7..7847f776 100644 --- a/src/utils.js +++ b/src/utils.js @@ -7,7 +7,7 @@ const has = require('lodash.has') const readPkgUp = require('read-pkg-up') const which = require('which') -const {pkg, path: pkgPath} = readPkgUp.sync({ +const {package: pkg, path: pkgPath} = readPkgUp.sync({ cwd: fs.realpathSync(process.cwd()), }) const appDirectory = path.dirname(pkgPath)