diff --git a/public/docs/_examples/gettingstarted/ts/README.md b/public/docs/_examples/gettingstarted/ts/README.md deleted file mode 100644 index 8c381820ad..0000000000 --- a/public/docs/_examples/gettingstarted/ts/README.md +++ /dev/null @@ -1,8 +0,0 @@ -#Getting Started (TS) for the DevGuide developer - -This is the source code for the "Getting Started" Typescript example code. - -* **package.json** - as the audience will see it; the example reaches up to the site level **node_modules** -and the scripts are not supposed to work here. - -* **tsd.json** - as the audience will see it; the example reaches up to the example level typings \ No newline at end of file diff --git a/public/docs/_examples/gettingstarted/ts/package.json b/public/docs/_examples/gettingstarted/ts/package.json index d9de287642..1a9dcbf5ea 100644 --- a/public/docs/_examples/gettingstarted/ts/package.json +++ b/public/docs/_examples/gettingstarted/ts/package.json @@ -10,7 +10,7 @@ "author": "", "license": "ISC", "dependencies": { - "angular2": "^2.0.0-alpha.37", - "systemjs": "^0.19.2" + "angular2": "2.0.0-alpha.38", + "systemjs": "0.19.2" } } diff --git a/public/docs/ts/latest/guide/gettingStarted.jade b/public/docs/ts/latest/guide/gettingStarted.jade index 4f3ac55c77..11131b2569 100644 --- a/public/docs/ts/latest/guide/gettingStarted.jade +++ b/public/docs/ts/latest/guide/gettingStarted.jade @@ -26,34 +26,27 @@ include ../../../../_includes/_util-fns :markdown ## Prerequisites - We'll need a base of tools for all of our application development. We'll only install these once starting with - [**node** and **npm**](https://docs.npmjs.com/getting-started/installing-node "Installing Node.js and updating npm"). + We'll need a base of tools for our application development throughout this guide: - Now use npm in a terminal (or Windows/Linux command line) to install the **TypeScript compiler** globally + - the **TypeScript compiler** + + - the [**tsd package manager**](https://www.npmjs.com/package/tsd "TSD Package Manager") so we can access + [TypeScript type definition files](http://definitelytyped.org/ "Definitely Typed") ("`.d.ts`" files). + + - **live-server**, a *static server* that runs our app in the browser and reloads the browser when any of the files change. + + **Open** a terminal (or Windows/Linux command line) and issue the following `npm` command to install them all: pre.prettyprint.lang-bash - code npm install -g typescript - - :markdown - Use npm again to install the [**tsd package manager**](https://www.npmjs.com/package/tsd "TSD Package Manager") - so we can download TypeScript type definitions files ("`.d.ts`" files) - from the [DefinitelyTyped](http://definitelytyped.org/) repository. - - pre.prettyprint.lang-bash - code npm install -g tsd - - :markdown - Install a node **static server** to serve our application. - We'll use **live-server** for this example because it performs a live reload by default and it's - fun to watch the browser update as we make changes. - - pre.prettyprint.lang-bash - code npm install -g live-server + code npm install -g typescript tsd live-server .l-sub-section :markdown - Our success depends upon installing compatible versions of these tools. - Confirm your version numbers in a terminal window with these commands: + We depend upon [**node** and **npm**](https://docs.npmjs.com/getting-started/installing-node "Installing Node.js and updating npm") + to install packages such as these global tools. + + We must be sure that we're installing Angular-compatible versions of these packages. + Issue the following commands in that same terminal window to confirm that we have the appropriate versions: table tr th Command @@ -118,26 +111,21 @@ include ../../../../_includes/_util-fns :markdown ## Install npm packages - Our application will need some 3rd party JavaScript files: + We need to install two JavaScript library packages: >***angular.js***, the Angular 2 library. - >***system.js***, a third-party open-source library that adds module loading functionality to our browser. - - >***traceur-runtime.js*** to transpile the TypeScript-generated JavaScript into the version of Javascript - our browser understands (the version known as "ES5"). + >***system.js***, an open-source library that provides module loading. We'll install these package with `npm` and create an npm **`package.json`** configuration file - that to maintain future packages as our application evolves. + to maintain them as our application evolves. In a terminal window, go to the **root** folder and type: ``` npm init -y - npm install --save angular2@2.0.0-alpha.37 systemjs@0.19.2 + npm i angular2@2.0.0-alpha.38 systemjs@0.19.2 --save --save-exact ``` - `npm` produced a `node_modules` folder that holds these packages and other packages that *they* require. - The essence of our `package.json` should look like this: +makeJson('gettingstarted/ts/package.json', { paths: 'name, version, dependencies '}) @@ -150,7 +138,6 @@ include ../../../../_includes/_util-fns We prefer writing TypeScript apps in editors that understand TypeScript, such as [Visual Studio Code](https://code.visualstudio.com/) and [Web Storm](https://www.jetbrains.com/webstorm/features/). - Such editors improve the development experience by checking type information and displaying API documentation ("intellisense") based on TypeScript definition files (`.d.ts`). @@ -174,16 +161,15 @@ include ../../../../_includes/_util-fns ### Add the TypeScript configuration file - We need to tell that editor how to interpret our TypeScript - which we do with a configuration file named **`tsconfig.json`**. - This configuration file also simplifies the TypeScript compilation command - that we'll run very soon. + We'll add a configuration file named **`tsconfig.json`** + to tell the editor how to interpret our TypeScript code and + to simplify the TypeScript compilation command that we'll run very soon. **Change to the `src` folder and create a `tsconfig.json`** file with the following content: +makeJson('gettingstarted/ts/src/tsconfig.json', null, 'tsconfig.json') :markdown - Our project should now look like this: + Our project folder structure should now look like this: ``` angular2-getting-started ├── node_modules @@ -199,24 +185,20 @@ include ../../../../_includes/_util-fns :markdown ## Create an `index.html` - While in the **`src`** directory and - add a new `index.html` file with the following HTML + While in the **`src`** directory we + add a new `index.html` file with the following content - +makeExample('gettingstarted/ts/src/index.html', null, 'index.html', - {pnk: [/(angular2\.dev\.js)/, /(system\.src\.js)/, /(traceur-runtime\.js)/]}) + +makeExample('gettingstarted/ts/src/index.html', null, 'index.html') .l-sub-section :markdown - Notice in the `
` element that we're loading the scripts we installed earlier with npm. + We're loading the library scripts in the `` element from the `node_modules` + that we installed earlier with npm. - There's an element called `