forked from matrix/element-web
Merge pull request #12696 from vector-im/travis/typescript-2
Support TypeScript for React components
This commit is contained in:
commit
296e7011e5
|
@ -40,13 +40,13 @@
|
||||||
"build:res": "node scripts/copy-res.js",
|
"build:res": "node scripts/copy-res.js",
|
||||||
"build:genfiles": "yarn reskindex && yarn build:res",
|
"build:genfiles": "yarn reskindex && yarn build:res",
|
||||||
"build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js",
|
"build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js",
|
||||||
"build:compile": "babel -d lib --verbose --extensions \".ts,.js\" src",
|
"build:compile": "babel -d lib --verbose --extensions \".ts,.js,.tsx\" src",
|
||||||
"build:bundle": "cross-env NODE_ENV=production webpack -p --progress --bail --mode production",
|
"build:bundle": "cross-env NODE_ENV=production webpack -p --progress --bail --mode production",
|
||||||
"build:electron": "yarn build && yarn install:electron && electron-builder -wml --ia32 --x64",
|
"build:electron": "yarn build && yarn install:electron && electron-builder -wml --ia32 --x64",
|
||||||
"build:electron:linux": "yarn build && electron-builder -l --x64",
|
"build:electron:linux": "yarn build && electron-builder -l --x64",
|
||||||
"build:electron:macos": "yarn build && electron-builder -m --x64",
|
"build:electron:macos": "yarn build && electron-builder -m --x64",
|
||||||
"build:electron:windows": "yarn build && electron-builder -w --ia32 --x64",
|
"build:electron:windows": "yarn build && electron-builder -w --ia32 --x64",
|
||||||
"build:types": "tsc --emitDeclarationOnly",
|
"build:types": "tsc --emitDeclarationOnly --jsx react",
|
||||||
"install:electron": "electron-builder install-app-deps",
|
"install:electron": "electron-builder install-app-deps",
|
||||||
"dist": "scripts/package.sh",
|
"dist": "scripts/package.sh",
|
||||||
"start": "concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n reskindex,reskindex-react,res,riot-js \"yarn reskindex:watch\" \"yarn reskindex:watch-react\" \"yarn start:res\" \"yarn start:js\"",
|
"start": "concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n reskindex,reskindex-react,res,riot-js \"yarn reskindex:watch\" \"yarn reskindex:watch-react\" \"yarn start:res\" \"yarn start:js\"",
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
"lint": "yarn lint:types && yarn lint:ts && yarn lint:js && yarn lint:style",
|
"lint": "yarn lint:types && yarn lint:ts && yarn lint:js && yarn lint:style",
|
||||||
"lint:js": "eslint src",
|
"lint:js": "eslint src",
|
||||||
"lint:ts": "echo 'We don't actually have a typescript linter at this layer because tslint is being removed from our stack. Presumably your TS is fine.'",
|
"lint:ts": "echo 'We don't actually have a typescript linter at this layer because tslint is being removed from our stack. Presumably your TS is fine.'",
|
||||||
"lint:types": "tsc --noEmit",
|
"lint:types": "tsc --noEmit --jsx react",
|
||||||
"lint:style": "stylelint 'res/css/**/*.scss'",
|
"lint:style": "stylelint 'res/css/**/*.scss'",
|
||||||
"test": "jest"
|
"test": "jest"
|
||||||
},
|
},
|
||||||
|
@ -94,7 +94,7 @@
|
||||||
"@babel/preset-typescript": "^7.7.4",
|
"@babel/preset-typescript": "^7.7.4",
|
||||||
"@babel/register": "^7.7.4",
|
"@babel/register": "^7.7.4",
|
||||||
"@babel/runtime": "^7.7.6",
|
"@babel/runtime": "^7.7.6",
|
||||||
"@types/react": "^16.9.17",
|
"@types/react": "16.9",
|
||||||
"@types/react-dom": "^16.9.4",
|
"@types/react-dom": "^16.9.4",
|
||||||
"autoprefixer": "^9.7.3",
|
"autoprefixer": "^9.7.3",
|
||||||
"babel-eslint": "^10.0.3",
|
"babel-eslint": "^10.0.3",
|
||||||
|
|
|
@ -10,10 +10,12 @@
|
||||||
"outDir": "./lib",
|
"outDir": "./lib",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"types": [
|
"types": [
|
||||||
"node"
|
"node",
|
||||||
|
"react"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./src/**/*.ts"
|
"./src/**/*.ts",
|
||||||
|
"./src/**/*.tsx"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ module.exports = (env, argv) => {
|
||||||
aliasFields: ['matrix_src_browser', 'browser'],
|
aliasFields: ['matrix_src_browser', 'browser'],
|
||||||
|
|
||||||
// We need to specify that TS can be resolved without an extension
|
// We need to specify that TS can be resolved without an extension
|
||||||
extensions: ['.js', '.json', '.ts'],
|
extensions: ['.js', '.json', '.ts', '.tsx'],
|
||||||
alias: {
|
alias: {
|
||||||
// alias any requires to the react module to the one in our path,
|
// alias any requires to the react module to the one in our path,
|
||||||
// otherwise we tend to get the react source included twice when
|
// otherwise we tend to get the react source included twice when
|
||||||
|
|
|
@ -1262,7 +1262,7 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/react" "*"
|
"@types/react" "*"
|
||||||
|
|
||||||
"@types/react@*", "@types/react@^16.9.17":
|
"@types/react@*", "@types/react@16.9":
|
||||||
version "16.9.23"
|
version "16.9.23"
|
||||||
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.23.tgz#1a66c6d468ba11a8943ad958a8cb3e737568271c"
|
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.23.tgz#1a66c6d468ba11a8943ad958a8cb3e737568271c"
|
||||||
integrity sha512-SsGVT4E7L2wLN3tPYLiF20hmZTPGuzaayVunfgXzUn1x4uHVsKH6QDJQ/TdpHqwsTLd4CwrmQ2vOgxN7gE24gw==
|
integrity sha512-SsGVT4E7L2wLN3tPYLiF20hmZTPGuzaayVunfgXzUn1x4uHVsKH6QDJQ/TdpHqwsTLd4CwrmQ2vOgxN7gE24gw==
|
||||||
|
|
Loading…
Reference in New Issue