Skip to content

WIP - build(docs-infra): update docs examples to latest v9 and Ivy#34374

Closed
gkalpak wants to merge 17 commits intoangular:masterfrom
gkalpak:build-aio-update-examples-ivy-v9
Closed

WIP - build(docs-infra): update docs examples to latest v9 and Ivy#34374
gkalpak wants to merge 17 commits intoangular:masterfrom
gkalpak:build-aio-update-examples-ivy-v9

Conversation

@gkalpak
Copy link
Copy Markdown
Member

@gkalpak gkalpak commented Dec 12, 2019

@gkalpak gkalpak added area: build & ci Related the build and CI infrastructure of the project comp: docs-infra state: WIP and removed cla: yes labels Dec 12, 2019
@googlebot

This comment has been minimized.

@ngbot ngbot Bot modified the milestone: needsTriage Dec 12, 2019
@mary-poppins
Copy link
Copy Markdown

@mary-poppins
Copy link
Copy Markdown

@gkalpak gkalpak force-pushed the build-aio-update-examples-ivy-v9 branch from d3acac0 to 8b02ec3 Compare December 12, 2019 16:06
@mary-poppins
Copy link
Copy Markdown

@gkalpak gkalpak force-pushed the build-aio-update-examples-ivy-v9 branch from 1c3e137 to 94dced4 Compare December 12, 2019 19:20
@mary-poppins
Copy link
Copy Markdown

@gkalpak gkalpak force-pushed the build-aio-update-examples-ivy-v9 branch 2 times, most recently from 2915499 to bdb74cb Compare December 12, 2019 19:56
@mary-poppins
Copy link
Copy Markdown

@mary-poppins
Copy link
Copy Markdown

@gkalpak gkalpak force-pushed the build-aio-update-examples-ivy-v9 branch from 1987ff7 to 9f7cbc2 Compare December 12, 2019 22:08
@mary-poppins
Copy link
Copy Markdown

@gkalpak gkalpak force-pushed the build-aio-update-examples-ivy-v9 branch from 9f7cbc2 to be630c0 Compare December 12, 2019 22:26
@mary-poppins
Copy link
Copy Markdown

@gkalpak gkalpak force-pushed the build-aio-update-examples-ivy-v9 branch from be630c0 to 5e302d0 Compare December 13, 2019 10:45
@mary-poppins
Copy link
Copy Markdown

@santoshyadavdev santoshyadavdev mentioned this pull request Mar 11, 2020
14 tasks
@mary-poppins
Copy link
Copy Markdown

@mary-poppins
Copy link
Copy Markdown

@mary-poppins
Copy link
Copy Markdown

@mary-poppins
Copy link
Copy Markdown

Comment thread aio/content/guide/universal.md Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As much as is this is probably the most approachable solution, I'd like to recommend providing the url option to renderModule from @angular/platform-server, since that initializes the URL platform-wide.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Nice! I didn't know about that; thx for bringing it up 👍
I have pushed a fixup commit to recommend this approach instead: 3072e2e

gkalpak added 17 commits March 23, 2020 17:31
The docs examples are switched to Ivy. On CI, the tests are run with
both Ivy and ViewEngine.

