Skip to content

Commit 940174b

Browse files
committed
Remove the files entry from the tsconfig.json
1 parent 4c54bc8 commit 940174b

6 files changed

Lines changed: 42 additions & 652 deletions

File tree

apps/perf-tests/controls-page.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// When there are both <file>.d.ts and <file>.ts, The default TypeScript file resolution will ignore the .d.ts
2+
/// <reference path="controls-page.d.ts" />
3+
14
import definition = require("controls-page");
25
import pagesModule = require("ui/page");
36
import stackLayoutModule = require("ui/layouts/stack-layout");

build/tsc-dev.js

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -110,20 +110,14 @@ function compile(fileNames, options) {
110110
console.log("Process exiting with code " + exitCode + ".");
111111
process.exit(exitCode);
112112
}
113-
var files = JSON.parse(fs.readFileSync("./tsconfig.json")).files;
114-
var options = {
115-
noEmitOnError: true,
116-
noEmitHelpers: true,
117-
target: ts.ScriptTarget.ES5,
118-
module: ts.ModuleKind.CommonJS,
119-
declaration: false,
120-
noImplicitAny: false,
121-
noImplicitUseStrict: true,
122-
experimentalDecorators: true
123-
};
113+
// Perhaps on file change before incremental compilation we should read the tsconfig.json again.
114+
var configFileName = path.resolve("tsconfig.json");
115+
var configObject = JSON.parse(fs.readFileSync("./tsconfig.json"));
116+
var configParseResult = ts.parseJsonConfigFileContent(configObject, ts.sys, path.dirname(configFileName));
117+
configParseResult.fileNames.forEach(console.log);
124118
if (isTranspile) {
125-
transpile(files, { module: ts.ModuleKind.CommonJS, noImplicitUseStrict: true });
119+
transpile(configParseResult.fileNames, configParseResult.options);
126120
}
127121
else {
128-
compile(files, options);
122+
compile(configParseResult.fileNames, configParseResult.options);
129123
}

build/tsc-dev.ts

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ function transpile(fileNames: string[], options: ts.CompilerOptions) {
7070
console.timeEnd("transpile");
7171

7272
if (isWatching) {
73+
// NOTE: Perhaps on file change before incremental compilation we should read the tsconfig.json again and update only tsconfig.json files.
74+
7375
console.log("Watching for changes...");
7476
fs.watch(".", { persistent: true, recursive: true, encoding: "utf8" }, (event, file) => {
7577
try {
@@ -132,19 +134,13 @@ function compile(fileNames: string[], options: ts.CompilerOptions) {
132134
process.exit(exitCode);
133135
}
134136

135-
var files = JSON.parse(fs.readFileSync("./tsconfig.json")).files;
136-
var options: ts.CompilerOptions = {
137-
noEmitOnError: true,
138-
noEmitHelpers: true,
139-
target: ts.ScriptTarget.ES5,
140-
module: ts.ModuleKind.CommonJS,
141-
declaration: false,
142-
noImplicitAny: false,
143-
noImplicitUseStrict: true,
144-
experimentalDecorators: true
145-
};
137+
var configFileName = path.resolve("tsconfig.json");
138+
var configObject = JSON.parse(fs.readFileSync("./tsconfig.json"));
139+
var configParseResult = ts.parseJsonConfigFileContent(configObject, ts.sys, path.dirname(configFileName));
140+
146141
if (isTranspile) {
147-
transpile(files, { module: ts.ModuleKind.CommonJS, noImplicitUseStrict: true });
142+
transpile(configParseResult.fileNames, configParseResult.options);
148143
} else {
149-
compile(files, options);
144+
compile(configParseResult.fileNames, configParseResult.options);
150145
}
146+

gruntfile.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,17 @@ module.exports = function(grunt) {
160160
localCfg.mainPackageContent = grunt.file.readJSON(localCfg.packageJsonFilePath);
161161
localCfg.packageVersion = getPackageVersion(localCfg.packageJsonFilePath);
162162
localCfg.commitSHA = getCommitSha();
163-
localCfg.typeScriptSrc = tsconfig.filesGlob;
163+
localCfg.typeScriptSrc = [
164+
"**/*.ts",
165+
"!node_modules/**/*.*",
166+
"!tests/node_modules/**/*.*",
167+
"!bin/**/*.*",
168+
"!build/**/*.*",
169+
"!Deploy/**/*.*",
170+
"!out/**/*.*",
171+
"!.*/**/*.*",
172+
"!obj/**/*.*"
173+
];
164174
localCfg.defaultExcludes = localCfg.typeScriptSrc.filter(function(item) { return /^!/.test(item); });
165175
localCfg.typeScriptSrcForTsLint = localCfg.typeScriptSrc.concat([
166176
"!tns-core-modules/ios.d.ts",
@@ -399,7 +409,9 @@ module.exports = function(grunt) {
399409
'tns-core-modules/module.d.ts',
400410
'tns-core-modules/xml/**/*.ts',
401411
'tns-core-modules/es-collections.d.ts',
402-
'node-tests/**/*.ts',
412+
'tns-core-modules/declarations.d.ts',
413+
'tns-core-modules/es6-promise.d.ts',
414+
'node-tests/**/*.ts'
403415
],
404416
outDir: localCfg.outDir,
405417
dest: localCfg.outDir,

node-tests/node-shims.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)