Skip to content

Commit

Permalink
Merge pull request #124 from pahen/typescript
Browse files Browse the repository at this point in the history
Support for TypeScript
  • Loading branch information
pahen authored Aug 26, 2017
2 parents 5b981cd + 50eb3ca commit e230714
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 10 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
; http://editorconfig.org
root = true

[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[{package.json,.travis.yml}]
indent_style = space
indent_size = 2
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,23 @@
"test:output": "./test/output.sh"
},
"dependencies": {
"chalk": "^1.1.3",
"commander": "^2.9.0",
"commondir": "^1.0.1",
"debug": "^2.2.0",
"dependency-tree": "5.9.1",
"graphviz": "^0.0.8",
"mz": "^2.4.0",
"chalk": "1.1.3",
"commander": "2.9.0",
"commondir": "1.0.1",
"debug": "2.2.0",
"dependency-tree": "5.10.1",
"graphviz": "0.0.8",
"mz": "2.4.0",
"ora": "1.2.0",
"pluralize": "4.0.0",
"pretty-ms": "2.1.0",
"rc": "^1.1.6",
"walkdir": "^0.0.11"
"rc": "1.1.6",
"walkdir": "0.0.11"
},
"devDependencies": {
"@aptoma/eslint-config": "6.0.0",
"eslint": "3.19.0",
"mocha": "^3.2.0",
"mocha": "3.2.0",
"should": "11.2.1"
}
}
20 changes: 20 additions & 0 deletions test/typescript.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* eslint-env mocha */
'use strict';

const madge = require('../lib/api');
require('should');

describe('TypeScript', () => {
const dir = __dirname + '/typescript';

it('extracts module dependencies', (done) => {
madge(dir + '/import.ts').then((res) => {
res.obj().should.eql({
'import.ts': ['require.ts'],
'require.ts': ['export.ts'],
'export.ts': []
});
done();
}).catch(done);
});
});
7 changes: 7 additions & 0 deletions test/typescript/export.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class ExportClass {
stringLength(s: string) {
return s.length;
}
}

export = ExportClass;
8 changes: 8 additions & 0 deletions test/typescript/import.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import B from './require';

class ImportClass {
constructor(public greeting: string) { }
greet() {
return "<h1>" + this.greeting + "</h1>";
}
};
7 changes: 7 additions & 0 deletions test/typescript/require.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import x = require('./export');

export default class RequireClass {
stringLength(s: string) {
return s.length;
}
}

0 comments on commit e230714

Please sign in to comment.