Commit graph

333 commits

Author SHA1 Message Date
George Kalpakas
19f189fa41 docs(docs-infra): add documentation on debugging the events generation process (#47449)
PR Close #47449
2022-09-15 09:20:14 -07:00
George Kalpakas
c9241fdeb0 build(docs-infra): introduce new process for generating data for the events page (#45588)
This commit introduces a new process for generating data for the AIO
[events page](https://angular.io/events), which streamlines the process
and minimizes duplication and manual work. For more details, see
`aio/scripts/generate-events/README.md`.

PR Close #45588
2022-09-12 12:25:44 -07:00
Angular Robot
4190e9a776 build: update dependency jasmine to v4 (#46617)
| datasource | package        | from   | to    |
| ---------- | -------------- | ------ | ----- |
| npm        | jasmine        | 3.10.0 | 4.2.1 |
| npm        | @types/jasmine | 3.5.14 | 4.0.3 |
| npm        | jasmine        | 3.6.1  | 4.2.1 |

PR Close #46617
2022-07-11 17:33:55 +00:00
Paul Gschwendtner
68a6a075f4 build: clean up references to old master branch (#45856)
Cleans up all references to the `master` branch we renamed to
`main` across Angular.

PR Close #45856
2022-05-04 16:23:33 -07:00
Paul Gschwendtner
95555658cf build: disable bazel nodejs linker to improve stability on windows (#45872)
The NodeJS Bazel linker does not work well on Windows because there
is no sandboxing and linker processes from different tests will attempt
to modify the same `node_modules`, causing concurrency race conditions
and resulting in flakiness.

PR Close #45872
2022-05-04 16:20:57 -07:00
Paul Gschwendtner
3a60063a54 build: updates to account for github primary branch rename
This is the commit accounting for the Github primary branch
rename when we actually perform the update.

We have three change phases: Prepare, Direct, Cleanup. This commit
is for the `direct` phase.
2022-04-28 11:17:01 -06:00
Joe Martin (Crowdstaffing)
e0ac614121 docs: update test threshold \nupdate test threshold to get this content merged. (#45325)
PR Close #45325
2022-04-08 19:36:31 +00:00
dario-piotrowicz
16e635ca49 fix(docs-infra): update a11y min-scores (#45209)
update (decrease) the value of some of the accessibility MIN_SCORES_PER_PAGE
after recent changes

PR Close #45209
2022-03-29 09:23:12 -07:00
Derek Cormier
22d1dc0acb build(bazel): add bazel build and test targets for aio build (#45022)
First step towards a migration of aio to bazel. Not yet built by ci.

PR Close #45022
2022-03-14 09:25:34 -07:00
Borja Paz Rodríguez
9d2401d99a docs: fix several typos (#44508)
PR Close #44508
2022-01-04 12:13:46 -08:00
George Kalpakas
e397a4c813 docs(docs-infra): remove obsolete mention of skipping HTTPS-related audits (#44214)
Since commit 6e40551394, the
`audit-web-app` script no longer needs to skip HTTPS-related audits.
Update the docs comment to reflect that.

PR Close #44214
2021-11-19 18:46:16 +00:00
George Kalpakas
8d8cdc1991 ci: improve angular.io deployment process for the master branch (#43963)
Previously, the master branch was only deployed to the
`next-angular-io-site` Firebase site, which is connected to the
`next.angular.io` domain. However, if the master major version was
higher than the stable major version (or the RC major version in case
there was an active RC), we also had to manually configure (via the
Firebase console and/or DNS records) the `v<X>.angular.io` domain to
redirect to `next.angular.io`. Then, once `<X>` became the new stable or
RC version, we had to manually remove the redirect (to let
`v<X>.angular.io` be redirected to `angular.io` or `rc.angular.io`).

This commit is part of a new process that reduces the manual steps as
follows (the steps below only apply when the master major version is
higher than the current stable and RC (if applicable)):
- A `v<X>-angular-io-site` Firebase site will be created as soon as the
  version in the `master` branch's `package.json` is updated to a new
  major.
- The `v<X>.angular.io` domain will be connected to that new Firebase
  site.
- When deploying from the master branch, we will deploy to both
  `next-angular-io-site` and `v<X>-angular-io-site`. In addition, the
  deployment to `v<X>-angular-io-site` will update the Firebase config
  file to redirect to `next.angular.io`.
- When the master version becomes the new stable/RC, we will start
  deploying to `v<X>-angular-io-site` from the stable/RC branch, which
  will update the Firebase config to stop redirecting to
  `next.angular.io` and redirect to `(rc.)angular.io` instead (without
  requiring changes in the Firebase console or DNS).

PR Close #43963
2021-10-29 15:05:04 -07:00
George Kalpakas
b202539bb1 ci: improve angular.io deployment process for the RC branch (#43963)
Previously, (when there was an active RC) the RC branch was only
deployed to the `rc-angular-io-site` Firebase site, which is connected
to the `rc.angular.io` domain. However, if the RC major version was
higher than the stable major version, we also had to manually configure
(via the Firebase console and/or DNS records) the `v<X>.angular.io`
domain to redirect to `rc.angular.io`. Then, once `<X>` became the new
stable version, we had to manually remove the redirect (to let
`v<X>.angular.io` be redirected to `angular.io`).

This commit is part of a new process that reduces the manual steps as
follows (the steps below only apply to RC versions that have a higher
major version than the current stable):
- A `v<X>-angular-io-site` Firebase site will be created for the new RC
  version.
- The `v<X>.angular.io` domain will be connected to that new Firebase
  site.
- When deploying from the RC branch, we will deploy to both
  `rc-angular-io-site` and `v<X>-angular-io-site`. In addition, the
  deployment to `v<X>-angular-io-site` will update the Firebase config
  file to redirect to `rc.angular.io`.
- When the RC version becomes the new stable, we will start deploying to
  `v<X>-angular-io-site` from the stable branch, which will update the
  Firebase config to stop redirecting to `rc.angular.io` and redirect to
  `angular.io` instead (without requiring changes in the Firebase
  console or DNS).

PR Close #43963
2021-10-29 15:05:04 -07:00
George Kalpakas
be24bb7535 ci: improve angular.io deployment process for the stable branch (#43963)
Previously, the stable branch was always deployed to the
`v<X>-angular-io-site` Firebase site, which was connected to the
`angular.io` domain. Whenever a new major version was released (and
became the new stable version), the `angular.io` domain had to be
disconnected from the previous Firebase site and be connected to the new
`v<Y>-angular-io-site` Firebase site. This was a manual process that
involved making changes in the Firebase console and the DNS records.

This commit is part of a new process that reduces the manual steps as
follows:
- A new `stable-angular-io-site` Firebase site is created.
- The `angular.io` domain will be connected to that new Firebase site.
- When deploying from the stable branch, we will deploy to both
  `stable-angular-io-site` and `v<X>-angular-io-site`. In addition, the
  deployment to `v<X>-angular-io-site` will update the Firebase config
  file to redirect to `angular.io`.
- When a new major version is released, we will start deploying from the
  new stable branch to `stable-angular-io-site`, but there will be no
  need to connect/disconnect the `angular.io` domain. Also,
  `v<X>.angular.io` will stop redirecting to `angular.io` by means of
  updating the Firebase config file (without requiring changes in the
  Firebase console or DNS).

PR Close #43963
2021-10-29 15:05:04 -07:00
George Kalpakas
cd359259f4 feat(docs-infra): add post-deploy actions for testing more redirect configs (#43963)
Add `deploy-to-firebase` post-deploy actions to allow testing various
redirect configs.
In a future commit, this will allow testing redirects for the `stable`,
`rc` and `next` deployments via the Firebase config file (without
requiring changes in the Firebase console or DNS).

PR Close #43963
2021-10-29 15:05:03 -07:00
George Kalpakas
02971ab6d7 refactor(docs-infra): make it easier to configure Firebase redirects at deployment (#43963)
Refactor the `deploy-to-firebase` post-deploy actions by extracting
logic to separate helper functions. This makes it easier to create more
functions for testing various redirect configs (in a future commit).

PR Close #43963
2021-10-29 15:05:03 -07:00
George Kalpakas
ea676514e9 feat(docs-infra): add more granular support for configuring Firebase redirects at deployment (#43963)
Previously, there was a `deploy-to-firebase` pre-deploy action for
configuring Firebase to redirect non-file requests to `angular.io`. This
is used for ensuring that `rc.angular.io` is correctly redirected to
`angular.io`, even when people have previously visited (and have a
ServiceWorker activated on) `rc.angular.io`.

This commit adds pre-deploy actions for configuring Firebase to redirect
a deployment to any of `angular.io`, `rc.angular.io` or
`next.angular.io` and also configure whether all requests or only
non-file requests will be redirected.
In a future commit, this will allow managing redirects for the `stable`,
`rc` and `next` deployments via the Firebase config file (without
requiring changes in the Firebase console or DNS).

PR Close #43963
2021-10-29 15:05:03 -07:00
George Kalpakas
4f39c2bf7d feat(docs-infra): create undo functions for all pre-deploy actions (#43963)
Create functions to undo the changes made by any pre-deploy action.
In a future commit, this will allow deploying a build to multiple
projects/sites with different small tweaks for each.

PR Close #43963
2021-10-29 15:05:03 -07:00
George Kalpakas
cbd0b37b4a test(docs-infra): avoid running expensive operations when focusing/skipping tests (#43963)
Previously, the pre-computation of branch version info for the
`deploy-to-firebase` tests would always take place even when the tests
that used that info were skipped. This pre-computation involves network
access and may add a noticeable delay.

This commit refactors the tests to not do the pre-computation if the
corresponding tests are skipped. This allows for a faster iteration
when focusing on a different set of tests.

PR Close #43963
2021-10-29 15:05:03 -07:00
George Kalpakas
23b7543dca refactor(docs-infra): move deploy-to-firebase post-deploy actions to a separate file (#43963)
Move some functions that are used as post-deploy actions from
`deploy-to-firebase/index.mjs` to a separate file
(`deploy-to-firebase/post-deploy-actions.mjs`) to keep `index.mjs` small
and easier to maintain.

NOTE:
While not strictly necessary atm, `post-deploy-actions.mjs` uses the
same default export pattern for consistency with `utils.mjs`.

PR Close #43963
2021-10-29 15:05:02 -07:00
George Kalpakas
b16a92d7f5 refactor(docs-infra): move deploy-to-firebase pre-deploy actions to a separate file (#43963)
Move some functions that are used as pre-deploy actions from
`deploy-to-firebase/index.mjs` to a separate file
(`deploy-to-firebase/pre-deploy-actions.mjs`) to keep `index.mjs` small
and easier to maintain.

Also, rename the `removeServiceWorker()` function to
`disableServiceWorker()`, which is a little more accurate.

NOTE:
While not strictly necessary atm, `pre-deploy-actions.mjs` uses the same
default export pattern for consistency with `utils.mjs`.

PR Close #43963
2021-10-29 15:05:02 -07:00
George Kalpakas
ce51f99976 refactor(docs-infra): move deploy-to-firebase util functions to a separate file (#43963)
Move some util functions from `deploy-to-firebase/index.mjs` to a
separate file (`deploy-to-firebase/utils.mjs`) to keep `index.mjs` small
and easier to maintain.

NOTE:
To make it easier to mock functions in tests, `utils.mjs` uses a default
export (instead of multiple named exports) and references local
functions through the default exported object.

PR Close #43963
2021-10-29 15:05:02 -07:00
George Kalpakas
5a21519872 refactor(docs-infra): create logSectionHeader() helper in deploy-to-firebase script (#43963)
Create a `logSectionHeader()` helper function to avoid duplicating code.

PR Close #43963
2021-10-29 15:05:02 -07:00
George Kalpakas
4f4b2b5ac9 refactor(docs-infra): convert deploy-to-firebase script to ESM (#43963)
Convert the `deploy-to-firebase` script (and corresponding tests) from
CommonJS format to ESM.

PR Close #43963
2021-10-29 15:05:02 -07:00
George Kalpakas
80d8eb87bb build(docs-infra): validate computed deployments in deploy-to-firebase script (#43963)
The `deploy-to-firebase` script might have to deploy a single AIO build
to multiple projects/sites (potentially with small tweaks between each).

This commit adds a step to validate the computed deployments to ensure
they are compatible with each other (for example, that there is exactly
one primary deployment that builds the app and sets the theme/mode and
that all secondary deployments are compatible with the primary one).

PR Close #43963
2021-10-29 15:05:02 -07:00
George Kalpakas
3894cef78e refactor(docs-infra): add name and type to deployment info (#43963)
This commit adds two new properties, `name` and `type`, to deployment
info data. This will make it easier to differentiate between deployment
targets (e.g. primary vs secondary) and will provide more informative
log messages.

In a subsequent commit, this new data can be used to validate the
computed deployments list.

PR Close #43963
2021-10-29 15:05:02 -07:00
George Kalpakas
f1b40483fe fix(docs-infra): improve an error message in deploy-to-firebase script (#43963)
This commit fixes a typo in an error message thrown in the
`deploy-to-firebase` script (`but it was but it was` --> `but it was`).

It also makes the error clearer when the request was not redirected.

Old error:
> Expected '<original-url>' to be redirected to '<expected-url>', but it
> was but it was redirected to 'undefined'.

New error:
> Expected '<original-url>' to be redirected to '<expected-url>', but it
> was not redirected.

PR Close #43963
2021-10-29 15:05:02 -07:00
George Kalpakas
2baadb92e8 build(docs-infra): enable linting for deploy-to-firebase scripts (#43963)
This commit enables linting for the scripts in
`aio/scripts/deploy-to-firebase/`. It also makes the necessary changes
to the files to make linting pass.

PR Close #43963
2021-10-29 15:05:02 -07:00
George Kalpakas
f8ab6e9eb3 refactor(docs-infra): move deploy-to-firebase.js into a dedicated directory (#43963)
This commit moves the `aio/scripts/deploy-to-firebase.js` script into a
new directory, `aio/scripts/deploy-to-firebase/`. This will make it
easier to break it up into multiple smaller files to better organize the
code (without polluting the `aio/scripts/` directory).

PR Close #43963
2021-10-29 15:05:02 -07:00
George Kalpakas
c997fef08a build(docs-infra): update scripts using Lighthouse to ES modules (#43607)
Update the AIO scripts that use Lighthouse (i.e. `audit-web-app.js` and
`test-aio-a11y.js`) to ES modules. This allows consuming
`lighthouse/lighthouse-cli` [v8.5.0+][1], which also switched to ES
modules.

NOTE:
Switching the `test-aio-a11y.js` script to ES modules is not strictly
necessary, since it invokes `audit-web-app.mjs` via a shell command, but
it was done for consistency.

[1]: https://github.com/GoogleChrome/lighthouse/releases/tag/v8.5.0

PR Close #43607
2021-10-04 16:29:49 -07:00
George Kalpakas
d07e736f17 build(docs-infra): auto-generate SW navigationUrls from Firebase config (#42452)
Previously, redirects had to be configured in both the Firebase config
(`firebase.json`) and the ServiceWorker config (`ngsw-config.json`).
This made it challenging to correctly configure redirects, since one had
to understand the different formats of the two configs, and was also
prone to getting out-of-sync configs.

This commit simplifies the process of adding redirects by removing the
need to update the ServiceWorker config (`ngsw-config.json`) and keep it
in sync with the Firebase config (`firebase.json`). Instead the
ServiceWorker `navigationUrls` are automatically generated from the list
of redirects in the Firebase config.

NOTE:
Currently, the automatic generation only supports the limited set of
patterns that are necessary to translate the existing redirects. It can
be made more sophisticated in the future, should the need arise.

PR Close #42452
2021-06-18 17:32:58 +00:00
George Kalpakas
12644486f4 ci: start tracking CSS payload sizes for angular.io (#42584)
Previously, we only tracked the sizes of the eagerly loaded JS bundles.
However, the CSS styles (which also have a non-negligible size) must
also be downloaded and parsed by the browser, thus affecting the initial
rendering time.

This commit starts tracking the CSS styles payload sizes.
(Originally discussed in
https://github.com/angular/angular/pull/42584#discussion_r653787961)

PR Close #42584
2021-06-18 17:32:26 +00:00
George Kalpakas
c964ad66d4 test(docs-infra): fix URL for a11y testing of angular.io (#42462)
This commit fixes one of the URLs used for testing the accessibility of
angular.io from `start-routing` to `start/start-routing`. The old URL is
not correct and result in a "Page not found" error.

This commit also increases some of the a11y scores.

PR Close #42462
2021-06-03 10:50:29 -07:00
Joey Perrott
4e9b61aaf9 docs: remove/update broken links in resources appearing on aio (#42232)
Remove or update broken links to resources from the resources and
contributors pages on aio.

Closes #39719

PR Close #42232
2021-05-26 14:21:12 -07:00
Alan Agius
70425539f7 build(docs-infra): remove view engine related code (#41638)
This is a pre-update to Angular 12 cleanup.

This is not needed for version 12, since applications cannot be built using View Engine.

PR Close #41638
2021-04-16 08:59:37 -07:00
George Kalpakas
80f11a9b86 ci: check that there are no unused contributor images (#41290)
When a contributor was removed from `contributors.json`, the
corresponding image should also be removed from
`aio/content/images/bios/`. However, this was often overlooked,
resulting in unused images remaining in `aio/content/images/bios/`.

This commit adds a check to ensure that all images in
`aio/content/images/bios/` are referenced in `contributors.json`.

PR Close #41290
2021-03-23 09:38:43 -07:00
Pete Bacon Darwin
5bc0a472bd refactor(docs-infra): remove image size exclusion list (#41292)
In #41253 the size of contributor images was limited, but
some images were already too large. So an exclusion list
was added. These images have now been reduced, so
the exclusion list is no longer needed.

The files were reduced by a combination of running them through the
https://tinyjpg.com/ online service and manually setting their size to
168px wide or tall using the MacOS Image Preview app.

PR Close #41292
2021-03-22 08:55:53 -07:00
Andrew Kushnir
2ccb579e06 feat(docs-infra): add profile picture size check (#41253)
This commit updates the logic that validates contributors.json data and introduces a new check that verifies that profile images don't exceed specified limit.

PR Close #41253
2021-03-19 12:37:21 -07:00
George Kalpakas
e1e766a880 fix(docs-infra): generate the 404.html page correctly (#41163)
Previously, the generated `404.html` page did not include a `<body>`
tag. In some browsers (such as IE 11), this was causing warnings in the
console.

This commit ensures the generated page contains a `<body>` tag. It also
fixes the indentation in the generated page.

PR Close #41163
2021-03-11 09:30:03 -08:00
George Kalpakas
d80d6ea3f6 fix(docs-infra): fix styling of <code> elements on older browsers (#41051)
Previously, styling of `<code>` elements utilized the `:not()` CSS
pseudo-class with multiple selectors (`:not(h1, h2, ...)`). It turns out
that older browsers (such as IE11) do not support multiple selectors in
a single `:not()` instance.
(See [MDN][1] and [CanIUse][2] for more info.)

This commit fixes `<code>` styling to use multiple separate `:not()`
instances instead (`:not(h1):not(h2)...`), so that they are styled
correctly on older browsers as well.

NOTE:
This change seems to trigger some kind of bug in LightHouse that causes
the a11y score of `/start` to be calculated as 0 (which is clearly
wrong). This happens on Linux (tested on CI and locally using the
Windows Subsystem for Linux (WSL)) - on Windows the score is computed
correctly as 98/100.
([Example failure][3])

The bug seems to be related to the layout of the content and goes away
if we change the viewport size (for example, switching to LightHouse's
`desktop` config) or make another change that affects the content's
layout (for example, reducing the padding of `<code>` elements).

To work around the issue, this commit updates the `test-aio-a11y.js`
script to test `/start-routing` instead of `/start`.

[1]: https://developer.mozilla.org/en-US/docs/Web/CSS/:not#description:~:text=Using%20two%20selectors
[2]: https://caniuse.com/css-not-sel-list
[3]: https://circleci.com/gh/angular/angular/931038

PR Close #41051
2021-03-09 08:52:51 -08:00
George Kalpakas
7854c4ddbe test(docs-infra): run a11y tests against /tutorial and update a11y scores (#41103)
This commit adds `/tutorial` to the list of angular.io pages that we run
a11y tests against and updates the required scores to match the current
ones (to avoid a future regression going unnoticed).

PR Close #41103
2021-03-08 08:33:47 -08:00
George Kalpakas
e59246cf5c test(docs-infra): print the browser version in audit-web-app.js to help debugging (#41103)
This commit updates the `audit-web-app.js` script (used to run PWA and
a11y tests on angular.io) to also print the version of the browser used
to run the tests. This can help when debugging a CI failure.

PR Close #41103
2021-03-08 08:33:47 -08:00
George Kalpakas
6e40551394 build(docs-infra): update Lighthouse to version 7.2.0 (#40994)
In this version, we no longer need our custom logic to skip certain
HTTPS related audits on localhost, since Lighthouse will treat it as a
secure context (similar to how browsers do).
See also GoogleChrome/lighthouse#11766.

PR Close #40994
2021-03-03 09:43:56 -08:00
Andrew Kushnir
446dba6b2b build(docs-infra): add more checks to verify contributors.json data (#40369)
This commit adds extra steps to verify contributors.json data, such as checking `lead` and `mentor` field as well as
making sure the list is sorted alphabetically.

PR Close #40369
2021-01-11 15:32:21 -08:00
Andrew Kushnir
f0c3e17512 refactor(docs-infra): rename contributors/check-pictures.js to validate-data.js (#40369)
This commit renames contributors/check-pictures.js to contributors/validate-data.js, since this file script will also
be used to include other checks.

PR Close #40369
2021-01-11 15:32:21 -08:00
George Kalpakas
c18a9d5c79 ci: reduce flakiness of docs-infra deploy-to-firebase.js tests (#40088)
The `deploy-to-firebase.js` tests rely on git info retrieved from the
`angular/angular` repository (via `git ls-remote ...`).

Previously, different calls to `git ls-remote ...` could return
different values if a new commit was pushed or a new branch was created
during test execution, resulting in errors ([example CI failure][1]).

This commit makes the tests more stable by memoizing the result of
`git ls-remote ...` and returning the same result for subsequent calls
with the same arguments (even if meanwhile the remote has been updated).

[1]: https://circleci.com/gh/angular/angular/877626

PR Close #40088
2020-12-14 11:38:32 -08:00
George Kalpakas
f01c713ee2 ci: fix AIO deployment to multiple Firebase sites (#39948)
Since #39853, it is possible to deploy to multiple Firebase sites from a
single branch. In order to deploy to a site, we need to associate an
alias (`aio`) with a site. This is done via the `firebase target:apply`
command. However, when the command is called multiple times, it
associates the alias with many sites, which subsequently fails during
deployment ([example failure][1]), since the `firebase deploy` command
does not know what site to deploy to.

This commit fixes the deployment script by ensuring that any previous
association with the `aio` alias is cleared (via the
`firebase target:clear` command) before associating it with a new site.

[1]: https://circleci.com/gh/angular/angular/871020

PR Close #39948
2020-12-03 13:43:44 -08:00
George Kalpakas
eba185edc8 test(docs-infra): reduce ambiguity in deploy-to-firebase.js test descriptions (#39853)
Previously, test descriptions used `latest` to refer to the most
recent/highest version. This was ambiguous, because `latest` can also
refer to the stable version of a package (e.g. see `@latest` npm tag).

This commit replaces `latest` with `highest` (or `highest for major`) to
reduce ambiguity.

Discussed in:
https://github.com/angular/angular/pull/39853#discussion_r531730317

PR Close #39853
2020-12-02 12:51:39 -08:00
George Kalpakas
cf1f5a1e37 fix(docs-infra): fix redirecting rc.angular.io to angular.io when no active RC (#39853)
Currently there is an issue with redirecting `rc.angular.io` to
`angular.io` when there is no active RC. If a user has visited
`rc.angular.io` before and has a ServiceWorker registered for that
subdomain, they will never "see" the redirect to `angular.io`.

This commit fixes the problem by doing an additional deployment from the
stable branch to the `rc-angular-io-site` Firebase site when there is no
active RC. This additional deployment will ensure that:
1. Users will be temporarily redirected from `rc.angular.io` to
   `angular.io`.
2. Users with a registered ServiceWorker (who don't see the redirect)
   will have their ServiceWorker unregistered on the next visit.
3. The content on both sites is identical.

See #39760 for more details on the problem and the solution.

NOTE:
As mentioned in #39760, for this fix to take affect, we need to remove
the redirect from `rc.angular.io` to `angular.io` in the Firebase
console for site `rc-angular-io-site`.

Fixes #39760

PR Close #39853
2020-12-02 12:51:38 -08:00
George Kalpakas
1e39e493fb fix(docs-infra): do not deploy as archive when major is not lower than stable (#39853)
Previously, a branch would be deployed as `archive` even if it had a
major version that was equal/higher than that of the stable branch (as
long as it was not the RC branch - i.e. not the most recent minor
branch). For example, with `11.0.x` as the stable branch  and `12.0.x`
as the RC branch, `11.1.x` would be deployed as archive.

Theoretically, we should never find ourselves in such a situation.
Typically, there will only be at most one minor branch most recent than
the stable one (and that branch will be the RC branch). However, it
is possible under unusual circumstances.

This commit adds additional checks to guard against this problem. It
also refactors the code in preparation of fixing an issue with
`rc.angular.io` redirects in the presence of a ServiceWorker, which will
require identifying whether there is an active RC version or not.
See #39760 for more details.

PR Close #39853
2020-12-02 12:51:37 -08:00