Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Some things still aren’t working properly - namely the REPL and code coverage with istanbul. The rest actually works.
  • Loading branch information
blakeembrey committed Jul 15, 2015
0 parents commit f64ab29
Show file tree
Hide file tree
Showing 26 changed files with 3,053 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# EditorConfig is awesome: http://EditorConfig.org

root = true

[*]
indent_size = 2
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
bower_components
coverage
.DS_Store
npm-debug.log
dist
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: node_js

notifications:
email:
on_success: never
on_failure: change

node_js:
- "0.12"

after_script: "npm install coveralls@2 && cat ./coverage/lcov.info | coveralls"
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2014 Blake Embrey ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
67 changes: 67 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# TypeScript Node

[![NPM version][npm-image]][npm-url]
[![NPM downloads][downloads-image]][downloads-url]
[![Build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]

> TypeScript execution environment for node.
## Installation

```
npm install typescript-node --save
```

## Features

* Execute TypeScript with node
* Interactive REPL
* Execute (and print) TypeScript inline
* Supports Source Maps
* Supports `tsconfig.json`

## Usage

```sh
# Execute a script as you world normally with `node`.
ts-node script.ts

# Start a TypeScript REPL
ts-node

# Execute code snippets with TypeScript
ts-node -e 'console.log("Hello, world!")'

# Execute and print code snippets with TypeScript
ts-node -p '"Hello, world!"'
```

### Loading `tsconfig.json`

**Typescript Node** automatically loads `tsconfig.json` options and files from the current directory using [tsconfig](https://github.com/TypeStrong/tsconfig).

### Configuration Options

You can set options by passing them in before the script.

```sh
ts-node --compiler ntypescript --configFile tsconfig.json --ignoreWarnings 2304 hello-world.ts
```

* **compiler** Use a custom, require-able TypeScript compiler compatible with `typescript@>=1.5-alpha`
* **configFile** Manually set the location of the `tsconfig.json` file
* **ignoreWarnings** Set an array of TypeScript diagnostic codes to ignore

## License

MIT

[npm-image]: https://img.shields.io/npm/v/typescript-node.svg?style=flat
[npm-url]: https://npmjs.org/package/typescript-node
[downloads-image]: https://img.shields.io/npm/dm/typescript-node.svg?style=flat
[downloads-url]: https://npmjs.org/package/typescript-node
[travis-image]: https://img.shields.io/travis/blakeembrey/typescript-node.svg?style=flat
[travis-url]: https://travis-ci.org/blakeembrey/typescript-node
[coveralls-image]: https://img.shields.io/coveralls/blakeembrey/typescript-node.svg?style=flat
[coveralls-url]: https://coveralls.io/r/blakeembrey/typescript-node?branch=master
3 changes: 3 additions & 0 deletions bin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env node

require('./dist/bin/ts-node')
68 changes: 68 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"name": "typescript-node",
"version": "0.0.0",
"description": "Feature complete TypeScript environment for node",
"main": "dist/typescript-node.js",
"bin": {
"ts-node": "bin.js"
},
"files": [
"dist/",
"typescript-node.d.ts",
"bin.js",
"register.js",
"LICENSE"
],
"scripts": {
"lint": "# TODO",
"build": "npm run build-ts",
"build-ts": "rm -rf dist && tsc",
"test-spec": "mocha dist/**/*.spec.js -R spec --bail",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- dist/**/*.spec.js -R spec --bail",
"test": "npm run build && npm run lint && npm run test-cov",
"prepublish": "npm run build"
},
"repository": {
"type": "git",
"url": "git://github.com/blakeembrey/typescript-node.git"
},
"typescript": {
"definition": "typescript-node.d.ts"
},
"keywords": [
"typescript",
"node",
"runtime",
"environment",
"ts",
"compiler"
],
"author": {
"name": "Blake Embrey",
"email": "[email protected]",
"url": "http://blakeembrey.me"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/blakeembrey/typescript-node/issues"
},
"homepage": "https://github.com/blakeembrey/typescript-node",
"devDependencies": {
"chai": "^3.0.0",
"istanbul": "^0.3.17",
"mocha": "^2.1.0",
"ntypescript": "^1.201507091536.1",
"pre-commit": "^1.0.6",
"typescript": "^1.5.0-beta"
},
"peerDependencies": {
"typescript": "^1.5.0-alpha"
},
"dependencies": {
"arrify": "^1.0.0",
"commander": "^2.8.1",
"source-map-support": "^0.3.2",
"tsconfig": "^1.0.1",
"xtend": "^4.0.0"
}
}
1 change: 1 addition & 0 deletions register.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('./').register()
Loading

0 comments on commit f64ab29

Please sign in to comment.