Skip to content

Commit b4ca7a4

Browse files
docs(aio): tidy up tooling documentation
1 parent a1e0558 commit b4ca7a4

7 files changed

Lines changed: 168 additions & 88 deletions

File tree

aio/tools/README.md

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,52 +18,53 @@ See the [README.md](cli-patches/README.md) for more details.
1818

1919
## examples
2020

21-
Many of the documentation pages contain snippets of code examples. We extract these snippets from real working example
22-
applications, which are stored in subfolders of the `/aio/content/examples` folder. Each example can be built and run
23-
independently. Each example also provides e2e specs, which are run as part of our Travis build tasks, to verify that the
24-
examples continue to work as expected, as changes are made to the core Angular libraries.
21+
Many of the documentation pages contain snippets of code examples. We extract these snippets from real
22+
working example applications, which are stored in subfolders of the `/aio/content/examples` folder. Each
23+
example can be built and run independently. Each example also provides e2e specs, which are run as part
24+
of our Travis build tasks, to verify that the examples continue to work as expected, as changes are made
25+
to the core Angular libraries.
2526

26-
In order to build, run and test these examples independently we need to install dependencies into their sub-folder. Also
27-
there are a number of common boilerplate files that are needed to configure each example's project. We maintain these
28-
common boilerplate files centrally to reduce the amount of effort if one of them needs to change.
27+
In order to build, run and test these examples independently we need to install dependencies into their
28+
sub-folder. Also there are a number of common boilerplate files that are needed to configure each
29+
example's project. We maintain these common boilerplate files centrally to reduce the amount of effort
30+
if one of them needs to change.
2931

3032
This `examples` tool folder contains two utilities:
3133

32-
* add-example-boilerplate.js - install the npm dependencies and boilerplate files into each of the examples' subfolders.
34+
* example-boilerplate.js - install/remove the npm dependencies and boilerplate files into/from each of the
35+
examples' subfolders.
3336
* run-example-e2e.js - run the e2e tests for one or more examples
3437

3538
See the [README.md](examples/README.md) for more details.
3639

3740
## example-zipper
3841

39-
In the AIO application, we offer the reader the option to download each example as a full self-contained runnable project
40-
packaged as a zip file. These zip files are generated by the utility in this folder.
42+
In the AIO application, we offer the reader the option to download each example as a full self-contained
43+
runnable project packaged as a zip file. These zip files are generated by the utility in this folder.
4144

4245
See the [README.md](example-zipper/README.md) for more details.
4346

4447
## plunker-builder
4548

46-
In the AIO application, we can embed a running version of the example as a [Plunker](http://plnkr.co/). We can also provide a
47-
link to create a runnable version of the example in the [Plunker](http://plnkr.co/edit) editor.
48-
49-
This folder contains three utilities:
50-
51-
* regularPlunker.js - generates an HTML file for each example that will post to Plunker to create a new editable project, when rendered.
52-
* embeddedPlunker.js - generates an HTML file for each example that can be used in an iframe to render an embedded Plunker project.
53-
* generatePlunkers.js - executes each of the `regularPlunker.js` and `embeddedPlunker.js` utilities to generate all the example plunker files.
49+
In the AIO application, we can embed a running version of the example as a [Plunker](http://plnkr.co/).
50+
We can also provide a link to create a runnable version of the example in the [Plunker](http://plnkr.co/edit)
51+
editor.
5452

53+
This folder contains three utilities: `regularPlunker.js`, `embeddedPlunker.js`, `generatePlunkers.js`.
5554
See the [README.md](plunker-builder/README.md) for more details.
5655

5756
## transforms
5857

59-
All the content that is rendered by the AIO application, and some of its configuration files, are generated from source files
60-
by [Dgeni](https://github.com/angular/dgeni). Dgeni is a general purpose documentation generation tool.
58+
All the content that is rendered by the AIO application, and some of its configuration files, are
59+
generated from source files by [Dgeni](https://github.com/angular/dgeni). Dgeni is a general purpose
60+
documentation generation tool.
6161

62-
Markdown files in `/aio/content`, code comments in the core Angular source files and example files are processed and transformed
63-
into files that are consumed by the AIO application.
62+
Markdown files in `/aio/content`, code comments in the core Angular source files and example files are
63+
processed and transformed into files that are consumed by the AIO application.
6464

65-
Dgeni is configured by "packages", which contain services and processors. Some of these packages are installed as `node_modules`
66-
from the [dgeni-packages](https://github.com/angular/dgeni-packages) and some are specific to the AIO project.
65+
Dgeni is configured by "packages", which contain services and processors. Some of these packages are
66+
installed as `node_modules` from the [dgeni-packages](https://github.com/angular/dgeni-packages) and
67+
some are specific to the AIO project.
6768

68-
The project specific packages are stored in the `aio/tools/transforms` folder. See the [README.md](transforms/README.md)
69-
for more details.
69+
The project specific packages are stored in the `aio/tools/transforms` folder. See the
70+
[README.md](transforms/README.md) for more details.

aio/tools/cli-patches/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ The AIO application is built using the Angular CLI tool. We are often trialling
44
we apply to the library after it is installed. This folder contains git patch files that contain these new features
55
and a utility to apply those patches to the CLI library.
66

7+
**Currently, we have no patches to run.**

aio/tools/example-zipper/README.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# Overview
22

3-
In the AIO application, we offer the reader the option to download each example as a full self-contained runnable project packaged as a zip file. These zip files are generated by the utility in this folder.
3+
In the AIO application, we offer the reader the option to download each example as a full self-contained
4+
runnable project packaged as a zip file. These zip files are generated by the utility in this folder.
45

56
## Example zipper
67

7-
The `exampleZipper.js` tool is very similar to the Plunker's `builder.js`. The latter creates an HTML file with all the examples' files and the former creates a zip file instead. They both use the `plnkr.json` file to flag an example as something to plunker or zip. For example:
8+
The `exampleZipper.js` tool is very similar to the Plunker's `builder.js`. The latter creates an HTML file
9+
with all the examples' files and the former creates a zip file instead. They both use the `plnkr.json` file
10+
to flag an example as something to plunker or zip. For example:
811

912
```json
1013
{
@@ -23,11 +26,14 @@ The zipper will use this information for creating new zips.
2326

2427
## Three kinds of examples
2528

26-
The majority of examples in AIO use `System.js` but there are also `CLI` and `Webpack` projects. This tool is able to differentiate between them.
29+
The majority of examples in AIO use `System.js` but there are also `CLI` and `Webpack` projects. This
30+
tool is able to differentiate between them.
2731

28-
The boilerplate uses a `package.json` that contains packages and scripts to run any kind of example. Using that `package.json` in the zips would confuse the users.
32+
The boilerplate uses a `package.json` that contains packages and scripts to run any kind of example.
33+
Using that `package.json` in the zips would confuse the users.
2934

30-
Thanks to the `package.json` customizer, we can create a new `package.json` on the fly that would only contain the packages and scripts needed to run that example.
35+
Thanks to the `package.json` customizer, we can create a new `package.json` on the fly that would
36+
only contain the packages and scripts needed to run that example.
3137

3238
The `exampleZipper.js` won't include any `System.js` related files for `CLI` or `Webpack` projects.
3339

@@ -40,15 +46,18 @@ Here you find a:
4046
* **base.json** - All the common scripts and packages
4147
* **cli.json** - Extra scripts and packages for the CLI
4248
* **webpack.json** - Extra scripts and packages for Webpack
43-
* **systemjs.json** - All the System.js related packages but it also contains the remainder scripts that are not in the other files.
49+
* **systemjs.json** - All the System.js related packages but it also contains the remainder scripts
50+
that are not in the other files.
4451

45-
The tool will also give some standard names to the scripts.
52+
The tool will also give some standard names to the scripts.
4653

4754
## The zipper.json
4855

49-
As mentioned, the tool uses the `plnkr.json` as a flag and also a configuration file for the zipper. The problem is that not all examples have a plunker but they could offer a zip instead.
56+
As mentioned, the tool uses the `plnkr.json` as a flag and also a configuration file for the zipper.
57+
The problem is that not all examples have a plunker but they could offer a zip instead.
5058

51-
In those cases, you can create a `zipper.json` file with the same syntax. It will be ignored by the plunker tool.
59+
In those cases, you can create a `zipper.json` file with the same syntax. It will be ignored by the
60+
plunker tool.
5261

5362
## Choosing the zip "type"
5463

@@ -62,12 +71,14 @@ In both `plnkr.json` and `zipper.json` you can use two extra properties for the
6271
}
6372
```
6473

65-
This would generate a zip for a webpack application and it will also remove everything related with SystemJS.
74+
This would generate a zip for a webpack application and it will also remove everything related with
75+
SystemJS.
6676

6777
## Executing the zip generation
6878

6979
`generateZips.js` will create a zip for each `plnkr.json` or `zipper.json` it finds.
7080

7181
Where? At `src/generated/zips/`.
7282

73-
Then the `<live-example>` embedded component will look at this folder to get the zip it needs for the example.
83+
Then the `<live-example>` embedded component will look at this folder to get the zip it needs for
84+
the example.

aio/tools/examples/README.md

Lines changed: 57 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,54 @@
11
# Overview
22

3-
Many of the documentation pages contain snippets of code examples. We extract these snippets from real working example applications, which are stored in subfolders of the `/aio/content/examples` folder. Each example can be built and run independently. Each example also provides e2e specs, which are run as part of our Travis build tasks, to verify that the examples continue to work as expected, as changes are made to the core Angular libraries.
3+
Many of the documentation pages contain snippets of code examples. We extract these snippets from
4+
real working example applications, which are stored in subfolders of the `/aio/content/examples`
5+
folder. Each example can be built and run independently. Each example also provides e2e specs, which
6+
are run as part of our Travis build tasks, to verify that the examples continue to work as expected,
7+
as changes are made to the core Angular libraries.
48

5-
In order to build, run and test these examples independently we need to install dependencies into their sub-folder. Also there are a number of common boilerplate files that are needed to configure each example's project. We maintain these common boilerplate files centrally to reduce the amount of effort if one of them needs to change.
9+
In order to build, run and test these examples independently we need to install dependencies into
10+
their sub-folder. Also there are a number of common boilerplate files that are needed to configure
11+
each example's project. We maintain these common boilerplate files centrally to reduce the amount
12+
of effort if one of them needs to change.
613

714
## Boilerplate overview
815

9-
As mentioned, many of the documentation pages contain snippets extracted from real example applications. To achieve that, all those applications needs to contain a basic boilerplate. E.g. a `node_modules` folder, `package.json` with scripts, `system.js` configuration, etc.
16+
As mentioned, many of the documentation pages contain snippets extracted from real example applications.
17+
To achieve that, all those applications needs to contain a basic boilerplate. E.g. a `node_modules`
18+
folder, `package.json` with scripts, `system.js` configuration, etc.
1019

11-
No one wants to maintain the boilerplate on each example, so the goal of this tool is to provide a generic boilerplate that works in all the examples.
20+
No one wants to maintain the boilerplate on each example, so the goal of this tool is to provide a
21+
generic boilerplate that works in all the examples.
1222

1323
### Boilerplate files
1424

15-
Inside `/aio/tools/examples/shared/boilerplate` you will see all the common boilerplate you can find in any Angular application using System.js. This is the boilerplate that will be carried to each example.
25+
Inside `/aio/tools/examples/shared/boilerplate` you will see all the common boilerplate you can find
26+
in any Angular application using System.js. This is the boilerplate that will be carried to each example.
1627

1728
Among these files, there are a few special ones:
1829

1930
* **src/systemjs.config.js** - This is the configuration of System.js used to run the example locally.
2031
* **src/systemjs.config.web.js** - This configuration replaces the previous one on Plunkers.
21-
* **/src/systemjs.config.web.build.js** - Same as the previous one but for using angular's `-builds` versions.
32+
* **src/systemjs.config.web.build.js** - Same as the previous one but for using angular's `-builds`
33+
versions.
2234
* **src/systemjs-angular-loader.js** - It is a System.js plugin that removes the need of `moduleId`.
23-
* **package.json** - This package.json only contains scripts, no dependencies. It contains the different tasks needed to run any example. Doesn't matter if CLI, System.js or Webpack.
24-
* **plnkr.json** - This file is used by the Plunker tool to generate a plunker for an example. This concrete file is just a placeholder. Authors needs to tweak it for each guide. More at the [plunker docs](../plunker-builder/README.md).
25-
* **example-config.json** - This file serves as a flag to indicate that the current folder is an example. This concrete file is just a placeholder. More on this later in this readme.
35+
* **package.json** - This package.json only contains scripts, no dependencies. It contains the
36+
different tasks needed to run any example. Doesn't matter if CLI, System.js or Webpack.
37+
* **plnkr.json** - This file is used by the Plunker tool to generate a plunker for an example. This
38+
concrete file is just a placeholder. Authors needs to tweak it for each guide. More at the
39+
[plunker docs](../plunker-builder/README.md).
40+
* **example-config.json** - This file serves as a flag to indicate that the current folder is an
41+
example. This concrete file is just a placeholder. More on this later in this readme.
2642

2743
### The example-config.json
2844

29-
So what is this **example-config.json** again? If an author wants to create a new example, say `/aio/content/examples/awesome-example`. The author needs to create an empty `example-config.json` in that folder. That serves as a flag so this tool will say "Hey, that is an example, let's copy all the boilerplate there".
45+
So what is this **example-config.json** again? If an author wants to create a new example, say
46+
`/aio/content/examples/awesome-example`. The author needs to create an empty `example-config.json`
47+
in that folder. That serves as a flag so this tool will say "Hey, that is an example, let's copy
48+
all the boilerplate there".
3049

31-
So when the tool runs, it finds **all** the folders with an `example-config.json` file, and puts a copy of the boilerplate in those folders.
50+
So when the tool runs, it finds **all** the folders with an `example-config.json` file, and puts
51+
a copy of the boilerplate in those folders.
3252

3353
Normally the file is empty, but we can add information in it, for example:
3454

@@ -39,33 +59,50 @@ Normally the file is empty, but we can add information in it, for example:
3959
}
4060
```
4161

42-
In this case, this would indicate that this is a CLI example. Won't make any difference on the boilerplate, but will be useful for e2e tests (more on this later). Also works as a hint for the example to know how is executed.
62+
In this case, this would indicate that this is a CLI example. Won't make any difference on the
63+
boilerplate, but will be useful for e2e tests (more on this later). Also works as a hint for
64+
the example to know how is executed.
4365

4466

4567
### A node_modules to share
4668

47-
With all the boilerplate files in place, the only missing piece are the installed packages. For that we have a `/aio/tools/examples/shared/package.json` which contains **all** the packages needed to run all the examples.
69+
With all the boilerplate files in place, the only missing piece are the installed packages. For
70+
that we have a `/aio/tools/examples/shared/package.json` which contains **all** the packages
71+
needed to run all the examples.
4872

49-
After installing these dependencies, a `node_modules` will be created at `/aio/tools/examples/shared/node_modules`. This folder will be **symlinked** into each example. So it is not a copy like the other boilerplate files. This solution works in all OSes. Windows may require admin rights.
73+
After installing these dependencies, a `node_modules` will be created at
74+
`/aio/tools/examples/shared/node_modules`. This folder will be **symlinked** into each example.
75+
So it is not a copy like the other boilerplate files. This solution works in all OSes. Windows
76+
may require admin rights.
5077

5178
### End to end tests
5279

53-
Each example contains an `e2e-spec.ts` file. We can find all the related configuration files for e2e in the `/aio/tools/examples/shared` folder.
80+
Each example contains an `e2e-spec.ts` file. We can find all the related configuration files for
81+
e2e in the `/aio/tools/examples/shared` folder.
5482

55-
This tool expects all the examples to be build with `npm run build`. If an example is not built with that script, the author would need to specify the new build command in the `example-config.json` as shown earlier.
83+
This tool expects all the examples to be build with `npm run build`. If an example is not built
84+
with that script, the author would need to specify the new build command in the `example-config.json`
85+
as shown earlier.
5686

5787
### add-example-boilerplate.js
5888

59-
This script installs all the dependencies that are shared among all the examples, creates the `node_modules` symlinks and copy all the boilerplate files where needed. It won't do anything about plunkers nor e2e tests.
89+
This script installs all the dependencies that are shared among all the examples, creates the
90+
`node_modules` symlinks and copy all the boilerplate files where needed. It won't do anything
91+
about plunkers nor e2e tests.
6092

61-
It also contains a function to remove all the boilerplate. It uses a `git clean -xdf` to do the job. It will remove all files that don't exist in the git repository, **including any new file that you are working on that hasn't been stage yet.** So be sure to save your work before removing the boilerplate.
93+
It also contains a function to remove all the boilerplate. It uses a `git clean -xdf` to do
94+
the job. It will remove all files that don't exist in the git repository, **including any
95+
new file that you are working on that hasn't been stage yet.** So be sure to save your work
96+
before removing the boilerplate.
6297

6398
### run-example-e2e.js
6499

65100
This script will find all the `e2e-spec.ts` files and run them.
66101

67-
To not run all tests, you can use the `--filter=name` flag to run the example's e2e that contains that name.
102+
To not run all tests, you can use the `--filter=name` flag to run the example's e2e that contains
103+
that name.
68104

69-
It also has an optional `--setup` flag to run the `add-example-boilerplate.js` script and install the latest `webdriver`.
105+
It also has an optional `--setup` flag to run the `add-example-boilerplate.js` script and install
106+
the latest `webdriver`.
70107

71108
It will create a `/aio/protractor-results-txt` file when it finishes running tests.

0 commit comments

Comments
 (0)