From ecf648dbfb9784cec7b31085bc905d75201ea563 Mon Sep 17 00:00:00 2001 From: Julien Benchetrit Date: Sun, 2 Sep 2018 13:00:47 +0300 Subject: [PATCH 1/4] Added missing babel-core bridge dependency and upgraded some packages to help the babel 6 => 7 transition --- package-lock.json | 108 +++++++++++++++++++++++----------------------- package.json | 10 ++--- 2 files changed, 60 insertions(+), 58 deletions(-) diff --git a/package-lock.json b/package-lock.json index e0762fae27..641bee5ae2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2050,9 +2050,9 @@ } }, "babel-loader": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.0.0.tgz", - "integrity": "sha512-lBUGBz411lSfT+8MHPEaqIVQ44odS1D/wxuTMhijqHc9arZR6jhJEaJa0RpZlCSITZoeK6xoDXTaVTrSoFD7IQ==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.0.1.tgz", + "integrity": "sha512-K5m4ivjWMEBTRkLkQMEBrOM8B1TxhniBKHrCemjeSFiHz4H8EopRgEhCtFSXhlriAcfFFwIelsLfx8urcaghLA==", "dev": true, "requires": { "find-cache-dir": "^1.0.0", @@ -2119,14 +2119,13 @@ } }, "babel-plugin-styled-components": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/babel-plugin-styled-components/-/babel-plugin-styled-components-1.5.1.tgz", - "integrity": "sha1-MdvraW0TVNFYXmDWbHkF9eR0r80=", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/babel-plugin-styled-components/-/babel-plugin-styled-components-1.6.0.tgz", + "integrity": "sha512-ilq495iB45Ifh70j8YBPwbTXpKG8E9P4V+ib2SWKT2eEGXtH9TPvfpvVPv37ZOxdYcxCwlnlKWdQuGzAyQb+7w==", "dev": true, "requires": { - "@babel/helper-annotate-as-pure": "^7.0.0-beta.37", - "babel-types": "^6.26.0", - "stylis": "^3.0.0" + "lodash": "^4.17.10", + "semver": "^5.5.1" } }, "babel-plugin-syntax-dynamic-import": { @@ -3048,9 +3047,9 @@ "dev": true }, "chardet": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz", - "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "dev": true }, "cheerio": { @@ -4650,9 +4649,9 @@ } }, "enzyme-adapter-react-16": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.3.0.tgz", - "integrity": "sha512-TRX+Y5QPreGmqfFU3bPsJUmqNZX9paQCmQ93kj7hnfQoZzufO/pahGN/OviWn60YcgaQojhf0AWv3PxrIDARbA==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.3.1.tgz", + "integrity": "sha512-BFD5aBZwuN8buSPl5eZpYiqx6AqRgw2G/dP+P5/ttC8vxNpLTgpr7iHo1dszfFrA44d41S5SGdhE4mNdB4hZqA==", "dev": true, "requires": { "enzyme-adapter-utils": "^1.6.0", @@ -4665,9 +4664,9 @@ } }, "enzyme-adapter-utils": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/enzyme-adapter-utils/-/enzyme-adapter-utils-1.6.1.tgz", - "integrity": "sha512-MH8Tbe/e6UlVGBTxO5vb2gHv/wqAU2j/I72nuVGHyb0TxzfZOttJopJea7/5ZgmwBSeqqcaRnd/B87//RDJ9/w==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/enzyme-adapter-utils/-/enzyme-adapter-utils-1.7.0.tgz", + "integrity": "sha512-K5FVpGxMlakvvWS6TkwogAzvMRE4pgve6grPzCuraVHRBzgrmeasGDF1CS2rQc7uKo7OF0FQZxaQm8oJAKXFVw==", "dev": true, "requires": { "function.prototype.name": "^1.1.0", @@ -4781,13 +4780,13 @@ } }, "eslint": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.4.0.tgz", - "integrity": "sha512-UIpL91XGex3qtL6qwyCQJar2j3osKxK9e3ano3OcGEIRM4oWIpCkDg9x95AXEC2wMs7PnxzOkPZ2gq+tsMS9yg==", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.5.0.tgz", + "integrity": "sha512-m+az4vYehIJgl1Z0gb25KnFXeqQRdNreYsei1jdvkd9bB+UNQD3fsuiC2AWSQ56P+/t++kFSINZXFbfai+krOw==", "dev": true, "requires": { - "ajv": "^6.5.0", - "babel-code-frame": "^6.26.0", + "@babel/code-frame": "^7.0.0", + "ajv": "^6.5.3", "chalk": "^2.1.0", "cross-spawn": "^6.0.5", "debug": "^3.1.0", @@ -4802,11 +4801,11 @@ "functional-red-black-tree": "^1.0.1", "glob": "^7.1.2", "globals": "^11.7.0", - "ignore": "^4.0.2", + "ignore": "^4.0.6", "imurmurhash": "^0.1.4", - "inquirer": "^5.2.0", + "inquirer": "^6.1.0", "is-resolvable": "^1.1.0", - "js-yaml": "^3.11.0", + "js-yaml": "^3.12.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.3.0", "lodash": "^4.17.5", @@ -4819,7 +4818,7 @@ "progress": "^2.0.0", "regexpp": "^2.0.0", "require-uncached": "^1.0.3", - "semver": "^5.5.0", + "semver": "^5.5.1", "strip-ansi": "^4.0.0", "strip-json-comments": "^2.0.1", "table": "^4.0.3", @@ -5498,14 +5497,25 @@ } }, "external-editor": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", - "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.3.tgz", + "integrity": "sha512-bn71H9+qWoOQKyZDo25mOMVpSmXROAsTJVVVYzrrtol3d4y+AsKjf4Iwl2Q+IuT0kFSQ1qo166UuIwqYq7mGnA==", "dev": true, "requires": { - "chardet": "^0.4.0", - "iconv-lite": "^0.4.17", + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", "tmp": "^0.0.33" + }, + "dependencies": { + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + } } }, "extglob": { @@ -7833,21 +7843,21 @@ "dev": true }, "inquirer": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-5.2.0.tgz", - "integrity": "sha512-E9BmnJbAKLPGonz0HeWHtbKf+EeSP93paWO3ZYoUpq/aowXvYGjjCSuashhXPpzbArIjBbji39THkxTz9ZeEUQ==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.2.0.tgz", + "integrity": "sha512-QIEQG4YyQ2UYZGDC4srMZ7BjHOmNk1lR2JQj5UknBapklm6WHA+VVH7N+sUdX3A7NeCfGF8o4X1S3Ao7nAcIeg==", "dev": true, "requires": { "ansi-escapes": "^3.0.0", "chalk": "^2.0.0", "cli-cursor": "^2.1.0", "cli-width": "^2.0.0", - "external-editor": "^2.1.0", + "external-editor": "^3.0.0", "figures": "^2.0.0", - "lodash": "^4.3.0", + "lodash": "^4.17.10", "mute-stream": "0.0.7", "run-async": "^2.2.0", - "rxjs": "^5.5.2", + "rxjs": "^6.1.0", "string-width": "^2.1.0", "strip-ansi": "^4.0.0", "through": "^2.3.6" @@ -14379,20 +14389,12 @@ } }, "rxjs": { - "version": "5.5.11", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.5.11.tgz", - "integrity": "sha512-3bjO7UwWfA2CV7lmwYMBzj4fQ6Cq+ftHc2MvUe+WMS7wcdJ1LosDWmdjPQanYp2dBRj572p7PeU81JUxHKOcBA==", + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.3.2.tgz", + "integrity": "sha512-hV7criqbR0pe7EeL3O66UYVg92IR0XsA97+9y+BWTePK9SKmEI5Qd3Zj6uPnGkNzXsBywBQWTvujPl+1Kn9Zjw==", "dev": true, "requires": { - "symbol-observable": "1.0.1" - }, - "dependencies": { - "symbol-observable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.1.tgz", - "integrity": "sha1-g0D8RwLDEi310iKI+IKD9RPT/dQ=", - "dev": true - } + "tslib": "^1.9.0" } }, "safe-buffer": { @@ -17596,9 +17598,9 @@ } }, "webpack-hot-middleware": { - "version": "2.22.3", - "resolved": "https://registry.npmjs.org/webpack-hot-middleware/-/webpack-hot-middleware-2.22.3.tgz", - "integrity": "sha512-mrG3bJGX4jgWbrpY0ghIpPgCmNhZziFMBJBmZfpIe6K/P1rWPkdkbGihbCUIufgQ8ruX4txE5/CKSeFNzDcYOw==", + "version": "2.23.0", + "resolved": "https://registry.npmjs.org/webpack-hot-middleware/-/webpack-hot-middleware-2.23.0.tgz", + "integrity": "sha512-9kgj0nCz/UMpMb0ncqebpTQYLbHCsBj4c0QO0QUqXWZ07lkvcFT5EP6xGCsW9XVVUcp1nWLAmdI4bVmQx8M1eA==", "dev": true, "requires": { "ansi-html": "0.0.7", diff --git a/package.json b/package.json index 73a6ceac59..60b4cd8abc 100644 --- a/package.json +++ b/package.json @@ -232,20 +232,20 @@ "add-asset-html-webpack-plugin": "2.1.3", "babel-core": "7.0.0-bridge.0", "babel-eslint": "9.0.0", - "babel-loader": "8.0.0", + "babel-loader": "8.0.1", "babel-plugin-dynamic-import-node": "2.1.0", "babel-plugin-react-intl": "2.4.0", "babel-plugin-react-transform": "3.0.0", - "babel-plugin-styled-components": "1.5.1", + "babel-plugin-styled-components": "1.6.0", "babel-plugin-transform-react-remove-prop-types": "0.4.15", "circular-dependency-plugin": "5.0.2", "compare-versions": "3.3.1", "coveralls": "3.0.2", "css-loader": "1.0.0", "enzyme": "3.5.0", - "enzyme-adapter-react-16": "1.3.0", + "enzyme-adapter-react-16": "1.3.1", "enzyme-to-json": "3.3.4", - "eslint": "5.4.0", + "eslint": "5.5.0", "eslint-config-airbnb": "17.1.0", "eslint-config-airbnb-base": "13.1.0", "eslint-config-prettier": "3.0.1", @@ -286,7 +286,7 @@ "webpack": "4.17.1", "webpack-cli": "3.1.0", "webpack-dev-middleware": "3.2.0", - "webpack-hot-middleware": "2.22.3", + "webpack-hot-middleware": "2.23.0", "webpack-pwa-manifest": "3.7.1" } } From b0bf6b377434566faedb2b361c39ac6f0f7eca91 Mon Sep 17 00:00:00 2001 From: Julien Benchetrit Date: Wed, 5 Sep 2018 12:14:01 +0300 Subject: [PATCH 2/4] Restore apveyor to using npm install + maintenance --- appveyor.yml | 6 ++-- package-lock.json | 70 +++++++++++++++++++++++++++-------------------- package.json | 14 +++++----- 3 files changed, 52 insertions(+), 38 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index ad3c549e3d..2a6eba8b44 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -24,8 +24,10 @@ install: - choco install -y googlechrome --ignore-checksums # Install the latest stable version of Node - ps: Install-Product node $env:nodejs_version - - npm install npm -g - - npm ci + - npm install + +# TODO: Switch to using npm ci instead of install +# once Node LTS ships with npm 5.7 (with ci) # Disable automatic builds build: off diff --git a/package-lock.json b/package-lock.json index 641bee5ae2..25396fb876 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1165,9 +1165,9 @@ } }, "@types/node": { - "version": "10.9.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.9.3.tgz", - "integrity": "sha512-DOzWZKUnmFYG0KUOs+9HEBju2QhBU6oM2zeluunQNt0vnJvnkHvtDNlQPZDkTrkC5pZrNx1TPqeL137zciXZMQ==", + "version": "10.9.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.9.4.tgz", + "integrity": "sha512-fCHV45gS+m3hH17zgkgADUSi2RR1Vht6wOZ0jyHP8rjiQra9f+mIcgwPQHllmDocYOstIEbKlxbFDYlgrTPYqw==", "dev": true }, "@webassemblyjs/ast": { @@ -2050,9 +2050,9 @@ } }, "babel-loader": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.0.1.tgz", - "integrity": "sha512-K5m4ivjWMEBTRkLkQMEBrOM8B1TxhniBKHrCemjeSFiHz4H8EopRgEhCtFSXhlriAcfFFwIelsLfx8urcaghLA==", + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.0.2.tgz", + "integrity": "sha512-Law0PGtRV1JL8Y9Wpzc0d6EE0GD7LzXWCfaeWwboUMcBWNG6gvaWTK1/+BK7a4X5EmeJiGEuDDFxUsOa8RSWCw==", "dev": true, "requires": { "find-cache-dir": "^1.0.0", @@ -2119,9 +2119,9 @@ } }, "babel-plugin-styled-components": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/babel-plugin-styled-components/-/babel-plugin-styled-components-1.6.0.tgz", - "integrity": "sha512-ilq495iB45Ifh70j8YBPwbTXpKG8E9P4V+ib2SWKT2eEGXtH9TPvfpvVPv37ZOxdYcxCwlnlKWdQuGzAyQb+7w==", + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/babel-plugin-styled-components/-/babel-plugin-styled-components-1.6.2.tgz", + "integrity": "sha512-m2kYpazgFROfbewTYhI3JhZ/xWtFYZsIdWSf2cLHN810uS/TA9fJPEMy93I9mosSOHhpW/wXznOAJPiAc+Wejw==", "dev": true, "requires": { "lodash": "^4.17.10", @@ -2511,9 +2511,9 @@ } }, "bluebird": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", - "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==", + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.2.tgz", + "integrity": "sha512-dhHTWMI7kMx5whMQntl7Vr9C6BvV10lFXDAasnqnrMYhXVCzzk6IO9Fo2L75jXHT07WrOngL1WDXOp+yYS91Yg==", "dev": true }, "bmp-js": { @@ -3356,9 +3356,9 @@ "dev": true }, "compare-versions": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.3.1.tgz", - "integrity": "sha512-GkIcfJ9sDt4+gS+RWH3X+kR7ezuKdu3fg2oA9nRA8HZoqZwAKv3ml3TyfB9OyV2iFXxCw7q5XfV6SyPbSCT2pw==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.4.0.tgz", + "integrity": "sha512-tK69D7oNXXqUW3ZNo/z7NXTEz22TCF0pTE+YF9cxvaAM9XnkLo1fV621xCLrRR6aevJlKxExkss0vWqUCUpqdg==", "dev": true }, "component-emitter": { @@ -4623,9 +4623,9 @@ "dev": true }, "enzyme": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/enzyme/-/enzyme-3.5.0.tgz", - "integrity": "sha512-I51gsZvXiUjrJC3oJ9wo1tvKyWQrrLD+7esOwTw5sZeQ6a+GVcQYVroXBF13hB/kJQ4vurtxEm35+5T1Q8R2Pw==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/enzyme/-/enzyme-3.6.0.tgz", + "integrity": "sha512-onsINzVLGqKIapTVfWkkw6bYvm1o4CyJ9s8POExtQhAkVa4qFDW6DGCQGRy/5bfZYk+gmUbMNyayXiWDzTkHFQ==", "dev": true, "requires": { "array.prototype.flat": "^1.2.1", @@ -4645,13 +4645,14 @@ "object.entries": "^1.0.4", "object.values": "^1.0.4", "raf": "^3.4.0", - "rst-selector-parser": "^2.2.3" + "rst-selector-parser": "^2.2.3", + "string.prototype.trim": "^1.1.2" } }, "enzyme-adapter-react-16": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.3.1.tgz", - "integrity": "sha512-BFD5aBZwuN8buSPl5eZpYiqx6AqRgw2G/dP+P5/ttC8vxNpLTgpr7iHo1dszfFrA44d41S5SGdhE4mNdB4hZqA==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.4.0.tgz", + "integrity": "sha512-sn2zE3g5/LrSNueLFBNOP0ID/YqOJEJb1qyyZ2VdSWbjzbiNDva3IBEntrBP29Wg/EBeSP5yYt5W+nvQ2oeDKg==", "dev": true, "requires": { "enzyme-adapter-utils": "^1.6.0", @@ -15194,6 +15195,17 @@ } } }, + "string.prototype.trim": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz", + "integrity": "sha1-0E3iyJ4Tf019IG8Ia17S+ua+jOo=", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.0", + "function-bind": "^1.0.2" + } + }, "string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -17242,9 +17254,9 @@ "dev": true }, "webpack": { - "version": "4.17.1", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.17.1.tgz", - "integrity": "sha512-vdPYogljzWPhFKDj3Gcp01Vqgu7K3IQlybc3XIdKSQHelK1C3eIQuysEUR7MxKJmdandZlQB/9BG2Jb1leJHaw==", + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.17.2.tgz", + "integrity": "sha512-hCK8FPco2Paz9FVMlo3ZdVd7Jsr7qxoiEwhd7f4dMaWBLZtc7E+/9QNee4CYHlVSvpmspWBnhFpx4MiWSl3nNg==", "dev": true, "requires": { "@webassemblyjs/ast": "1.5.13", @@ -17271,7 +17283,7 @@ "tapable": "^1.0.0", "uglifyjs-webpack-plugin": "^1.2.4", "watchpack": "^1.5.0", - "webpack-sources": "^1.0.1" + "webpack-sources": "^1.2.0" }, "dependencies": { "ajv": { @@ -17598,9 +17610,9 @@ } }, "webpack-hot-middleware": { - "version": "2.23.0", - "resolved": "https://registry.npmjs.org/webpack-hot-middleware/-/webpack-hot-middleware-2.23.0.tgz", - "integrity": "sha512-9kgj0nCz/UMpMb0ncqebpTQYLbHCsBj4c0QO0QUqXWZ07lkvcFT5EP6xGCsW9XVVUcp1nWLAmdI4bVmQx8M1eA==", + "version": "2.23.1", + "resolved": "https://registry.npmjs.org/webpack-hot-middleware/-/webpack-hot-middleware-2.23.1.tgz", + "integrity": "sha512-oUdCGDHONJrARtqxPSiON4db4dRWUsRiPwD7dYkglrTc3vF7LKa2jncwN0lIVkNwtoCh/yiHVTzz3Hbcux8ikA==", "dev": true, "requires": { "ansi-html": "0.0.7", diff --git a/package.json b/package.json index 60b4cd8abc..b33e0d008f 100644 --- a/package.json +++ b/package.json @@ -232,18 +232,18 @@ "add-asset-html-webpack-plugin": "2.1.3", "babel-core": "7.0.0-bridge.0", "babel-eslint": "9.0.0", - "babel-loader": "8.0.1", + "babel-loader": "8.0.2", "babel-plugin-dynamic-import-node": "2.1.0", "babel-plugin-react-intl": "2.4.0", "babel-plugin-react-transform": "3.0.0", - "babel-plugin-styled-components": "1.6.0", + "babel-plugin-styled-components": "1.6.2", "babel-plugin-transform-react-remove-prop-types": "0.4.15", "circular-dependency-plugin": "5.0.2", - "compare-versions": "3.3.1", + "compare-versions": "3.4.0", "coveralls": "3.0.2", "css-loader": "1.0.0", - "enzyme": "3.5.0", - "enzyme-adapter-react-16": "1.3.1", + "enzyme": "3.6.0", + "enzyme-adapter-react-16": "1.4.0", "enzyme-to-json": "3.3.4", "eslint": "5.5.0", "eslint-config-airbnb": "17.1.0", @@ -283,10 +283,10 @@ "stylelint-processor-styled-components": "1.3.2", "svg-url-loader": "2.3.2", "url-loader": "1.1.1", - "webpack": "4.17.1", + "webpack": "4.17.2", "webpack-cli": "3.1.0", "webpack-dev-middleware": "3.2.0", - "webpack-hot-middleware": "2.23.0", + "webpack-hot-middleware": "2.23.1", "webpack-pwa-manifest": "3.7.1" } } From 85fee34786fecb98475c63a9fb6b88eb2ea764b4 Mon Sep 17 00:00:00 2001 From: Julien Benchetrit Date: Wed, 5 Sep 2018 13:36:37 +0300 Subject: [PATCH 3/4] Partial fixes for extract-intl script --- internals/scripts/extract-intl.js | 90 ++++++++++++++----------------- 1 file changed, 39 insertions(+), 51 deletions(-) diff --git a/internals/scripts/extract-intl.js b/internals/scripts/extract-intl.js index 087b04e1d9..1d700f57d1 100644 --- a/internals/scripts/extract-intl.js +++ b/internals/scripts/extract-intl.js @@ -1,28 +1,34 @@ -/* eslint-disable */ +/* eslint-disable no-restricted-syntax */ /** * This script will extract the internationalization messages from all components - and package them in the translation json files in the translations file. + * and package them in the translation json files in the translations file. */ + +require('shelljs/global'); + const fs = require('fs'); const nodeGlob = require('glob'); -const transform = require('babel-core').transform; +const { transformSync } = require('@babel/core'); +const get = require('lodash/get'); const animateProgress = require('./helpers/progress'); const addCheckmark = require('./helpers/checkmark'); -const pkg = require('../../package.json'); -const presets = pkg.babel.presets; -const plugins = pkg.babel.plugins || []; +const { appLocales, DEFAULT_LOCALE } = require('../../app/i18n'); -const i18n = require('../../app/i18n'); +const pkg = require('../../package.json'); +const { presets } = pkg.babel; +let plugins = pkg.babel.plugins || []; -const DEFAULT_LOCALE = i18n.DEFAULT_LOCALE; +// TODO: The react-intl plugin must be restored here. +// Without it, this script is pointless. +// plugins.push('react-intl'); -require('shelljs/global'); +// NOTE: styled-components plugin is filtered out as it creates errors when used with transform +plugins = plugins.filter(p => p !== 'styled-components'); // Glob to match all js files except test files const FILES_TO_PARSE = 'app/**/!(*.test).js'; -const locales = i18n.appLocales; const newLine = () => process.stdout.write('\n'); @@ -54,15 +60,7 @@ const readFile = fileName => new Promise((resolve, reject) => { fs.readFile( fileName, - (error, value) => (error ? reject(error) : resolve(value)), - ); - }); - -const writeFile = (fileName, data) => - new Promise((resolve, reject) => { - fs.writeFile( - fileName, - data, + 'utf8', (error, value) => (error ? reject(error) : resolve(value)), ); }); @@ -72,7 +70,7 @@ const oldLocaleMappings = []; const localeMappings = []; // Loop to run once per locale -for (const locale of locales) { +for (const locale of appLocales) { oldLocaleMappings[locale] = {}; localeMappings[locale] = {}; // File to store translation messages into @@ -94,44 +92,34 @@ for (const locale of locales) { } } -/* push `react-intl` plugin to the existing plugins that are already configured in `package.json` - Example: - ``` - "babel": { - "plugins": [ - ["transform-object-rest-spread", { "useBuiltIns": true }] - ], - "presets": [ - "env", - "react" - ] - } - ``` -*/ -plugins.push(['react-intl']); - -const extractFromFile = fileName => { - return readFile(fileName) +const extractFromFile = fileName => + readFile(fileName) .then(code => { // Use babel plugin to extract instances where react-intl is used - const { metadata: result } = transform(code, { presets, plugins }); + let messages = []; + try { + const output = transformSync(code, { presets, plugins }); + // TODO: Ensure that this is the correct path to find the react-intl messages + messages = get(output, 'metadata.result.react-intl.messages', []); + } catch (e) { + console.log(e); // eslint-disable-line + } - for (const message of result['react-intl'].messages) { - for (const locale of locales) { + for (const message of messages) { + for (const locale of appLocales) { const oldLocaleMapping = oldLocaleMappings[locale][message.id]; // Merge old translations into the babel extracted instances where react-intl is used const newMsg = locale === DEFAULT_LOCALE ? message.defaultMessage : ''; - localeMappings[locale][message.id] = oldLocaleMapping - ? oldLocaleMapping - : newMsg; + localeMappings[locale][message.id] = oldLocaleMapping || newMsg; } } }) .catch(error => { - process.stderr.write(`Error transforming file: ${fileName}\n${error}`); + process.stderr.write( + `\nError transforming file: ${fileName}\n${error}\n`, + ); }); -}; const memoryTask = glob(FILES_TO_PARSE); const memoryTaskDone = task('Storing language files in memory'); @@ -144,16 +132,16 @@ memoryTask.then(files => { ); const extractTaskDone = task('Run extraction on all files'); // Run extraction on all files that match the glob on line 16 - extractTask.then(result => { + extractTask.then(() => { extractTaskDone(); // Make the directory if it doesn't exist, especially for first run - mkdir('-p', 'app/translations'); + mkdir('-p', 'app/translations'); // eslint-disable-line let localeTaskDone; let translationFileName; - for (const locale of locales) { + for (const locale of appLocales) { translationFileName = `app/translations/${locale}.json`; localeTaskDone = task( `Writing translation messages for ${locale} to: ${translationFileName}`, @@ -161,10 +149,10 @@ memoryTask.then(files => { // Sort the translation JSON file so that git diffing is easier // Otherwise the translation messages will jump around every time we extract - let messages = {}; + const messages = {}; Object.keys(localeMappings[locale]) .sort() - .forEach(function(key) { + .forEach(key => { messages[key] = localeMappings[locale][key]; }); From d759ccdbe493065e439a237e139c2b8c13b5e8c1 Mon Sep 17 00:00:00 2001 From: Julien Benchetrit Date: Wed, 5 Sep 2018 13:55:06 +0300 Subject: [PATCH 4/4] Fixed path inside extract-intl script --- internals/scripts/extract-intl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internals/scripts/extract-intl.js b/internals/scripts/extract-intl.js index 1d700f57d1..e2eed94b1f 100644 --- a/internals/scripts/extract-intl.js +++ b/internals/scripts/extract-intl.js @@ -100,7 +100,7 @@ const extractFromFile = fileName => try { const output = transformSync(code, { presets, plugins }); // TODO: Ensure that this is the correct path to find the react-intl messages - messages = get(output, 'metadata.result.react-intl.messages', []); + messages = get(output, 'metadata.react-intl.messages', []); } catch (e) { console.log(e); // eslint-disable-line }