Skip to content

Commit 06d9ea3

Browse files
committed
Merge pull request Asana#53 from Asana/typescript-starter
Typescript starter
2 parents 83c7fe7 + ec8a01c commit 06d9ea3

16 files changed

+92
-323
lines changed

.editorconfig

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,22 @@ root = true
33

44
[*]
55
charset = utf-8
6+
end_of_line = lf
67
indent_size = 2
78
indent_style = space
8-
trim_trailing_whitespace = true
99
insert_final_newline = true
1010
max_line_length = 80
1111
quote_type = double
12+
trim_trailing_whitespace = true
1213

1314
[*.md]
1415
trim_trailing_whitespace = false
1516

1617
[*.ts]
18+
curly_bracket_next_line = false
19+
continuation_indent_size = 4
20+
indent_brace_style = BSD KNF
1721
indent_size = 4
1822
max_line_length = 140
19-
continuation_indent_size = 4
23+
spaces_around_brackets = outside
24+
spaces_around_operators = true

.gitignore

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,8 @@ node_modules
3131
.idea
3232
*.iml
3333

34-
# Build artifacts
35-
_build
36-
doc
37-
*.js
34+
# Artifacts
35+
build
3836
*.d.ts
39-
40-
# TypeScript Configuration
41-
tsconfig.json
37+
*.js
4238
typings

.travis.yml

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,32 @@
1-
after_success:
2-
- npm run coverage
3-
after_deploy:
4-
- git config --global user.email "[email protected]"
5-
- git config --global user.name "Asana"
6-
- npm run doc
7-
before_deploy:
8-
- npm run bundle
9-
before_script:
10-
- npm run typings
1+
# Cache node_modules and typings for future runs. This does make the builds
2+
# sometimes fail because of a bad cache but usually this is a huge test
3+
# performance win.
114
cache:
125
directories:
13-
- node_modules
14-
- typings
6+
- node_modules
7+
- typings
8+
# Set up environment variables for tests
9+
env:
10+
global:
11+
# Use a better mocha reporter for Travis
12+
- MOCHA_REPORTER=spec
13+
# Use the Travis Docker build system which is faster
14+
sudo: false
15+
# Specify to use node
16+
language: node_js
17+
# Specify the node versions to run on
18+
node_js:
19+
- "0.12"
20+
# Make sure to have typings before the test
21+
before_script:
22+
- npm run typings
23+
# Make sure to bundle the application before any deploys
24+
before_deploy:
25+
- npm run bundle
26+
# Report code coverage to coveralls after successful test runs
27+
after_success:
28+
- npm run coveralls
29+
# Deploy to npm on tagged commits
1530
deploy:
1631
provider: npm
1732
@@ -21,10 +36,3 @@ deploy:
2136
on:
2237
tags: true
2338
repo: Asana/typed-react
24-
env:
25-
global:
26-
secure: d7CTjWUzh9E5JQELB9OqqC9DLaC2TfgwlTeHN2HhlmCMpva8KgV6QdLNtLNp2WRAvcuFYQITJCASRckhaUXD9HfE/PVjCLRoeIflQwNddfGedVI89xPpY7BQqQGSdRWXpvgaHGETovty75MWBT+5H0ju7oxJt+wKkz+Lj/NC2ks=
27-
language: node_js
28-
node_js:
29-
- '0.12'
30-
sudo: false

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2014 Asana
3+
Copyright (c) 2015 Asana
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Typed React [![NPM Version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage][coveralls-image]][coveralls-url]
1+
# Typed React
2+
3+
[![NPM Version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage][coveralls-image]][coveralls-url]
24

35
A binding layer between React and TypeScript. React currently uses a `createClass` function which takes in a component specification and then binds the value of `this`. Unfortunately TypeScript does not support that currently but there are several proposals to do that in the future. React moving to a world which supports ES6 classes will also make this unnecessary. In the meantime, this library quite simple provides a class to extend and factory function to convert the prototype for `createClass`.
46

@@ -129,3 +131,4 @@ npm test
129131

