Commit Graph

713 Commits

Author SHA1 Message Date
George Kalpakas af762fa917 build: allow Node.js v15 and above for local development (#42387)
This commit changes the `engines` rules in the root `package.json` as
well as the `package.json` used when working on docs example to also
accept Node.js versions greater than v14. This aligns them with
`aio/package.json` and allows using Node.js v15 and v16 (current) for
local development in the `angular/angular` repo.

Related to #42367.

PR Close #42387
2021-06-01 10:14:08 -07:00
mgechev c9bc88757b docs: embed the devtools video in the corresponding guide (#42161)
Allow people consume the content in a video format.

PR Close #42161
2021-05-20 16:55:16 +00:00
Kristiyan Kostadinov e86a1d3441 docs: make all examples compatible with strict mode (#41999)
Turns on the `strict` compiler flag and resolves the compilation errors in the various AIO examples.

PR Close #41999
2021-05-17 10:42:18 -07:00
Alex Rickabaugh d34ce6b76a build(docs-infra): update docs examples to Angular v12.0.0 (#42071)
This commit updates the example boilerplate to Angular v12.0.0. The
[diff](https://github.com/cexbrayat/angular-cli-diff/compare/11.2.11...12.0.0)
is fairly trivial and the migrations did not produce any code changes.

PR Close #42071
2021-05-12 19:37:15 -04:00
iRealNirmal e071e3b507 build(docs-infra): fixed i18n broken stackblitz example (#42001)
This commit fixes the broken stackblitz example of i18n.

Closes #41838.

PR Close #42001
2021-05-10 16:11:34 -04:00
Ajit Singh ddf2a6c975 build: update node version to stop aio from breaking while generating docs (#42009)
When aio yarn docs-only command runs on v12.14.1 it fails details given on issue #41979. Upgrading node version to v12.17.0 solves this but creates a new warning (node:467072) ExperimentalWarning: The ESM module loader is experimental.
This warning gets removed in v12.20.0. Upgrading node version to 12.20.0

PR Close #42009
2021-05-10 10:39:39 -04:00
Pete Bacon Darwin d59f2b0d0c refactor(core): remove unnecessary cast (#41960)
The `as any` is no longer needed since `providedIn` can accept `'any'`.

PR Close #41960
2021-05-10 10:28:31 -04:00
Pete Bacon Darwin 71f37c9d9c build(docs-infra): add NgModules references to provided injectables (#41960)
Parse the `providers` property of each NgModule doc and add this doc to
the `ngModules` property of each provided injectable.

PR Close #41960
2021-05-10 10:28:30 -04:00
Pete Bacon Darwin 85f5cb45d2 build(docs-infra): associate `providedIn` injectables with their NgModule (#41960)
Such injectables were not appearing in the providers lists of their NgModule.
This commit updates the doc-gen to support associating these automatically.
Further, it also allows developers to mark other injectables that are provided
in an NgModule with a reference to the NgModule where they are provided.

The commit also does a refactoring of the `processNgModuleDocs` dgeni
processor code, to make it easier to maintain.

Fixes #41203

PR Close #41960
2021-05-10 10:28:30 -04:00
George Kalpakas 2076bde100 build(docs-infra): take disambiguated doc paths into account when generating the sitemap (#41842)
In ##41788, the `disambiguateDocsPathsProcessor` was introduced to fix
an issue with case-insensitively equal paths. This processor may alter
the paths of some docs and thus their final URL in the app.

Previously, both the `disambiguateDocPathsProcessor` and the
`createSitemap` processor (which relies on the docs' computed paths to
generate the sitemap file) were configured to run before the
"rendering-docs" phase. However, this resulted in the
`disambiguateDocPathsProcessor`'s running after `createSitemap`, which
meant that the sitemap did not include the updated doc paths.

This commit fixes it by ensuring that the
`disambiguateDocPathsProcessor` is explicitly run before the
`createSitemap` processor, so that the latter will be able to take into
account any changes made by the former.

PR Close #41842
2021-04-27 14:05:23 -07:00
George Kalpakas d1f5a9e44b test(docs-infra): update `firebase-test-utils` to support regex-based redirects (#41842)
This commit updates the utilities in `firebase-test-utils/` to also
support testing Firebase redirects that are configured using regular
expressions (via the `regex` property).
See the [Firebase docs][1] for more details.

[1]: https://firebase.google.com/docs/hosting/full-config#redirects

PR Close #41842
2021-04-27 14:05:23 -07:00
George Kalpakas ae1ce5f9c7 refactor(docs-infra): prepare `firebase-test-utils` for accepting regex-based redirects (#41842)
Currently, the utilities for testing Firebase redirects assume that the
redirects are configured using the glob-based `source` property.
However, Firebase also supports configuring redirects using regular
expressions (via the `regex` property).
See the [Firebase docs][1] for more details.

This commit refactors the utilities in `firebase-test-utils/` to make it
easy to add support for such regex-based redirect configurations.

[1]: https://firebase.google.com/docs/hosting/full-config#redirects

PR Close #41842
2021-04-27 14:05:23 -07:00
George Kalpakas 36e10e7932 test(docs-infra): fix `create-example` tests on Windows (#41842)
Previously, the tests in `create-example.spec.ts` made assertions using
some hard-coded absolute paths (something like `/foo/bar`). This caused
the tests to fail on Windows, where the absolute paths are prefixed with
the drive letter (something like `C:/foo/bar`).

This commit uses `path.resolve()` to ensure paths are converted to the
format used on the current OS.

PR Close #41842
2021-04-27 14:05:23 -07:00
Joey Perrott 2f678fcedb build: update node version requirements (#41822)
Update the node version requirements to only include the LTS versions supported, rather
than accidently including the active versions.

PR Close #41822
2021-04-26 15:21:13 -07:00
Pete Bacon Darwin 538286df16 build(docs-infra): add path disambiguation (#41788)
When two documents have the same `outputPath`, only differing by
letter casing, there can be problems on case-insensitive file-systems:
Only one of each of the docs would end up being written.

Moreover, the Webpack 5 bundler will error if it comes across files
that have this kind of ambiguous paths.

This commit adds a new docType: `disambiguator`, which will display
a list of the docs that match an ambiguous path. Each of the ambiguous
docs is then given a unique path and outputPath to ensure there are no
collisions.

PR Close #41788
2021-04-26 12:12:00 -07:00
Pete Bacon Darwin 2ede980fea build(docs-infra): no duplicate docTypes in postProcessHtml processor (#41788)
This processor was being initialized with the same docTypes twice.

PR Close #41788
2021-04-26 12:11:59 -07:00
George Kalpakas 99f2ffc740 build: update stemmer to version 2.0.0 (#41724)
NOTE:
`stemmer` v2.0.0 switched to ES modules (see
words/stemmer@03519229c8), which means
that the only way to consume it in our CommonJS setup (for example, in
[generateKeywords][1]) is via an async `import()`.

This commit makes the `generateKeywords` processor asynchronous in order
to be able to dynamically import and use `stemmer`.

[1]: 251bec159a/aio/tools/transforms/angular-base-package/processors/generateKeywords.js

PR Close #41724
2021-04-26 11:00:59 -07:00
George Kalpakas a938849148 fix(docs-infra): apply custom `autoLinkCode` filters to single-word `<code>` elements (#41709)
Previously, the `autoLinkCode` Dgeni post-processor would not apply the
custom filters when matching the whole contents of a `<code>` element.
This meant that custom filters would not be applied to single-word
`<code>` elements.

You can see occurrences of this issue in the following sections of the
"Reactive forms" guide:
- [Creating nested form groups][1]
  (look for `street, city, state, and zip controls`)
- [Using the FormBuilder service to generate controls][2]
  (look for `group method`)

This commit fixes this by also applying the custom filters when
processing the whole contents of a `<code>` element.

This commit also updates the `filterPipes` custom filter to allow
matching a pipe's name in a single-word `<code>` element (where there is
no preceeding `|` character).

[1]: https://v10.angular.io/guide/reactive-forms#creating-nested-form-groups
[2]: https://v10.angular.io/guide/reactive-forms#using-the-formbuilder-service-to-generate-controls

PR Close #41709
2021-04-26 10:59:08 -07:00
George Kalpakas de19b8bb88 fix(docs-infra): do not process generated nodes for auto-linking (#41709)
While generating the docs, when a `<code>` element is inspected for
auto-linking, the `autoLinkCode` Dgeni post-processor will break its
contents up into words and generate text nodes for those words that
should not be auto-linked.

Previously, our text node visitor would visit these generated text nodes
and try to auto-link them too. As a result, it would unnecessarily
process nodes that had already been checked (and could potentially
generate links that would otherwise be ignored).

You can see an occurrence of this issue in the
[Create the product list][1] section of the
"Getting started with Angular" tutorial (look for `<a>`).

This commit fixes this by ensuring the visitor will skip the current
node and any nodes generated by `autoLinkCode`.

[1]: https://v11.angular.io/start#create-the-product-list

PR Close #41709
2021-04-26 10:59:07 -07:00
George Kalpakas 6465b5056a build(docs-infra): fix e2e testing SystemJS-based docs examples (#41796)
This commits makes the SystemJS-based docs examples more self-contained
by ensuring the necessary WebDrivers are fetched before running the e2e
tests.
This is a follow-up to #41689. (See there for more discussion.)

PR Close #41796
2021-04-26 09:25:12 -07:00
George Kalpakas 122c8ba0e3 build(docs-infra): fix `StackblitzBuilder` after `jsdom` update (#41725)
In commit c617f1f768, `jsdom` was updated
from v9 to v16. This includes a breaking change that caused
`StackblitzBuilder` to fail to generate the StackBlitz examples.
However, this failure went unnoticed, because `StackblitzBuilder` still
completed successfully after failing to generate the examples. (This has
been fixed in the previous commit.)

This commit updates `StackblitzBuilder` to use the new `jsdom` API.

PR Close #41725
2021-04-22 08:38:20 -07:00
George Kalpakas 5a80bc6eb5 build(docs-infra): exit with an error code if generating StackBlitz examples fails (#41725)
Previously, failing to generate one or more StackBlitz examples would
log the errors but exit the command successfully. This made it easy to
miss such failures.

This commit fixes this by exiting the process with an error code if
generating one or more StackBlitz examples fails.
(In order to be able to see all potential errors, all examples are
attempted to be generated before exiting the process.)

PR Close #41725
2021-04-22 08:38:20 -07:00
Kapunahele Wong a2b671e61b docs: add margin to button boilerplate CSS for examples (#41413)
PR Close #41413
2021-04-20 11:37:27 -07:00
Pete Bacon Darwin 70341bcfed build(docs-infra): update docs examples to Angular v11.2.10 (#41689)
This commit updates the docs examples to Angular v11.2.10. See the [diff between 11.0.1 and 11.2.10 (FW) and 11.2.9 (CLI)][1].

The changes are fairly trivial including:

- Removal of `emitDecoratorMetadata` from tsconfig.json files, where no JIT compilation is required.
- Setting `enableI18nLegacyMessageIdFormat` to `false` for CLI based applications - the i18n example was already migrated away from legacy message IDs.

[1]: https://github.com/cexbrayat/angular-cli-diff/compare/11.2.9..11.0.1

PR Close #41689
2021-04-19 14:18:51 -07:00
Pete Bacon Darwin 1573510187 refactor(docs-infra): tidy up systemjs boilerplate for upgrade examples (#41689)
The ngUpgrade examples mostly rely upon SystemJS configuration.
This commit tidies up how these examples are built and tested so that
it will be easier to migrate them to work with Angular 11.2.x

PR Close #41689
2021-04-19 14:18:51 -07:00
Alan Agius d3edc5c0f5 test(docs-infra): run all example tests in IVY runtime (#41638)
We have several tests which use system.js, this means that we cannot use NGCC with `--create-ivy-entry-points`, also we need to process UMD bundles since our system.js configurations use UMDs.

PR Close #41638
2021-04-16 08:59:37 -07:00
Alan Agius e920eac026 build(docs-infra): update lite-server to fix errors on OSX (#41638)
```
$ lite-server -c bs-config.aot.json
$ ngc -p tsconfig-aot.json && rollup -c rollup-config.js
/Users/xxxx/git/angular/aio/tools/examples/shared/node_modules/browser-sync/node_modules/chokidar/lib/fsevents-handler.js:26
  return (new fsevents(path)).on('fsevent', callback).start();
          ^
TypeError: fsevents is not a constructor
    at createFSEventsInstance (/Users/xxxx/git/angular/aio/tools/examples/shared/node_modules/browser-sync/node_modules/chokidar/lib/fsevents-handler.js:26:11)
    at setFSEventsListener (/Users/xxxx/git/angular/aio/tools/examples/shared/node_modules/browser-sync/node_modules/chokidar/lib/fsevents-handler.js:80:16)
    at FSWatcher.FsEventsHandler._watchWithFsEvents (/Users/xxxx/git/angular/aio/tools/examples/shared/node_modules/browser-sync/node_modules/chokidar/lib/fsevents-handler.js:244:16)
    at FSWatcher.<anonymous> (/Users/xxxx/git/angular/aio/tools/examples/shared/node_modules/browser-sync/node_modules/chokidar/lib/fsevents-handler.js:378:25)
    at LOOP (fs.js:1752:14)
    at processTicksAndRejections (internal/process/task_queues.js:79:11)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
completed: yarn serve:aot
```

PR Close #41638
2021-04-16 08:59:37 -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
Joey Perrott ee615e0744 build: upgrade to node 14 (#41544)
Upgrade local development environment for the angular repo to use node 14
dropping node 10 from supported for development within the angular repo.

PR Close #41544
2021-04-14 09:40:17 -07:00
Pete Bacon Darwin 60d023449b build(docs-infra): ensure that jasmine node tests fail on build error (#41596)
Previously if there was a problem when building the tests, the error would
be swallowed as an unhandled promise rejection. Now these are caught and
the process is exited with a non-zero value to prevent any CI jobs from
passing incorrectly.

PR Close #41596
2021-04-13 11:54:15 -07:00
Alan Agius b3d9dea52b build(docs-infra): add correct types to tuples (#41596)
This is to fix the below error:
```
tools/firebase-test-utils/FirebaseRedirect.ts:17:50 - error TS2345: Argument of type '(string | RegExp)[][]' is not assignable to parameter of type 'ReplacementDetail[]'.
  Type '(string | RegExp)[]' is missing the following properties from type 'ReplacementDetail': 0, 1

17     return XRegExp.replaceEach(this.destination, [...paramReplacers, ...restReplacers]);
```

https://app.circleci.com/pipelines/github/angular/angular/31076/workflows/5fd3851e-ae9e-4d77-b0ef-366ba38a9088/jobs/961795

PR Close #41596
2021-04-13 11:54:15 -07:00
Alan Agius ed7d288364 build: update several dependencies (#41434)
With this change we update several dependencies to avoid Renovate creating a lot of PRs during onboarding. We also remove yarn workspaces as after further analysis these are not needed.

Certain dependencies such as `@octokit/rest`, `remark` and `@babel/*` have not been updated as they require a decent amount of work to update, and it's best to leave them for a seperate PR.

PR Close #41434
2021-04-12 16:46:29 -07:00
Pete Bacon Darwin 14a64acb72 build(docs-infra): store search dictionary as a string (#41447)
Previously, the search index info file contained an array of strings that is
the dictionary of terms in the corpus.
Storing this as a space separated string reduces the size of the file.

PR Close #41447
2021-04-07 13:51:08 -07:00
Pete Bacon Darwin 65cd44e731 build(docs-infra): tidy up the generateKeywords processor (#41447)
The recent PR #41368 contained some changes that could be improved.

PR Close #41447
2021-04-07 13:51:08 -07:00
Joey Perrott c385e74454 build: rely on engines to prevent using npm for dependency install (#41477)
Rather than relying on a preinstall script, set `engine-strict` to `true` in a
project `.npmrc` file, relying on the `engines` having `npm` set to note that
yarn should be used instead.

---

Output from `npm install` changes from:
```
$ npm install

> angular-srcs@12.0.0-next.7 preinstall /usr/local/account/js/angular
> node tools/yarn/check-yarn.js

/usr/local/account/js/angular/tools/yarn/check-yarn.js:12
  throw new Error(
  ^

Error: Please use Yarn instead of NPM to install dependencies. See: https://yarnpkg.com/lang/en/docs/install/
    at Object.<anonymous> (/usr/local/account/js/angular/tools/yarn/check-yarn.js:12:9)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! angular-srcs@12.0.0-next.7 preinstall: `node tools/yarn/check-yarn.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-srcs@12.0.0-next.7 preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /usr/local/account/.npm/_logs/2021-04-06T22_54_02_292Z-debug.log
```
to
```
$ npm install
npm ERR! code ENOTSUP
npm ERR! notsup Unsupported engine for angular-srcs@12.0.0-next.7: wanted: {"node":">=10.19.0 <13.0.0","yarn":">=1.22.4 <2","npm":"Plesae use yarn instead of NPM to install dependencies"} (current: {"node":"10.20.1","npm":"6.14.4"})
npm ERR! notsup Not compatible with your version of node/npm: angular-srcs@12.0.0-next.7
npm ERR! notsup Not compatible with your version of node/npm: angular-srcs@12.0.0-next.7
npm ERR! notsup Required: {"node":">=10.19.0 <13.0.0","yarn":">=1.22.4 <2","npm":"Plesae use yarn instead of NPM to install dependencies"}
npm ERR! notsup Actual:   {"npm":"6.14.4","node":"10.20.1"}

npm ERR! A complete log of this run can be found in:
npm ERR!     /usr/local/account/.npm/_logs/2021-04-06T22_53_23_912Z-debug.log
```

PR Close #41477
2021-04-07 12:05:01 -07:00
Joey Perrott 4a68e13d1b build: update package.json engines range for nodes in preparation for upgrade (#41472)
In preparation for upgrading to `node@14`, and dropping `node@10`, updating the engines
for local `package.json`s.

PR Close #41472
2021-04-06 12:46:31 -07:00
George Kalpakas 4ae57cabd8 build: correctly publish `angular-in-memory-web-api` as CI build artifact (#41429)
Previously, the `angular-in-memory-web-api` package was built in
`dist/packages-dist/misc/angular-in-memory-web-api/`. This was different
from other Angular packages, which were placed directly in
`dist/packages-dist/`. This caused the `create-package-archives.sh`
script to create an invalid `misc.tgz` archive (i.e. treating the
`misc/` subdirectory as a package).
See, for example, the artifacts [here][1].

This commit changes the build scripts to have the
`angular-in-memory-web-api` package built in
`dist/angular-in-memory-web-api-dist/`, similar to how the `zone.js`
package is handled. It also updates the CircleCI config to correctly
publish the `angular-in-memory-web-api` package to CI build artifacts.

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

PR Close #41429
2021-04-06 10:22:54 -07:00
George Kalpakas a623bf4e70 build(docs-infra): enable linting for `ng-packages-installer` scripts (#41429)
This commit enables linting for the scripts in
`aio/tools/ng-packages-installer/`. It also makes the necessary changes
to the files to make linting pass.

PR Close #41429
2021-04-06 10:22:53 -07:00
George Kalpakas d42019d412 build(docs-infra): update `eslint` and `eslint-plugin-jasmine` to latest versions (#41429)
This commit updates the `eslint` and `eslint-plugin-jasmine` packages to
latest versions to take advantage of latest fixes and improvements.

PR Close #41429
2021-04-06 10:22:53 -07:00
George Kalpakas 180c1b555f fix(docs-infra): avoid auto-linking generic word `state` (#41438)
Since `state` is a generic word, this commit adds it to the list of
ignored words for auto-linking to avoid incorrectly auto-linking to the
[state()][1] animation helper. For example, see `/ngsw/state` in the
[ServiceWorker in production][2] guide.

[1]: https://v10.angular.io/api/animations/state
[2]: https://v10.angular.io/guide/service-worker-devops#locating-and-analyzing-debugging-information

PR Close #41438
2021-04-05 08:56:43 -07:00
GChuf 46a97b985e build: Bump minimum required node version to 10.19.0 (#41390)
Critical security vulnerability fixed in node v 10.19.0
Other performance and security updates since node 10.9.0

PR Close #41390
2021-04-02 10:29:24 -07:00
Pete Bacon Darwin fccffc647b refactor(docs-infra): include more info in search index data (#41368)
The AIO search index is built in a WebWorker on the browser from a set
of page information that is downloaded as a JSON file (`search-data.json`).
We want to keep this file as small as possible while providing enough
data to generate a useful index to query against.

Previously, we only included one copy of each (non-ignored) term from each
doc but this prevents more subtle ranking of query results, since the number
of occurences of a term in a doc is lost.

This commit changes the generated file in the following ways:

- All non-ignored terms are now included in the order in which they appear
  in the doc.
- The terms are indexed into a dictonary to avoid the text of the term being
  repeated in every doc that contains the term.
- Each term is pre-"stemmed" using the same Porter Stemming algorith that the
  Lunr search engine uses.

The web-worker has been updated to decode the new format of the file.
Now that all terms are included, it may enable some level of phrase based
matching in the future.

The size of the generated file is considerably larger than previously, but
on production HTTP servers the data is sent compressed, which reduces the
size dramatically.

PR Close #41368
2021-04-01 12:02:37 -07:00
Alan Agius 300d6d1e38 build(docs-infra): support building the local `angular-in-memory-web-api` package in `NgPackagesInstaller` (#41313)
In some cases, we want to test the AIO app or docs examples against the locally built `angular-in-memory-web-api` for example to ensure that the changes in a commit do not introduce a breaking changes.

PR Close #41313
2021-03-29 15:14:16 -07:00
Kapunahele Wong e340d190bd docs: add some boilerplate button, h3, and hr styles (#41052)
PR Close #41052
2021-03-23 09:37:59 -07:00
Pete Bacon Darwin fbdb19c263 docs(localize): expose documentation for the `@angular/localize` package (#40317)
PR Close #40317
2021-03-19 12:36:10 -07:00
Pete Bacon Darwin 2893b925c3 build(docs-infra): capture all decorators in doc-gen (#41091)
In 6cff877 we broke the decorator docs because the
doc-gen no longer knew how to identify them.

This commit updates the dgeni processor responsible
for identifying the decorators in the code and ensures
that the docs are now generated correctly.

Fixes #40851

PR Close #41091
2021-03-08 08:34:40 -08:00
Kapunahele Wong 356d9a0537 docs: improve contrast of colors and body padding in boilerplate CSS (#40890)
Shifts colors to pass WebAIM contrast checker and adds media
query so that body padding is smaller at smaller widths.
Body padding responsiveness will help on StackBlitz and small
screens.

PR Close #40890
2021-03-01 15:30:32 -08:00
Pete Bacon Darwin 4859c0947a build(docs-infra): implement full template checking for examples (#40930)
This commit turns on full template type checking and fixes the examples
that had errors.

PR Close #40930
2021-02-26 15:40:44 -08:00
Pete Bacon Darwin 03d92f75e6 build(docs-infra): enable Ivy in StackBlitz examples (#40930)
We need to explicitly set the `enableIvy` option in a tsconfig file
to tell StackBlitz not to use ViewEngine.

This commit will generate an appropriate tsconfig.json file in the
example data that is sent to StackBlitz, which matches the Ivy
setting of the AIO project itself.

PR Close #40930
2021-02-26 15:40:44 -08:00
Alan Agius d51d39cb4c docs: update docs to use new zone.js entry-points (#40823)
In CLI version 12, the old style of imports is no longer supported.

PR Close #40823
2021-02-24 07:58:29 -08:00