build(docs-infra): add a tool to create new examples (#39283)

This tool can be run from anywhere in the aio folder as:

```sh
yarn create-example <example-name>
```

It will create some basic scaffold files to get the example started.
After creation the developer should then use `yarn boilerplate:add`
or similar to ensure that the example can be run and tested.

You can optionally provide an absolute path to a pre-existing CLI
project and it will copy over appropriate files (ignoring boilerplate)
to the newly created example.

```sh
yarn create-example <example-name> /path/to/other/cli/project
```

Fixes #39275

PR Close #39283
This commit is contained in:
Pete Bacon Darwin
2020-10-15 12:05:14 +01:00
committed by Andrew Kushnir
parent 81aa119739
commit 34b74cecb6
19 changed files with 440 additions and 120 deletions
+8
View File
@@ -150,6 +150,14 @@ See [aio/README.md](../../README.md#developer-tasks) for the available command-l
Running the script will create an `aio/protractor-results.txt` file with the results of the tests.
### `create-example.js`
The [create-example.js](./create-example.js) script creates a new example under the `aio/content/examples` directory.
You must provide a new name for the example.
By default the script will place basic scaffold files into the new example (from [shared/example-scaffold](./shared/example-scaffold)).
But you can also specify the path to a separate CLI project, from which the script will copy files that would not be considered "boilerplate".
See the [Boilerplate overview](#boilerplate-overview) for more information.
### Updating example dependencies