Skip to content

Commit e51fa38

Browse files
committed
make main.js executable and flesh out README
Summary: Add some minor docs on how to use tsickle as a user. It sounds like we might fold this into the ng tsc_wrapped so I think this is all I'll do on this. Reviewers: alexeagle, rkirov Reviewed By: alexeagle, rkirov Subscribers: alexeagle, typescript-eng Differential Revision: https://reviews.angular.io/D141
1 parent c1e5ab4 commit e51fa38

File tree

6 files changed

+46
-12
lines changed

6 files changed

+46
-12
lines changed

README.md

+35-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,44 @@
11
# Tsickle - TypeScript to Closure Annotator [![Build Status](https://travis-ci.org/angular/tsickle.svg?branch=master)](https://travis-ci.org/angular/tsickle)
22

3-
Tsickle processes TypeScript and adds [Closure Compiler](https://github.com/google/closure-compiler/)
4-
-compatible JSDoc annotations. This allows using TypeScript to transpile your sources, and then
5-
Closure Compiler to bundle and optimize them, while taking advantage of type information in Closure
6-
Compiler.
3+
Tsickle processes TypeScript and adds [Closure Compiler]-compatible JSDoc
4+
annotations. This allows using TypeScript to transpile your sources, and then
5+
Closure Compiler to bundle and optimize them, while taking advantage of type
6+
information in Closure Compiler.
7+
8+
[Closure Compiler]: https://github.com/google/closure-compiler/
79

810
## Installation
911

10-
- execute `npm i` to install the dependencies,
12+
- Execute `npm i` to install the dependencies.
13+
14+
## Usage
15+
16+
### Project Setup
17+
18+
Tsickle works by wrapping `tsc`. To use it, you must set up your project such
19+
that it builds correctly when you run `tsc` from the command line, by
20+
configuring the settings in `tsconfig.json`.
21+
22+
If you have complicated tsc command lines and flags in a build file (like a
23+
gulpfile etc.) Tsickle won't know about it. Another reason it's nice to put
24+
everything in `tsconfig.json` is so your editor inherits all these settings as
25+
well.
1126

12-
## Gulp tasks
27+
### Invocation
1328

14-
- `gulp watch` executes the unit tests in watch mode (use `gulp test.unit` for a single run),
29+
Run `tsickle --help` for the full syntax, but basically you specify the minified
30+
output bundle path and the input TypeScript project.
31+
32+
## Development
33+
34+
### Gulp tasks
35+
36+
- `gulp watch` executes the unit tests in watch mode (use `gulp test.unit` for a
37+
single run),
1538
- `gulp test.e2e` executes the e2e tests,
16-
- `gulp test.check-format` checks the source code formatting using `clang-format`,
39+
- `gulp test.check-format` checks the source code formatting using
40+
`clang-format`,
1741
- `gulp test` runs unit tests, e2e tests and checks the source code formatting.
42+
43+
Export the environment variable `UPDATE_GOLDENS=1` to have the test suite
44+
rewrite the golden files when you run it.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"devDependencies": {
2020
"chai": "^2.1.1",
21-
"clang-format": "1.0.37",
21+
"clang-format": "^1.0.41",
2222
"glob": "^7.0.0",
2323
"google-closure-compiler": "^20160315.2.0",
2424
"gulp": "^3.8.11",

src/main.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env node
2+
13
import * as closure from 'google-closure-compiler';
24
import * as fs from 'fs';
35
import * as minimist from 'minimist';

src/tsickle.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import * as ts from 'typescript';
2-
import {TypeTranslator} from './type-translator';
2+
33
import {Rewriter} from './rewriter';
4+
import {TypeTranslator} from './type-translator';
5+
46
export {convertDecorators} from './decorator-annotator';
57

68
export interface Options {

test/decorator-annotator_test.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import {convertDecorators} from '../src/decorator-annotator';
21
import {expect} from 'chai';
2+
3+
import {convertDecorators} from '../src/decorator-annotator';
34
import * as tsickle from '../src/tsickle';
5+
46
import * as test_support from './test_support';
57

68
const testCaseFileName = 'testcase.ts';

test/test_support.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import * as fs from 'fs';
2-
import * as ts from 'typescript';
32
import * as glob from 'glob';
43
import * as path from 'path';
4+
import * as ts from 'typescript';
55

66
import * as tsickle from '../src/tsickle';
77

8+
89
/** The TypeScript compiler options used by the test suite. */
910
const compilerOptions: ts.CompilerOptions = {
1011
target: ts.ScriptTarget.ES6,

0 commit comments

Comments
 (0)