|
1 |
| -# Browserify |
2 |
| - |
3 |
| -### Install |
4 |
| -```sh |
5 |
| -npm install tsify |
6 |
| -``` |
7 |
| - |
8 |
| -### Using Command Line Interface |
9 |
| - |
10 |
| -```sh |
11 |
| -browserify main.ts -p [ tsify --noImplicitAny ] > bundle.js |
12 |
| -``` |
13 |
| - |
14 |
| -### Using API |
15 |
| - |
16 |
| -```javascript |
17 |
| -var browserify = require("browserify"); |
18 |
| -var tsify = require("tsify"); |
19 |
| - |
20 |
| -browserify() |
21 |
| - .add('main.ts') |
22 |
| - .plugin('tsify', { noImplicitAny: true }) |
23 |
| - .bundle() |
24 |
| - .pipe(process.stdout); |
25 |
| -``` |
26 |
| - |
27 |
| -More details: [smrq/tsify](https://github.com/smrq/tsify) |
28 |
| - |
29 |
| -# Duo |
30 |
| - |
31 |
| -### Install |
32 |
| -```sh |
33 |
| -npm install duo-typescript |
34 |
| -``` |
35 |
| - |
36 |
| -### Using Command Line Interface |
37 |
| - |
38 |
| -```sh |
39 |
| -duo --use duo-typescript entry.ts |
40 |
| -``` |
41 |
| - |
42 |
| -### Using API |
43 |
| -```javascript |
44 |
| -var Duo = require('duo'); |
45 |
| -var fs = require('fs') |
46 |
| -var path = require('path') |
47 |
| -var typescript = require('duo-typescript'); |
48 |
| - |
49 |
| -var out = path.join(__dirname, "output.js") |
50 |
| - |
51 |
| -Duo(__dirname) |
52 |
| - .entry('entry.ts') |
53 |
| - .use(typescript()) |
54 |
| - .run(function (err, results) { |
55 |
| - if (err) throw err; |
56 |
| - // Write compiled result to output file |
57 |
| - fs.writeFileSync(out, results.code); |
58 |
| - }); |
59 |
| -``` |
60 |
| -More details: [frankwallis/duo-typescript](https://github.com/frankwallis/duo-typescript) |
61 |
| - |
62 |
| -# Grunt |
63 |
| - |
64 |
| -### Install |
65 |
| - |
66 |
| -```sh |
67 |
| -npm install grunt-ts |
68 |
| -``` |
69 |
| - |
70 |
| -### Basic Gruntfile.js |
71 |
| - |
72 |
| -````javascript |
73 |
| -module.exports = function(grunt) { |
74 |
| - grunt.initConfig({ |
75 |
| - ts: { |
76 |
| - default : { |
77 |
| - src: ["**/*.ts", "!node_modules/**/*.ts"] |
78 |
| - } |
79 |
| - } |
80 |
| - }); |
81 |
| - grunt.loadNpmTasks("grunt-ts"); |
82 |
| - grunt.registerTask("default", ["ts"]); |
83 |
| -}; |
84 |
| -```` |
85 |
| - |
86 |
| -More details: [TypeStrong/grunt-ts](https://github.com/TypeStrong/grunt-ts) |
87 |
| - |
88 |
| -# gulp |
89 |
| - |
90 |
| -### Install |
91 |
| -```sh |
92 |
| -npm install gulp-typescript |
93 |
| -``` |
94 |
| - |
95 |
| -### Basic gulpfile.js |
96 |
| - |
97 |
| -```javascript |
98 |
| -var gulp = require("gulp"); |
99 |
| -var ts = require("gulp-typescript"); |
100 |
| - |
101 |
| -gulp.task("default", function () { |
102 |
| - var tsResult = gulp.src("src/*.ts") |
103 |
| - .pipe(ts({ |
104 |
| - noImplicitAny: true, |
105 |
| - out: "output.js" |
106 |
| - })); |
107 |
| - return tsResult.js.pipe(gulp.dest('built/local')); |
108 |
| -}); |
109 |
| -``` |
110 |
| -More details: [ivogabe/gulp-typescript](https://github.com/ivogabe/gulp-typescript) |
111 |
| - |
112 |
| -# jspm |
113 |
| - |
114 |
| -### Install |
115 |
| -```sh |
116 |
| -npm install -g jspm@beta |
117 |
| -``` |
118 |
| -_Note: Currently TypeScript support in jspm is in 0.16beta_ |
119 |
| - |
120 |
| -More details: [TypeScriptSamples/jspm](https://github.com/Microsoft/TypeScriptSamples/tree/jspm/jspm) |
121 |
| - |
122 |
| -# webpack |
123 |
| - |
124 |
| -### Install |
125 |
| -```sh |
126 |
| -npm install awesome-typescript-loader --save-dev |
127 |
| -``` |
128 |
| - |
129 |
| -### Basic webpack.config.js |
130 |
| -```javascript |
131 |
| -module.exports = { |
132 |
| - |
133 |
| - // Currently we need to add '.ts' to resolve.extensions array. |
134 |
| - resolve: { |
135 |
| - extensions: ['', '.ts', '.webpack.js', '.web.js', '.js'] |
136 |
| - }, |
137 |
| - |
138 |
| - // Source maps support (or 'inline-source-map' also works) |
139 |
| - devtool: 'source-map', |
140 |
| - |
141 |
| - // Add loader for .ts files. |
142 |
| - module: { |
143 |
| - loaders: [ |
144 |
| - { |
145 |
| - test: /\.ts$/, |
146 |
| - loader: 'awesome-typescript-loader' |
147 |
| - } |
148 |
| - ] |
149 |
| - } |
150 |
| -}; |
151 |
| -``` |
152 |
| -More details: [s-panferov/awesome-typescript-loader](https://github.com/s-panferov/awesome-typescript-loader) |
153 |
| - |
154 |
| - |
155 |
| -# MSBuild |
156 |
| - |
157 |
| -Update project file to include locally installed `Microsoft.TypeScript.Default.props` (at the top) and `Microsoft.TypeScript.targets` (at the bottom) files: |
158 |
| - |
159 |
| -```XML |
160 |
| -<?xml version="1.0" encoding="utf-8"?> |
161 |
| -<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
162 |
| - <!-- Include default props at the bottom --> |
163 |
| - <Import |
164 |
| - Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props" |
165 |
| - Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props')" /> |
166 |
| - |
167 |
| - <!-- TypeScript configurations go here --> |
168 |
| - <PropertyGroup Condition="'$(Configuration)' == 'Debug'"> |
169 |
| - <TypeScriptRemoveComments>false</TypeScriptRemoveComments> |
170 |
| - <TypeScriptSourceMap>true</TypeScriptSourceMap> |
171 |
| - </PropertyGroup> |
172 |
| - <PropertyGroup Condition="'$(Configuration)' == 'Release'"> |
173 |
| - <TypeScriptRemoveComments>true</TypeScriptRemoveComments> |
174 |
| - <TypeScriptSourceMap>false</TypeScriptSourceMap> |
175 |
| - </PropertyGroup> |
176 |
| - |
177 |
| - <!-- Include default targets at the bottom --> |
178 |
| - <Import |
179 |
| - Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" |
180 |
| - Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets')" /> |
181 |
| -</Project> |
182 |
| -``` |
183 |
| - |
184 |
| -More details about defining MSBuild compiler options: [Setting Compiler Options in MSBuild projects](https://github.com/Microsoft/TypeScript/wiki/Setting-Compiler-Options-in-MSBuild-projects). |
185 |
| - |
186 |
| -# NuGet |
187 |
| - |
188 |
| -* Right-Click -> Manage NuGet Packages |
189 |
| -* Search for `Microsoft.TypeScript.MSBuild` |
190 |
| -* Hit `Install` |
191 |
| -* When install is complete, rebuild! |
192 |
| - |
193 |
| -More details can be found at [Package Manager Dialog](http://docs.nuget.org/Consume/Package-Manager-Dialog) and [using nightly builds with NuGet](https://github.com/Microsoft/TypeScript/wiki/Nightly-drops#using-nuget-with-msbuild) |
| 1 | +> ### This page has moved to http://www.typescriptlang.org/docs/handbook/integrating-with-build-tools.html |
0 commit comments