Skip to content

Commit f64ab29

Browse files
committed
Initial commit
Some things still aren’t working properly - namely the REPL and code coverage with istanbul. The rest actually works.
0 parents  commit f64ab29

26 files changed

+3053
-0
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
root = true
4+
5+
[*]
6+
indent_size = 2
7+
indent_style = space
8+
end_of_line = lf
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
bower_components
3+
coverage
4+
.DS_Store
5+
npm-debug.log
6+
dist

.travis.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
language: node_js
2+
3+
notifications:
4+
email:
5+
on_success: never
6+
on_failure: change
7+
8+
node_js:
9+
- "0.12"
10+
11+
after_script: "npm install coveralls@2 && cat ./coverage/lcov.info | coveralls"

LICENSE

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

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# TypeScript Node
2+
3+
[![NPM version][npm-image]][npm-url]
4+
[![NPM downloads][downloads-image]][downloads-url]
5+
[![Build status][travis-image]][travis-url]
6+
[![Test coverage][coveralls-image]][coveralls-url]
7+
8+
> TypeScript execution environment for node.
9+
10+
## Installation
11+
12+
```
13+
npm install typescript-node --save
14+
```
15+
16+
## Features
17+
18+
* Execute TypeScript with node
19+
* Interactive REPL
20+
* Execute (and print) TypeScript inline
21+
* Supports Source Maps
22+
* Supports `tsconfig.json`
23+
24+
## Usage
25+
26+
```sh
27+
# Execute a script as you world normally with `node`.
28+
ts-node script.ts
29+
30+
# Start a TypeScript REPL
31+
ts-node
32+
33+
# Execute code snippets with TypeScript
34+
ts-node -e 'console.log("Hello, world!")'
35+
36+
# Execute and print code snippets with TypeScript
37+
ts-node -p '"Hello, world!"'
38+
```
39+
40+
### Loading `tsconfig.json`
41+
42+
**Typescript Node** automatically loads `tsconfig.json` options and files from the current directory using [tsconfig](https://github.com/TypeStrong/tsconfig).
43+
44+
### Configuration Options
45+
46+
You can set options by passing them in before the script.
47+
48+
```sh
49+
ts-node --compiler ntypescript --configFile tsconfig.json --ignoreWarnings 2304 hello-world.ts
50+
```
51+
52+
* **compiler** Use a custom, require-able TypeScript compiler compatible with `typescript@>=1.5-alpha`
53+
* **configFile** Manually set the location of the `tsconfig.json` file
54+
* **ignoreWarnings** Set an array of TypeScript diagnostic codes to ignore
55+
56+
## License
57+
58+
MIT
59+
60+
[npm-image]: https://img.shields.io/npm/v/typescript-node.svg?style=flat
61+
[npm-url]: https://npmjs.org/package/typescript-node
62+
[downloads-image]: https://img.shields.io/npm/dm/typescript-node.svg?style=flat
63+
[downloads-url]: https://npmjs.org/package/typescript-node
64+
[travis-image]: https://img.shields.io/travis/blakeembrey/typescript-node.svg?style=flat
65+
[travis-url]: https://travis-ci.org/blakeembrey/typescript-node
66+
[coveralls-image]: https://img.shields.io/coveralls/blakeembrey/typescript-node.svg?style=flat
67+
[coveralls-url]: https://coveralls.io/r/blakeembrey/typescript-node?branch=master

bin.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env node
2+
3+
require('./dist/bin/ts-node')

package.json

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"name": "typescript-node",
3+
"version": "0.0.0",
4+
"description": "Feature complete TypeScript environment for node",
5+
"main": "dist/typescript-node.js",
6+
"bin": {
7+
"ts-node": "bin.js"
8+
},
9+
"files": [
10+
"dist/",
11+
"typescript-node.d.ts",
12+
"bin.js",
13+
"register.js",
14+
"LICENSE"
15+
],
16+
"scripts": {
17+
"lint": "# TODO",
18+
"build": "npm run build-ts",
19+
"build-ts": "rm -rf dist && tsc",
20+
"test-spec": "mocha dist/**/*.spec.js -R spec --bail",
21+
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- dist/**/*.spec.js -R spec --bail",
22+
"test": "npm run build && npm run lint && npm run test-cov",
23+
"prepublish": "npm run build"
24+
},
25+
"repository": {
26+
"type": "git",
27+
"url": "git://github.com/blakeembrey/typescript-node.git"
28+
},
29+
"typescript": {
30+
"definition": "typescript-node.d.ts"
31+
},
32+
"keywords": [
33+
"typescript",
34+
"node",
35+
"runtime",
36+
"environment",
37+
"ts",
38+
"compiler"
39+
],
40+
"author": {
41+
"name": "Blake Embrey",
42+
"email": "[email protected]",
43+
"url": "http://blakeembrey.me"
44+
},
45+
"license": "MIT",
46+
"bugs": {
47+
"url": "https://github.com/blakeembrey/typescript-node/issues"
48+
},
49+
"homepage": "https://github.com/blakeembrey/typescript-node",
50+
"devDependencies": {
51+
"chai": "^3.0.0",
52+
"istanbul": "^0.3.17",
53+
"mocha": "^2.1.0",
54+
"ntypescript": "^1.201507091536.1",
55+
"pre-commit": "^1.0.6",
56+
"typescript": "^1.5.0-beta"
57+
},
58+
"peerDependencies": {
59+
"typescript": "^1.5.0-alpha"
60+
},
61+
"dependencies": {
62+
"arrify": "^1.0.0",
63+
"commander": "^2.8.1",
64+
"source-map-support": "^0.3.2",
65+
"tsconfig": "^1.0.1",
66+
"xtend": "^4.0.0"
67+
}
68+
}

register.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require('./').register()

0 commit comments

Comments
 (0)