Skip to content

Commit 8549348

Browse files
committed
first!
0 parents  commit 8549348

10 files changed

+692
-0
lines changed

.gitignore

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/.idea
2+
/.vagrant
3+
4+
/node_modules
5+
6+
/dist
7+
/cache
8+
/scratch
9+
/tsd-cache
10+
/test/tmp
11+
12+
/tscommand*
13+
ignoreBaseDirFile.*
14+
.tscache
15+
16+
/*.tgz
17+
tmp/
18+
dump/
19+
20+
.baseDir.ts
21+
.baseDir.d.ts
22+
.baseDir.js
23+
.baseDir.js.map
24+
25+
_tmp.*
26+
27+
npm-debug.log

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "repo"]
2+
path = repo
3+
url = https://github.com/Bartvds/DefinitelyTyped.git

.jshintrc

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"bitwise": true,
3+
"camelcase": false,
4+
"curly": true,
5+
"eqeqeq": true,
6+
"es3": false,
7+
"forin": true,
8+
"freeze": true,
9+
"immed": true,
10+
"indent": 4,
11+
"latedef": true,
12+
"newcap": true,
13+
"noarg": true,
14+
"noempty": true,
15+
"nonew": true,
16+
"plusplus": false,
17+
"quotmark": true,
18+
"undef": true,
19+
"unused": true,
20+
"strict": false,
21+
"trailing": true,
22+
23+
"maxlen": 180,
24+
25+
"asi": false,
26+
"boss": false,
27+
"debug": false,
28+
"eqnull": false,
29+
"esnext": true,
30+
"evil": false,
31+
"expr": false,
32+
"funcscope": false,
33+
"gcl": false,
34+
"globalstrict": false,
35+
"iterator": false,
36+
"lastsemic": false,
37+
"laxbreak": false,
38+
"laxcomma": false,
39+
"loopfunc": false,
40+
"maxerr": 50,
41+
"moz": false,
42+
"multistr": false,
43+
"notypeof": false,
44+
"proto": false,
45+
"scripturl": false,
46+
"smarttabs": true,
47+
"shadow": false,
48+
"sub": false,
49+
"supernew": false,
50+
"validthis": false,
51+
52+
"browser": false,
53+
"couch": false,
54+
"devel": false,
55+
"dojo": false,
56+
"jquery": false,
57+
"mootools": false,
58+
"node": true,
59+
"nonstandard": false,
60+
"prototypejs": false,
61+
"rhino": false,
62+
"worker": false,
63+
"wsh": false,
64+
"yui": false,
65+
66+
"globals": {
67+
"describe": true,
68+
"it": true,
69+
"beforeEach": true,
70+
"afterEach": true,
71+
"before": true,
72+
"after": true,
73+
"define": true,
74+
"chai": true,
75+
"assert": true
76+
}
77+
}

.npmignore

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/.idea
2+
/assets
3+
/cache
4+
/cookbooks
5+
/deploy
6+
/docs
7+
/media
8+
/src
9+
/tasks
10+
/test
11+
/typings
12+
/tsd-cache
13+
/util
14+
/tool
15+
/repo
16+
/lib
17+
/scratch
18+
19+
/tsd-config.json
20+
/tsd.json
21+
/tslint.json
22+
/Vagrantfile
23+
/Gruntfile.js
24+
25+
.npmignore
26+
.gitignore
27+
.gitmodules
28+
29+
.travis.yml
30+
.jshintrc
31+
.vagrant
32+
.editorconfig
33+
34+
/tscommand*
35+
ignoreBaseDirFile.*
36+
.tscache
37+
tmp/
38+
39+
/*.tgz
40+
/*.txt

.travis.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
language: node_js
2+
node_js:
3+
- "0.11"
4+
- "0.10"
5+
6+
notifications:
7+
email:
8+

LICENSE-MIT

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Copyright (c) 2014 Bart van der Schoor
2+
3+
Permission is hereby granted, free of charge, to any person
4+
obtaining a copy of this software and associated documentation
5+
files (the "Software"), to deal in the Software without
6+
restriction, including without limitation the rights to use,
7+
copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the
9+
Software is furnished to do so, subject to the following
10+
conditions:
11+
12+
The above copyright notice and this permission notice shall be
13+
included in all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
OTHER DEALINGS IN THE SOFTWARE.

README.md

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# export-dts-bundle
2+
3+
[![Build Status](https://secure.travis-ci.org/grunt-ts/export-dts-bundle.svg?branch=master)](http://travis-ci.org/grunt-ts/export-dts-bundle) [![NPM version](https://badge.fury.io/js/export-dts-bundle.svg)](http://badge.fury.io/js/export-dts-bundle) [![Dependency Status](https://david-dm.org/grunt-ts/export-dts-bundle.svg)](https://david-dm.org/grunt-ts/export-dts-bundle) [![devDependency Status](https://david-dm.org/grunt-ts/export-dts-bundle/dev-status.svg)](https://david-dm.org/grunt-ts/export-dts-bundle#info=devDependencies) [![Build status](https://ci.appveyor.com/api/projects/status/usywa9w6kd7ssskv)](https://ci.appveyor.com/project/BartvanderSchoor/export-dts-bundle)
4+
5+
> Export TypeScript .d.ts files as an external module defintion
6+
7+
This module is a naïve string-based approach at generating bundles from the .d.ts declaration files generated by a TypeScript compiler.
8+
9+
The main use-case is generating definition for npm/bower modules written in TypeScript (commonjs/amd).
10+
11+
Source-code should following the external-module pattern (using `import/export`'s and `--outDir`).
12+
13+
:warning: Experimental; use with care.
14+
15+
This module was born out of necessity and frustration. It is a little hacky, but at least if seems to work..
16+
17+
- original code was extracted from an ad-hoc Grunt-task so it is fully synchronous without feedback (except maybe some thrown assertion Error's if you feed it garbage input).
18+
- it works by line-by-line string operations so who knows what kind of funky edge-cases it burns (leave an issue if you find some).
19+
20+
21+
## Usage
22+
23+
1) Get it from npm:
24+
25+
````
26+
npm install export-dts-bundle
27+
````
28+
29+
2) Compile your modules with the TypeScript compiler of your choice with the `--declaration` and `--outDir` flags (and probably `--module commonjs` too).
30+
31+
3) Run `export-dts-bundle`
32+
33+
Let's assume the project is called `cool-project` main module is `build/index.js` with a `build/index.d.ts`:
34+
35+
````js
36+
var dts = require('export-dts-bundle');
37+
38+
dts.bundle({
39+
main: 'build/index.d.ts',
40+
name: 'cool-project'
41+
});
42+
````
43+
44+
This will traverse all references and imports for the .d.ts file of your sub-modules. Then it replace the `build/index.d.ts` file with the bundle of all visible imports.
45+
46+
It will also remove the other `.d.ts` files.
47+
48+
4) Extra bonus points if you link the generated definition in your package.json (or bower.json), in the typescript element:
49+
50+
````json
51+
{
52+
name: "cool-project",
53+
version: "0.1.3"
54+
// ..
55+
typescript: {
56+
definition: "build/index.d.ts"
57+
}
58+
}
59+
````
60+
61+
Using this makes the definition findable for tooling, for example the [TypeScript Definitions package manager](https://github.com/DefinitelyTyped/tsd) (from v0.6.x) can auto-link these into it `tsd.d.ts` bundle file (wow, so convenient).
62+
63+
## Todo
64+
65+
- add feature to create a DefinitelyTyped header (using `definition-header` package)
66+
- add feature to auto-update package.json/bower.json with the definition link
67+
- find time to implement a real, parser based solution
68+
69+
70+
## Contributions
71+
72+
They are very welcome. Beware this module is a quick hack-job so good luck!
73+
74+
75+
## License
76+
77+
Copyright (c) 2014 [Bart van der Schoor](https://github.com/Bartvds)
78+
79+
Licensed under the MIT license.

index.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('./lib/index');

0 commit comments

Comments
 (0)