From 7d7e48f7593ef44313eb8dd4b7626ad8d919974a Mon Sep 17 00:00:00 2001 From: Hristo Deshev Date: Wed, 15 Feb 2017 13:24:44 +0200 Subject: [PATCH] Use a shared tsconfig. Don't duplicate compiler options across projects. --- gruntfile.js | 11 +---------- tsconfig.base-dts.json | 17 ++--------------- tsconfig.combined-dts.json | 17 ++--------------- tsconfig.json | 19 +------------------ tsconfig.node-tests.json | 17 +---------------- tsconfig.shared.json | 20 ++++++++++++++++++++ 6 files changed, 27 insertions(+), 74 deletions(-) create mode 100644 tsconfig.shared.json diff --git a/gruntfile.js b/gruntfile.js index 253a4df79..655e74b8c 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -105,7 +105,7 @@ module.exports = function(grunt) { }; // Configure localCfg - var outDir = tsconfig.compilerOptions.outDir || "./bin/dist"; + var outDir = "./bin/dist"; var srcDir = "."; var tnsCoreModulesDir = path.join(srcDir, "tns-core-modules");; var srcAppDirs = ["tests/app", "apps/app"]; //Don't move the tests folder from index 0! @@ -156,15 +156,6 @@ module.exports = function(grunt) { "!**/*.ios.d.ts" ].concat(localCfg.defaultExcludes); - var tsOptions = tsconfig.compilerOptions; - tsOptions.fast = 'never'; - tsOptions.removeComments = !grunt.option('leavecomments') || ''; - tsOptions.compiler = "node_modules/typescript/bin/tsc"; - tsOptions.failOnTypeErrors = true; - tsOptions.outDir = localCfg.outDir; - var removeCommentsArgument = tsOptions.removeComments ? " --removeComments" : ""; - tsOptions.additionalFlags = "--outDir " + localCfg.outDir + removeCommentsArgument; - // Config grunt.initConfig({ localCfg : localCfg, diff --git a/tsconfig.base-dts.json b/tsconfig.base-dts.json index 84a793481..a6469419e 100644 --- a/tsconfig.base-dts.json +++ b/tsconfig.base-dts.json @@ -1,20 +1,7 @@ { + "extends": "./tsconfig.shared", "compilerOptions": { - "noEmit": true, - "noEmitOnError": true, - "noEmitHelpers": true, - "target": "es5", - "module": "commonjs", - "declaration": false, - "noImplicitAny": false, - "noImplicitUseStrict": true, - "experimentalDecorators": true, - "sourceMap": true, - "jsx": "react", - "reactNamespace": "UIBuilder", - "lib": [ - "es2016", "dom" - ] + "noEmit": true }, "include": [ "tns-core-modules/**/*.d.ts" diff --git a/tsconfig.combined-dts.json b/tsconfig.combined-dts.json index 780689696..b18734cae 100644 --- a/tsconfig.combined-dts.json +++ b/tsconfig.combined-dts.json @@ -1,20 +1,7 @@ { + "extends": "./tsconfig.shared", "compilerOptions": { - "noEmit": true, - "noEmitOnError": true, - "noEmitHelpers": true, - "target": "es5", - "module": "commonjs", - "declaration": false, - "noImplicitAny": false, - "noImplicitUseStrict": true, - "experimentalDecorators": true, - "sourceMap": true, - "jsx": "react", - "reactNamespace": "UIBuilder", - "lib": [ - "es6", "dom" - ] + "noEmit": true }, "include": [ "bin/dist/tns-core-modules/tns-core-modules.d.ts" diff --git a/tsconfig.json b/tsconfig.json index 04a2eef17..5cc389b15 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,22 +1,5 @@ { - "compilerOptions": { - "noEmitOnError": false, - "noEmitHelpers": true, - "target": "es5", - "module": "commonjs", - "declaration": false, - "noImplicitAny": false, - "noImplicitUseStrict": true, - "removeComments": true, - "experimentalDecorators": true, - "diagnostics": true, - "sourceMap": true, - "jsx": "react", - "reactNamespace": "UIBuilder", - "lib": [ - "es6", "dom" - ] - }, + "extends": "./tsconfig.shared", "exclude": [ "tns-platform-declarations/node_modules/", "tns-platform-declarations/package/", diff --git a/tsconfig.node-tests.json b/tsconfig.node-tests.json index 7e9f13ce0..951be1cca 100644 --- a/tsconfig.node-tests.json +++ b/tsconfig.node-tests.json @@ -1,20 +1,5 @@ { - "compilerOptions": { - "noEmitOnError": true, - "noEmitHelpers": true, - "target": "es5", - "module": "commonjs", - "declaration": false, - "noImplicitAny": false, - "noImplicitUseStrict": true, - "experimentalDecorators": true, - "sourceMap": true, - "jsx": "react", - "reactNamespace": "UIBuilder", - "lib": [ - "es2016", "dom" - ] - }, + "extends": "./tsconfig.shared", "include": [ "tns-core-modules/js-libs/easysax/**/*.ts", "tns-core-modules/module.d.ts", diff --git a/tsconfig.shared.json b/tsconfig.shared.json new file mode 100644 index 000000000..7b755204d --- /dev/null +++ b/tsconfig.shared.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "noEmitOnError": false, + "noEmitHelpers": true, + "target": "es5", + "module": "commonjs", + "declaration": false, + "noImplicitAny": false, + "noImplicitUseStrict": true, + "removeComments": true, + "experimentalDecorators": true, + "diagnostics": true, + "sourceMap": true, + "jsx": "react", + "reactNamespace": "UIBuilder", + "lib": [ + "es6", "dom" + ] + } +}