Partially addresses:
[FW-1609](https://angular-team.atlassian.net/browse/FW-1609)
…les on CI

Previously, only e2e tests were run for docs examples on CI. As a
result, unit tests (which are included in the zipped archives we provide
for users to download and play with the examples locally) were often
outdated and broken.

This commit configures specific docs examples that have meaningful unit
tests to run them on CI (via the `run-example-e2e.js` script). Where
necessary, the unit tests are fixed to ensure they pass and reflect the
changes in the corresponding component/service.
This commit also removes some auto-generated unit tests that are not
meaningful (e.g. make trivial assertions, such that a component instance
is truthy) and are often broken anyway (e.g. because the corresponding
component has been changed in ways that make the tests fail).
…`core-js`

The `core-js` dependency is no longer included in `package.json` for
`cli`-type examples, but only for the `systemjs` ones. This commit
updates the `package.json` templates to reflect that (and also updates
the `npm-packages` guide accordingly).
… `tests`

Each docs example has an `example-config.json` configuration file. Among
other things, this file can be used to specify what commands to run in
order to test the example. (If not specified, the `run-example-e2e.js`
script will run a default `yarn e2e` command.)

Previously, the property specifying the test commands was called `e2e`.
This is because in the past only e2e tests were run for docs examples.
Since recently, some examples may specify commands for other types of
tests (such as unit tests). Therefore, calling the property that holds
the list of test commands `e2e` no longer makes sense and can be
misleading to people looking at the configuration files.

This commit renamed the property to the more generic `tests`. In the
future, the `run-example-e2e.js` script (and corresponding npm script)
should be renamed and refactored to also avoid giving the impression
that only e2e tests are run.

Discussed in:
angular#36143 (comment)
…s example ZIP archive

Previously, the `package.json` template used in the ZIP archive of the
`universal` example that we offer for download missed the `build` npm
script.

This commit updates the template for the `universal` docs example to
include the `build` npm script.

NOTE:
The `build` npm script is already included in
`aio/tools/examples/shared/boilerplate/universal/package.json`, but it
was removed by the example zipper.
I noticed these minor styling issues while aligning the `universal`
examples with the `toh-pt6` example (in a subsequent commit).
…match latest CLI

Update the `main.ts` files in Tour-of-Heroes examples to match what
would be generated by the latest CLI.
As mentioned in the `universal` guide, the `toh-pt6` examples is the
starting poitn for the `universal` example. However, the two examples
had become out-of-sync, because some fixes/changes were made to the
Tour-of-Heroes examples.

This commit ports these changes to the `universal` example.
Update the `universal` example (and related files) to match what would
be generated by the latest CLI.
… error in `universal` example

Previously, building the `universal` example failed with:
```
node_modules/@types/express/index.d.ts(90,50): error TS2694: Namespace '".../@types/express-serve-static-core/index"' has no exported member 'Params'.
node_modules/@types/express/index.d.ts(90,64): error TS2694: Namespace '".../@types/express-serve-static-core/index"' has no exported member 'ParamsDictionary'.
```

This commit fixes the error by upgrading
`@types/express-serve-static-core` to a newer version.
See DefinitelyTyped/DefinitelyTyped#40905 for more details.
Previously, there were no tests for the `universal` docs example. This
meant that the project was not tested at all (not even ensuring that it
can be built successfully).

This commit adds e2e tests for the `universal` example (ported from
`toh-pt6` and cleaned up) and also verifies that the project can be
built successfully (including the server).
In the past, server-side rendered apps needed to convert URLs used in
API requests to absolute when rendering on the server. Originally, this
was handled in the `universal` guide and corresponding example app by
modifying the `HeroService` to use `APP_BASE_HREF` to derive the
absolute URL.

In angular#28956, the guide was updated to show an improved method: Specifying
an `HttpInterceptor` that took care of converting the URLs to absolute.
That interceptor was only provided when rendering the app on the server.
By mistake, the corresponding example app was not updated along with the
guide.

Since `@nguniversal/*` v7.1.0, it is no longer necessary to convert the
URLs to absolute inside the app. This is handled in the `@nguniversal`
libs (see angular/universal#897).

This commit updates the example app to emove unnecessary code and
modifies the guide to mention the issue with absolute URLs, but explain
that developers only need to worry about it when not using one of the
`@nguniversal/*-engine` packages.
Update the `i18n` example (and related files) to match what would be
generated by the latest CLI.
@gkalpak
Copy link
Copy Markdown
Member Author

gkalpak commented Jul 3, 2020

The final bit was addressed in #36924, so this can be closed.

@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area: build & ci Related the build and CI infrastructure of the project cla: yes state: blocked state: WIP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Tour of Heroes completed project ZIP file for v9

5 participants