Upgrade to babel@7 and support typescript
This breaks the tests
This commit is contained in:
parent
c02beb9ba3
commit
97af0403e5
4 changed files with 85 additions and 57 deletions
33
.babelrc
33
.babelrc
|
@ -1,20 +1,25 @@
|
||||||
{
|
{
|
||||||
|
"sourceMaps": "inline",
|
||||||
"presets": [
|
"presets": [
|
||||||
"react",
|
["@babel/preset-env", {
|
||||||
"es2015",
|
"targets": {
|
||||||
"es2016"
|
"browsers": [
|
||||||
|
"last 2 versions"
|
||||||
|
],
|
||||||
|
"node": 12
|
||||||
|
},
|
||||||
|
"modules": "commonjs"
|
||||||
|
}],
|
||||||
|
"@babel/preset-typescript",
|
||||||
|
"@babel/preset-flow",
|
||||||
|
"@babel/preset-react"
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
[
|
"@babel/plugin-proposal-numeric-separator",
|
||||||
"transform-builtin-extend",
|
"@babel/plugin-proposal-class-properties",
|
||||||
{
|
"@babel/plugin-proposal-object-rest-spread",
|
||||||
"globals": ["Error"]
|
"@babel/plugin-transform-flow-comments",
|
||||||
}
|
"@babel/plugin-syntax-dynamic-import",
|
||||||
],
|
"@babel/plugin-transform-runtime"
|
||||||
"transform-class-properties",
|
|
||||||
"transform-object-rest-spread",
|
|
||||||
"transform-runtime",
|
|
||||||
"add-module-exports",
|
|
||||||
"syntax-dynamic-import"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,39 @@
|
||||||
steps:
|
steps:
|
||||||
- label: ":eslint: Lint"
|
- label: ":eslint: JS Lint"
|
||||||
command:
|
command:
|
||||||
- "echo '--- Install js-sdk'"
|
- "echo '--- Install js-sdk'"
|
||||||
- "./scripts/ci/install-deps.sh"
|
- "./scripts/ci/install-deps.sh"
|
||||||
- "yarn lintwithexclusions"
|
- "yarn lint:js"
|
||||||
- "yarn stylelint"
|
|
||||||
plugins:
|
plugins:
|
||||||
- docker#v3.0.1:
|
- docker#v3.0.1:
|
||||||
image: "node:10"
|
image: "node:12"
|
||||||
|
|
||||||
|
- label: ":eslint: TS Lint"
|
||||||
|
command:
|
||||||
|
- "echo '--- Install js-sdk'"
|
||||||
|
- "./scripts/ci/install-deps.sh"
|
||||||
|
- "yarn lint:ts"
|
||||||
|
plugins:
|
||||||
|
- docker#v3.0.1:
|
||||||
|
image: "node:12"
|
||||||
|
|
||||||
|
- label: ":eslint: Types Lint"
|
||||||
|
command:
|
||||||
|
- "echo '--- Install js-sdk'"
|
||||||
|
- "./scripts/ci/install-deps.sh"
|
||||||
|
- "yarn lint:types"
|
||||||
|
plugins:
|
||||||
|
- docker#v3.0.1:
|
||||||
|
image: "node:12"
|
||||||
|
|
||||||
|
- label: "🛠 Build"
|
||||||
|
command:
|
||||||
|
- "echo '--- Install js-sdk'"
|
||||||
|
- "./scripts/ci/install-deps.sh"
|
||||||
|
- "yarn build"
|
||||||
|
plugins:
|
||||||
|
- docker#v3.0.1:
|
||||||
|
image: "node:12"
|
||||||
|
|
||||||
- label: ":chains: End-to-End Tests"
|
- label: ":chains: End-to-End Tests"
|
||||||
agents:
|
agents:
|
||||||
|
|
|
@ -8,7 +8,7 @@ var fs = require('fs');
|
||||||
* to build everything; however it's the easiest way to load our dependencies
|
* to build everything; however it's the easiest way to load our dependencies
|
||||||
* from node_modules.
|
* from node_modules.
|
||||||
*
|
*
|
||||||
* If you run karma in multi-run mode (with `yarn test-multi`), it will watch
|
* If you run karma in multi-run mode (with `yarn test:multi`), it will watch
|
||||||
* the tests for changes, and webpack will rebuild using a cache. This is much quicker
|
* the tests for changes, and webpack will rebuild using a cache. This is much quicker
|
||||||
* than a clean rebuild.
|
* than a clean rebuild.
|
||||||
*/
|
*/
|
||||||
|
|
73
package.json
73
package.json
|
@ -8,10 +8,7 @@
|
||||||
"url": "https://github.com/matrix-org/matrix-react-sdk"
|
"url": "https://github.com/matrix-org/matrix-react-sdk"
|
||||||
},
|
},
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"main": "lib/index.js",
|
|
||||||
"files": [
|
"files": [
|
||||||
".babelrc",
|
|
||||||
".eslintrc.js",
|
|
||||||
"CHANGELOG.md",
|
"CHANGELOG.md",
|
||||||
"CONTRIBUTING.rst",
|
"CONTRIBUTING.rst",
|
||||||
"LICENSE",
|
"LICENSE",
|
||||||
|
@ -19,14 +16,11 @@
|
||||||
"code_style.md",
|
"code_style.md",
|
||||||
"git-revision.txt",
|
"git-revision.txt",
|
||||||
"header",
|
"header",
|
||||||
"jenkins.sh",
|
|
||||||
"karma.conf.js",
|
|
||||||
"lib",
|
"lib",
|
||||||
"package.json",
|
"package.json",
|
||||||
"release.sh",
|
|
||||||
"scripts",
|
"scripts",
|
||||||
|
"docs",
|
||||||
"src",
|
"src",
|
||||||
"test",
|
|
||||||
"res"
|
"res"
|
||||||
],
|
],
|
||||||
"bin": {
|
"bin": {
|
||||||
|
@ -34,32 +28,33 @@
|
||||||
"matrix-gen-i18n": "scripts/gen-i18n.js",
|
"matrix-gen-i18n": "scripts/gen-i18n.js",
|
||||||
"matrix-prune-i18n": "scripts/prune-i18n.js"
|
"matrix-prune-i18n": "scripts/prune-i18n.js"
|
||||||
},
|
},
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"typings": "lib/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"reskindex": "node scripts/reskindex.js -h header",
|
|
||||||
"reskindex:watch": "node scripts/reskindex.js -h header -w",
|
|
||||||
"rethemendex": "res/css/rethemendex.sh",
|
|
||||||
"i18n": "matrix-gen-i18n",
|
"i18n": "matrix-gen-i18n",
|
||||||
"prunei18n": "matrix-prune-i18n",
|
"prunei18n": "matrix-prune-i18n",
|
||||||
"diff-i18n": "cp src/i18n/strings/en_EN.json src/i18n/strings/en_EN_orig.json && ./scripts/gen-i18n.js && node scripts/compare-file.js src/i18n/strings/en_EN_orig.json src/i18n/strings/en_EN.json",
|
"diff-i18n": "cp src/i18n/strings/en_EN.json src/i18n/strings/en_EN_orig.json && ./scripts/gen-i18n.js && node scripts/compare-file.js src/i18n/strings/en_EN_orig.json src/i18n/strings/en_EN.json",
|
||||||
"build": "yarn reskindex && yarn start:init",
|
|
||||||
"build:watch": "babel src -w --skip-initial-build -d lib --source-maps --copy-files",
|
|
||||||
"emoji-data-strip": "node scripts/emoji-data-strip.js",
|
"emoji-data-strip": "node scripts/emoji-data-strip.js",
|
||||||
"start": "yarn start:init && yarn start:all",
|
"reskindex": "node scripts/reskindex.js -h header",
|
||||||
"start:all": "concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n build,reskindex \"yarn build:watch\" \"yarn reskindex:watch\"",
|
"reskindex:watch": "node scripts/reskindex.js -h header -w",
|
||||||
"start:init": "babel src -d lib --source-maps --copy-files",
|
"rethemendex": "res/css/rethemendex.sh",
|
||||||
"lint": "eslint src/",
|
|
||||||
"lintall": "eslint src/ test/",
|
|
||||||
"lintwithexclusions": "eslint --max-warnings 0 --ignore-path .eslintignore.errorfiles src test",
|
|
||||||
"stylelint": "stylelint 'res/css/**/*.scss'",
|
|
||||||
"clean": "rimraf lib",
|
"clean": "rimraf lib",
|
||||||
"prepare": "yarn clean && yarn build && git rev-parse HEAD > git-revision.txt",
|
"build": "yarn clean && git rev-parse HEAD > git-revision.txt && yarn build:compile && yarn build:types",
|
||||||
|
"build:compile": "yarn reskindex && babel src -s -d lib --verbose --extensions \".ts,.js\"",
|
||||||
|
"build:types": "tsc --emitDeclarationOnly",
|
||||||
|
"start": "echo THIS IS FOR LEGACY PURPOSES ONLY. && yarn start:all",
|
||||||
|
"start:all": "concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n build,reskindex \"yarn start:build\" \"yarn reskindex:watch\"",
|
||||||
|
"start:build": "babel src -w -s -d lib --verbose --extensions \".ts,.js\"",
|
||||||
|
"lint": "yarn lint:types && yarn lint:ts && yarn lint:js && yarn lint:style",
|
||||||
|
"lint:js": "eslint --max-warnings 0 --ignore-path .eslintignore.errorfiles src test",
|
||||||
|
"lint:ts": "tslint --project ./tsconfig.json -t stylish",
|
||||||
|
"lint:types": "tsc --noEmit",
|
||||||
|
"lint:style": "stylelint 'res/css/**/*.scss'",
|
||||||
"test": "karma start --single-run=true --browsers VectorChromeHeadless",
|
"test": "karma start --single-run=true --browsers VectorChromeHeadless",
|
||||||
"test-multi": "karma start",
|
"test:multi": "karma start",
|
||||||
"e2etests": "./test/end-to-end-tests/run.sh --riot-url http://localhost:8080"
|
"test:e2e": "./test/end-to-end-tests/run.sh --riot-url http://localhost:8080"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"babel-plugin-syntax-dynamic-import": "^6.18.0",
|
|
||||||
"babel-runtime": "^6.26.0",
|
|
||||||
"blueimp-canvas-to-blob": "^3.5.0",
|
"blueimp-canvas-to-blob": "^3.5.0",
|
||||||
"browser-encrypt-attachment": "^0.3.0",
|
"browser-encrypt-attachment": "^0.3.0",
|
||||||
"browser-request": "^0.3.3",
|
"browser-request": "^0.3.3",
|
||||||
|
@ -115,20 +110,20 @@
|
||||||
"zxcvbn": "^4.4.2"
|
"zxcvbn": "^4.4.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-cli": "^6.26.0",
|
"@babel/cli": "^7.7.5",
|
||||||
"babel-core": "^6.26.3",
|
"@babel/core": "^7.7.5",
|
||||||
"babel-eslint": "^10.0.1",
|
"@babel/plugin-proposal-class-properties": "^7.7.4",
|
||||||
"babel-loader": "^7.1.5",
|
"@babel/plugin-proposal-numeric-separator": "^7.7.4",
|
||||||
"babel-plugin-add-module-exports": "^0.2.1",
|
"@babel/plugin-proposal-object-rest-spread": "^7.7.4",
|
||||||
"babel-plugin-transform-builtin-extend": "^1.1.2",
|
"@babel/plugin-transform-flow-comments": "^7.7.4",
|
||||||
"babel-plugin-transform-class-properties": "^6.24.1",
|
"@babel/plugin-transform-runtime": "^7.7.6",
|
||||||
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
"@babel/preset-env": "^7.7.6",
|
||||||
"babel-plugin-transform-runtime": "^6.23.0",
|
"@babel/preset-flow": "^7.7.4",
|
||||||
"babel-polyfill": "^6.26.0",
|
"@babel/preset-react": "^7.7.4",
|
||||||
"babel-preset-es2015": "^6.24.1",
|
"@babel/preset-typescript": "^7.7.4",
|
||||||
"babel-preset-es2016": "^6.24.1",
|
"@babel/register": "^7.7.4",
|
||||||
"babel-preset-es2017": "^6.24.1",
|
"@babel/runtime": "^7.7.6",
|
||||||
"babel-preset-react": "^6.24.1",
|
"babel-eslint": "^10.0.3",
|
||||||
"chokidar": "^2.1.2",
|
"chokidar": "^2.1.2",
|
||||||
"concurrently": "^4.0.1",
|
"concurrently": "^4.0.1",
|
||||||
"eslint": "^5.12.0",
|
"eslint": "^5.12.0",
|
||||||
|
@ -163,6 +158,8 @@
|
||||||
"stylelint": "^9.10.1",
|
"stylelint": "^9.10.1",
|
||||||
"stylelint-config-standard": "^18.2.0",
|
"stylelint-config-standard": "^18.2.0",
|
||||||
"stylelint-scss": "^3.9.0",
|
"stylelint-scss": "^3.9.0",
|
||||||
|
"tslint": "^5.20.1",
|
||||||
|
"typescript": "^3.7.3",
|
||||||
"walk": "^2.3.9",
|
"walk": "^2.3.9",
|
||||||
"webpack": "^4.20.2",
|
"webpack": "^4.20.2",
|
||||||
"webpack-cli": "^3.1.1"
|
"webpack-cli": "^3.1.1"
|
||||||
|
|
Loading…
Reference in a new issue