Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

docs(tutorial): update to use v1.5.x and best practices #14416

Closed
wants to merge 6 commits into from

Conversation

gkalpak
Copy link
Member

@gkalpak gkalpak commented Apr 12, 2016

This is a major re-structuring of the tutorial app's codebase, aiming at applying established best practices (in terms of file naming/layout and code organization) and utilizing several new features and enhancements (most notably components) introduced in recent versions of Angular (especially v1.5).

Apart from the overall changes, two new chapters were introduced: one on components and one on code organization.

In the process, several other things were (incidentally) taken care of, including:

  • Dependencies were upgraded to latest versions.
  • Animations were polished.
  • Outdated links were updated.
  • The app's base URL was changed to / (instead of /app/).

BTW, this has been tested with the following versions of Node (on Windows 10) and everything worked fine:

  • 0.11.16
  • 4.2.6
  • 4.4.2
  • 5.10.0

This was inspired by (and loosely based on) #13834.
Again, mad props to @teropa for leading the way :)

Note:
The old version of the tutorial, that is compatible with Angular version 1.4 or older, has been saved on the pre-v1.5.0-snapshot branch of angular-phonecat. The v1.4.x version of the tutorial should be pointed to that branch instead of master.

Related to angular/angular-phonecat#326.
Related to angular/angular-seed#341.


Fixes #12755
Fixes #13312
Fixes #13623
Fixes #13632

Closes #8952
Closes #11726
Closes #12946
Closes #12947
Closes #13198
Closes #13284
Closes #13834
Closes #14178
Closes #14223

@gkalpak gkalpak added this to the Phonecat Tutorial Overhaul milestone Apr 12, 2016
gkalpak added a commit to gkalpak/angular-phonecat that referenced this pull request Apr 12, 2016
…s for the post-1.5.0 era

This commit and the accompanying updates to the tutorial steps constitute a major re-structuring of
the tutorial app's codebase, aiming at applying established best practices (in terms of file
naming/layout and code organization) and utilizing several new features and enhancements (most
notably components) introduced in recent versions of Angular (especially v1.5).

Apart from the overall changes, two new chapters were introduced: one on components and one on code
organization.

--
In the process, several other things were (incidentally) taken care of, including:

* Dependencies were upgraded to latest versions.
* Animations were polished.
* Outdated links were updated.
* The app's base URL was changed to `/` (instead of `/app/`).

BTW, this has been tested with the following versions of Node (on Windows 10) and everything worked
fine:

* 0.11.16
* 4.2.6
* 4.4.2
* 5.10.0

--
This was inspired by (and loosely based on) angular#289.
Mad props to @teropa for leading the way :)

--
**Note:**
The old version of the tutorial, that is compatible with Angular version 1.4 or older, has been
saved on the `pre-v1.5.0-snapshot` branch. The `v1.4.x` version of the tutorial should be pointed
to that branch instead of `master`.

--
Related to angular/angular.js#14416.
Related to angular/angular-seed#329.
Related to angular/angular-seed#333.

---
Fixes angular#198
Fixes angular#214
Fixes angular#224
Fixes angular#230
Fixes angular#243
Fixes angular#246
Fixes angular#252
Fixes angular#277
Fixes angular#286
Fixes angular#295
Fixes angular#303
Fixes angular#304
Fixes angular#323
Fixes angular#324

Closes angular#268
Closes angular#270
Closes angular#278
Closes angular#280
Closes angular#289
Closes angular#309
Closes angular#311
Closes angular#319
@gkalpak
Copy link
Member Author

gkalpak commented Apr 12, 2016

This has to get merged simultaneously with corresponding PRs on:

Repo PRs
angular-phonecat #326
angular-seed #341
angular.io #1106 (see Upgrading from 1.x)

Things that still need to be fixed:

  • The images under docs/img/tutorial must be updated to match the new text/code.

Things that should/could be cosidered (potentially after this PR has been merged merged):

  • Update the tutorial (and the necessary docs-app directives) on the v1.4.x branch, which will still contain the old version of the tutorial, to point to the pre-v1.5.0-snapshot branch of angular-phonecat.
  • Adding an "advanced" section at the end, either pointing to resources (e.g. relevant Developer Guide sections) or as subsequent steps. Example topics:
    • Directives/DDO, 2-way/1-way/1-time bindings
    • Forms (+ ngMessages)
    • ngComponentRouter
    • (multi-slot) transclusion
    • Task runners/Build tools and best practices
    • Testing animations
  • To discuss: Is it better to import the core module from the main phonecatApp module only, or on a per-view basis ?
  • To discuss: Is it better to split up the CSS per component or keep it in a couple top-level files (e.g. one for animations and one for the rest) ? What about animation-related JS code ?
  • To discuss: Do we want to mention/use Protractor's directConnect: true config option ?

