Add typescript support to asset compilation.

This commit is contained in:
Pweaver (Paul Weaver) 2017-05-24 11:31:00 -07:00 committed by Tim Abbott
parent 601d018367
commit bbb3aad611
6 changed files with 60 additions and 4 deletions

View File

@ -8,17 +8,20 @@
"clipboard": "1.5.16",
"handlebars": "4.0.6",
"i18next": "3.4.4",
"i18next-parser": "0.11.1",
"i18next-xhr-backend": "0.5.4",
"i18next-browser-languagedetector": "0.3.0",
"i18next-localstorage-cache": "0.3.0",
"i18next-parser": "0.11.1",
"i18next-xhr-backend": "0.5.4",
"jquery": "2.2.3",
"jquery-validation": "1.16.0",
"katex": "0.7.1",
"moment": "2.18.1",
"moment-timezone": "0.5.12",
"plotly.js": "1.19.2",
"source-map-loader": "0.2.1",
"string.prototype.codepointat": "0.2.0",
"ts-loader": "2.1.0",
"typescript": "2.3.3",
"underscore": "1.8.3",
"webpack": "2.5.1",
"webpack-bundle-tracker": "0.2.0",
@ -36,6 +39,7 @@
"nwmatcher": "1.3.6",
"phantomjs-prebuilt": "2.1.14",
"svgo": "0.7.2",
"tslint": "5.3.2",
"webpack-dev-server": "2.4.1",
"xmlhttprequest": "1.5.0"
},

18
static/ts/tsconfig.json Normal file
View File

@ -0,0 +1,18 @@
{
"compilerOptions": {
"outDir": "../webpack-bundles/",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"noFallthroughCasesInSwitch": true,
"suppressImplicitAnyIndexErrors": true,
"newLine": "lf",
"module": "commonjs",
"target": "es5",
"jsx": "react",
"allowJs": false
},
"rootDir": "../.."
}

9
static/ts/tslint.json Normal file
View File

@ -0,0 +1,9 @@
{
"defaultSeverity": "error",
"extends": [
"tslint:recommended"
],
"jsRules": {},
"rules": {},
"rulesDirectory": []
}

View File

@ -700,6 +700,8 @@ def run():
external_linter('add_class', ['tools/find-add-class'])
external_linter('css', ['tools/check-css'], ['css'])
external_linter('eslint', ['node', 'node_modules/.bin/eslint', '--quiet'], ['js'])
external_linter('tslint', ['node', 'node_modules/.bin/tslint', '-c',
'static/ts/tslint.json'], ['ts'])
external_linter('puppet', ['puppet', 'parser', 'validate'], ['pp'])
external_linter('templates', ['tools/check-templates'], ['handlebars', 'html'])
external_linter('urls', ['tools/check-urls'])

View File

@ -6,10 +6,33 @@ module.exports = {
entry: assets,
module: {
noParse: /(min)\.js/,
},
rules: [
// Run the typescript compilier on .ts files before webpack
{
test: /\.tsx?$/,
loader: 'ts-loader',
},
// This loads and transforms sourcemap files from other compiliers.
// The typescript comilier will generate a sourcemap and source-map-loaded will output
// the correct sourcemap from that.
{
enforce: 'pre',
test: /\.js$/,
loader: "source-map-loader",
},
{
enforce: 'pre',
test: /\.tsx?$/,
use: "source-map-loader",
},
],
},
output: {
path: path.resolve(__dirname, '../static/webpack-bundles'),
filename: '[name].js',
},
plugins: [],
resolve: {
extensions: [".tsx", ".ts", ".js", ".json"],
},
};

View File

@ -1,2 +1,2 @@
ZULIP_VERSION = "1.5.1+git"
PROVISION_VERSION = '5.2'
PROVISION_VERSION = '5.3'