130132
[coveralls-url]: https://coveralls.io/r/Asana/typed-react
131133
[coveralls-image]: https://img.shields.io/coveralls/Asana/typed-react/master.svg?style=flat-square
134+

gulpfile.ts

Lines changed: 0 additions & 205 deletions
This file was deleted.

package.json

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,25 @@
44
"description": "A binding layer between React and TypeScript",
55
"main": "index.js",
66
"files": [
7-
"*.js",
8-
"*.d.ts"
7+
"typed-react.d.ts",
8+
"**/*.js",
9+
"!**/*_test.js",
10+
"!build/**/*.js",
11+
"!coverage/**/*.js",
12+
"!node_modules/**/*.js"
913
],
1014
"scripts": {
11-
"bundle": "gulp bundle",
12-
"coverage": "cat ./coverage/lcov.info | coveralls",
13-
"doc": "gulp doc",
14-
"test": "gulp test",
15+
"prebundle": "npm run compile && mv build/src/** .",
16+
"bundle": "dts-generator --name $npm_package_name --main index.d.ts --baseDir . --exclude node_modules/dts-generator/node_modules/typescript/bin/lib.es6.d.ts -out ${npm_package_name}.d.ts *.d.ts",
17+
"clean": "rm -rf build coverage *.js *.d.ts",
18+
"precompile": "npm run clean",
19+
"compile": "find src test typings -name \"*.ts\" | xargs tsc --declaration --module commonjs --target es5 --noImplicitAny --outDir build",
20+
"coveralls": "cat ./coverage/lcov.info | coveralls",
21+
"prelint": "npm run compile -- --sourceMap",
22+
"lint": "find src test -name \"*.ts\" | sed 's/^/--file=/g' | xargs tslint",
23+
"pretest": "npm run lint && find build -type f -name *.js -exec sed -i .bak -e '1s/^var __extends/\\/\\* istanbul ignore next \\*\\/\rvar __extends/; 1s/^/require(\"source-map-support\").install();\r/' {} \\;",
24+
"test": "istanbul cover _mocha -- --reporter ${MOCHA_REPORTER-nyan} --slow 10 --ui tdd --recursive build/**/*_test.js",
25+
"posttest": "istanbul check-coverage --statements 100 --branches 100 --functions 100 --lines 100",
1526
"typings": "tsd reinstall && tsd rebundle"
1627
},
1728
"repository": {
@@ -32,22 +43,16 @@
3243
"react": ">=0.12"
3344
},
3445
"devDependencies": {
35-
"chai": "^2.1.1",
46+
"chai": "^2.3.0",
3647
"coveralls": "^2.11.2",
37-
"del": "^1.1.1",
38-
"dts-bundle": "^0.2.0",
39-
"event-stream": "^3.1.7",
40-
"gulp": "^3.8.8",
41-
"gulp-gh-pages": "^0.4.0",
42-
"gulp-istanbul": "^0.6.0",
43-
"gulp-mocha": "^2.0.0",
44-
"gulp-replace": "^0.5.0",
45-
"gulp-tslint": "^1.3.0",
46-
"gulp-typedoc": "^1.1.0",
47-
"gulp-typescript": "^2.1.0",
48-
"react": "^0.13.0",
48+
"dts-generator": "^1.4.1",
49+
"istanbul": "^0.3.14",
50+
"mocha": "^2.2.4",
51+
"sinon": "^1.14.1",
52+
"source-map-support": "^0.2.10",
4953
"tsd": "^0.6.0-beta.5",
50-
"typescript-require": "https://github.com/pspeter3/typescript-require/releases/download/v1.0.6/typescript-require-1.0.6.tgz"
54+
"tslint": "^2.1.1",
55+
"typescript": "^1.4.1"
5156
},
5257
"typescript": {
5358
"definition": "typed-react.d.ts"

src/component.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/// <reference path="../typings/react/react.d.ts"/>
2-
31
import Mixin = require("././mixin");
42
import react = require("react");
53

src/create_class.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/// <reference path="../typings/react/react.d.ts"/>
21
import extractPrototype = require("./extract_prototype");
32
import Component = require("./component");
43
import react = require("react");

0 commit comments

Comments
 (0)