From 87abce08d3102153717f92e59684a143213cb7f7 Mon Sep 17 00:00:00 2001 From: Dustin Tauer Date: Fri, 25 Mar 2022 15:30:29 -0500 Subject: [PATCH] 2022 updates --- .prettierrc | 2 +- .travis.yml | 2 +- README.md | 4 +- appveyor.yml | 2 +- babel.config.json | 3 ++ client/jest.config.js | 4 +- cypress/support/index.js | 5 ++- other/whats-a-mock/.babelrc | 12 ------ package.json | 62 +++++++++++++++------------- server/dev.js | 2 +- server/package.json | 15 +++---- server/test/til-server-test-utils.js | 1 + shared/generate.js | 1 + 13 files changed, 54 insertions(+), 61 deletions(-) create mode 100644 babel.config.json delete mode 100644 other/whats-a-mock/.babelrc diff --git a/.prettierrc b/.prettierrc index 68f30bd7..fb31ee19 100644 --- a/.prettierrc +++ b/.prettierrc @@ -4,7 +4,7 @@ "useTabs": false, "semi": false, "singleQuote": true, - "trailingComma": 'all', + "trailingComma": "all", "bracketSpacing": false, "jsxBracketSameLine": false } diff --git a/.travis.yml b/.travis.yml index 892dc664..f6a0f770 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ sudo: false language: node_js -node_js: 8 +node_js: 16 addons: apt: packages: diff --git a/README.md b/README.md index 0ac35352..e129a615 100644 --- a/README.md +++ b/README.md @@ -74,8 +74,8 @@ you're working with. ## System Requirements - [git][git] v2.14.1 or greater -- [NodeJS][node] v8.9.4 or greater -- [npm][npm] v5.6.0 or greater +- [NodeJS][node] v16.13.1 or greater +- [npm][npm] v8.3.0 or greater All of these must be available in your `PATH`. To verify things are set up properly, you can run this: diff --git a/appveyor.yml b/appveyor.yml index 4b0e7edf..d8f14a03 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,6 @@ environment: matrix: - - node_version: "8" + - node_version: "16" branches: only: diff --git a/babel.config.json b/babel.config.json new file mode 100644 index 00000000..ff3059c3 --- /dev/null +++ b/babel.config.json @@ -0,0 +1,3 @@ +{ + "presets": ["@babel/preset-env"] +} \ No newline at end of file diff --git a/client/jest.config.js b/client/jest.config.js index 5c0d9b4d..b37e9d88 100644 --- a/client/jest.config.js +++ b/client/jest.config.js @@ -5,9 +5,7 @@ module.exports = { url: 'https://til.test.com', }, testPathIgnorePatterns: ['/node_modules/', '/helpers/'], - setupTestFrameworkScriptFile: require.resolve( - './test/setup-test-framework.js', - ), + setupFilesAfterEnv: ['./test/setup-test-framework.js'], modulePaths: ['/src', '/test'], moduleNameMapper: { '\\.svg$': '/test/svg-file-mock.js', diff --git a/cypress/support/index.js b/cypress/support/index.js index 793e84cd..b8dd6286 100644 --- a/cypress/support/index.js +++ b/cypress/support/index.js @@ -1,3 +1,4 @@ -import 'babel-polyfill' -import 'cypress-testing-library/add-commands' +import "core-js/stable"; +import "regenerator-runtime/runtime"; +import '@testing-library/cypress' import './commands' diff --git a/other/whats-a-mock/.babelrc b/other/whats-a-mock/.babelrc deleted file mode 100644 index 0c2b576e..00000000 --- a/other/whats-a-mock/.babelrc +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - [ - "env", - { - "targets": { - "node": "current" - } - } - ] - ] -} diff --git a/package.json b/package.json index fe0ea141..b7abe20d 100644 --- a/package.json +++ b/package.json @@ -36,38 +36,37 @@ "setup": "node ./scripts/verify && node ./scripts/install && npm run validate && node ./scripts/autofill-feedback-email.js" }, "devDependencies": { - "all-contributors-cli": "4.10.1", - "as-a": "1.3.1", - "axios": "0.18.0", - "babel-polyfill": "6.26.0", - "babel-preset-env": "1.6.1", + "@babel/plugin-transform-runtime": "^7.17.0", + "@babel/preset-env": "7.16.11", + "@testing-library/cypress": "^8.0.2", + "all-contributors-cli": "6.20.0", + "as-a": "2.2.0", + "axios": "0.26.1", "child-process-promise": "2.2.1", - "concurrently": "3.5.1", - "cross-env": "5.1.3", - "cross-spawn": "6.0.4", - "cypress": "2.0.2", - "cypress-testing-library": "1.0.1", - "doctoc": "1.3.0", - "eslint": "4.18.0", - "eslint-config-kentcdodds": "13.0.1", - "eslint-import-resolver-jest": "2.1.1", - "eslint-plugin-cypress": "2.0.1", - "faker": "4.1.0", - "fs-extra": "5.0.0", - "husky": "0.14.3", - "inquirer": "5.2.0", - "is-ci": "1.1.0", - "jest": "22.1.2", - "lint-staged": "7.0.4", + "concurrently": "7.0.0", + "cross-env": "7.0.3", + "cross-spawn": "7.0.3", + "cypress": "9.5.2", + "doctoc": "2.1.0", + "eslint": "8.11.0", + "eslint-config-kentcdodds": "20.1.0", + "eslint-import-resolver-jest": "3.0.2", + "eslint-plugin-cypress": "2.12.1", + "faker": "6.6.6", + "fs-extra": "10.0.1", + "husky": "7.0.4", + "inquirer": "8.2.1", + "is-ci": "3.0.1", + "jest": "27.5.1", + "lint-staged": "12.3.7", "lodash.omit": "4.5.0", - "node": "8.9.4", - "npm-run-all": "4.1.2", - "prettier": "1.12.0", + "npm-run-all": "4.1.5", + "prettier": "2.6.0", "react": "16.3.1", - "react-dom": "16.3.1", + "react-dom": "16.3.3", "react-test-renderer": "16.3.1", - "replace-in-file": "3.4.0", - "rimraf": "2.6.2" + "replace-in-file": "6.3.2", + "rimraf": "3.0.2" }, "lint-staged": { "linters": { @@ -118,5 +117,10 @@ "coverage", "workshop-setup.js", "other/coverage-example" - ] + ], + "dependencies": { + "@babel/runtime": "^7.17.8", + "core-js": "^3.21.1", + "regenerator-runtime": "^0.13.9" + } } diff --git a/server/dev.js b/server/dev.js index 2b65abe2..982ca8ae 100644 --- a/server/dev.js +++ b/server/dev.js @@ -1,5 +1,5 @@ ;(async () => { - require('babel-register') + require('@babel/register') const serverTestUtils = require('./test/til-server-test-utils') await serverTestUtils.initDb() await serverTestUtils.insertTestUser() diff --git a/server/package.json b/server/package.json index 61f324c0..a9dd0187 100644 --- a/server/package.json +++ b/server/package.json @@ -14,6 +14,7 @@ "author": "Kent C. Dodds (http://kentcdodds.com/)", "license": "MIT", "dependencies": { + "@babel/polyfill": "^7.12.1", "axios": "0.18.0", "body-parser": "1.18.2", "cors": "2.8.4", @@ -35,20 +36,16 @@ }, "babel": { "presets": [ - [ - "env", - { - "targets": { - "node": "current" - } - } - ] + "@babel/preset-env" ], "plugins": [ - "transform-object-rest-spread" + "transform-object-rest-spread", + "@babel/plugin-transform-runtime" ] }, "devDependencies": { + "@babel/core": "^7.17.8", + "@babel/register": "^7.17.7", "babel-cli": "6.26.0", "babel-core": "6.26.0", "babel-plugin-transform-object-rest-spread": "6.26.0", diff --git a/server/test/til-server-test-utils.js b/server/test/til-server-test-utils.js index f0f30dff..36259a80 100644 --- a/server/test/til-server-test-utils.js +++ b/server/test/til-server-test-utils.js @@ -4,6 +4,7 @@ // actually can run synchronously. import * as generate from 'til-shared/generate' import db from '../src/utils/db' +import '@babel/polyfill' async function initDb({ users = Array.from({length: 10}, () => diff --git a/shared/generate.js b/shared/generate.js index 1cc88270..9b19989e 100644 --- a/shared/generate.js +++ b/shared/generate.js @@ -1,3 +1,4 @@ +/* eslint-disable prefer-object-spread */ const omit = require('lodash.omit') const faker = require('faker') const {getSaltAndHash, getUserToken} = require('./auth')