Jelajahi Sumber

Upgrade Babel to v7 and Jest to 24

Renée Kooi 6 tahun lalu
induk
melakukan
aced95aad2
5 mengubah file dengan 3136 tambahan dan 3304 penghapusan
  1. 0 13
      .babelrc
  2. 21 0
      babel.config.js
  3. 3 3
      bin/build-lib.js
  4. 3099 3275
      package-lock.json
  5. 13 13
      package.json

+ 0 - 13
.babelrc

@@ -1,13 +0,0 @@
-{
-  "presets": [
-    ["env", {
-      "modules": false,
-      "loose": true
-    }]
-  ],
-  "plugins": [
-    "transform-object-rest-spread",
-    "transform-object-assign",
-    ["transform-react-jsx", { "pragma":"h" }]
-  ]
-}

+ 21 - 0
babel.config.js

@@ -0,0 +1,21 @@
+module.exports = (api) => {
+  let targets = {}
+  if (api.env('test')) {
+    targets.node = 'current'
+  }
+
+  return {
+    presets: [
+      ['@babel/preset-env', {
+        modules: false,
+        loose: true,
+        targets
+      }]
+    ],
+    plugins: [
+      '@babel/plugin-proposal-object-rest-spread',
+      '@babel/plugin-transform-object-assign',
+      ['@babel/plugin-transform-react-jsx', { pragma: 'h' }]
+    ]
+  }
+}

+ 3 - 3
bin/build-lib.js

@@ -1,5 +1,5 @@
 const chalk = require('chalk')
-const babel = require('babel-core')
+const babel = require('@babel/core')
 const { promisify } = require('util')
 const glob = promisify(require('glob'))
 const mkdirp = promisify(require('mkdirp'))
@@ -15,7 +15,7 @@ const SOURCE = 'packages/{*,@uppy/*}/src/**/*.js'
 const IGNORE = /\.test\.js$|__mocks__|companion\//
 // Files that should trigger a rebuild of everything on change
 const META_FILES = [
-  '.babelrc',
+  'babel.config.js',
   'package.json',
   'package-lock.json',
   'bin/build-lib.js'
@@ -57,7 +57,7 @@ async function buildLib () {
   }
 }
 
-console.log('Using Babel version:', require('babel-core/package.json').version)
+console.log('Using Babel version:', require('@babel/core/package.json').version)
 buildLib().catch((err) => {
   console.error(err.stack)
   process.exit(1)

File diff ditekan karena terlalu besar
+ 3099 - 3275
package-lock.json


+ 13 - 13
package.json

@@ -9,21 +9,21 @@
   "pre-commit": "lint:staged",
   "license": "MIT",
   "devDependencies": {
+    "@babel/cli": "^7.4.4",
+    "@babel/core": "^7.4.4",
+    "@babel/plugin-proposal-object-rest-spread": "^7.4.4",
+    "@babel/plugin-transform-object-assign": "^7.2.0",
+    "@babel/plugin-transform-proto-to-assign": "^7.4.4",
+    "@babel/plugin-transform-react-jsx": "^7.3.0",
+    "@babel/polyfill": "^7.4.4",
+    "@babel/preset-env": "^7.4.4",
+    "@babel/register": "^7.4.4",
     "@octokit/rest": "^16.25.0",
     "@types/react": "^16.8.10",
     "aliasify": "^2.1.0",
     "autoprefixer": "^7.2.6",
-    "babel-cli": "^6.26.0",
-    "babel-core": "^6.26.3",
-    "babel-jest": "^23.6.0",
-    "babel-plugin-transform-object-assign": "^6.22.0",
-    "babel-plugin-transform-object-rest-spread": "^6.26.0",
-    "babel-plugin-transform-proto-to-assign": "^6.26.0",
-    "babel-plugin-transform-react-jsx": "^6.24.1",
-    "babel-polyfill": "^6.26.0",
-    "babel-preset-env": "^1.7.0",
-    "babel-register": "^6.26.0",
-    "babelify": "^8.0.0",
+    "babel-jest": "^24.0.0",
+    "babelify": "^10.0.0",
     "browser-resolve": "^1.11.3",
     "browser-sync": "^2.26.3",
     "browserify": "^16.2.3",
@@ -50,7 +50,7 @@
     "glob": "^7.1.3",
     "gzip-size": "^5.0.0",
     "isomorphic-fetch": "2.2.1",
-    "jest": "^23.6.0",
+    "jest": "^24.0.0",
     "json3": "^3.3.2",
     "lerna": "^3.13.4",
     "lint-staged": "^6.1.1",
@@ -142,7 +142,7 @@
     "automock": false,
     "collectCoverage": true,
     "collectCoverageFrom": [
-      "packages/**/src/**"
+      "packages/**/src/**/*.js"
     ],
     "testMatch": [
       "**/packages/**/*.test.js"

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini