Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Upgrade to babel@7 and support TypeScript #10526

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
{
"presets": [
"react",
"es2015",
"es2016"
"@babel/preset-react",
["@babel/preset-env", {
"modules": "commonjs",
"targets": {"browsers": ["last 2 versions"]}
}],
"@babel/preset-flow",
"@babel/preset-typescript"
],
"plugins": [
[
"transform-builtin-extend",
{
"globals": ["Error"]
}
],
"transform-class-properties",
"transform-object-rest-spread",
"transform-async-to-bluebird",
"transform-runtime",
"add-module-exports",
"syntax-dynamic-import"
"babel-plugin-add-module-exports",
"@babel/plugin-proposal-numeric-separator",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-transform-flow-comments",
["@babel/plugin-transform-async-to-generator", {
"module": "bluebird",
"method": "coroutine"
}],
"@babel/plugin-transform-runtime",
"@babel/plugin-syntax-dynamic-import"
]
}
30 changes: 17 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"diff-i18n": "cp src/i18n/strings/en_EN.json src/i18n/strings/en_EN_orig.json && yarn i18n && node scripts/compare-file.js src/i18n/strings/en_EN_orig.json src/i18n/strings/en_EN.json",
"build:res": "node scripts/copy-res.js",
"build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js",
"build:compile": "yarn reskindex && babel --source-maps -d lib src",
"build:compile": "yarn reskindex && babel --source-maps -d lib src --extensions \".ts,.js\" --verbose",
"build:bundle": "cross-env NODE_ENV=production webpack -p --progress --bail --mode production",
"build:bundle:dev": "webpack --progress --bail --mode development",
"build:electron": "yarn clean && yarn build && yarn install:electron && build -wml --ia32 --x64",
Expand Down Expand Up @@ -86,22 +86,25 @@
"url": "^0.11.0"
},
"devDependencies": {
"@babel/cli": "^7.5.5",
"@babel/core": "^7.5.5",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-proposal-numeric-separator": "^7.2.0",
"@babel/plugin-proposal-object-rest-spread": "^7.5.5",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-transform-async-to-generator": "^7.5.0",
"@babel/plugin-transform-flow-comments": "^7.5.5",
"@babel/plugin-transform-runtime": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@babel/preset-flow": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.3.3",
"autoprefixer": "^6.6.0",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-eslint": "^8.1.1",
"babel-loader": "^7.1.5",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-loader": "^8.0.6",
"babel-plugin-add-module-exports": "^1.0.2",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-plugin-transform-async-to-bluebird": "^1.1.1",
"babel-plugin-transform-builtin-extend": "^1.1.2",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-es2016": "^6.24.1",
"babel-preset-es2017": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"chokidar": "^2.0.4",
"concurrently": "^4.0.1",
Expand Down Expand Up @@ -148,6 +151,7 @@
"react-addons-test-utils": "^15.6.0",
"rimraf": "^2.4.3",
"source-map-loader": "^0.2.4",
"typescript": "^3.5.3",
"webpack": "^4.23.1",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.11"
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/auth/VectorAuthFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import SdkConfig from 'matrix-react-sdk/lib/SdkConfig';

import { _t } from 'matrix-react-sdk/lib/languageHandler';

module.exports = React.createClass({
export default React.createClass({
displayName: 'VectorAuthFooter',
statics: {
replaces: 'AuthFooter',
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/auth/VectorCustomServerDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { _t } from 'matrix-react-sdk/lib/languageHandler';
* This is identical to `CustomServerDialog` except for replacing "this app"
* with "Riot".
*/
module.exports = React.createClass({
export default React.createClass({
displayName: 'VectorCustomServerDialog',
statics: {
replaces: 'CustomServerDialog',
Expand Down
15 changes: 15 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"target": "esnext",
"moduleResolution": "node",
"allowJs": true,
"noEmit": false,
"strict": false,
"isolatedModules": true,
"esModuleInterop": true
},
"include": [
"src/*.ts",
"src/**/*.ts"
]
}
Loading