Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: support for wildcards #916

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
"engines" : {
"node" : ">=0.8.0"
},
"dependencies": {
"glob": "latest"
},
"devDependencies": {
"jake" : "latest",
"mocha" : "latest",
Expand Down
20 changes: 18 additions & 2 deletions src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module ts {
type: "boolean",
},
{
name: "emitBOM",
name: "emitBOM",
type: "boolean"
},
{
Expand Down Expand Up @@ -197,11 +197,27 @@ module ts {
}
}
else {
filenames.push(s);
testPathsAndPush(s);
}
}
}

function testPathsAndPush(filenameOrPattern: string) {
var fs = require("fs");
var path = require("path");

if (fs.existsSync(path.resolve(process.cwd(), filenameOrPattern))) {
filenames.push(filenameOrPattern);
return;
}

var glob = require("glob");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't use NPM packages in the compiler (tsc.exe doesn't run under node); you'll need to re-implement whatever functionality this package is providing. Go through the sys interface for file system operations.


glob.sync(filenameOrPattern).forEach(function(filename) {
filenames.push(filename);
});
}

function parseResponseFile(filename: string) {
var text = sys.readFile(filename);

Expand Down