@@ -64,7 +64,7 @@ a few git commands.
64
64
65
65
### Install Git
66
66
67
- You can download and install Git from http ://git-scm.com/download. Once installed, you should have
67
+ You can download and install Git from https ://git-scm.com/download. Once installed, you should have
68
68
access to the `git` command line tool. The main commands that you will need to use are:
69
69
70
70
* `git clone ...`: Clone a remote repository onto your local machine.
@@ -99,8 +99,8 @@ The tutorial instructions, from now on, assume you are running all commands from
99
99
100
100
### Install Node.js
101
101
102
- If you want to run the preconfigured local web server and the test tools then you will also need
103
- [Node.js v4 +][node].
102
+ In order to install dependencies (such as the test tools and AngularJS itself) and run the
103
+ preconfigured local web server, you will also need [Node.js v6 +][node].
104
104
105
105
You can download a Node.js installer for your operating system from https://nodejs.org/en/download/.
106
106
@@ -125,22 +125,25 @@ npm --version
125
125
[Node Version Manager (nvm)][nvm] or [Node Version Manager (nvm) for Windows][nvm-windows].
126
126
</div>
127
127
128
- Once you have Node.js installed on your machine, you can download the tool dependencies by running:
128
+ By installing Node.js, you also get [npm][npm], which is a command line executable for downloading
129
+ and managing Node.js packages. We use it to download the AngularJS framework as well as development
130
+ and testing tools.
131
+
132
+ Once you have Node.js installed on your machine, you can download these dependencies by running:
129
133
130
134
```
131
135
npm install
132
136
```
133
137
134
- This command reads angular-phonecat's `package.json` file and downloads the following tools into the
135
- `node_modules` directory:
138
+ This command reads angular-phonecat's `package.json` file and downloads the following dependencies
139
+ into the `node_modules` directory:
136
140
137
- * [Bower][bower] - client-side code package manager
138
141
* [Http-Server][http-server] - simple local static web server
139
142
* [Karma][karma] - unit test runner
140
143
* [Protractor][protractor] - end-to-end (E2E) test runner
141
144
142
- Running `npm install` will also automatically use bower to download the AngularJS framework into the
143
- `app/bower_components ` directory.
145
+ Running `npm install` will also automatically copy the AngularJS framework and other dependencies
146
+ necessary for our app to work into the `app/lib/ ` directory.
144
147
145
148
<div class="alert alert-info">
146
149
Note the angular-phonecat project is setup to install and run these utilities via npm scripts.
@@ -160,23 +163,23 @@ tasks that you will need while developing:
160
163
161
164
### Install Helper Tools (optional)
162
165
163
- The Bower, Http-Server, Karma and Protractor modules are also executables, which can be installed
164
- globally and run directly from a terminal/command prompt. You don't need to do this to follow the
165
- tutorial, but if you decide you do want to run them directly, you can install these modules globally
166
- using, `sudo npm install -g ...`.
166
+ The Http-Server, Karma and Protractor modules are also executables, which can be installed globally
167
+ and run directly from a terminal/command prompt. You don't need to do this to follow the tutorial,
168
+ but if you decide you do want to run them directly, you can install these modules globally using,
169
+ `sudo npm install --global ...`.
167
170
168
- For instance, to install the Bower command line executable you would do:
171
+ For instance, to install the `http-server` command line executable you would do:
169
172
170
173
```
171
- sudo npm install -g bower
174
+ sudo npm install --global http-server
172
175
```
173
176
174
- _(Omit the sudo if running on Windows)_
177
+ _(Omit the sudo if running on Windows. )_
175
178
176
- Then you can run the bower tool directly, such as:
179
+ Then you can run the `http-server` tool directly, such as:
177
180
178
181
```
179
- bower install
182
+ http-server ./app
180
183
```
181
184
182
185
@@ -278,6 +281,45 @@ It is good to run the E2E tests whenever you make changes to the HTML views or w
278
281
the application as a whole is executing correctly. It is very common to run E2E tests before pushing
279
282
a new commit of changes to a remote repository.
280
283
284
+ <div class="alert alert-warning">
285
+ <p>
286
+ Each version of Protractor is compatible with specific browser versions. If you are reading this
287
+ some time in the future, it is possible that the specified Protractor version is no longer
288
+ compatible with the latest version of Chrome that you are using.
289
+ </p>
290
+ <p>
291
+ If that is the case, you can try upgrading Protractor to newer version. For instructions on how
292
+ to upgrade dependencies see [Updating dependencies](tutorial/#updating-dependencies).
293
+ </p>
294
+ </div>
295
+
296
+
297
+ ### Updating dependencies
298
+
299
+ In order to avoid surprises, all dependencies listed in `package.json` are pinned to specific
300
+ versions (this is what the [package-lock.json][package-lock] file is about). This ensures that the
301
+ same version of a dependency is installed every time.
302
+
303
+ Since all dependencies are acquired via npm, you can use the same tool to easily update them as
304
+ well (although you probably don't need to for the purpose of this tutorial). Simply run the
305
+ preconfigured script:
306
+
307
+ ```
308
+ npm run update-deps
309
+ ```
310
+
311
+ This will update all packages to the latest version that satisfy their version ranges (as specified
312
+ in `package.json`) and also copy the necessary files into `app/lib/`. For example, if `package.json`
313
+ contains `"some-package": "1.2.x"`, it will be updated to the latest 1.2.x version (e.g. 1.2.99),
314
+ but not to 1.3.x (e.g. 1.3.0).
315
+
316
+ If you want to update a dependency to a version newer than what the specificed range would permit,
317
+ you can change the version range in `package.json` and then run `npm run update-deps` as usual.
318
+
319
+ <div class="alert alert-info">
320
+ See [here][semver-ranges] for more info on the various version range formats.
321
+ </div>
322
+
281
323
282
324
### Common Issues
283
325
@@ -324,14 +366,16 @@ Now that you have set up your local machine, let's get started with the tutorial
324
366
325
367
326
368
[angular-phonecat]: https://github.com/angular/angular-phonecat
327
- [bower]: http://bower.io/
328
- [git]: http://git-scm.com/
369
+ [git]: https://git-scm.com/
329
370
[http-server]: https://github.com/nodeapps/http-server
330
371
[jdk]: https://en.wikipedia.org/wiki/Java_Development_Kit
331
- [jdk-download]: http ://www.oracle.com/technetwork/java/javase/downloads/index.html
372
+ [jdk-download]: https ://www.oracle.com/technetwork/java/javase/downloads/index.html
332
373
[karma]: https://karma-runner.github.io/
333
- [node]: http://nodejs.org/
374
+ [node]: https://nodejs.org/
375
+ [npm]: https://www.npmjs.com/
334
376
[nvm]: https://github.com/creationix/nvm
335
377
[nvm-windows]: https://github.com/coreybutler/nvm-windows
378
+ [package-lock]: https://docs.npmjs.com/files/package-lock.json
336
379
[protractor]: https://github.com/angular/protractor
337
- [selenium]: http://docs.seleniumhq.org/
380
+ [selenium]: https://docs.seleniumhq.org/
381
+ [semver-ranges]: https://docs.npmjs.com/misc/semver#ranges
0 commit comments