From f3bfed82ef590d02c65a92db90485ec0e3e16ab3 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 18 Dec 2019 14:33:57 +1000 Subject: [PATCH] compile typescript in one go much faster, especially with --incremental --- Makefile | 15 ++++++--------- ts/.gitignore | 1 + ts/{ => src}/deckbrowser.ts | 0 ts/{ => src}/editor.ts | 0 ts/{ => src}/overview.ts | 0 ts/{ => src}/reviewer-bottom.ts | 0 ts/{ => src}/reviewer.ts | 0 ts/{lib => src/types}/global.d.ts | 0 ts/{ => src}/webview.ts | 0 ts/tsconfig.json | 23 +++++++++++++++++++++++ 10 files changed, 30 insertions(+), 9 deletions(-) rename ts/{ => src}/deckbrowser.ts (100%) rename ts/{ => src}/editor.ts (100%) rename ts/{ => src}/overview.ts (100%) rename ts/{ => src}/reviewer-bottom.ts (100%) rename ts/{ => src}/reviewer.ts (100%) rename ts/{lib => src/types}/global.d.ts (100%) rename ts/{ => src}/webview.ts (100%) create mode 100644 ts/tsconfig.json diff --git a/Makefile b/Makefile index e55dd0825..cca58a026 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ clean: rm -rf .build rm -rf $(JSDEPS) -build: .build/ui js +build: .build/ui .build/js .build/ui: $(shell find designer -name '*.ui') ./tools/build_ui.sh @@ -86,12 +86,9 @@ pytype: .build/pytype pytype --config pytype.conf touch $@ -.PHONY: js +TSDEPS := $(wildcard ts/src/*.ts) +JSDEPS := $(patsubst ts/src/%.ts, web/%.js, $(TSDEPS)) -TSDEPS := $(wildcard ts/*.ts) -JSDEPS := $(patsubst ts/%.ts, web/%.js, $(TSDEPS)) - -js: $(JSDEPS) - -web/%.js: ts/%.ts - (cd ts && ./node_modules/.bin/tsc --lib es6,dom lib/global.d.ts $(notdir $<) --outFile ../web/$(notdir $@)) +.build/js: $(TSDEPS) + (cd ts && ./node_modules/.bin/tsc --build) + touch $@ diff --git a/ts/.gitignore b/ts/.gitignore index 3c3629e64..35523de68 100644 --- a/ts/.gitignore +++ b/ts/.gitignore @@ -1 +1,2 @@ node_modules +.buildinfo diff --git a/ts/deckbrowser.ts b/ts/src/deckbrowser.ts similarity index 100% rename from ts/deckbrowser.ts rename to ts/src/deckbrowser.ts diff --git a/ts/editor.ts b/ts/src/editor.ts similarity index 100% rename from ts/editor.ts rename to ts/src/editor.ts diff --git a/ts/overview.ts b/ts/src/overview.ts similarity index 100% rename from ts/overview.ts rename to ts/src/overview.ts diff --git a/ts/reviewer-bottom.ts b/ts/src/reviewer-bottom.ts similarity index 100% rename from ts/reviewer-bottom.ts rename to ts/src/reviewer-bottom.ts diff --git a/ts/reviewer.ts b/ts/src/reviewer.ts similarity index 100% rename from ts/reviewer.ts rename to ts/src/reviewer.ts diff --git a/ts/lib/global.d.ts b/ts/src/types/global.d.ts similarity index 100% rename from ts/lib/global.d.ts rename to ts/src/types/global.d.ts diff --git a/ts/webview.ts b/ts/src/webview.ts similarity index 100% rename from ts/webview.ts rename to ts/src/webview.ts diff --git a/ts/tsconfig.json b/ts/tsconfig.json new file mode 100644 index 000000000..9a00499e8 --- /dev/null +++ b/ts/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "rootDir": "src", + "outDir": "../web", + "incremental": true, + "tsBuildInfoFile": "./.buildinfo", + "strict": true, + /* Enable all strict type-checking options. */ + "noImplicitAny": false, + /* Raise error on expressions and declarations with an implied 'any' type. */ + "strictNullChecks": false, + /* Enable strict null checks. */ + "noImplicitThis": false, + /* Raise error on 'this' expressions with an implied 'any' type. */ + "esModuleInterop": true + } +}