Skip to content

Commit 4ca9c57

Browse files
committed
Initial commit.
0 parents  commit 4ca9c57

File tree

7 files changed

+76
-0
lines changed

7 files changed

+76
-0
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules/
2+
dist/
3+
*.d.ts
4+
*.log
5+
*.tgz

.npmignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules/
2+
*.d.ts
3+
*.log
4+
*.tgz
5+
6+
!index.d.ts

package.json

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "example",
3+
"version": "0.0.1",
4+
"description": "Example of a TypeScript-based package",
5+
"main": "dist/example.js",
6+
"scripts": {
7+
"prepublish": "autodts link && tsc && autodts generate",
8+
"test": "node test/test.js"
9+
},
10+
"author": "Juha Järvi",
11+
"license": "MIT",
12+
"typescript": {
13+
"definition": "index.d.ts"
14+
},
15+
"dependencies": {
16+
"@lib/dependency-example": "0.0.2"
17+
},
18+
"devDependencies": {
19+
"autodts": "~0.0.2",
20+
"dts-generator": "~1.5.0",
21+
"typescript": "~1.5.3"
22+
}
23+
}

src/example.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// example.ts
2+
3+
export {default as Greeter, DeepThought} from './example/Greeter';
4+
// export {Foo, Bar, Baz} from './example/AnotherFile';

src/example/Greeter.ts

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Greeter.ts
2+
/// <reference path = "../../typings/auto.d.ts" />
3+
4+
import {MeaningOfLife} from '@lib/dependency-example';
5+
6+
export default class Greeter {
7+
8+
static sayHello(name: string) {
9+
console.log('Hello, ' + name);
10+
}
11+
12+
}
13+
14+
export class DeepThought {
15+
16+
constructor(name: string) {
17+
this.result = MeaningOfLife.compute();
18+
}
19+
20+
result: number;
21+
22+
}

test/test.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
var example = require('..');
2+
3+
example.Greeter.sayHello('World!');
4+
console.log('Meaning of life is ' + new example.DeepThought().result);

tsconfig.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"compilerOptions": {
3+
"declaration": true,
4+
"module": "CommonJS",
5+
"target": "es5",
6+
"noImplicitAny": true,
7+
"outDir": "dist"
8+
},
9+
"files": [
10+
"src/example.ts"
11+
]
12+
}

0 commit comments

Comments
 (0)