Commit Graph

562 Commits

Author SHA1 Message Date
George Kalpakas 82a6fc5ef9 build(docs-infra): use local version of Zone.js when testing against local packages (#35858)
In some cases, we want to test the AIO app or docs examples against the
locally built Angular packages (for example to ensure that the changes
in a commit do not introduce a breaking change). In order to achieve
this, we have the `ng-packages-installer` script that handles updating
a project's `package.json` file to use the locally built Angular
packages (and appropriate versions for their (dev-/peer-)dependencies).

Previously, `ng-packages-installer` would only consider the locally
built Angular packages (from `dist/packages-dist/`). However, given that
Zone.js is now part of the `angular/angular` repo, it makes sense to
also use the locally built Zone.js package (from `dist/zone.js-dist/`).
Otherwise, the tests might fail for commits that update both the Angular
packages (and related docs examples) and the Zone.js package. An example
of such a simultaneous change (that would have broken tests) is #33838.

This commit updates the script to install the locally built Zone.js
package (in addition to the Angular ones). The commit ensures that the
Zone.js package will always be available alongside the Angular packages
(i.e. that the Zone.js package will be built by the same script that
builds the Angular packages and that the `dist/zone.js-dist/` directory
will be cached on CI).

Note: This problem was discovered while enabling docs examples unit
tests in #34374.

PR Close #35858
2020-03-06 17:30:20 -05:00
Andrew Scott 1b8a66893e Revert "build(docs-infra): use local version of Zone.js when testing against local packages (#35780)" (#35857)
This reverts commit 7d832ae1001b6264bb7124086089e9e69c10c9b6; breaks CI
with error `Concurrent upstream jobs persisted the same file(s) into the workspace:`

PR Close #35857
2020-03-04 10:57:36 -08:00
Pete Bacon Darwin 603ab40e85 build(docs-infra): ensure that CLI options are included in search (#35801)
PR Close #35801
2020-03-04 08:48:58 -08:00
Pete Bacon Darwin c1b5daf5a8 style(docs-infra): format files (#35801)
PR Close #35801
2020-03-04 08:48:58 -08:00
George Kalpakas 7d832ae100 build(docs-infra): use local version of Zone.js when testing against local packages (#35780)
In some cases, we want to test the AIO app or docs examples against the
locally built Angular packages (for example to ensure that the changes
in a commit do not introduce a breaking change). In order to achieve
this, we have the `ng-packages-installer` script that handles updating
a project's `package.json` file to use the locally built Angular
packages (and appropriate versions for their (dev-/peer-)dependencies).

Previously, `ng-packages-installer` would only consider the locally
built Angular packages (from `dist/packages-dist/`). However, given that
Zone.js is now part of the `angular/angular` repo, it makes sense to
also use the locally built Zone.js package (from `dist/zone.js-dist/`).
Otherwise, the tests might fail for commits that update both the Angular
packages (and related docs examples) and the Zone.js package. An example
of such a simultaneous change (that would have broken tests) is #33838.

This commit updates the script to install the locally built Zone.js
package (in addition to the Angular ones). The commit ensures that the
Zone.js package will always be available alongside the Angular packages
(i.e. that the Zone.js package will be built by the same script that
builds the Angular packages and that the `dist/zone.js-dist/` directory
will be cached on CI).

Note: This problem was discovered while enabling docs examples unit
tests in #34374.

PR Close #35780
2020-03-04 08:35:26 -08:00
George Kalpakas 4c7d833233 refactor(docs-infra): simplify `NgPackagesInstaller` and speed up local package detection (#35780)
Previously, `NgPackagesInstaller` would only look for Angular local
packages and do so by listing all (deeply nested) files in
`dist/packages-dist/` and looking for `package.json` files nested two
levels deep (i.e. `dist/packages-dist/*/package.json`). Thus, it would
unnecessarily check a large number of files.

This commit changes the package detection logic to instead look for
a `package.json` file directly inside each subdirectory of
`dist/packages-dist/`, which speeds up the operation.
It also refactors the code to make it easier to look for packages in
other directories (besides `dist/packages-dist/`). This will be useful
in a subsequent commit to look for and use the locally built `zone.js`
package (from `dist/zone.js-dist/`).

PR Close #35780
2020-03-04 08:35:26 -08:00
George Kalpakas 3f88de9407 build: move build scripts to dedicated directory (#35780)
This commit moves the build-related scripts
(`build-ivy-npm-packages.js`, `build-packages-dist.js` and
`package-builder.js`) to a dedicated directory to keep the `scripts/`
directory cleaner.

It also moves the logic for building the `zone.js` package to a separate
script, `zone-js-builder.js`, to make it re-usable. A subsequent commit
will use it to build the `zone.js` package when building the Ivy Angular
packages as well.

PR Close #35780
2020-03-04 08:35:26 -08:00
Sonu Kapoor 7ca2a2a863 feat(docs-infra): add `searchKeywords` preprocessor (#35539)
This commit adds a new preprocessor to use `${@searchKeywords}`, allowing
the docs to use a list of custom search phrases that will be
prioritized over the keywords found in the content.

Closes #35449

PR Close #35539
2020-02-27 10:47:52 -08:00
ajitsinghkaler 9c01ca42d3 feat(docs-infra): add entry-point label on api endpoint docs (#35427)
On API docs pages for Angular packages (e.g. https://angular.io/api/common), we show all primary and secondary entry-points. Following a link to one of the secondary entry-points (e.g. https://angular.io/api/common/http), navigates the docs page for the secondary entry-point, where it is incorrectly (and misleadingly) labelled as PACKAGE and not as an entry-point.

Implemented a new ENTRY-POINT label and add support for correctly differentiating between entry-points and packages.

Fixes #34081

PR Close #35427
2020-02-26 12:54:22 -08:00
George Kalpakas bdfe71ae93 build(docs-infra): use `puppeteer` to get a browser for docs examples tests (#35381)
In #35049, integration and AIO tests were changed to use the browser
provided by `puppeteer` in tests. This commit switches the docs examples
tests to use the same setup.

IMPLEMENTATION NOTE:
The examples are used to create ZIP archives that docs users can
download to experiment with. Since we want the downloaded projects to
resemble an `@angular/cli` generated project, we do not want to affect
the project's Protractor configuration in order to use `puppeteer`.

To achieve this, a second Protractor configuration is created (which is
ignored when creating the ZIP archives) that extends the original one
and passes the approperiate arguments to use the browser provided by
`puppeteer`. This new configuration (`protractor-puppeteer.conf.js`) is
used when running the docs examples tests (on CI or locally during
development).

PR Close #35381
2020-02-18 12:42:47 -08:00
Sonu Kapoor 7fb66eca25 docs: changes AoT to AOT for consistency (#35112)
PR Close #35112
2020-02-04 10:43:33 -08:00
crisbeto 471375adbe docs(ivy): document global debugging utilities and clean up API (#34453)
Cleans up the public API of the global debugging utilities, documents them and exposes them in the API docs.

PR Close #34453
2020-01-30 11:30:32 -08:00
Judy Bogart 549ab2ecc3 build(docs-infra): add words to ignore in snippets (#34915)
PR Close #34915
2020-01-27 10:49:03 -08:00
Sonu Kapoor 77c53559d0 build(docs-infra): specify more relevant landing files for StackBlitz projects (#34553)
The StackBlitz API (which we use to generate StackBlitz projects on the
fly, when a user clicks on a live example link in the docs) allows
specifying the file to open in the editor by passing a query param. If
no file is specified, StackBlitz opens a default one.

This commit specifies relevant landing files for some of the examples to
make it easier to engage with the examples more quickly, and to see what
the example is attempting to demonstrate.

Fixes #22357.

PR Close #34553
2020-01-22 13:45:23 -08:00
Kapunahele Wong a3b2d6735a build(docs-infra): add auto-link-filter for generic words (#34835)
Fixes #34794

PR Close #34835
2020-01-21 15:08:01 -05:00
dependabot[bot] 8942b7106d build(docs-infra): bump handlebars from 4.0.12 to 4.5.3 in /aio/tools/examples/shared (#34585)
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.0.12 to 4.5.3.
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/wycats/handlebars.js/blob/master/release-notes.md)
- [Commits](https://github.com/wycats/handlebars.js/compare/v4.0.12...v4.5.3)

Signed-off-by: dependabot[bot] <support@github.com>

PR Close #34585
2020-01-08 15:03:12 -08:00
Igor Minar 3bbd12d560 build: update to yarn@1.21.1 (#34384)
This updates yarn throughout the monorepo for both build and CI.

PR Close #34384
2019-12-16 07:39:58 -08:00
Kara Erickson 17f7f06ca5 Revert "build: update to yarn@1.21.1" (#34402)
This reverts commit f029af50820765019413fa319330830306b80d6a while we investigate
some failures on master on Circle CI. Currently the Windows tests and the
"test-ivy-aot" jobs are red because of incompatible yarn versions.

PR Close #34402
2019-12-13 13:43:25 -08:00
Igor Minar b405942b0c build: update to yarn@1.21.1 (#34384)
This updates yarn throughout the monorepo for both build and CI.

PR Close #34384
2019-12-13 10:51:12 -08:00
George Kalpakas 2ecf9f3f2a refactor(docs-infra): give more descriptive variable name (#34284)
Discussion:
https://github.com/angular/angular/pull/34213#discussion_r353249119

PR Close #34284
2019-12-10 09:18:35 -08:00
Kristiyan Kostadinov e7cf1e0580 feat(docs-infra): add the ability to expose globals (#34237)
Adds the ability to expose global symbols in the API docs via the `@globalApi` tag. Also supports optionally setting a namespace which will be added to the name automatically (e.g. `foo` will be renamed to `ng.foo`). Relevant APIs should also be exported through the `global.ts` file which will show up under `core/global`.

PR Close #34237
2019-12-06 10:58:09 -08:00
Joey Perrott 0341f3239a build: set upper version limit for yarn to <2 (#34236)
Rather than bumping up the allowed version of yarn on each release
we should instead just allow for anything within the major version
1 range.

PR Close #34236
2019-12-05 13:07:41 -08:00
ajitsinghkaler c0869ecfb3 fix(docs-infra): add deprecated-api-item class to remaining deprecated items (#34192)
Fixes #31455

PR Close #34192
2019-12-05 10:12:11 -08:00
George Kalpakas 671deadde1 fix(docs-infra): avoid version mismatch error when using local Angular packages (#34213)
The local Angular packages used to build `aio/` when running
`yarn setup-local`/`yarn build-local` (and related commands), are built
by bazel. Bazel, determines the version to use for these locally built
packages based on the latest tag for a commit on the current branch.
(This works as expected during the release, because the packages are
built on the correct branch with up-to-date tags.)

During local development, however, this often leads to generating older
versions than what the current `@angular/cli` version is compatible
with, if the user has not fetched the latest tags from `angular/angular`
or the branch has not been rebased recently.

Previously, the above (common) situation would result in a build error
by the CLI. (Note that this would be a false error, because in this case
the version set by bazel would not reflect the actual version of the
local packages.) The solution would be for the user to fetch the latest
tags from `angular/angular`, rebase their branch and run a bazel build
again (ensuring that it would actually build anew and not emit cached
artifacts). This was cumbersome and most people didn't even know about
it.

This commit avoids this error and the associated pain-points by
overwriting the versions of the installed local packages with fake
versions based on the ones in the lockfile, which are guaranteed to be
compatible with the currently used CLI version.

Fixes #34208

PR Close #34213
2019-12-03 10:40:14 -08:00
ajitsinghkaler 72abde603d docs: add deprecated-api-item class to deprecated items (#34088)
Fixes #31455

PR Close #34088
2019-12-02 11:03:05 -08:00
Sonu Kapoor 2cc954d5a5 test(docs-infra): ensure RxJS-related docs examples can compile without errors (#34063)
Previously, some RxJS-related examples (which are not proper Angular apps) were not
tested on CI as part of the `example-e2e` npm script. This meant that the examples
could get out-of-date or contain compile errors without as noticing.

This commit ensures that the `example-e2e` script picks up these examples and checks
that they compile successfully.

Partly addresses #28017.

PR Close #34063
2019-12-02 11:02:13 -08:00
arturovt f2800b90b2 docs(docs-infra): fix typos and spelling in the stackblitz-builder/README.md (#34009)
PR Close #34009
2019-11-25 11:39:05 -05:00
Pete Bacon Darwin 06bca0cc66 fix(docs-infra): do not auto-link code in bash and json snippets (#33877)
Previously any code block, which was not marked with
`no-auto-link` css class would have its contents auto-linked to
API pages. Sometimes this results in false positive links being
generated.

This is problematic for triple backticked blocks, which cannot provide
the `no-auto-link` CSS class to prevent the linking.

This commit fixes the problem by allowing the auto-linker to be
configured not to auto-link code blocks that have been marked with an
"ignored" language. By default these are `bash` and `json`.

Triple backticked blocks are able to specify the language directly after
the first set of triple backticks.

Fixes #33859

PR Close #33877
2019-11-18 09:11:01 -08:00
Pete Bacon Darwin 526537fefe style(docs-infra): reformat the auto-link-code files (#33877)
PR Close #33877
2019-11-18 09:11:01 -08:00
Pete Bacon Darwin 5beae0633b build(docs-infra): sync examples node engine constraints with aio (#33877)
PR Close #33877
2019-11-18 09:11:01 -08:00
George Kalpakas 7eb3e3bce6 build: fix build scripts on macOS (#33854)
In #33823, `scripts/package-builds.sh` (which is used by both
`build-packages-dist.sh` and `build-ivy-npm-packages.sh`) was updated to
use `realpath`. It turns out that `realpath` does not exist on macOS, so
the build scripts do not work there.

In order to fix this (and also reduce the likelihood of introducing
similar issues in the future), this commit changes these bash scripts to
Node.js scripts (using [ShellJS](https://github.com/shelljs/shelljs) for
a cross-platform implementation of Unix shell commands where necessary).

PR Close #33854
2019-11-15 16:05:00 -08:00
crisbeto a3034ef92e build: bump maximum allowed yarn version (#33430)
Currently this repo allows Yarn between 1.17.3 and 1.18.0, whereas the components repo requires a minimum of 1.19.1 which makes it annoying to switch between repositories. These changes bump the maximum allowed Yarn version.

PR Close #33430
2019-10-29 11:48:18 -07:00
Igor Minar 86e1e6c082 feat: typescript 3.6 support (#32946)
BREAKING CHANGE: typescript 3.4 and 3.5 are no longer supported, please update to typescript 3.6

Fixes #32380

PR Close #32946
2019-10-18 13:15:16 -04:00
George Kalpakas ab09895810 build(docs-infra): update protractor/webdriver-manager to support latest Chrome (#33206)
Update `protractor` and ensure that the latest version of
`webdriver-manager` (v12.1.7) is installed, which correctly installs a
ChromeDriver version that is compatible with the latest version of
Chrome.

With the previous version of `webdriver-manager`, ChromeDriver v75 would
be installed by default, which was not compatible with the latest
version of Chrome (v77).

PR Close #33206
2019-10-17 14:12:29 -04:00
George Kalpakas 16fe90d6ac fix(docs-infra): consider all formats when compiling docs examples with `ngcc` (#33206)
Previously, when compiling the docs examples with `ngcc` (to run them in
Ivy mode), we would only consider the `es2015` property. However, some
packages (such as `angular-in-memory-web-api`) may not have that
property in their `package.json`. They might still be compilable by
`ngcc`, if they define other format properties (such as `module` or
`main`), but `ngcc` would still fail if it could not find any of the
_specified_ properties (here only `es2015`):

```
Error: Unable to process any formats for the following entry-points (tried es2015):
  - /.../node_modules/angular-in-memory-web-api
```

This commit fixes potential issues by considering all properties that
would be considered if `ngcc` was run implicitly by `@angular/cli` and
aligns the command with the one that will be generated for new apps:
https://github.com/angular/angular/blob/3e14c2d02/packages/core/schematics/migrations/postinstall-ngcc/index.ts#L22

PR Close #33206
2019-10-17 14:12:29 -04:00
Matias Niemelä d192a7b47a revert: fix(docs-infra): consider all formats when compiling docs examples with `ngcc` (#33216)
This reverts commit ccccb80fbecbe99cd913a494892f172962766f85.

PR Close #33216
2019-10-17 02:42:45 -04:00
Matias Niemelä e4504a40bd revert: build(docs-infra): update protractor/webdriver-manager to support latest Chrome (#33216)
This reverts commit b6574f24e1370238c9d6d1faa5a56fb4cb3adf79.

PR Close #33216
2019-10-17 02:42:45 -04:00
George Kalpakas e71a93afb3 build(docs-infra): update protractor/webdriver-manager to support latest Chrome (#33206)
Update `protractor` and ensure that the latest version of
`webdriver-manager` (v12.1.7) is installed, which correctly installs a
ChromeDriver version that is compatible with the latest version of
Chrome.

With the previous version of `webdriver-manager`, ChromeDriver v75 would
be installed by default, which was not compatible with the latest
version of Chrome (v77).

PR Close #33206
2019-10-16 19:02:43 -04:00
George Kalpakas 31b5db6fa8 fix(docs-infra): consider all formats when compiling docs examples with `ngcc` (#33206)
Previously, we would only consider the `es2015` property, but some
packages (such as `angular-in-memory-web-api`) may not have that. They
might still be compilable by `ngcc`, is they have other format
properties (e.g. `module` or `main`).

This commit fixes potential issues by considering all properties that
would be considered via the cli integration and aligns the command to
turn on ivy for docs examples with the one used in new cli apps:
https://github.com/angular/angular/blob/3e14c2d02/packages/core/schematics/migrations/postinstall-ngcc/index.ts#L22

PR Close #33206
2019-10-16 19:02:43 -04:00
Kara Erickson 86104b82b8 refactor(core): rename ngInjectableDef to ɵprov (#33151)
Injectable defs are not considered public API, so the property
that contains them should be prefixed with Angular's marker
for "private" ('ɵ') to discourage apps from relying on def
APIs directly.

This commit adds the prefix and shortens the name from
ngInjectableDef to "prov" (for "provider", since injector defs
are known as "inj"). This is because property names cannot
be minified by Uglify without turning on property mangling
(which most apps have turned off) and are thus size-sensitive.

PR Close #33151
2019-10-16 16:36:19 -04:00
Kara Erickson cda9248b33 refactor(core): rename ngInjectorDef to ɵinj (#33151)
Injector defs are not considered public API, so the property
that contains them should be prefixed with Angular's marker
for "private" ('ɵ') to discourage apps from relying on def
APIs directly.

This commit adds the prefix and shortens the name from
ngInjectorDef to inj. This is because property names
cannot be minified by Uglify without turning on property
mangling (which most apps have turned off) and are thus
size-sensitive.

PR Close #33151
2019-10-16 16:36:19 -04:00
George Kalpakas 1a34fbce25 fix(ngcc): rename the executable from `ivy-ngcc` to `ngcc` (#33140)
Previously, the executable for the Angular Compatibility Compiler
(`ngcc`) was called `ivy-ngcc`. This would be confusing for users not
familiar with our internal terminology, especially given that we call it
`ngcc` in all our docs and presentations.

This commit renames the executable to `ngcc` and replaces `ivy-ngcc`
with a script that errors with an informative message (prompting the
user to use `ngcc` instead).

Jira issue: [FW-1624](https://angular-team.atlassian.net/browse/FW-1624)

PR Close #33140
2019-10-14 16:29:14 +00:00
George Kalpakas b2666a2857 build(docs-infra): enable more TypeScript strictness flags (#32980)
PR Close #32980
2019-10-10 13:56:14 -07:00
George Kalpakas dcd28b591d build(docs-infra): clean up and update dependencies to match latest CLI (#32980)
This commit includes the following types of changes:
- Remove unused dependencies.
- Move dev dependencies from `devDependencies` to `dependencies` (and
  vice versa for production dependencies).
- Update `@types/*`.
- Update dependencies to more closely match the dependencies installed
  by the latest CLI for new apps.

Also, ensured that the latest version of `webdriver-manager` (v12.1.7)
was installed for `protractor`, which correctly installs a ChromeDriver
version that is compatible with the latest version of Chrome.

PR Close #32980
2019-10-10 13:56:14 -07:00
Santosh Yadav 393398e6f5 build(docs-infra): update in-memory-we-api and karma-jasmine-html-reporter version (#32892)
The `karma-jasmine-html-reporter` update also includes a fix for
taras42/karma-jasmine-html-reporter#31.

Fixes #29802

PR Close #32892
2019-10-07 10:51:19 -07:00
JiaLiPassion 53d13c3fc6 refactor: rename unpatched event flag in Zone from `BLACK_LISTED_EVENTS` to `UNPATCHED_EVENTS` (#29617)
Closes #28529

PR Close #29617
2019-10-04 08:44:58 -07:00
George Kalpakas 9364a14d36 fix(docs-infra): ignore `ng*Def` members in API docs (#31378)
`ng*Def` properties (such as `ngInjectorDef`) are not considered part of
the public API and should not appear in the API docs. This commit adds a
filter to remove these properties from the docs metadata.

PR Close #31378
2019-10-03 10:24:34 -07:00
Stephen Fluin a3b6b109d8 docs: fix stackblitz example polyfills (#32969)
PR Close #32969
2019-10-02 13:20:37 -07:00
George Kalpakas 497d6b1323 ci: re-run flaky docs examples e2e tests in `test_docs_examples[_ivy]` jobs (#32497)
The docs examples e2e tests have been quite flaky recently. This causes
the `test_docs_examples` and `test_docs_examples_ivy` CircleCI jobs to
often fail (and block PRs) without a real reason.

This commit adds support for re-running failed docs examples e2e tests
and configures the `test_docs_examples` and `test_docs_examples_ivy`
jobs to try running each test that fails a second time, before giving up
and marking it as failed.

Closes #31841
Closes #31842

PR Close #32497
2019-09-05 18:10:31 -04:00
Joey Perrott 4b1251106e build: bump yarn requirement to 1.17.3 (#32344)
PR Close #32344
2019-08-28 17:13:05 -07:00