Skip to content

Commit

Permalink
feat: upgrade all deps
Browse files Browse the repository at this point in the history
  • Loading branch information
Kent C. Dodds committed May 14, 2019
1 parent 400e5b9 commit e872e0f
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 41 deletions.
58 changes: 29 additions & 29 deletions package.json
Expand Up @@ -34,58 +34,58 @@
"author": "Kent C. Dodds <kent@doddsfamily.us> (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": [
Expand Down Expand Up @@ -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"
}
}
20 changes: 10 additions & 10 deletions 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(() => {})}))

Expand All @@ -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)
})

Expand All @@ -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')
})
Expand Down Expand Up @@ -106,23 +106,23 @@ 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)
expect(require('../utils').ifAnyDep('preact', t, f)).toBe(f)
})

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)
expect(require('../utils').ifAnyDep(['preact', 'webpack'], t, f)).toBe(f)
})

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)
Expand All @@ -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}))
}
5 changes: 4 additions & 1 deletion src/config/rollup.config.js
Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion src/utils.js
Expand Up @@ -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)
Expand Down

0 comments on commit e872e0f

Please sign in to comment.