@teropa
Copy link
Contributor

teropa commented Apr 12, 2016

@gkalpak I can look into getting angular.io updated. I'll need to look into this branch in more detail to see the extent of the changes need to that guide, but in any case I'll bring it up with the docs team tomorrow.

@gkalpak
Copy link
Member Author

gkalpak commented Apr 12, 2016

@teropa: Thx, that would be great ! Also, as you look through it, any feedback is more than welcome 😃

BTW, I tried to follow the structure that you used in the Upgrade Guide more closely, so hopefully you will be able to get rid of some of the noise in the guide and focus more on the new/different concepts.

Big 👍 for your work on both #13834 and the Upgrade Guide.

access to the `git` command line tool. The main commands that you will need to use are:

* `git clone ...`: Clone a remote repository onto your local machine.
* `git checkout ...`: Check out a particular branch or a tagged version of the code to hack on.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an annoying issue about corporate firewalls blocking git

angular/angular-phonecat#141
and probably
angular/angular-phonecat#235

Can we add this information into the guide?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

@gkalpak gkalpak mentioned this pull request Apr 12, 2016
```js
// Register `phoneList` component, along with its associated controller and template
angular.
module('phonecatApp').
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it officially recommended practice to "reopen" the module to add in the component?
Given that you are creating a new file anyway, why not have a one module = one file bijection.
The benefits of this are:

  • you don't have to sort the files when building a distribution file
  • you can easily move a file to another project without having to bring along its module definition

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is explicitly mentioned anywhere, but this seems to be what john's styleguide is going throughout.
This is how I do it too fwiw 😛

Pros and cons of one module per file:

you don't have to sort the files when building a distribution file

👍

you can easily move a file to another project without having to bring along its module definition

The idea is that you are creating a module for the "least viable feature" - i.e. the smaller chunk of functionality that does something worth moving around or re-using in another project. So, there is no point in copying just the controller file of a component over to another project - you would copy the whole component directory instead(including the controller, controller spec, the module definition, the template etc).

Too many modules

👎

I don't think it's promoted as a good practice anywhere (at least I haven't seen it), so there might be few projects following this convention out there (I'm just speculating here).

👎

Could go either way (but only because I'm too tempted by not having to sort the files when bundling/testing 😛 )
I also have a slight concern about the overhead of creating a module for everything. I think there is a (tiny) bit of work involved in loading a module, which could add up.

Leaving it up to you 😁

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohhh! It's so hard to decide...

I am generally not in favour of reopening anything. Especially old milk bottles!

So I think I would rather go with one module per file:

  • I don't believe that there is not so much of a performance penalty, because there is a similar cost to looking up the module when reopening.
  • I believe that having small modules that explicitly declare their dependencies makes them a bit more self documenting.
  • My feeling is that if things are so tightly bound that they should be in a single module then they should be in the same file??

If you do feel strongly @gkalpak then don't do it. But if you are not bothered then I would be delighted to see this changed :-)

another instance of a running web server) you will get an `EADDRINUSE` error. Make sure the port
is available before running `npm start`.
</div>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this warning should also appear in the introduction when setting up the environment. At least that is where I encountered this error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put it here, because we already have 8-9 alerts in the introduction. I can move it there if think it's better. (One more won't hurt I guess 😃)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think would be better to move all the warnings in the introduction in a separate sections (at the bottom of introduction).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That might work. A kind of setup troubleshooting section?

@gkalpak
Copy link
Member Author

gkalpak commented May 23, 2016

Added a couple more fixups that move warning in a "Common Issues" section (in the introduction) and use ! as hash-prefix (angular-phonecat and angular-seed have been updated accordingly).
/cc @petebacondarwin

@gkalpak
Copy link
Member Author

gkalpak commented May 23, 2016

Tasks for after getting this in:

@petebacondarwin
Copy link
Member

LGTM

@gkalpak gkalpak changed the title WIP - docs(tutorial): update to use v1.5.x and best practices docs(tutorial): update to use v1.5.x and best practices May 23, 2016
gkalpak added a commit to angular/angular-phonecat that referenced this pull request May 24, 2016
…s for the post-1.5.0 era

This commit and the accompanying updates to the tutorial steps constitute a major re-structuring of
the tutorial app's codebase, aiming at applying established best practices (in terms of file
naming/layout and code organization) and utilizing several new features and enhancements (most
notably components) introduced in recent versions of Angular (especially v1.5).

Apart from the overall changes, two new chapters were introduced: one on components and one on code
organization.

--
In the process, several other things were (incidentally) taken care of, including:

* Dependencies were upgraded to latest versions.
* Animations were polished.
* Outdated links were updated.
* The app's base URL was changed to `/` (instead of `/app/`).

BTW, this has been tested with the following versions of Node (on Windows 10) and everything worked
fine:

* 0.11.16
* 4.2.6
* 4.4.2
* 5.10.0

--
This was inspired by (and loosely based on) #289.
Mad props to @teropa for leading the way :)

--
**Note:**
The old version of the tutorial, that is compatible with Angular version 1.4 or older, has been
saved on the `pre-v1.5.0-snapshot` branch. The `v1.4.x` version of the tutorial should be pointed
to that branch instead of `master`.

--
Related to angular/angular.js#14416.
Related to angular/angular-seed#329.
Related to angular/angular-seed#333.

---
Fixes #198
Fixes #214
Fixes #224
Fixes #230
Fixes #243
Fixes #246
Fixes #252
Fixes #277
Fixes #286
Fixes #295
Fixes #303
Fixes #304
Fixes #323
Fixes #324

Closes #268
Closes #270
Closes #278
Closes #280
Closes #289
Closes #309
Closes #311
Closes #319
gkalpak added a commit to angular/angular-phonecat that referenced this pull request May 24, 2016
…s for the post-1.5.0 era

This commit and the accompanying updates to the tutorial steps constitute a major re-structuring of
the tutorial app's codebase, aiming at applying established best practices (in terms of file
naming/layout and code organization) and utilizing several new features and enhancements (most
notably components) introduced in recent versions of Angular (especially v1.5).

Apart from the overall changes, two new chapters were introduced: one on components and one on code
organization.

--
In the process, several other things were (incidentally) taken care of, including:

* Dependencies were upgraded to latest versions.
* Animations were polished.
* Outdated links were updated.
* The app's base URL was changed to `/` (instead of `/app/`).

BTW, this has been tested with the following versions of Node (on Windows 10) and everything worked
fine:

* 0.11.16
* 4.2.6
* 4.4.2
* 5.10.0

--
This was inspired by (and loosely based on) #289.
Mad props to @teropa for leading the way :)

--
**Note:**
The old version of the tutorial, that is compatible with Angular version 1.4 or older, has been
saved on the `pre-v1.5.0-snapshot` branch. The `v1.4.x` version of the tutorial should be pointed
to that branch instead of `master`.

--
Related to angular/angular.js#14416.
Related to angular/angular-seed#329.
Related to angular/angular-seed#333.

---
Fixes #198
Fixes #214
Fixes #224
Fixes #230
Fixes #243
Fixes #246
Fixes #252
Fixes #277
Fixes #286
Fixes #295
Fixes #303
Fixes #304
Fixes #323
Fixes #324

Closes #268
Closes #270
Closes #278
Closes #280
Closes #289
Closes #309
Closes #311
Closes #319
This is a major re-structuring of the tutorial app's codebase, aiming at applying established best
practices (in terms of file naming/layout and code organization) and utilizing several new features
and enhancements (most notably components) introduced in recent versions of Angular (especially
v1.5).

Apart from the overall changes, two new chapters were introduced: one on components and one on code
organization.

--
In the process, several other things were (incidentally) taken care of, including:

* Dependencies were upgraded to latest versions.
* Animations were polished.
* Outdated links were updated.
* The app's base URL was changed to `/` (instead of `/app/`).

BTW, this has been tested with the following versions of Node (on Windows 10) and everything worked
fine:

* 0.11.16
* 4.2.6
* 4.4.2
* 5.10.0

--
This was inspired by (and loosely based on) angular#13834.
Again, mad props to @teropa for leading the way :)

--
**Note:**
The old version of the tutorial, that is compatible with Angular version 1.4 or older, has been
saved on the `pre-v1.5.0-snapshot` branch of
[angular-phonecat](https://github.com/angular/angular-phonecat). The `v1.4.x` version of the
tutorial should be pointed to that branch instead of `master`.

--
Related to angular/angular-phonecat#326.
Related to angular/angular-seed#329.
Related to angular/angular-seed#333.

---
Fixes angular#12755
Fixes angular#13312
Fixes angular#13623
Fixes angular#13632

Closes angular#8952
Closes angular#11726
Closes angular#12946
Closes angular#12947
Closes angular#13198
Closes angular#13284
Closes angular#13834
Closes angular#14178
Closes angular#14223
- Fix typos.
- Improve wording.
- Simplify links.
- Add warnings:
  - Firewalls blocking `git:`.
  - File include order (i.e. `.module` files before other files).
- Improve tests:
  - Remove unnecessary locals when calling `$componentController()`.
  - Extract protractor queries.
- Fix typos.
- Fix navigation for steps > 12.
- Make section title consistent (include "Component" where appropriate).
- Improve alert formatting (titles, line spacing).
- Fix typos.
- Improve common issues descriptions.
- Move common setup issues to dedicated section.
- Use `!` as hash-prefix.
@gkalpak gkalpak force-pushed the docs-tutorial-post-v1.5.0 branch from 2c74a42 to d7be60f Compare May 24, 2016 11:01
@googlebot
Copy link

CLAs look good, thanks!

1 similar comment
@googlebot
Copy link

CLAs look good, thanks!

@gkalpak gkalpak closed this in c2033d7 May 24, 2016
gkalpak added a commit that referenced this pull request May 24, 2016
This is a major re-structuring of the tutorial app's codebase, aiming at applying established best
practices (in terms of file naming/layout and code organization) and utilizing several new features
and enhancements (most notably components) introduced in recent versions of Angular (especially
v1.5).

Apart from the overall changes, two new chapters were introduced: one on components and one on code
organization.

--
In the process, several other things were (incidentally) taken care of, including:

* Dependencies were upgraded to latest versions.
* Animations were polished.
* Outdated links were updated.
* The app's base URL was changed to `/` (instead of `/app/`).

BTW, this has been tested with the following versions of Node (on Windows 10) and everything worked
fine:

* 0.11.16
* 4.2.6
* 4.4.2
* 5.10.0
* 6.2.0

--
This was inspired by (and loosely based on) #13834.
Again, mad props to @teropa for leading the way :)

--
**Note:**
The old version of the tutorial, that is compatible with Angular version 1.4 or older, has been
saved on the `pre-v1.5.0-snapshot` branch of
[angular-phonecat](https://github.com/angular/angular-phonecat). The `v1.4.x` version of the
tutorial should be pointed to that branch instead of `master`.

--
Related to angular/angular-phonecat#326.
Related to angular/angular-seed#341.

Closes #14416
@gkalpak gkalpak deleted the docs-tutorial-post-v1.5.0 branch May 25, 2016 19:19
gkalpak added a commit to gkalpak/angular.js that referenced this pull request May 25, 2016
…o the correct branch

- Add a deprecation notice on the 'index' page.
- Hide the "Live Demo" buttons (since we don't have a live demo).
- Update the GitHub diff links to point to the `pre-v1.5.0-snapshot` angular-phonecat branch.
- Modify all git commangs to use the appropriate branch and tags.

Related to angular#14416.
teropa added a commit to IdeaBlade/angular.io that referenced this pull request May 28, 2016
This is a major reorganization of the Upgrade guide.

* Compatible with the new version of the AngularJS 1 PhoneCat
  tutorial.
* No longer switching Angular 1 code to SystemJS for PhoneCat,
  to allow beginning Angular 2 migration with fewer preparation
  steps. SystemJS switch now happens simultaneously with upgrade.
  (This is based on input from @joeeames)
* Testing moved to an appendix to make the main narrative
  shorter and easier to follow.
* Use component methods to do phone filtering and ordering
  instead of introducing pipes to replace filterFilter and orderByFilter.
* Cover issue with camelCase inputs on downgraded components.

For authors:

* All examples now fully integrated with the example boilerplate. Uses the
  same Angular 2 version as all other guides. E2E tests are executed
  along with all the others.
* Reduced number of PhoneCat versions from five to three.
* Each directory has a README explaining how to run it and what might
  be peculiar about it.

Closes angular/angular#8622
Relates to angular/angular.js#14416
Relates to angular/angular-phonecat#326
wardbell pushed a commit to angular/angular.io that referenced this pull request May 28, 2016
closes #1538
This is a major reorganization of the Upgrade guide.

* Compatible with the new version of the AngularJS 1 PhoneCat
  tutorial.
* No longer switching Angular 1 code to SystemJS for PhoneCat,
  to allow beginning Angular 2 migration with fewer preparation
  steps. SystemJS switch now happens simultaneously with upgrade.
  (This is based on input from @joeeames)
* Testing moved to an appendix to make the main narrative
  shorter and easier to follow.
* Use component methods to do phone filtering and ordering
  instead of introducing pipes to replace filterFilter and orderByFilter.
* Cover issue with camelCase inputs on downgraded components.

For authors:

* All examples now fully integrated with the example boilerplate. Uses the
  same Angular 2 version as all other guides. E2E tests are executed
  along with all the others.
* Reduced number of PhoneCat versions from five to three.
* Each directory has a README explaining how to run it and what might
  be peculiar about it.

Closes angular/angular#8622
Relates to angular/angular.js#14416
Relates to angular/angular-phonecat#326
gkalpak added a commit that referenced this pull request May 31, 2016
…o the correct branch

- Add a deprecation notice on the 'index' page.
- Hide the "Live Demo" buttons (since we don't have a live demo).
- Update the GitHub diff links to point to the `1.4-snapshot` angular-phonecat branch.
- Modify all git commangs to use the appropriate branch and tags (e.g. `1.4-step-*`).

Related to #14416.

Closes #14675
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants