You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: aio/tools/README.md
+27-26Lines changed: 27 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,52 +18,53 @@ See the [README.md](cli-patches/README.md) for more details.
18
18
19
19
## examples
20
20
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.
25
26
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.
29
31
30
32
This `examples` tool folder contains two utilities:
31
33
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.
33
36
* run-example-e2e.js - run the e2e tests for one or more examples
34
37
35
38
See the [README.md](examples/README.md) for more details.
36
39
37
40
## example-zipper
38
41
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.
41
44
42
45
See the [README.md](example-zipper/README.md) for more details.
43
46
44
47
## plunker-builder
45
48
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.
54
52
53
+
This folder contains three utilities: `regularPlunker.js`, `embeddedPlunker.js`, `generatePlunkers.js`.
55
54
See the [README.md](plunker-builder/README.md) for more details.
56
55
57
56
## transforms
58
57
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.
61
61
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.
64
64
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.
67
68
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.
Copy file name to clipboardExpand all lines: aio/tools/example-zipper/README.md
+22-11Lines changed: 22 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,13 @@
1
1
# Overview
2
2
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.
4
5
5
6
## Example zipper
6
7
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:
8
11
9
12
```json
10
13
{
@@ -23,11 +26,14 @@ The zipper will use this information for creating new zips.
23
26
24
27
## Three kinds of examples
25
28
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.
27
31
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.
29
34
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.
31
37
32
38
The `exampleZipper.js` won't include any `System.js` related files for `CLI` or `Webpack` projects.
33
39
@@ -40,15 +46,18 @@ Here you find a:
40
46
***base.json** - All the common scripts and packages
41
47
***cli.json** - Extra scripts and packages for the CLI
42
48
***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.
44
51
45
-
The tool will also give some standard names to the scripts.
52
+
The tool will also give some standard names to the scripts.
46
53
47
54
## The zipper.json
48
55
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.
50
58
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.
52
61
53
62
## Choosing the zip "type"
54
63
@@ -62,12 +71,14 @@ In both `plnkr.json` and `zipper.json` you can use two extra properties for the
62
71
}
63
72
```
64
73
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.
66
76
67
77
## Executing the zip generation
68
78
69
79
`generateZips.js` will create a zip for each `plnkr.json` or `zipper.json` it finds.
70
80
71
81
Where? At `src/generated/zips/`.
72
82
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
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.
4
8
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.
6
13
7
14
## Boilerplate overview
8
15
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.
10
19
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.
12
22
13
23
### Boilerplate files
14
24
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.
16
27
17
28
Among these files, there are a few special ones:
18
29
19
30
***src/systemjs.config.js** - This is the configuration of System.js used to run the example locally.
20
31
***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.
22
34
***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.
26
42
27
43
### The example-config.json
28
44
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".
30
49
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.
32
52
33
53
Normally the file is empty, but we can add information in it, for example:
34
54
@@ -39,33 +59,50 @@ Normally the file is empty, but we can add information in it, for example:
39
59
}
40
60
```
41
61
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.
43
65
44
66
45
67
### A node_modules to share
46
68
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.
48
72
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.
50
77
51
78
### End to end tests
52
79
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.
54
82
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.
56
86
57
87
### add-example-boilerplate.js
58
88
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.
60
92
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.
62
97
63
98
### run-example-e2e.js
64
99
65
100
This script will find all the `e2e-spec.ts` files and run them.
66
101
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.
68
104
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`.
70
107
71
108
It will create a `/aio/protractor-results-txt` file when it finishes running tests.
0 commit comments