Skip to content

Commit 5215823

Browse files
committed
chore(tsconfig) filesGlob cleanup
closes #648
1 parent 2df83f4 commit 5215823

File tree

4 files changed

+30
-15
lines changed

4 files changed

+30
-15
lines changed

dist/main/tsconfig/tsconfig.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ var os = require('os');
6767
var formatting = require('./formatting');
6868
var projectFileName = 'tsconfig.json';
6969
var defaultFilesGlob = [
70-
"./**/*.ts",
71-
"./**/*.tsx",
72-
"!./node_modules/**/*",
70+
"**/*.ts",
71+
"**/*.tsx",
72+
"!node_modules/**",
7373
];
74-
var invisibleFilesGlob = ["./**/*.ts", "./**/*.tsx"];
74+
var invisibleFilesGlob = ["**/*.ts", "**/*.tsx"];
7575
exports.defaults = {
7676
target: ts.ScriptTarget.ES5,
7777
module: ts.ModuleKind.CommonJS,
@@ -217,7 +217,7 @@ function getProjectSync(pathOrSrcFile) {
217217
if (!projectSpec.files && !projectSpec.filesGlob) {
218218
var toExpand = invisibleFilesGlob;
219219
if (projectSpec.exclude) {
220-
toExpand = toExpand.concat(projectSpec.exclude.map(function (exclude) { return '!' + exclude; }));
220+
toExpand = toExpand.concat(projectSpec.exclude.map(function (exclude) { return ("!" + exclude + "/**"); }));
221221
}
222222
}
223223
if (projectSpec.filesGlob) {

docs/faq.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,23 @@
33
## I keep getting changes to tsconfig.json
44
This is probably because of us keeping `files` updated with the `filesGlob` option. The reason why we do this is because the official `tsconfig.json` spec does not support `filesGlob`. Therefore we keep `files` in sync with the `filesGlob` so that your team mates can use whatever editor they prefer (sublime text, visual studio etc.).
55

6+
## For really large projects atom-typescript gets slow
7+
If you have `tsconfig.json` in a folder that contains `node_modules`, atom-typescript might become slow (due to extensive file listing). Two possible fixes:
8+
* Move `tsconfig.json` into a sub folder e.g. `src`
9+
* Add a `filesGlob` that excludes `node_modules` e.g.:
10+
11+
```ts
12+
"filesGlob" : [
13+
"**/*.ts",
14+
"**/*.tsx",
15+
"!node_modules/**",
16+
];
17+
```
18+
19+
[Further Details](https://github.com/TypeStrong/atom-typescript/issues/648).
20+
621
## I don't want atom-typescript compiling my js
7-
Set `compileOnSave : false` in your tsconfig.json (https://github.com/TypeStrong/atom-typescript/blob/master/docs/tsconfig.md#compileonsave). Then you've got all the intellisense / refactoring goodness of atom-typescript but no generated JavaScript. Why is this useful? Well you might be using something else for your build such as [gulp-typescript](https://github.com/ivogabe/gulp-typescript) or [tsify](https://github.com/smrq/tsify).
22+
Set `compileOnSave : false` in your tsconfig.json (https://github.com/TypeStrong/atom-typescript/blob/master/docs/tsconfig.md#compileonsave). Then you've got all the intellisense / refactoring goodness of atom-typescript but no generated JavaScript. Why is this useful? Well you might be using something else for your build such as [ts-loader](https://github.com/TypeStrong/ts-loader) or [tsify](https://github.com/TypeStrong/tsify) or [gulp-typescript](https://github.com/ivogabe/gulp-typescript).
823

924
## Which version of TypeScript does atom-typescript use?
1025
It uses [ntypescript](https://github.com/TypeStrong/ntypescript) which is just a build of Microsoft/Master. This means it's the latest and greatest of the TypeScript goodness. There is a possibility that in the future it will move to TypeScript nightlies but our current automation is working well.

lib/main/tsconfig/tsconfig.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,14 @@ var projectFileName = 'tsconfig.json';
205205
* This is what we write to new files
206206
*/
207207
var defaultFilesGlob = [
208-
"./**/*.ts",
209-
"./**/*.tsx",
210-
"!./node_modules/**/*",
208+
"**/*.ts",
209+
"**/*.tsx",
210+
"!node_modules/**",
211211
];
212212
/**
213213
* This is what we use when the user doens't specify a files / filesGlob
214214
*/
215-
var invisibleFilesGlob = ["./**/*.ts", "./**/*.tsx"];
215+
var invisibleFilesGlob = ["**/*.ts", "**/*.tsx"];
216216

217217
export var defaults: ts.CompilerOptions = {
218218
target: ts.ScriptTarget.ES5,
@@ -293,7 +293,7 @@ function rawToTsCompilerOptions(jsonOptions: CompilerOptions, projectDir: string
293293
if (compilerOptions.out !== undefined) {
294294
compilerOptions.out = path.resolve(projectDir, compilerOptions.out);
295295
}
296-
296+
297297
if (compilerOptions.outFile !== undefined) {
298298
// Till out is removed. Support outFile by just copying it to `out`
299299
compilerOptions.out = path.resolve(projectDir, compilerOptions.outFile);
@@ -393,7 +393,7 @@ export function getProjectSync(pathOrSrcFile: string): TypeScriptProjectFileDeta
393393
if (!projectSpec.files && !projectSpec.filesGlob) { // If there is no files and no filesGlob, we create an invisible one.
394394
var toExpand = invisibleFilesGlob;
395395
if(projectSpec.exclude){
396-
toExpand = toExpand.concat(projectSpec.exclude.map((exclude) => '!' + exclude));
396+
toExpand = toExpand.concat(projectSpec.exclude.map((exclude) => `!${exclude}/**`));
397397
}
398398
}
399399
if (projectSpec.filesGlob) { // If there is a files glob we will use that

snippets/tsconfig-snippets.cson

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
'prefix': 'fg'
44
'body': """
55
"filesGlob": [
6-
"./**/*.ts",
7-
"./**/*.tsx",
8-
"!./node_modules/**/*.ts"
6+
"**/*.ts",
7+
"**/*.tsx",
8+
"!node_modules/**"
99
],
1010
"""

0 commit comments

Comments
 (0)