@@ -13,12 +13,53 @@ Scalable JavaScript development with types, classes and modules.
13
13
14
14
## Install
15
15
16
- npm install -g typescript
16
+ ### Instructions for the in-development version:
17
+
18
+ 1 . Download the zip file of this repository from https://github.com/mbrowne/typescript-dci/archive/master.zip
19
+ 2 . If you already have typescript installed, you will need to remove the symlink to the existing Typescript compiler
20
+ or else the ` npm install ` command below will fail. If you installed typescript as a global module in the standard location,
21
+ you can remove the existing symlink by running:
22
+
23
+ ` rm /usr/local/bin/tsc `
24
+
25
+ 3 . Unzip the downloaded file:
26
+
27
+ ` unzip typescript-dci-master.zip `
28
+
29
+ 4 . Install it as a global node.js module (note: on some systems you may need to prefix this command with ` sudo ` ):
30
+
31
+ ` npm install -g typescript-dci-master `
32
+
33
+
34
+ ### Coming Soon:
35
+ npm install -g typescript-dci
17
36
18
37
## Usage
19
38
20
- tsc hello.ts
21
-
39
+ tsc --module commonjs hello.ts
40
+ or:
41
+
42
+ tsc --module amd hello.ts
43
+
44
+ The ` --module ` flag is required when using DCI because some features are achieved at runtime, so the ` typescript-dci/dci ` module
45
+ needs to be available to every DCI program. For server-side or desktop programs, use ` commonjs ` and it should work out of the box.
46
+
47
+ To generate client-side code that will run in the browser, use ` amd ` to compile your project into [ AMD] ( http://requirejs.org/docs/whyamd.html )
48
+ modules. You will also need to ensure that your project has access to the ` typescript-dci/dci ` module. To do this, copy the
49
+ file ` typescript-dci/dci/dci-amd.js ` to your project directory and rename it to ` dci.js ` . In the future this process will be
50
+ simplified.
51
+
52
+ In order to run the client-side code you will need an AMD loader. Some good AMD loaders include:
53
+
54
+ - [ curl] ( https://github.com/cujojs/curl ) (not to be confused with the command-line tool of the same name)
55
+ - [ RequireJS] ( http://requirejs.org/ )
56
+
57
+ (curl is listed first because it is more lightweight, but both are excellent projects.)
58
+
59
+ Some AMD projects also provide a bundling tool that makes it possible to combine all your modules into one or more minified files,
60
+ in order to optimize your app for production. For example, [ curl] ( https://github.com/cujojs/curl ) has a companion project
61
+ [ cram] ( https://github.com/cujojs/cram/tree/master/docs ) .
62
+
22
63
23
64
## Build
24
65
0 commit comments