Compare commits

..

457 Commits

Author SHA1 Message Date
davidlsharp1
dbbfab3ee8 docs: changing "struture" to "structure" (#29497)
PR Close #29497
2019-03-25 09:21:11 -07:00
George Kalpakas
b87ae8e5f9 ci: add .codefresh/ to the fw-dev-infra group (#29478)
PR Close #29478
2019-03-22 13:16:17 -07:00
Piotr Tomiak
8b1d28ff48 docs(core): close tags in example (#29474)
PR Close #29474
2019-03-22 13:15:04 -07:00
Michael Prentice
463e967abb docs: update developer guide for testing and IntelliJ (#29048)
provide the command for running all test suites
- don't make new contributors read the whole Bazel doc
add info about ClangFormatIJ plugin for IntelliJ
add info about Bazel plugin for IntelliJ
fix inconsistent casing of GitHub

PR Close #29048
2019-03-22 13:05:42 -07:00
Amadou Sall
71b8bbef95 docs: fix minor typo in testing.md (#29464)
PR Close #29464
2019-03-22 10:59:22 -07:00
Siddharth Ajmera
a2cf677714 docs: add Siddharth Ajmera to GDE resources (#28456)
PR Close #28456
2019-03-21 15:58:21 -07:00
Dave
9e1ce318a8 docs: add NG-DE 2019 to events page (#29079)
PR Close #29079
2019-03-21 15:55:17 -07:00
Alan Agius
a00c2a9210 docs: add app shell guide (#28591)
PR Close #28591
2019-03-21 15:54:27 -07:00
Cameron Steffen
a677d8b330 docs(core): indicate OnPush applies to children (#28320)
Indicate the OnPush change detection strategy applies to all child directives.
Resolves confusion from #12480.
PR Close #28320
2019-03-21 15:48:47 -07:00
Brandon
7fe89ba4ea docs: drop Coding Conventions section from style guide (#29331)
Closes #24153

PR Close #29331
2019-03-21 15:40:21 -07:00
Paul Gschwendtner
a8af83bf36 ci: disable sauce-connect ssl bumping (#29447)
By default we disable SSL bumping for all requests. This is because SSL
bumping is not needed for our test setup and in order to perform the SSL
bumping, Saucelabs intercepts all HTTP requests in the tunnel VM and modifies
them. This can cause flakiness as it makes all requests dependent on the SSL bumping
middleware.

See: https://wiki.saucelabs.com/display/DOCS/Troubleshooting+Sauce+Connect#TroubleshootingSauceConnect-DisablingSSLBumping

PR Close #29447
2019-03-21 22:18:19 +00:00
luixaviles
c75e16aae8 docs: add Luis Aviles to GDE resources (#29405)
PR Close #29405
2019-03-20 19:06:24 -04:00
Brandon
1affcc63c0 docs: add docs team to Angular Team section on collaborators page (#29396) (#29434)
PR Close #29396

PR Close #29434
2019-03-20 18:33:49 -04:00
Alex Eagle
34395aeea1 docs: update contributors.json on patch branch 2019-03-20 14:48:27 -07:00
Justin Schwartzenberger
f64de2e9f3 docs: add Justin Schwartzenberger to GDE page (#29430)
PR Close #29430
2019-03-20 16:14:04 -04:00
George Kalpakas
86ad77c1b1 ci: add devversion to fw-dev-infra (#29418)
PR Close #29418
2019-03-20 13:44:31 -04:00
Alex Eagle
d5c815f1f2 docs: add alexeagle to @angular/fw-global-approvers (#29287)
This is for large-scale refactorings

PR Close #29287
2019-03-20 13:43:23 -04:00
Alex Eagle
32c6d5313a Revert "build: add a nice Angular-themed color for the vscode status bar (#29407)" (#29419)
This reverts commit efcd6af17d360d26accca7a3af5233d1696dcd7b.
Engineers on the team thought that the red color means something is
broken.
See slack discussion in #general

PR Close #29419
2019-03-20 13:31:28 -04:00
Matias Niemelä
388c1a3638 release: cut the v7.2.10 release 2019-03-19 17:46:29 -07:00
Matias Niemelä
334a3ba125 build: add a nice Angular-themed color for the vscode status bar (#29407)
PR Close #29407
2019-03-19 18:09:35 -04:00
Kapunahele Wong
fd1d161844 docs: edit $any() section and add example in Template Syntax (#28157)
PR Close #28157
2019-03-19 13:19:18 -04:00
Rob Gregorius
280ea13342 docs(core): fix typo in NgModule imports example description (#29272)
PR Close #29272
2019-03-19 13:11:35 -04:00
John Reese
3b1e539bab docs(forms): fix small typo in forms documentation (#29370)
PR Close #29370
2019-03-19 13:11:11 -04:00
Robert Tyree
8e57965e3c docs: fix typo in section introduction (#29394)
PR Close #29394
2019-03-19 13:09:08 -04:00
George Kalpakas
761bb0aafd ci: add .vscode/** to the @angular/fw-dev-infra group (#29302)
PR Close #29302
2019-03-19 02:46:36 -04:00
George Kalpakas
1b881b6ba2 build: add aio/src/generated/ to ignored files lists in settings.json (#29302)
PR Close #29302
2019-03-19 02:46:36 -04:00
Paul Gschwendtner
f03d724fea build: re-add bazel symlink prefix in patch branch (#29312)
Recently the bazelrc configuration in the patch branch
has been accidentally overwritten. In order to keep
patch and master in sync, we need to revert that small
change in the patch branch.

PR Close #29312
2019-03-18 17:38:15 -04:00
Paul Gschwendtner
cf8d934ba9 fix(compiler-cli): incorrect metadata bundle for multiple unnamed re-exports (#29360)
Currently if an Angular library has multiple unnamed module re-exports, NGC will
generate incorrect metdata if the project is using the flat-module bundle option.

e.g.

_public-api.ts_
```ts
export * from '@mypkg/secondary1';
export * from '@mypkg/secondary2';
```

There are clearly two unnamed re-exports in the `public-api.ts` file. NGC right now
accidentally overwrites all previous re-exports with the last one. Resulting in the
generated metadata only containing a reference to `@mypkg/secondary2`.

This is problematic as it is common for primary library entry-points to have
multiple re-exports (e.g. Material re-exporting all public symbols; or flex-layout
exporting all public symbols from their secondary entry-points).

Currently Angular Material works around this issue by manually creating
a metadata file that declares the re-exports from all unnamed re-exports.

(see: https://github.com/angular/material2/blob/master/tools/package-tools/build-release.ts#L78-L85)

This workaround works fine currently, but is no longer easily integrated when
building the package output with Bazel. In order to be able to build such
libraries with Bazel (Material/flex-layout), we need to make sure that NGC
generates the proper flat-module metadata bundle.

PR Close #29360
2019-03-18 15:08:43 -04:00
Eduard
67f4852acb docs: fix a typo in creating libraries guide (#29154)
PR Close #29154
2019-03-15 12:43:16 -04:00
zackarychapple
08f6a64893 docs: updating url for jsonp reference (#29247)
PR Close #29247
2019-03-15 12:41:38 -04:00
Pete Bacon Darwin
ee49bbebc7 build(docs-infra): update AIO dependencies within their current ranges (#29316)
PR Close #29316
2019-03-14 18:32:10 -04:00
Brandon Roberts
da78b02d71 docs: clarify commands to integrate routing (#26530)
PR Close #26530
2019-03-14 18:26:53 -04:00
Michael Prentice
d787925841 docs: update developer guide for use with yarn (#29044)
remove reference to npm
remove confusing optional comments and $(yarn bin) with missing /
remove reference to protractor commands which don't exist
provide yarn commands which don't require gulp installed globally

PR Close #29044
2019-03-14 17:20:58 -04:00
Jason Aden
4e6efb361d docs: remove 'PR target: review' label (#29227)
We have switched to using Github's `Review` feature to request and track if a PR needs review. Therefore this label can be removed.

PR Close #29227
2019-03-14 17:04:57 -04:00
George Kalpakas
aa371335dc docs: unify comp: upgrade/{dynamic,static} labels as comp: upgrade (#29276)
PR Close #29276
2019-03-14 16:58:53 -04:00
Brandon
090b6d92da docs: remove configuration instructions at the top of the i18n guide (#29313)
The instructions lead you to think you run this step before setting
up your locale. The command is mentioned further in the guide after
setup is complete.

Closes #26052

PR Close #29313
2019-03-14 16:58:03 -04:00
Brandon
a5cbfa2aab docs: backport fix to event-binding example for production build (#28423)
Examples are run in production mode and the methods weren't optional.

PR Close #28423
2019-03-14 16:56:13 -04:00
Sarun Intaralawan
e8ed37a0e7 docs(core): deprecate ViewEncapsulation.Native (#26361) (#28423)
PR Close #26361

PR Close #28423
2019-03-14 16:56:13 -04:00
Kayce Basques
e5cbebef0d docs: make the styles section less ambiguous (#26092) (#28423)
PR Close #26092

PR Close #28423
2019-03-14 16:56:13 -04:00
Tomas Veras
654ec1570a docs: add missing type when handling errors in hero service. (#28256) (#28423)
PR Close #28256

PR Close #28423
2019-03-14 16:56:13 -04:00
Stepan Suvorov
728d903a67 docs: fix explanation of Injectable decorator in architecture guide (#27480) (#28423)
PR Close #27480

PR Close #28423
2019-03-14 16:56:13 -04:00
ericksoen
495f8e1bc6 docs: correct minor typo (#27382) (#28423)
PR Close #27382

PR Close #28423
2019-03-14 16:56:13 -04:00
Hamza TEI
d778a65447 docs: update link to post on redirects in router guide (#27256) (#28423)
Change victor savkin's url post on redirects to:
http://vsavkin.tumblr.com/post/146722301646/angular-router-empty-paths-componentless-routes

PR Close #27256

PR Close #28423
2019-03-14 16:56:13 -04:00
Giorgos Bamparopoulos
e8dbba417d docs: rename "internal" access modifier to "protected" (#26627) (#28423)
PR Close #26627

PR Close #28423
2019-03-14 16:56:13 -04:00
Kapunahele Wong
00c145f14c docs: rewrite event binding section and add example (#26162) (#28423)
PR Close #26162

PR Close #28423
2019-03-14 16:56:13 -04:00
Brandon
8c4c9858a2 docs: fix redirect with secondary outlet in router guide example (#29267)
The URL wasn't be parsed into a UrlTree, so redirecting with a
secondary route went to a 404

Closes #28805

PR Close #29267
2019-03-14 10:51:53 -04:00
George Kalpakas
caf3a53385 build(docs-infra): automatically create previews for members of aio-auto-previews (#29293)
PR Close #29293
2019-03-14 10:51:20 -04:00
Greg Magolan
6ba1cd4365 build(bazel): fix tsconfig extends for //packages/bazel/test/protractor-2:ts_spec (#29280)
PR Close #29280
2019-03-13 10:39:22 -07:00
Paul Gschwendtner
bb18cba253 build: user bazelrc should be able to overwrite existing flags (#29279)
Currently the project `bazelrc` file imports a user bazelrc if present. This
has been added in order to allow user-specific Bazel configuration settings
when working within the Angular project. Since we currently import that
user configuration before setting the project-specific settings, it's not
possible for developers to overwrite given options (e.g. the `symlink_prefix`).

Moving the import to the end of the file solves that problem.

PR Close #29279
2019-03-13 10:38:59 -07:00
Kara Erickson
5abb9360d8 release: cut the v7.2.9 release 2019-03-12 16:36:45 -07:00
Paul Gschwendtner
16c59aecf1 ci: run legacy saucelabs for every build (#29270)
Recently we moved the Saucelabs job into a cronjob in order to avoid
heavy flakiness that we experienced due to a Saucelabs connect bug
that has been supposedly fixed by the Saucelabs team (no new version
is released yet though).

Our initial assumption was that we very rarely hit specific browser failures
and can therefore move the Saucelabs tests into a cronjob, but after some
days of having the cronjob, we realized that we actually hit browser-specific
failures quite often and that we should run the tests for every PR (like before)

PR Close #29270
2019-03-12 14:54:42 -07:00
Paul Gschwendtner
47d1216f6b ci(docs-infra): run cli docs examples concurrently (#29261)
PR Close #29261
2019-03-12 12:22:28 -07:00
Paul Gschwendtner
5e614bfda8 build(docs-infra): support running cli docs examples concurrently (#29261)
PR Close #29261
2019-03-12 12:22:28 -07:00
Brandon
efecf36eb5 docs: fix failing specs in testing example (#29256)
The tests that need the actuallyDone flag are grouped together

PR Close #29256
2019-03-12 11:58:30 -07:00
Filipe Silva
b68d29791f ci: rebase PRs on target branch (#29215)
PR Close #29215
2019-03-12 11:35:00 -07:00
Filipe Silva
136cd097c8 ci: add descriptive message for merge conflicts (#29215)
Fix #29199

PR Close #29215
2019-03-12 11:34:59 -07:00
WilliamKoza
7be198a8e3 docs: change the file name of the public API according with Angular CLI (#29200)
PR Close #29200
2019-03-12 11:17:24 -07:00
Riley Littlefield
b4ee74667b docs: fix typo in directive decorator description (#29207)
PR Close #29207
2019-03-12 10:51:13 -07:00
Ivan Tham
67444e70ab docs: update enableIvy link (#29238)
PR Close #29238
2019-03-12 10:35:00 -07:00
Sam Julien
09e55eabf3 docs: add Sam Julien to GDE group (#29190)
PR Close #29190
2019-03-12 10:34:31 -07:00
Adam Plumer
1c838eb976 docs: update Universal guide (#28956)
PR Close #28956
2019-03-11 15:33:23 -07:00
Patrick Roche
24ec9e57ad docs: add ending slash to input in TOH pt1 and pt2 examples (#29176)
PR Close #29176
2019-03-08 09:33:58 -08:00
Judy Bogart
190330a612 docs: clarify intro and examples (#29012)
PR Close #29012
2019-03-07 15:34:30 -08:00
Judy Bogart
9417086f6c docs: add publicapi flag (#29012)
PR Close #29012
2019-03-07 15:34:30 -08:00
Judy Bogart
535ff0564a docs: route interface and types doc example (#29012)
PR Close #29012
2019-03-07 15:34:30 -08:00
George Kalpakas
e8c8ec7075 test(docs-infra): add script for verifying all guides/examples/images have owners (#29172)
It is useful for manually checking that all guides/examples/images have
owners in `.github/CODEOWNERS`, but is not used for automatic
verification (e.g. on CI) for now.

PR Close #29172
2019-03-07 14:03:36 -08:00
George Kalpakas
03d2813c20 docs: remove unused examples and images (#29172)
PR Close #29172
2019-03-07 14:03:36 -08:00
George Kalpakas
fb5b2a89cd docs: add missing guides, examples, images to CODEOWNERS (#29172)
PR Close #29172
2019-03-07 14:03:36 -08:00
Greg Magolan
ea495d958f build: rules_nodejs 0.26.0 & use @npm instead of @ngdeps now that downstream angular build uses angular bundles (#29063)
* removed /tools/http_server and uses http_server from rules_nodejs
* updated bazel schematics to use angular bundles

PR Close #29063
2019-03-07 08:57:24 -08:00
tomastrajan
2edb87e7f8 docs: add tomas trajan to GDE resources (#29116)
PR Close #29116
2019-03-07 07:30:09 -08:00
Andrew Kushnir
903d28fe86 release: cut the v7.2.8 release 2019-03-06 09:58:26 -08:00
Paul Gschwendtner
6945f7978e build(docs-infra): ivy prebuild script should not run ngcc for all formats (#29122)
Currently when building AIO with Ivy, we run Ngcc and transform
all found formats. This potentially slows down the build (and
therefore the "test_aio_local_ivy" job). Since it's not necessary
to build all formats, and we only need "fesm5" and "fesm2015",
we can explicitly specify the required formats.

**Note**: Currently this does not have any big effect, because Angular
Material does not ship ES2015/ES5 files. The change primarily just
suppresses the Ngcc messages for Material not providing ES2015/ES5
entry-points.

Technically if new non-Ivy packages are added to AIO, this
speeds up the build as we don't build the unused formats.

PR Close #29122
2019-03-05 16:11:05 -08:00
Paul Gschwendtner
27afe01910 ci(docs-infra): "test_aio_local_ivy" job should attach ivy package output (#29122)
Currently the "test_docs_examples_ivy" job attaches
the legacy package output, while we can also attach
the Ivy NPM package output. We don't need Ngcc to downlevel
the Angular packages in order to build AIO with Ivy.

PR Close #29122
2019-03-05 16:11:05 -08:00
George Kalpakas
36b6110e7d docs: order upcoming events in chronological order (#29115)
Related to https://github.com/angular/angular/pull/29095#issuecomment-469386472.

PR Close #29115
2019-03-05 09:51:10 -08:00
WilliamKoza
24a1e146da refactor(language-service): clean up imports language-service and misspellings in public API (#29097)
PR Close #29097
2019-03-05 09:46:47 -08:00
José Toledo Navarro
2256920292 docs(router): align examples in interfaces docs (#29093)
* Use exclusively `TeamComponent` class for examples, as currently there are at least 3 different component classes being used, one of which is actually as a type argument for a `Resolve<T>` implementation.
PR Close #29093
2019-03-05 09:45:53 -08:00
Maxim Mazurok
2a25ac2ac9 fix(router): removed obsolete TODO comment (#29085)
PR Close #29085
2019-03-05 09:44:41 -08:00
George Kalpakas
56693339c2 fix(service-worker): detect new version even if files are identical to an old one (#26006)
Previously, if an app version contained the same files as an older
version (e.g. making a change, then rolling it back), the SW would not
detect it as the latest version (and update clients).

This commit fixes it by adding a `timestamp` field in `ngsw.json`, which
makes each build unique (with sufficiently high probability).

Fixes #24338

PR Close #26006
2019-03-05 09:41:45 -08:00
Judy Bogart
c976b88dcf docs: fix and add decorator api doc (#28986) (#29112)
PR Close #28986

PR Close #29112
2019-03-04 17:51:42 -08:00
Paul Gschwendtner
3e08794abf ci: print sauce-connect log output on timeout (#29105)
Currently when `sauce-connect` times out after 2min, we just
print a message saying that the SauceLabs tunnel didn't establish
within 2min. In order to make debugging easier, we now print the
full log file output on failure.

PR Close #29105
2019-03-04 13:37:41 -08:00
George Kalpakas
b598e884f6 fix(service-worker): ignore passive mixed content requests (#25994)
Although [passive mixed content][1] requests (like images) only produce
a warning without a ServiceWorker, fetching it via a ServiceWorker
results in an error. See
https://github.com/angular/angular/issues/23012#issuecomment-376430187
for more details.

This commit makes the ServiceWorker ignore such requests and let them be
handled by the browser directly to avoid breaking apps that would work
without the ServiceWorker.

[1]: https://developers.google.com/web/fundamentals/security/prevent-mixed-content/what-is-mixed-content#passive_mixed_content

Fixes #23012

PR Close #25994
2019-03-04 11:51:06 -08:00
Pete Bacon Darwin
cf916a03d3 docs(core): tidy up the description of resolveComponentResources() (#28055) (#28736)
There were a number of typos and some of the sentences did not
read well.

PR Close #28055

PR Close #28736
2019-03-04 10:36:27 -08:00
Pete Bacon Darwin
ee6498f37e refactor(compiler): remove unnecessary ! operators from lexer (#28055) (#28736)
When we added the strict null checks, the lexer had some `!`
operators added to prevent the compilation from failing.

This commit resolves this problem correctly and removes the
hacks.

Also the comment

```
// Note: this is always lowercase!
```

has been removed as it is no longer true.

See #24571

PR Close #28055

PR Close #28736
2019-03-04 10:36:27 -08:00
Pete Bacon Darwin
1a0b2ff4fb refactor(compiler): use options argument for parsers (#28055) (#28736)
This commit consolidates the options that can modify the
parsing of text (e.g. HTML, Angular templates, CSS, i18n)
into an AST for further processing into a single `options`
hash.

This makes the code cleaner and more readable, but also
enables us to support further options to parsing without
triggering wide ranging changes to code that should not
be affected by these new options.  Specifically, it will let
us pass information about the placement of a template
that is being parsed in its containing file, which is essential
for accurate SourceMap processing.

PR Close #28055

PR Close #28736
2019-03-04 10:36:27 -08:00
Amadou Sall
dfb331cd18 docs: fix minor typo (#29100)
tradition -> traditional
PR Close #29100
2019-03-04 10:15:38 -08:00
Pete Bacon Darwin
11c926ce47 docs: add AngularConnect announcement for after ng-conf (#29096)
PR Close #29096
2019-03-04 10:14:42 -08:00
Pete Bacon Darwin
a0119b1144 docs(docs-infra): update where we are presenting (#29095)
PR Close #29095
2019-03-04 10:13:54 -08:00
Alex Eagle
c938fb4619 build: update to bazel 0.23 2019-03-01 15:40:50 -08:00
Matias Niemelä
2f49a23d64 test(animations): fix unit-based delays within the animation DSL (#28993)
Closes #24291

PR Close #28993
2019-03-01 15:16:49 -08:00
Alan Agius
c6eaaf5b3d docs: add how to create a minimal repo in bug report template (#29022)
PR Close #29022
2019-03-01 10:15:30 -08:00
Paul Gschwendtner
5e38ec8acc ci(docs-infra): disable failing ivy jit systemjs examples (#29046)
As a side effect of 09b34bae8655d4251516655c317b150c46cd3653,
we fixed that the docs systemjs examples currently do not run
with Ivy in JIT mode. This now uncovered new failures with the JIT
resource loading. e.g.

```
zone.js:665 Unhandled Promise rejection: Component 'PhoneListComponent' is not resolved:
 - templateUrl: ./phone-list.template.html
Did you run and wait for 'resolveComponentResources()'? ; Zone: <root> ; Task: Promise.then ; Value: Error: Component 'PhoneListComponent' is not resolved:
 - templateUrl: ./phone-list.template.html
Did you run and wait for 'resolveComponentResources()'?
    at Function.get (directive.ts:54)
    at getComponentDef (definition.ts:648)
    at verifyDeclarationsHaveDefinitions (module.ts:185)
    at Array.forEach (<anonymous>)
    at verifySemanticsOfNgModuleDef (module.ts:159)
    at Function.get (module.ts:132)
    at getInjectorDef (defs.ts:181)
    at R3Injector.processInjectorType (r3_injector.ts:230)
    at eval (r3_injector.ts:114)
    at eval (r3_injector.ts:451) Error: Component 'PhoneListComponent' is not resolved:
```

We temporarily disable these two failing SystemJS examples by adding them to the
`fixmeIvyExamples` list.

PR Close #29046
2019-02-28 17:08:52 -08:00
Paul Gschwendtner
0cd5964f67 ci: increase parallelism for "test_docs_examples" jobs (#29046)
Currently the docs example tests (`test_docs_examples_ivy`
and `test_docs_examples`) are the culprits for a slow-down
in our overall CI turnaround. We need to increase parallelism
in order to make our CI turnaround more _acceptable_. This is
temporary and the long-term goal is to move these tests to Bazel
with remote build execution.

References #28940

PR Close #29046
2019-02-28 17:08:52 -08:00
Paul Gschwendtner
f3938a6a2b ci: "test_docs_examples_ivy" should attach ivy package output (#29046)
Currently the "test_docs_examples_ivy" job attaches
the legacy package output, while we can also attach
the Ivy NPM package output. We don't need Ngcc to downlevel
the Angular packages in order to run the docs examples with Ivy.

PR Close #29046
2019-02-28 17:08:52 -08:00
Paul Gschwendtner
3baa74449c build(docs-infra): examples should not run ngcc for all formats (#29046)
Currently when adding the example boilerplate to all
examples with Ivy enabled, we run Ngcc and transform
all found formats. This potentially slows down the build and
is not necessary as we only need the "fesm5" and "fesm2015" bundles.

PR Close #29046
2019-02-28 17:08:52 -08:00
Paul Gschwendtner
df4e97c81e build: remove accidentally pushed bazel-out symlink (#29046)
https://github.com/angular/angular/pull/29019 accidentally
committed/pushed the bazel-out symlink. This removes the symlink
git "marker" from the patch branch.

PR Close #29046
2019-02-28 17:08:52 -08:00
Greg Magolan
d629f2c6a8 build(bazel): revert back to non-vendored yarn in node_repositories() (#29034)
Resolves Windows issue https://github.com/bazelbuild/rules_nodejs/issues/588

PR Close #29034
2019-02-28 10:52:24 -08:00
George Kalpakas
6ee47d5e76 ci: speed up publish_artifacts CircleCI job for PRs (#29028)
PR Close #29028
2019-02-28 10:39:19 -08:00
Wassim Chegham
9226b421e8 style: enforce buildifier lint rules (#29019)
PR Close #29019
2019-02-28 02:57:35 -08:00
Rado Kirov
b06847f43d refactor: Consistently use index access on index signature types. (#28937)
This change helps highlight certain misoptimizations with Closure
compiler. It is also stylistically preferable to consistently use index
access on index sig types.

Roughly, when one sees '.foo' they know it is always checked for typos
in the prop name by the type system (unless 'any'), while "['foo']" is
always not.

Once all angular repos are conforming this will become a tsetse.info
check, enforced by bazel.

PR Close #28937
2019-02-28 02:52:19 -08:00
George Kalpakas
a54a752147 build: add VSCode extension recommendations (#28784)
Previously, the VSCode settings for the workspace specified the
`clang-format.executable` setting to configure auto-formatting to use
`clang-format`. Yet, this setting has no effect without the extension
that provides that configuration option namely [xaver.clang-format][1]).
For people that didn't have the extension installed, VSCode would use
the default formatters, resulting in vastly different file fomatting.

This commit adds a set of [rcommended workspace extensions][2], to help
people get the right extensions when checking out the repository.

The recommended extensions are:
- [gkalpak.aio-docs-utils][3]:
  Utilities to aid in authoring/viewing Angular documentation source
  code. Currently, mainly aid in working with
  `{@example}`/`<code-example>` tags.
- [ms-vscode.vscode-typescript-tslint-plugin][4]:
  Add auto-linting for TS files using `tslint` while editing.
- [xaver.clang-format][1]:
  Add auto-formatting for JS/TS files using `clang-format`.

[1]: https://marketplace.visualstudio.com/items?itemName=xaver.clang-format
[2]: http://go.microsoft.com/fwlink/?LinkId=827846
[3]: https://marketplace.visualstudio.com/items?itemName=gkalpak.aio-docs-utils
[4]: https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-typescript-tslint-plugin

PR Close #28784
2019-02-28 02:47:21 -08:00
George Kalpakas
d00a2e8920 build: update VSCode settings to limit auto-formatting on save to JS/TS files (#28784)
Previously, auto-formatting on save was enabled for all file types,
which meant also using default VSCode formatting settings for files
where this was not desirable - for example HTML files (such as
angular.io and docs examples templates) and JSON files (such as Firebase
configurations).
This was problematic for the following reasons:
- Unlike with JS/TS files, the formatting of other file types is not
  checked/enforced on CI.
- Formatting is subject to default VSCode settings and everyone's local
  VSCode settings overrides.
- Especially for docs examples files, changing the layout might require
  updating the wording in corresponding guides (e.g. when referring to
  line-numbers).

If we decide that we do want to lint those other file types as well
(which sounds like a good idea), we should do it in a way that ensures
consistent formatting and check the formatting on CI.

PR Close #28784
2019-02-28 02:47:15 -08:00
Matias Niemelä
86981b395d fix(animations): ensure position and display styles are handled outside of keyframes/web-animations (#28911)
When web-animations and/or CSS keyframes are used for animations certain
CSS style values (such as `display` and `position`) may be ignored by a
keyframe-based animation. Angular should special-case these styles to
ensure that they get applied as inline styles throughout the duration of
the animation.

Closes #24923
Closes #25635

Jira Issue: FW-1091
Jira Issue: FW-1092

PR Close #28911
2019-02-27 11:57:31 -08:00
Greg Magolan
feec963106 style: format (#28995)
PR Close #28995
2019-02-27 08:47:27 -08:00
Greg Magolan
09fc669b4f build(bazel): allow a user to control a subset of angularCompilerOption in their tsconfig file when using ng_module (#28995)
PR Close #28995
2019-02-27 08:47:27 -08:00
Ben Lesh
cb339b87f3 release: cut the v7.2.7 release 2019-02-26 16:20:57 -08:00
George Kalpakas
fdcf877f83 fix(core): traverse and sanitize content of unsafe elements (#28804)
In the past, the sanitizer would remove unsafe elements, but still
traverse and sanitize (and potentially preserve) their content. This was
problematic in the case of `<style></style>` tags, whose content would
be converted to HTML text nodes.

In order to fix this, the sanitizer's behavior was changed in #25879 to
ignore the content of _all_ unsafe elements. While this fixed the
problem with `<style></style>` tags, it unnecessarily removed the
contents for _any_ unsafe element. This was an unneeded breaking change.

This commit partially restores the old sanitizer behavior (namely
traversing content of unsafe elements), but introduces a list of
elements whose content should not be traversed if the elements
themselves are considered unsafe. Currently, this list contains `style`,
`script` and `template`.

Related to #25879 and #26007.

Fixes #28427

PR Close #28804
2019-02-26 13:32:10 -08:00
Filipe Silva
5b5b9897c9 ci: add workspace prereq job to saucelabs_tests (#28973)
Port of https://github.com/angular/angular/pull/28939, followup to https://github.com/angular/angular/pull/28965.

PR Close #28973
2019-02-26 08:40:44 -08:00
George Kalpakas
0e7365724e docs: re-phrase note in architecture guide for clarity (#28543)
PR Close #28543
2019-02-26 08:39:17 -08:00
Author Name
4ef1a3cd97 docs: add Leonardo Zizzamia to GDE resources (#25935)
PR Close #25935
2019-02-25 14:07:56 -08:00
Nikita Poltoratsky
38b5ed05ea docs: add Nebular to UI Components section in resources (#28838)
PR Close #28838
2019-02-25 12:54:58 -08:00
nchetankumar
642c015f23 docs: modify the descendant spelling and remove multiple times parent's word (#27886)
PR Close #27886
2019-02-25 12:54:29 -08:00
Brandon
0977d95802 docs(core): export the ...Decorator interfaces to ensure they are documented (#28836) (#28961)
If an interface is not exported publicly from its package, then the doc-gen
does not see it, and so cannot include it in the generated documentation.

This was the case for a number of `...Decorator` interfaces, such as
`PipeDecorator` and `InputDecorator.

This commit adds these interfaces to the public export to fix this problem.

PR Close #28836

PR Close #28961
2019-02-25 12:53:50 -08:00
Filipe Silva
d374787db6 ci: add bazel_repository_cache to CircleCI workspace (#28935) (#28965)
PR Close #28935

PR Close #28965
2019-02-25 10:24:34 -08:00
Filipe Silva
a634deb885 ci: rename install job to setup (#28935) (#28965)
Followup to https://github.com/angular/angular/pull/28928#pullrequestreview-207023800

PR Close #28935

PR Close #28965
2019-02-25 10:24:34 -08:00
Filipe Silva
bcbd7ed8f0 ci: share data between jobs using workspaces (#28928) (#28965)
PR Close #28928

PR Close #28965
2019-02-25 10:24:34 -08:00
Mikhail Tatsky
f7de2be3f3 docs: add FancyGrid to resources page (#28949)
PR Close #28949
2019-02-25 10:23:34 -08:00
Camille Roux
1e97d511c7 docs: add Human Coders trainings in resources.json (#28840)
PR Close #28840
2019-02-25 10:23:01 -08:00
softchris
7e1e00c21e docs: add ngVikings 2019 to events page (#28501)
PR Close #28501
2019-02-25 10:22:28 -08:00
Rick Katka
481f4b7412 docs: Updated TOH Heros documentation (#28347)
Updated the TOH Heros documentation to specify that the ng cli now generates 4 files
PR Close #28347
2019-02-25 10:21:45 -08:00
Sarun Intaralawan
4bc0084e5a docs(router): reword relativeLinkResolution docs to not mention version numbers (#26991)
PR Close #26991
2019-02-22 14:35:55 -08:00
Greg Magolan
b6864494a1 fix(bazel): pin browser repositories using @npm_bazel_karma//:browser_repositories.bzl in bazel schematics (#28896)
PR Close #28896
2019-02-22 12:19:00 -08:00
Greg Magolan
0021437ee1 build: fixes (#28896)
PR Close #28896
2019-02-22 12:19:00 -08:00
Greg Magolan
d91ecd2c8b build: update to rules_typescript 0.25.1 (#28896)
* build_bazel_rules_typescript renamed to npm_bazel_typescript
* build_bazel_rules_karma renamed to npm_bazel_karma
* browser_repositories.bzl removed and now using @npm_bazel_karma//:browser_repositories.bzl
* includes some fixes for future ts_library devmode es2015 support but some failure still remain when devmode is es2015 so this PR keeps it as es5 using the bazelOptions.devmodeTargetOverride tsconfig setting

PR Close #28896
2019-02-22 12:18:59 -08:00
Keen Yee Liau
d0018e6bf6 fix(language-service): Fix completions for input/output with alias (#28904)
This PR fixes a bug in autocompletion for @Input/@Output decorator with
an alias. The current implementation ignores the alias.

Credit for this work is attributed to @edgardmessias
The original work fixed the bug, but was lacking test.

PR Close #27959

PR Close #28904
2019-02-22 12:02:18 -08:00
Oscar Busk
587ca854cc docs: clarify documentation about listening to progress events (#28892)
PR Close #28892
2019-02-22 10:50:43 -08:00
Paul Gschwendtner
8b9f03d9fa ci: run saucelabs legacy tests every hour (#28903)
Initially when we introduced the cronjob for Saucelabs,
we specified that the tests should run every 4h. Since the
caretaker needs more recent results when merging PRs
or before creating a release, we should run the saucelabs
tests every hour. This still ensures that PRs are not
affected by Saucelabs flakiness or incidents, and
the caretaker can also react better to real browser
failures (and isn't blocked on a 4h time frame)

PR Close #28903
2019-02-22 09:52:06 -08:00
Daniel Ruf
40f1f94fe0 refactor: remove unused and duplicate CSS properties from styleguide examples (#28252)
PR Close #28252
2019-02-22 09:51:36 -08:00
Jeferson Duwe
2270467d60 docs: fix ngSwitch example (#28899)
docs: fix ngSwitch example

remove the predix "app-" from the confuse emotion ngSwitchCase.
PR Close #28899
2019-02-22 08:54:00 -08:00
Igor Minar
8efda5b353 feat(docs-infra): add meta[name]=Description to angular.io's index.html (#28916)
This change makes angular.io more user and SEO friendly according to web.dev.

See: https://web.dev/discoverable/write-descriptive-text

PR Close #28916
2019-02-21 23:27:29 -08:00
Igor Minar
7b7f2d9c1b fix(docs-infra): add [lang] attribute to index.html of angular.io (#28916)
It's the right thing to do, and improves accessiblity.

See: https://dequeuniversity.com/rules/axe/3.1/html-has-lang?application=lighthouse

PR Close #28916
2019-02-21 23:27:28 -08:00
Igor Minar
c469e25cf2 fix(docs-infra): set the default html title to 'Angular' (#28916)
This removes the annoying flicker while the app is loading.

Also: it's just Angular.

PR Close #28916
2019-02-21 23:27:28 -08:00
Igor Minar
a21cde2960 style(docs-infra): reformat using vscode html formatter (#28916)
Makes it easier to keep on editing and reformatting the file.

PR Close #28916
2019-02-21 23:27:28 -08:00
Filipe Silva
9b774348b3 ci: update circleci post checkout to v2 syntax (#28472)
The `post` key is part of the CircleCI 1.0 syntax is not available in the 2.0 syntax.

PR Close #28472
2019-02-21 22:18:22 -08:00
Vani
ce219ccfa2 docs(common): update docs for HttpClient methods (#26143)
PR Close #26143
2019-02-21 20:56:13 -08:00
Greg Magolan
53bbb01047 build(bazel): cleanup the jasmine bootstrap code (#28906)
PR Close #28906
2019-02-21 17:59:18 -08:00
Greg Magolan
c6741bf36a build: no //package/bazel/src/api-extractor on the patch branch (#28901)
PR Close #28901
2019-02-21 17:54:04 -08:00
Alex Eagle
cc06bf50f3 build: Add .bzl/BUILD files to @angular/bazel package (#28901)
It's now possible to use it as a hybrid package in latest rules_nodejs, so no WORKSPACE dep is needed

PR Close #28901
2019-02-21 17:53:56 -08:00
Greg Magolan
21e78ad022 build: no //package/bazel/src/api-extractor on the patch branch (#28901)
PR Close #28901
2019-02-21 16:34:37 -08:00
Alex Eagle
05e855092b build: Add .bzl/BUILD files to @angular/bazel package (#28901)
It's now possible to use it as a hybrid package in latest rules_nodejs, so no WORKSPACE dep is needed

PR Close #28901
2019-02-21 16:34:37 -08:00
George Kalpakas
2817764433 ci: make yarn globally available and independent of $BASH_ENV (#28889)
Previously, our yarn (which overwrote the pre-installed yarn on the
docker image) was only available through `$BASH_ENV` (as an exported
function). This caused it to be undefined for commands executed in other
shells (e.g. via Node.js' `child_process.spawn()` unless explicitly
configuring it to run with `bash`).

This commit fixes this by making our yarn version available globally via
a symlink (`/usr/local/bin/yarn`).

(This was accidentally broken in #28839.)

PR Close #28889
2019-02-21 12:37:53 -08:00
Kapunahele Wong
145639d0f8 docs: edit resources description (#28764)
PR Close #28764
2019-02-21 12:34:06 -08:00
Greg Magolan
3eb327b67b build(bazel): do not build rxjs from source under Bazel (#28869)
PR Close #28869
2019-02-21 08:05:25 -08:00
Paul Gschwendtner
be6af26dc1 ci: run saucelabs unit tests as cronjob (#28787)
We no longer want to run Saucelabs for every PR/commit because
Saucelabs has been very flaky recently and it blocks most of the
PRs with a flaky failing state that we cannot fix most of the time due
to upstream Saucelabs failures/incidents. Since real browsers tests
rarely catch browser-specific failures (same as in Material), we should
only run Saucelabs in a cronjob on the upstream branches. This still
ensures/guarantees our browser compatibility, but makes our CI
more stable and the PR workflow more productive.

PR Close #28787
2019-02-20 16:47:31 -08:00
Paul Gschwendtner
637e81e9bb build: remove legacy-unit-tests-local job (#28703)
Since all unit tests are now run with Bazel, we can remove
the local legacy unit tests job. We still need to keep the
Saucelabs legacy job until we can run all of these web
unit tests with Saucelabs and Bazel.

PR Close #28703
2019-02-20 16:31:50 -08:00
Paul Gschwendtner
abc3cbb33f build: run example unit tests with bazel (#28703)
With #28402 we updated the `examples` package to be
built and tested with Bazel. This PR was only intended
for the e2e integration tests, and there still seem to be
a few unit tests that need to be migrated to Bazel until
we can remove the legacy local unit tests job.

PR Close #28703
2019-02-20 16:31:50 -08:00
Igor Minar
27eb8f2723 build: update deps in ./scripts/release/post-check
The versions were off and @angular/http dep was missing.
2019-02-20 13:14:33 -08:00
Igor Minar
81671cea9a release: cut the v7.2.6 release 2019-02-20 12:15:47 -08:00
Igor Minar
843fc7df9f Revert "feat(router): add hash-based navigation option to setUpLocationSync (#28609)"
This reverts commit fc895ba1893d08813f931c8794c7db97782f1c36.

This is change is a feature and doesn't belong on the patch branch.
2019-02-20 12:07:16 -08:00
George Kalpakas
cfe4732e41 fix(docs-infra): prevent extra space at the bottom of the page in Chrome (#28864)
The supposedly visually hidden `mat-icon` creates unnecessary space at
the bottom of the page (below the footer) in recent Chrome versions.
This didn't happen before and it still doesn't happen in other browsers
(Firefox, Edge, IE).

This commit fixes it by wrapping the icon in a visually hidden `div`
container, which doesn't have other styles (such as `mat-icon` does)
that could affect the layout of the page.

Fixes #28858

PR Close #28864
2019-02-20 09:20:38 -08:00
Alex Eagle
48cabb44c7 build: use vendored yarn under Bazel (#28839)
PR Close #28839
2019-02-20 09:19:05 -08:00
Alex Eagle
9d0db2fe4b ci: Vendor yarn into our repo (#28839)
This avoids a dynamic dependency on fetching a package from the internet in our CI.
We have observed that this is not 100% reliable.

PR Close #28839
2019-02-20 09:19:05 -08:00
Igor Minar
069146e7f3 ci: exclude **/third_party/** from google3 check (#28870)
this pattern is being excluded in copybara. see cl/234807990.

PR Close #28870
2019-02-20 09:17:21 -08:00
Jason Aden
fc895ba189 feat(router): add hash-based navigation option to setUpLocationSync (#28609)
The `setUpLocationSync` function in @angular/router/upgrade didn't previously let you sync hash-based navigations. With this change, you can now pass an option to `setUpLocationSync` that will make sure location changes run in Angular in hash-based apps.

Fixes #24429 #21995

PR Close #28609
2019-02-19 16:20:36 -08:00
Sharon DiOrio
9a51528072 docs: add Sharon DiOrio to contributors (#28671)
PR Close #28671
2019-02-19 16:15:01 -08:00
Juri Strumpflohner
7fc38d4947 docs: fix wrong filename in text (#28832)
This should be `ngsw.json` not `ngsw-config.json` as the latter is only the src file that gets then compiled into the `ngsw.json` and placed into the `dist` folder
PR Close #28832
2019-02-19 13:34:10 -08:00
Igor Minar
b1f84ec78f style: reformat aio/content/marketing/contributors.json with clang-format (#28500)
without this change, it's difficult to edit this file for anyone who has IDE configured for angular/angular development.

PR Close #28500
2019-02-19 13:01:19 -08:00
sis0k0
f351e8a5b1 docs: add Stanimira Vlaeva to contributors (#28500)
PR Close #28500
2019-02-19 13:01:19 -08:00
Trevor Karjanis
ff2c342356 docs(common): fix a typo in a debounce requests example header (#28829)
Remove the extra parenthesis from a debounce requests example.

There are no associated issues.

PR Close #28829
2019-02-19 12:59:22 -08:00
Trevor Karjanis
01b05b3f7c docs(platform-browser): fix a grammatical error in the BrowserModule documentation (#28808)
The browser module is not included by defaults, it is included by default. Default should be singular.

There is no associated issue.
PR Close #28808
2019-02-19 12:54:53 -08:00
George Kalpakas
3b78f9eb0f build(compiler-cli): upgrade chokidar to latest version (#28797)
Fixes #28771

PR Close #28797
2019-02-19 12:54:12 -08:00
Paul Gschwendtner
f6ca619343 test: bazel integration test should use angular npm packages (#28762)
PR Close #28762
2019-02-19 12:53:20 -08:00
Paul Gschwendtner
ab69c31fc5 fix(compiler-cli): incorrect bundled metadata for static class member call expressions (#28762)
Currently if developers use call expressions in their static
class members ([like we do in Angular](https://github.com/angular/angular/blob/master/packages/core/src/change_detection/differs/keyvalue_differs.ts#L121)),
the metadata that is generated for flat modules is invalid. This
is because the metadata bundler logic currently does not handle
call expressions in static class members and the symbol references
are not rewritten to avoid relative paths in the bundle.

Static class members using a call expression are not relevant for
the ViewEngine AOT compilation, but it is problematic that the
bundled metadata references modules using their original relative
path. This means that the bundled metadata is no longer encapsulated
and depends on other emitted files to be emitted in the proper place.

These incorrect relative paths can now cause issues where NGC
looks for the referenced symbols in the incorrect path. e.g.

```
src/
 | lib/
    | index.ts -> References the call expression using `../../di`
```

Now the metadata looks like that:

```
node_modules/
  | @angular/
  -- | core/
  -- -- | core.metadata.json -> Says that the call expr. is in `../../di`.
  | di/
```

Now if NGC tries to use the metadata files and create the summary files,
NGC resolves the call expression to the `node_modules/di` module. Since
the "unexpected" module does not contain the desired symbol, NGC will
error out.

We should fix this by ensuring that we don't ship corrupted metadata
to NPM which contains relative references that can cause such
failures (other imports can be affected as well; it depends on what
modules the developer has installed and how we import our call
expressions).

Fixes #28741.

PR Close #28762
2019-02-19 12:53:20 -08:00
Kara Erickson
38de40c9ec docs: clarify process surrounding merge label (#28837)
In the TRIAGE_AND_LABELS doc, it was not clear that the merge label
may be applied by the author before the PR is green (as a sort of
auto-submit). After the label is applied, it is still up to the
caretaker to determine that the PR is acceptable before merging.
This commit adds that clarification.

PR Close #28837
2019-02-19 12:43:21 -08:00
Paul Gschwendtner
53352c40c3 ci: combine "define_env_vars" and "download_yarn" anchor (#28788)
As discussed in https://github.com/angular/angular/pull/28546#discussion_r254068014, we want to combine the
`define_env_vars` and `download_yarn` anchor since downloading Yarn depends on setting up the
environment variables. In addition this simplifies our setup and reduces code-duplication.

PR Close #28788
2019-02-19 12:41:51 -08:00
George Kalpakas
dd3cab6eb1 build(docs-infra): improve caching configuration for Firebase hosting (#28785)
This will hopefully improve(/fix?) the errors discussed in #28114.
See there for a more detailed discussion.

PR Close #28785
2019-02-19 12:38:51 -08:00
George Kalpakas
ea1a3d3603 build: fix validate-commit-message on Windows (#28780)
Previously, the `validate-commit-message` gulp task was using the
`git log ... ^r1 r2` syntax to list commits between the base branch and
the current head. This didn't work as expected on Windows, because `^`
is the escape character. As a result, the command was equivalent to
`git log ... r1 r2` on Windows, which essentially logs all commits
reachable from either `r1` or `r2`.

This commit fixes it by switching to git's
[double-dot range notation][1] (`r1..r2`), which is an alias for the
`^r1 r2` syntax and works correctly on all platforms.

[1]: https://git-scm.com/docs/gitrevisions#_dotted_range_notations

Fixes #16830

PR Close #28780
2019-02-19 12:37:58 -08:00
George Kalpakas
cf1b436010 build: stop execution on error in validate-commit-message (#28780)
Stop execution when an error happens in `validate-commit-message` gulp
task and ensure the error message is printed at the bottom.

Fixes #16829

PR Close #28780
2019-02-19 12:37:58 -08:00
Amadou Sall
cdcbb53a2d docs: capitalize karma (#28775)
PR Close #28775
2019-02-19 12:36:22 -08:00
Nikita Potapenko
db2db6e7f5 docs: clarify behavior of dependency injection at root injector (#28753)
PR Close #28753
2019-02-19 12:33:49 -08:00
Filipe Silva
1df6b16263 ci: add gkalpak and filipesilva to fw-dev-infra (#28807)
PR Close #28807
2019-02-19 12:31:29 -08:00
Igor Minar
f4871212b7 ci: add /aio/content/images/bios/** to @angular/fw-docs-marketing group (#28835)
we previously missed it.

PR Close #28835
2019-02-19 12:30:38 -08:00
Jamie R. Rytlewski
2a23eca917 docs: display the beginning label in interpolation guide example (#28602)
Updating the doc to add the beginning label.

I'm not sure if this was the way it was intended, but it looked strange with just an ending </label> tag.

PR Close #28602
2019-02-19 12:24:46 -08:00
Keilla Fernandes
b5da4c6676 docs(aio): add Keilla Fernandes to GDE resources (#28437)
PR Close #28437
2019-02-19 11:24:15 -08:00
Sergej Grilborzer
b8c2f3b93f docs: warn that directives don't support namespaces (#25855)
PR Close #25855
2019-02-19 11:01:56 -08:00
Igor Minar
75cf86e70f ci: add /packages/* to the @angular/fw-dev-infra CODEOWNERS group (#28745)
It was previously missing which is a bug.

PR Close #28745
2019-02-16 20:58:48 -08:00
Cody Schroeder
bf25165354 build(bazel): specify tsconfig-test dependency (#28696)
PR Close #28696
2019-02-16 20:57:34 -08:00
Miško Hevery
a2ba4448da release: cut the v release 2019-02-15 21:13:21 +00:00
Paul Gschwendtner
ac6b2b4dc3 build: convert examples package to bazel (#28733)
* build: switch example e2e tests to bazel

* No longer builds the example e2e tests using "tsc". The examples are now built with Bazel and can therefore be built with Ivy by using the `--define=compile=aot` switch.
* No longer runs the example e2e tests using the protractor CLI. example e2e tests are executed with the Bazel protractor rule and can therefore run incrementally.

* test: disable failing ivy example e2e tests

*Note for patch branch:* We had to disable more examples in Ivy because
the patch branch does not contain all Ivy/ngtsc fixes.
2019-02-14 15:25:00 -08:00
Vani
b6dffa9763 docs: incorporate review feedback (#26827)
PR Close #26827
2019-02-14 19:33:15 +00:00
Vani
54b57def58 docs: update HttpInterceptor API docs (#26827)
PR Close #26827
2019-02-14 19:33:15 +00:00
Paul Gschwendtner
e2b3cc8118 build: remove unused rollup.config.js files (#28646)
Since we build and publish the individual packages
using Bazel and `build.sh` has been removed, we can
safely remove the `rollup.config.js` files which are no
longer needed because the `ng_package` bazel rule
automatically handles the rollup settings and globals.

PR Close #28646
2019-02-14 19:29:22 +00:00
Greg Magolan
5e701a2c88 build(bazel): rollback to chromium 69 (latest version that still works on OSX) (#28698)
PR Close #28698
2019-02-13 19:18:28 -08:00
Greg Magolan
27a3df146d build(bazel): pin chromium to 72.0.3636 and chrome-driver to 2.46 on all platforms (#28698)
PR Close #28698
2019-02-13 19:18:28 -08:00
Greg Magolan
8cce7efbb2 build(bazel): pin chrome driver to 2.45 and use newer chrome in linux to fix test in CI (#28698)
PR Close #28698
2019-02-13 19:18:28 -08:00
Greg Magolan
d225c3a6e3 build(bazel): temporarily pin browser versions while upstream is fixed as work-around for #28681 (#28698)
PR Close #28698
2019-02-13 19:18:27 -08:00
Alberto Garza
b23582d57e docs(animations): fixed some grammar (#28708)
PR Close #28708
2019-02-13 19:14:58 -08:00
Alex Eagle
d3c6e512a3 build: update jquery to latest (#28719)
Versions less than 3.0.0 have security vulnerabilities

PR Close #28719
2019-02-13 19:14:11 -08:00
George Kalpakas
a873fab10c docs-infra: backporting #28592, #28463, #28650, #28688, #28663 (#28714)
* ci(docs-infra): run docs examples tests in production mode (#28592)

PR Close #28592

* docs: remove quickstart example and copy tsconfig.1.json into TS config guide (#28592)

This example has long been replaced by the cli-quickstart, but was never deleted.

PR Close #28592

* docs: enable E2E test for setup example (#28592)

This guide is not being shown publicly, and its test is currently being ignored.
Instead of deleting this test and guide, it may be repurposed in the future for a local development guide.

PR Close #28592

* docs: ignore progression filenames from compilation (#28592)

PR Close #28592

* docs: remove unused StringSafeDatePipe from AngularJS Quick Ref example (#28592)

PR Close #28592

* docs: make parent finder functions compatible with AoT (#28592)

PR Close #28592

* docs: make toggleImage arguments optional in AngularJS quick reference (#28592)

PR Close #28592

* docs: add insert remove component to AppModule for animations example (#28592)

PR Close #28592

* docs: ignore component for app compilation for displaying data example (#28592)

PR Close #28592

* docs: ignore files from app compilation for ngmodule-faq example (#28592)

PR Close #28592

* docs: ignore initial components for app compilation in router example (#28592)

PR Close #28592

* docs: remove unused files in styleguide example (#28592)

PR Close #28592

* docs: make method arguments optional in template syntax example (#28592)

PR Close #28592

* docs: add more files to be ignored during app compilation (#28592)

PR Close #28592

* docs: run component-interaction and DI in JiT mode (#28592)

PR Close #28592

* docs: re-enable E2E tests for Http guide (#28592)

PR Close #28592

* ci(docs-infra): test docs examples with Ivy (#28463)

PR Close #28463

* fix(docs-infra): add progression files to exclude list for docs examples (#28650)

Also disables Http guide under Ivy tests with documented error

PR Close #28650

* fix(docs-infra): fix filtering in run-example-e2e.js (#28663)

PR Close #28663

* test(ivy): enable more docs examples e2e tests (#28688)

PR Close #28688
2019-02-13 16:42:39 -08:00
Miško Hevery
ecef0dd65e
Revert "test(ivy): enable more docs examples e2e tests (#28688)" (#28712)
This reverts commit 1cc74eaece6c2fdbd77a92062cceecf23460b2db.
2019-02-13 15:43:16 -08:00
Miško Hevery
1cc74eaece ci: fix bad merge 2019-02-13 14:58:22 -08:00
Greg Magolan
e2b3be87cb build(bazel): update to rules_nodejs 0.18.6 (#28699)
PR Close #28699
2019-02-13 12:13:09 -08:00
SebastienBtr
3ca6c928f9 docs(router): change slideInDownAnimation into slideInAnimation (#28640)
In the Routing & Navigation there is a typo - slideInDownAnimation, but it should be slideInAnimation

PR Close #28572

PR Close #28640
2019-02-13 12:03:46 -08:00
Paul Gschwendtner
5933d16f3e build: fix web_worker images example not working (#28562)
The web_worker images example is currently not really usable
because the rendered button that can be used to upload
an "image" to the demo is currently not working. This is because
the HTML markup for the `file-field` is not matching what `materialize-css`
expects. See: https://materializecss.com/text-inputs.html

PR Close #28562
2019-02-13 12:01:55 -08:00
Paul Gschwendtner
0f839bcfd0 build: playground examples do not explicitly specify "ng_module" assets (#28562)
Currently all playground examples are built with NGC, and most
of the HTML resources are automatically inlined. Surprisingly NGC
is able to resolve the relative component assets even though these
aren't specified in the `assets`. This seems to work because NGC
resolves the files in the execroot where the files are present
(if Bazel doesn't use sandboxing).

Issue is tracked with TOOL-667

PR Close #28562
2019-02-13 12:01:55 -08:00
Paul Gschwendtner
edda94edfa build: fix web_worker playground examples using external resources (#28562)
The `web_workers/images` example is not being tested by any e2e
spec and therefore it's technically not necessary to fix that it uses
external resources, though in order to ensure that the Bazel builds
are hermetic and that we can eventually add e2e specs for the
web_worker/image example, we should avoid any use of external
resources.

We remove the `web-animations` polyfill in the `web_workers/animations`
example because we should try to vendor as few as possible deps. Also
the animations API is already supported by browsers we run the e2e tests
against (note here: `web_workers/animations` is currently also disabled)

PR Close #28562
2019-02-13 12:01:55 -08:00
Judy Bogart
b5e36eaa3e docs: add di-related api doc (#27731)
PR Close #27731
2019-02-13 11:59:32 -08:00
Paul Gschwendtner
08a1f51704 build: remove legacy e2e tests job (#28697)
Now that all e2e integration tests within `modules/` have been
migrated to Bazel, we can remove the legacy e2e tests job.

PR Close #28697
2019-02-13 11:54:37 -08:00
Paul Gschwendtner
9690e36f78 build: update instructions to run benchmark tests (#28697)
* Updates the instructions on how to run the benchmark tests.
* Removes the unused `favicon.ico` file and the corresponding Bazel filegroup

PR Close #28697
2019-02-13 11:54:36 -08:00
Paul Gschwendtner
68e741227b build: convert largeform benchmarks to bazel (#28697)
Switches the `largeform` benchmarks to Bazel.
This is the last remaining e2e test within `modules/`.

PR Close #28697
2019-02-13 11:54:36 -08:00
Paul Gschwendtner
50a2327520 build: run largetable benchmark tests with bazel (#28697)
PR Close #28697
2019-02-13 11:54:36 -08:00
Paul Gschwendtner
b07346c8e3 build: serve largetable benchmark tests with bazel (#28697)
PR Close #28697
2019-02-13 11:54:36 -08:00
Paul Gschwendtner
8e95849751 build: fix routing playground example using external resource (#28697)
Currently the "routing" playground example fails the e2e tests
because it tries to load the OpenSans font using an external
HTTP request. External http requests are not allowed (unless
explicitly enabled) within Bazel in order to ensure that
all targets are built and tested in a hermetic way.

In order to work around this issue in a Bazel idiomatic way,
we just vendor the fonts in the "third_party" folder. Note
that we can technically also enable internet for the RBE
host platform, but it's not a best practice for hermeticity.

The following syntax would allow us to enable internet for
RBE (stated here for tracking)

```
properties: {
  name: "dockerNetwork"
  value: "standard"
}
```

PR Close #28697
2019-02-13 11:54:36 -08:00
Paul Gschwendtner
cd143f67af build: disable failing ivy playground example e2e tests (#28697)
With ed1ba88ffd9d0fc266808413fa517e7a31943bc8 we switched the
examples to run with Bazel. This means that we can now also run the
e2e tests for these examples against Ivy. All playground e2e tests,
**except** the `web_worker` examples, successfully run with Ivy.

The failing webworker e2e tests have been temporarily disabled with
`fixmeIvy` and need to be investigated in a follow-up.

PR Close #28697
2019-02-13 11:54:36 -08:00
Paul Gschwendtner
dd85351162 build: re-enable upgrade playground example (#28697)
The `upgrade` playground example has been disabled for a
long time because Protractor initially didn't support running
hybrid apps. Now that we use a more recent version of Protractor
that handles hybrid apps (also automatically), we can re-enable
this long-standing disabled test.

Additionally the e2e test logic was outdated and failed because a
CSS selector did not match the template of the upgrade example.
With this change, the CSS selector has been updated to match the
example's template, and also the test has been updated slightly
to also ensure that content projection works.

PR Close #28697
2019-02-13 11:54:36 -08:00
Paul Gschwendtner
c1c68889de build: run playground e2e examples with bazel (#28697)
PR Close #28697
2019-02-13 11:54:36 -08:00
Paul Gschwendtner
866f4be782 build: fix "person_management" playground example (#28697)
Currently when someone serves the "person_management" playground
example, there will be runtime exceptions by `@angular/forms` if
someone clicks on one of the two buttons rendered in the example.

This happens because the example is outdated and the input elements
using `ngModel` do not specify a proper "name" while being inside of
a `<form>` element. A name is required inside of a form. The failure
is not specific to Ivy and is not covered by any test because the e2e
tests for this example are just asserting that the page properly loads
(the error only shows up one of the buttons has been clicked)

This is the reason why these errors were never visibile to the e2e tests.
Though in order to make this example work, we should this fix these failures
so that the example can work as expected.

```
FullNameComponent.html:7 ERROR Error: If ngModel is used within a form tag, either the name attribute must be set or the form
      control must be defined as 'standalone' in ngModelOptions.

      Example 1: <input [(ngModel)]="person.firstName" name="first">
      Example 2: <input [(ngModel)]="person.firstName" [ngModelOptions]="{standalone: true}">
    at Function.TemplateDrivenErrors.missingNameException (template_driven_errors.ts:40)
    at NgModel._checkName (ng_model.ts:319)
    at NgModel._checkForErrors (ng_model.ts:302)
    at NgModel.ngOnChanges (ng_model.ts:215)
    at Object.checkAndUpdateDirectiveInline (provider.ts:208)
    at checkAndUpdateNodeInline (view.ts:429)
    at checkAndUpdateNode (view.ts:389)
    at debugCheckAndUpdateNode (services.ts:431)
    at debugCheckDirectivesFn (services.ts:392)
    at Object.eval [as updateDirectives] (FullNameComponent.html:7)
```

PR Close #28697
2019-02-13 11:54:36 -08:00
Paul Gschwendtner
80e4019c83 build: switch playground examples to bazel (#28697)
Currently all playground examples are built with `tsc`
and served with the `gulp serve` task. In order to be able
to test these examples easily with Ivy, we now build and
serve the examples using Bazel. This allows us to expand our
Ivy test coverage and additionally it allows us to move forward
with the overall Bazel migration. Building & serving individual
examples is now very easy and doesn't involve building everything
inside of `/modules`.

PR Close #28697
2019-02-13 11:54:36 -08:00
Paul Gschwendtner
d9f3316021 build: fix bazel protractor tests not capturing console output (#28697)
Currently we depend on the "rules_webtesting" version that is
installed by "rules_typescript//:package.bzl". This version of
the webtesting rules comes with a very old version of Chromium
and the `chromedriver` that does not support capturing console
errors properly (with stack traces). Since we have a few e2e
tests that depend on console output (e.g. playground/src/source-map),
we need to make sure that these tests can pass upon Bazel
migration.

**Note for patch version**: Technically this commit is no longer updating
the `rules_webtesting` version because a different PR/commit already updated
the version transitively in `master & patch` and reverted 0094b99176264b27582ab620565632788cab66c5
partially, so in order to keep master and patch in sync, we should not update the
version of `rules_webtesting`.

PR Close #28697
2019-02-13 11:54:36 -08:00
Miško Hevery
424a3b95aa ci: corrected left over merge marker 2019-02-13 10:50:36 -08:00
Miško Hevery
7e883c2319 ci: corrected left over merge marker 2019-02-13 10:41:55 -08:00
Marc Laval
6a7fd70ddf test(ivy): enable more docs examples e2e tests (#28688)
PR Close #28688
2019-02-13 09:54:29 -08:00
Paul Gschwendtner
73f9db53c2 ci: downgrade to sauce-connect v4.5.1 (#28659)
We currently face a lot of flakiness with our
Saucelabs CI jobs. These randomly exceed the 10min
CircleCI no-output limit because something throws
off `sauce-connect` in a long-lasting loop where
it tries to connect to some of their Saucelabs
servers. The initial assumption from the Saucelabs
team was that we might have some invalid firewall
rules, but this does not answer why this happens
_randomly_, so the latest update from the support
is that there have been some changes in the latest
version of `sauce-connect` version that **could**
cause this flakiness.

I've manually did multiple test runs and was only
able to reproduce the issues with v4.5.3 (latest
version), so it might be worth downgrading to
v4.5.1. This is also what the Saucelabs support
proposed us to do (though it's not guaranteed that
v4.5.1 is unaffected by the same issue)

PR Close #28659
2019-02-12 17:23:38 -08:00
Alex Eagle
2bf526bbfb docs: add a README for third_party usage (#28651)
PR Close #28651
2019-02-12 09:54:44 -08:00
Judy Bogart
8bd7d5befc docs: clarify library types integration (#28410)
PR Close #28410
2019-02-11 17:13:45 +00:00
Paul Gschwendtner
aa163bea93 refactor(compiler): allow disabling external symbol factory reexports (#28594)
Currently external static symbols which are referenced by AOT
compiler generated code, will be re-exported in the corresponding
`.ngfactory` files.

This way of handling the symbol resolution has been introduced in
favor of avoding dynamically generated module dependencies. This
behavior therefore avoids any strict dependency failures.

Read more about a particular scenario here: https://github.com/angular/angular/issues/25644#issuecomment-458354439

Now with `ngtsc`, this behavior has changed since `ngtsc` just
introduces these module dependencies in order to properly reference
the external symbol from its original location (also eliminating the need
for factories). Similarly we should provide a way to use the same
behavior with `ngc` because the downside of using the re-exported symbol
resolution is that user-code transformations (e.g. the `ngInjectableDef`
metadata which is added to the user source code), can resolve external
symbols to previous factory symbol re-exports. This is a critical issue
because it means that the actual JIT code references factory files in order
to access external symbols. This means that the generated output cannot
shipped to NPM without shipping the referenced factory files.

A specific example has been reported here: https://github.com/angular/angular/issues/25644#issue-353554070

PR Close #28594
2019-02-11 17:12:51 +00:00
Paul Gschwendtner
2f73c554c9 build: fix invalid bazel target referenced by benchmarks (#28626)
PR Close #28626
2019-02-08 15:13:53 -08:00
Paul Gschwendtner
fb2d15fda1 build: remove outdated polymer tree benchmark (#28568)
The "tree/polymer_leaves" benchmark has no benchmark tests, nor do we install
Polymer anywhere. Polymer was previously installed through `bower`, but since
we removed bower, there is no easy way to run this benchmark with Polymer.

Considering that there are no benchmark tests, nor we have an easy way to
install/vendor Polymer, we should just remove this benchmark app.

This is also based on the assumption that we want to remove the
Polymer benchmarks anyway: see: 8a05199fb9be5ef91ec8094a3c6abc0a65eb6bcd

PR Close #28568
2019-02-08 13:42:03 -08:00
Paul Gschwendtner
018507fa02 build: run tree benchmark tests with bazel (#28568)
PR Close #28568
2019-02-08 13:42:00 -08:00
Paul Gschwendtner
95bb72d322 build: serve benchmark tree examples with bazel (#28568)
PR Close #28568
2019-02-08 13:40:10 -08:00
Paul Gschwendtner
ce6e6c3f81 build: unable to run perf bazel e2e tests on windows (#28568)
Currently it's not possible to run the benchmark e2e tests with Bazel on Windows
because the logic that imports the `perf_util`'s is not using a proper Bazel script
manifest path. A script manifest path should not start with `./angular/`, but rather
with the workspace name (which is in our case `angular/`)

PR Close #28568
2019-02-08 13:37:37 -08:00
Paul Gschwendtner
e4b1bdbfa0 ci: do not install firebase-tools without cache (#28615)
Currently we install `firebase-tools` manually in the
integration tests run script. This is problematic
because it means that we cannot cache `firebase-tools`
properly and Yarn might time out downloading this
dependency. We can safely move this to the top level
`package.json` since Bazel now has a `.bazelignore` and
since we have a cache that works for PRs (with fallback
caching).

Note that the `.bazelignore` is relevant here because
`firebase-tools` has been mainly moved to the bash
script because it broke some Bazel calls.

See 4f0cae067656fa4563417542297c67030d911a36.

PR Close #28615
2019-02-08 10:23:20 -08:00
Nikita Potapenko
6477c9e04a docs(core): fixed code snippets (#28619)
PR Close #28619
2019-02-08 09:27:24 -08:00
George Kalpakas
3f380b3b78 test(upgrade): change flaky test to not be affected by other tests (#28617)
It seems that in some cases (especially on CI), global state is not
cleaned up properly causing a specific test to fail.
See #28045 and #28181 for more context.

This PR restores the global state for the affected test. This partly
defeat the purpose of the test, but is better than having flakes on CI.

Fixes #28614

PR Close #28617
2019-02-08 09:27:03 -08:00
Alex Eagle
c4c0e9dbc5 docs: update merge label meaning (#28574)
PR Close #28574
2019-02-08 09:25:05 -08:00
Igor Minar
4ddf57c58d ci: add all required statuses to the requiredStatuses list for angular-robot (#28613)
Somehow the current list ommits quite a few important targets. Especially the cla and google3.

This changes adds all the statuses that must always be present and green for this agregate state expised as "ci/angular: merge status" to be green.

PR Close #28613
2019-02-08 09:20:29 -08:00
Nikita Potapenko
624f01c311 docs(core): fixed typo (#28618)
PR Close #28618
2019-02-08 09:19:40 -08:00
Sebastian Dorn
6a713521e3 docs(aio): add Happy Angular Podcast to resources (#28407)
PR Close #28407
2019-02-07 21:57:08 -08:00
Filipe Silva
57a5ba3438 ci: use fallback caches (#28545)
This PR adds fallback cache hits for partial cache restoration.

PR Close #28545
2019-02-07 16:45:54 -08:00
Vladimir Moskva
1b6fb5bc19 refactor(common): Remove deprecated FileType (#28583)
FileType objects are deprecated. They are not required for specifying valid file types for rule attributes, a list of strings can be used instead.

PR Close #28583
2019-02-07 16:45:23 -08:00
Vani
bd9da268c1 docs: update HttpHeader documentation (#26233)
PR Close #26233
2019-02-07 16:42:13 -08:00
stoneLeaf
1e58a2194f fix(router): redirect to root url when returned as UrlTree from guard (#28271)
When a UrlTree of root url was returned by a guard as a redirection, the
navigation was not processed. The issue came from the error handler which
incorrectly marked the router as already navigated.

Fixes #27845

PR Close #28271
2019-02-06 21:23:33 -08:00
George Kalpakas
da81c9cb54 build(docs-infra): use pinned dependencies when possible in ng-packages-installer (#28510)
Previously, `ng-packages-installer` would replace the version ranges for
all dependencies that were peer dependencies of an Angular package with
the version range used in the Angular package. This effectively meant
that the pinned version (from `yarn.lock`) for that dependency was
ignored (even if the pinned version satisfied the new version range).

This commit reduces non-determinism in CI jobs using the locally built
Angular packages by always using pinned versions of dependencies for
Angular package peer dependencies if possible.

For example, assuming the following versions for the RxJS dependency:

- **aio/package.json**: `rxjs: ^6.3.0`
- **aio/yarn.lock**: `rxjs@^6.3.0: 6.3.3`
- **@angular/core#peerDependencies**: `rxjs: ^6.0.0`

...the following versions would be used with `ng-packages-installer`:

- Before this commit:
  - **aio/package.json**: `rxjs: ^6.0.0`
  - **node_modules/rxjs/**: `6.4.0` (latest version satisfying `^6.0.0`)
- After this commit:
  - **aio/package.json**: `rxjs: ^6.3.0`
  - **node_modules/rxjs/**: `6.3.3` (because it satisfies `^6.0.0`)

PR Close #28510
2019-02-06 21:23:03 -08:00
George Kalpakas
ef6d26d4fa build(docs-infra): keep other dependencies pinned when installing local Angular packages (#28510)
`ng-packages-installer` can be used to replace Angular packages with
locally built ones (from `dist/packages-dist/`) along with their peer
dependencies.

Previously, in order to achieve this, `yarn install` was called with the
`--no-lockfile` option, which resulted in installing the latest versions
of all dependencies (including transitive ones) permitted by the
corresponding version ranges in `package.json` files. As a result, newly
released versions would be picked, resulting in unexpected,
non-deterministic breakages in CI.

This commit calls `yarn install` with the `--pure-lockfile` option
instead. As a result, only the Angular packages (for which the locally
built ones are used) and their peer dependencies are unpinned; the
pinned versions from `yarn.lock` are used for all other (direct and
transitive) dependencies.

While this does not eliminate non-determinism across builds, it
significantly reduces it.

PR Close #28510
2019-02-06 21:23:03 -08:00
George Kalpakas
13bc1cd853 perf(docs-infra): avoid unnecessary I/O operation in ng-packages-installer (#28510)
PR Close #28510
2019-02-06 21:23:03 -08:00
George Kalpakas
1fa1379318 refactor(docs-infra): format package.json for readability in ng-packages-installer (#28510)
PR Close #28510
2019-02-06 21:23:03 -08:00
George Kalpakas
d9efacc07e build(docs-infra): remove unnecessary workaround for RxJS in ng-packages-installer (#28510)
Since b43f8bc7d, RxJS does not need to be patched any more in the
top-level `node_modules/`, so we don't need to special-case RxJS in
`ng-package-installer` and use `node_modules/rxjs/`.

PR Close #28510
2019-02-06 21:23:03 -08:00
cexbrayat
47f5b5f2d4 docs(service-worker): note about isStable/setInterval (#28102)
The docs don't mention that the app will never be stable if a `setInterval` is running somewhere, and that it will prevent the servcie worker to be registered too.

PR Close #28102
2019-02-06 15:13:20 -05:00
cexbrayat
019fe77f64 docs(core): document isStable traps (#28102)
PR Close #28102
2019-02-06 15:13:19 -05:00
Matias Niemelä
a0e3a8e0f7 build: fix revert issue with bitmap.ts (#28576)
PR Close #28576
2019-02-06 15:09:34 -05:00
Alex Eagle
8908156eae build: switch to typescript's es2015 typings (#28570)
Note that this allows Angular to depend on the entirety of the ES2015 API, not just our restricted subset.
This change is needed because our copy of the subset was out-of-date, and prevents us using ES2015 target in dev mode.

This is a subset of #27738

PR Close #28570
2019-02-06 14:17:56 -05:00
Greg Magolan
2ee265fb1f build: update to rules_typescript 0.23.2 and rules_nodejs 0.16.8 (#28567)
PR Close #28567
2019-02-06 14:12:42 -05:00
George Kalpakas
116512b06d ci(docs-infra): ensure aio_monitoring failure notifications do not depend on earlier steps (#28555)
Previously, in order for the `aio_monitoring` failure notifications to
work, the steps up to `define_env_vars` should have succeeded. This
meant that any failures in earlier steps would not send notifications.

This commit fixes it by making the notification step independent of the
`define_env_vars` step.

PR Close #28555
2019-02-06 06:22:00 -08:00
George Kalpakas
1d841973eb ci: save the cache in build-npm-packages job instead of test (#28555)
In most cases, it doesn't make a difference, because the cache does
already exist and is not saved. In the few cases where the dependencies
change (and the cache needs to be updated), it makes more sense to save
the cache in the `build-npm-packages` job, because most jobs depend on
it and thus will be able to take advantage of the updated cache right
away.

This seems to be an oversight in b26ac1c22.

PR Close #28555
2019-02-06 06:22:00 -08:00
George Kalpakas
3694e1a38c ci: run the yarn_install step when necessary (#28555)
PR Close #28555
2019-02-06 06:22:00 -08:00
George Kalpakas
88d8813ccc refactor: use steps consistently in CircleCI config (#28555)
PR Close #28555
2019-02-06 06:22:00 -08:00
George Kalpakas
49bfb63442 ci(docs-infra): fix download_yarn in aio_monitoring (#28555)
The `download_yarn` step depends on the `CI_YARN_VERSION` environment
variable and thus has to be run after the `define_env_vars` step.
Accidentally broken in [#28546][1].

[1]: https://github.com/angular/angular/pull/28546/files#diff-1d37e48f9ceff6d8030570cd36286a61R447

PR Close #28555
2019-02-06 06:21:59 -08:00
Matias Niemelä
48848c9ca4 build: add some debug info for yarn installs (#28553)
PR Close #28553
2019-02-06 06:21:01 -08:00
Paul Gschwendtner
a1f1ea993d build: update yarn to v1.13.0 (#28546)
Currently our version of Yarn is installed through
the "circleci/node" docker image. This is problematic
because in order to be able to update Yarn, we always
need to update the docker image to a version that
comes with the desired Yarn version. Sometimes there
is no docker image with the desired latest Yarn version,
and therefore we cannot easily update the Yarn version.

Additionally updating the docker image also means that
we need to update our version of NodeJS, as well as the
version of `openssl` might have changed (meaning that
our encrypted credential files may not be decodable with
the new version of `openssl`)

PR Close #28546
2019-02-06 06:20:50 -08:00
Stephen Fluin
be8a403bc9 feat(aio): show developer survey 2019 (#28552)
PR Close #28552
2019-02-06 02:33:39 -05:00
Paul Gschwendtner
c378402af4 build: fix failing compiler-cli tests on windows (#28550)
Note that this fixes `compiler-cli` tests within `compiler-cli/test`,
but there seem to be remaining `ngcc` tests within `compiler-cli/src`
which aren't working on Windows. This is out-of-scope for this commit.

PR Close #28550
2019-02-05 23:47:33 -05:00
Paul Gschwendtner
91ce8c17ff build: support running ngtsc tests on windows (#28550)
Currently the "ngtsc` testing helpers resolve the `fake_core` NPM
package using the `TEST_SRCDIR` variable. This is problematic on Windows
where Bazel runfiles are not symlinked into the runfiles directory.
In order to properly resolve the NPM Bazel tree artifact, we use the
`resolveTreeNpmArtifact` runfile helper that properly resolves the artifact
properly on all platforms.

PR Close #28550
2019-02-05 23:47:33 -05:00
Paul Gschwendtner
786be967fd build: support running compiler-cli tests on windows (#28550)
In order to support running "compiler-cli" tests that use the "test_support.ts"
utilities on Windows with Bazel, we need to imporve the logic that resolves NPM
packages and symlinks them into a temporary directory.

A more Bazel idiomatic and windows compatible way of resolving Bazel runfiles
is to use the "RUNFILES_MANIFEST" if present. This ensures that the NPM
packages can be also symlinked on Windows, and tests can execute properly
on Windows. Read more about why this is needed here:

* https://github.com/bazelbuild/bazel/issues/3726#issue-257062364

PR Close #28550
2019-02-05 23:47:33 -05:00
Paul Gschwendtner
e88d5e0df2 build: remove unused "test.sh" leftover code in compiler-cli (#28550)
Since we recently removed the `test.sh` script, and now run
all tests with Bazel, we can remove the unused logic that makes
compiler-cli tests pass in non-Bazel.

This cleans up the tests, and also makes it easier to write tests
without worrying about two ways of the Angular package output
(Bazel `ng_package` rules vs. old `build.sh` logic of building)

PR Close #28550
2019-02-05 23:47:33 -05:00
Paul Gschwendtner
f39f01e00b build: remove unused "test.sh" leftover code in language-service (#28550)
Since we recently removed the `test.sh` script, and now run all
tests with Bazel, we can remove the unused logic that makes language-service
tests pass in non-Bazel.

This cleans up the tests, and also makes it easier to write tests
without worrying about two ways of the Angular package output
(Bazel `ng_package` rules vs. old `build.sh` logic of building)

PR Close #28550
2019-02-05 23:47:32 -05:00
Paul Gschwendtner
ce750e6f5b fix(compiler-cli): diagnostics should respect "newLine" compiler option (#28550)
PR Close #28550
2019-02-05 23:47:32 -05:00
WilliamKoza
beba944843 fix(docs-infra): avoid a race-condition with navigating forward/back and immediately reloading (#28368)
This can result in an inconsistent state

PR Close #28368
2019-02-05 23:44:57 -05:00
WilliamKoza
50981cbb1f fix(docs-infra): remove the try catch in the test of the browser's capacities (#28368)
PR Close #28368
2019-02-05 23:44:56 -05:00
WilliamKoza
76e40eed35 feat(docs-infra): add debouncing in storing scroll position (#28368)
There is no debouncing when we store the scroll Position.
Currently, we have a message in the console after a while:
>Throttling history state changes to prevent the browser from hanging
see: https://bugs.chromium.org/p/chromium/issues/detail?id=786211 for more informations

PR Close #28368
2019-02-05 23:44:56 -05:00
kevinphelps
d491a20f3b fix(router): set href when routerLink is used on an 'area' element (#28441)
closes #28401

PR Close #28441
2019-02-05 23:28:41 -05:00
Matias Niemelä
74c202a5cd release: cut the v7.2.4 release 2019-02-05 19:39:39 -08:00
Matias Niemelä
483e8d28ec revert: build: switch to typescript's es2015 typings (#28134)
This reverts commit a6fd118f79156cec5c7be67cc7a3e3f4553a5392.
2019-02-05 18:08:39 -05:00
Alex Eagle
a6fd118f79 build: switch to typescript's es2015 typings (#28134)
Note that this allows Angular to depend on the entirety of the ES2015 API, not just our restricted subset.
This change is needed because our copy of the subset was out-of-date, and prevents us using ES2015 target in dev mode.

This is a subset of https://github.com/angular/angular/pull/27738

PR Close #28134
2019-02-05 14:25:10 -05:00
George Kalpakas
fe6e76c1e7 ci: keep job alive when yarn request takes more than 10 minutes (#28458)
Occasionally, yarn's requests take more than 10 minutes to
complete/fail, by which time CircleCI jobs due to no output.

This commit works around the issue by periodically printing something to
stdout.

PR Close #28458
2019-02-05 13:07:41 -05:00
Paul Gschwendtner
de560019f2 build: fix bazel repositories not cached on circleci (#28515)
Previously all Bazel repositories were cached on CircleCI
because the `experimental_repository_cache` flag has been
specified and the given repository cache directory has been
included in the CircleCI cache storage.

The directory is currently still included in the CircleCI
cache storage, but the `--repository_cache` flag is no longer
specified, and the cache directory is basically empty all the
time. The flag seems to have been removed accidentally within
SHA c8b70ae8e4a878c8855249df82bf3a46ce6ea0e5.

We should specifiy this flag on the CI again, so that Bazel
doesn't need to install the Bazel managed node modules
all the time. This would slow down analysis phase on CI; and also
makes us dependent on the Yarn/NPM registry which often times out
if we fetch a lot of dependencies.

Also in order to make sure that cached Bazel repositories are
also most of the time in sync with what's currently defined in
the workspace, we need to update the cache key.

PR Close #28515
2019-02-05 13:06:24 -05:00
George Kalpakas
52ed53d071 build(docs-infra): upgrade cli command docs sources to b5e796a03 (#28467)
Updating [angular#7.2.x](https://github.com/angular/angular/tree/7.2.x) from [cli-builds#7.3.x](https://github.com/angular/cli-builds/tree/7.3.x).
Relevant changes in [commit range](699743282...b5e796a03):

**Modified**
- help/add.json
- help/build.json
- help/generate.json
- help/new.json

PR Close #28467
2019-02-05 13:05:39 -05:00
Jeremy Elbourn
5b72d4d676 ci: refactoring from adding material tests to master ci (#28496)
This cherry-picks changes from #28197 to minimize the difference in
the ci infrastructure between master the the current patch branch

PR Close #28496
2019-02-05 01:52:59 -05:00
Jeremy Elbourn
c1aa1bf872 build: gulp format only changed lines by default (#28411)
Changes `gulp format` to format only changed lines by default
(`gulp format:changed`) and introduces a new task, `gulp format:all` to
format all source files. Since formatting only changed lines should be
the more common action, it makes more sense as the shorter default.

PR Close #28411
2019-02-04 16:49:16 -05:00
Adam Plumer
dad1bc7ca3 build: bump year (#28220)
PR Close #28220
2019-02-04 16:41:00 -05:00
LHearen
2109c30afe docs: fix shadow variable in tutorial example (#28499)
PR Close #28499
2019-02-04 14:54:53 -05:00
WilliamKoza
874919a25b fix(docs-infra): remove polyfill web-animations since we use Angular > 6 and we don't use AnimationBuilder (#28514)
PR Close #28514
2019-02-04 14:54:26 -05:00
George Kalpakas
c64e666755 test: log cli version in cli-hello-world[-ivy] integration projects (#28421)
This helps debug issues on CI.

PR Close #28421
2019-02-04 11:02:41 -05:00
George Kalpakas
1da403d8f3 refactor: correctly name cli-hello-world-ivy project to distinguish from cli-hello-world in logs (#28421)
PR Close #28421
2019-02-04 11:02:40 -05:00
George Kalpakas
60c5ebd46a ci(docs-infra): compile with Ivy (#28421)
Jira: FW-552

PR Close #28421
2019-02-04 11:02:40 -05:00
George Kalpakas
b71d1987cd build(docs-infra): upgrade @angular/cli to 7.2.1 (#28421)
PR Close #28421
2019-02-04 11:02:40 -05:00
George Kalpakas
e6325eb9ef refactor(docs-infra): get rid of on component input (#28421)
PR Close #28421
2019-02-04 11:02:40 -05:00
George Kalpakas
114519ab6a fix(ivy): add missing private render3 exports (#28421)
PR Close #28421
2019-02-04 11:02:40 -05:00
George Kalpakas
a9a095d44a refactor(core): remove duplicate check in defaultStyleSanitizer (#28421)
PR Close #28421
2019-02-04 11:02:40 -05:00
Filipe Silva
5f9d574d4d build(docs-infra): update terser version in lockfile (#28512)
See https://github.com/angular/angular-cli/issues/13582#issuecomment-460261055.

PR Close #28512
2019-02-04 10:52:07 -05:00
Minko Gechev
baeb446392 ci: add mgechev to tools & tools-bazel codeowners (#28384)
PR Close #28384
2019-02-04 03:31:29 -08:00
Paul Gschwendtner
0d1bfdc505 build: fix circleci not restoring cache for PRs (#28480)
Currently whenever someone creates a pull request, the NPM dependencies
are downloaded and installed. This is problematic because we have a lot
NPM dependencies with potentially large files that would need to be
downloaded (e.g. the Bazel binaries).

The caches are currently not being restored because we added the
`{Branch}` variable to the CircleCI cache key. Since every PR has a different
branch name (e.g. `devversion/refs/heads/my-banch`), the cache keys would
never match an existing cache key, and the PR would start fresh by
downloading everything.

We can safely remove the `{Branch}` variable from the cache key because
it does not provide any value since the cached files are based on the state
of the `yarn.lock` file and not based on the current branch name. This reduces
our dependency on the slow and sometimes **flaky** Yarn registry. We should
try to depend as few as possible on external services (e.g. see how Saucelabs
flakiness can cause trouble for the caretaker; same applies to flaky Yarn installs)

PR Close #28480
2019-02-04 02:48:49 -08:00
George Kalpakas
fa130e9445 ci: pin ChromeDriver to a version compatible with docker image's Chrome (#28494)
By default, `webdriver-manager update` will download the latest
ChromeDriver version, which might not be compatible with the Chrome
version included in the [docker image used on CI], causing CI failures.
Previously, we used to pin the ChromeDriver version on CI in
[ngcontainer's Dockerfile][2]. This was accidentally broken in #26691,
while moving from ngcontainer to default CircleCI docker images.

This commit fixes the issue by pinning ChromeDriver to a known
compatible version.

[1]: bfd48d156d/.circleci/config.yml (L16)
[2]: bfd48d156d/tools/ngcontainer/Dockerfile (L63)

PR Close #28494
2019-02-01 20:22:04 -05:00
George Kalpakas
194710fc1d ci: fix setting env var with spaces in value (#28494)
PR Close #28494
2019-02-01 20:22:04 -05:00
George Kalpakas
6ae5e2b32a ci(docs-infra): reduce output verbosity to improve log readability (#28494)
PR Close #28494
2019-02-01 20:22:04 -05:00
Keen Yee Liau
d85d396c26 fix(bazel): Bazel builder resolves with require.resolve() (#28478)
This commit fixes a bug in the Bazel builder in which the path to Bazel
executable is constructed using the project path. For non-default
project, the node_modules directory is actually one level above the
project path.

This PR fixes the bug by resolving node_modules with require.resolve().
It requires @bazel/bazel v0.22.1 because previous versions do not have
index.js or main field in package.json and would cause node module
resolution to fail.

This has been tested with both bazel and ibazel.

PR Close #28478
2019-02-01 13:56:54 -05:00
Jeremy Elbourn
1a25144297 perf: pngcrush all pngs (#28479)
This is the result of running
```sh
find ./ -iname "*.png" -exec pngcrush -brute -ow --  {} \;
```

[Summary of size reductions](https://docs.google.com/spreadsheets/d/12Qgx7DfKabWw0PJza6ozC1kCHTofi6wyBLWGtwLW7G4/preview)

Last done in July, 2017 in #18243

PR Close #28479
2019-02-01 13:56:02 -05:00
Keen Yee Liau
449da8c18e fix(bazel): fix integration test for bazel-schematics (#28460)
With the release of @angular/bazel v7.2.3, the npm install step right
after `ng new` installs this version. However there is a bug in the
builder which results in bazel executable not found.

This bug was not discovered before because the dependencies of the
project created by `ng new` are not pinned.

The fix is to pin the version of @angular/bazel to 7.2.2 which relies on
global installation of bazel.

PR Close #28460
2019-01-30 19:05:12 -05:00
Jason Aden
0f37ed1060 release: cut the v7.2.3 release 2019-01-30 11:42:59 -08:00
Jeff Cross
5c85b4f1e9 docs: add Jeff Cross to contributors (#28432)
PR Close #28432
2019-01-29 16:41:32 -08:00
jithil-kore
22bc6ef22a docs: fix typo for Browserslist in build guide (#28328)
PR Close #28328
2019-01-29 16:35:27 -08:00
Matti Järvinen
bf928d1c9e docs: fix typo for Browserslist in file structure guide (#28312)
PR Close #28312
2019-01-29 16:33:19 -08:00
Nazar Nasirzada
d11c2f915b docs: fix typo in lifecycle-hooks.md (#28206)
## PR Checklist
Please check if your PR fulfills the following requirements:
 
* [x]  The commit message follows our guidelines: https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit
* [ ]  Tests for the changes have been added (for bug fixes / features)
* [x]  Docs have been added / updated (for bug fixes / features)
 
## PR Type
What kind of change does this PR introduce?

* [ ]  Bugfix
* [ ]  Feature
* [ ]  Code style update (formatting, local variables)
* [ ]  Refactoring (no functional changes, no api changes)
* [ ]  Build related changes
* [ ]  CI related changes
* [x]  Documentation content changes
* [ ]  angular.io application / infrastructure changes
* [ ]  Other... Please describe:

## What is the current behavior?
Issue Number: N/A

## What is the new behavior?
## Does this PR introduce a breaking change?
* [ ]  Yes
* [x]  No

## Other information
PR Close #28206
2019-01-29 16:32:03 -08:00
Janghyun Han
98c99e5073 docs: angular.kr link added (#28113)
PR Close #28113
2019-01-29 16:31:38 -08:00
Erick Xavier
2c63108faa docs(core): add relative path information to component metadata (#27962)
Adds the information that the templateUrl and styleUrls options supports only relative Urls.

Adds more information about relative paths and absolute URLs in project metadata.

PR Close #27962
2019-01-29 16:31:12 -08:00
onlyflix
0ff48a1266 style: change to American English (#27266)
PR Close #27266
2019-01-29 16:30:26 -08:00
Jason Aden
ea2a3f8335 Revert "build: switch example e2e tests to bazel (#28402)" (#28438)
This reverts commit ef78e335604de8352d2fb5bd3a131eca08d3d405.

PR Close #28438
2019-01-29 16:20:27 -08:00
Jason Aden
cbed4851a3 Revert "test: disable failing ivy example e2e tests (#28402)" (#28438)
This reverts commit 351610ca8db31b22c89994de6aa31a015be95082.

PR Close #28438
2019-01-29 16:20:27 -08:00
jithil-kore
7c157780a9 docs: fix Redundant "See also:" link in ContentChild (#28334)
PR Close #28334
2019-01-29 12:03:26 -08:00
jithil-kore
cc1b2a5373 perf: yarn version upgrade (#28360)
PR Close #28360
2019-01-29 11:58:48 -08:00
WilliamKoza
5076185fc8 fix(docs-infra): add hamburger button to CLI COMMANDS section (#28418)
Currently, when we navigate in the `CLI COMMANDS` section, the "hamburger button" isn't present because the class css `folder-cli` is missing.
This PR add this class in order to show this button when we are in this section.

PR Close #28418
2019-01-29 11:48:34 -08:00
Alan Agius
65375f4c21 fix(docs-infra): boolean options default value is incorrect when it's undefined (#27024)
In the CLI when it's undefined it can mean `false`, or sometimes it will be overwritten by a runtime value.

PR Close #27024
2019-01-28 20:43:16 -08:00
Dhananjay Kumar
068a6070dc docs(docs-infra): add ng-India to events list (#28119)
docs: add ng-India to events list
PR Close #28119
2019-01-28 20:18:52 -08:00
Paul Gschwendtner
47e9761a01 build: improve compiler-cli codegen output test (#28191)
* Improves the `compiler-cli/integrationtest` codegen output test slightly by using a more clear test description and by adding an assertion that ensures that decorators are downleveled.

PR Close #28191
2019-01-28 20:07:23 -08:00
Paul Gschwendtner
bef52d20b5 build: fix outdated ngtools compiler-cli test logic (#28191)
* Fixes that the test logic for `ngtools` in the offline compiler test is no longer working due to being unmaintained for a long time
* Makes the path comparison logic platform agnostic, so that the tests can be also executed on Windows

PR Close #28191
2019-01-28 20:07:23 -08:00
Paul Gschwendtner
fe50710021 build: fix outdated i18n compiler-cli test assertions (#28191)
PR Close #28191
2019-01-28 20:07:23 -08:00
Paul Gschwendtner
71b66fb862 build: run offline_compiler_test using bazel (#28191)
PR Close #28191
2019-01-28 20:07:23 -08:00
Keen Yee Liau
8db05b408e test(bazel): Integration test for Sass support (#28297)
Add .sass files to the integration test for bazel-schematics.

Also addressed Alex's comment in
https://github.com/angular/angular/pull/28167/files#r248149866
about the unit tests being too brittle.

PR Close #28297
2019-01-28 20:01:19 -08:00
Paul Gschwendtner
351610ca8d test: disable failing ivy example e2e tests (#28402)
PR Close #28402
2019-01-28 19:21:10 -08:00
Paul Gschwendtner
ef78e33560 build: switch example e2e tests to bazel (#28402)
* No longer builds the example e2e tests using "tsc". The examples are now built with Bazel and can therefore be built with Ivy by using the `--define=compile=aot` switch.
* No longer runs the example e2e tests using the protractor CLI. example e2e tests are executed with the Bazel protractor rule and can therefore run incrementally.

NOTE: Unit tests found within the examples are still running within the legacy jobs.

PR Close #28402
2019-01-28 19:21:10 -08:00
Keen Yee Liau
12b8a6e351 fix(bazel): Builder should invoke local bazel/iblaze (#28303)
Builder for `@angular/bazel` schematics should not expect bazel/ibazel
to be on the PATH. It should instead invoke the local executable
installed by yarn/npm.

PR Close #28303
2019-01-28 12:01:36 -08:00
Keen Yee Liau
260ac20e92 fix(bazel): Bazel-workspace schematics should run in ScopedTree (#28349)
Users should be able to add Bazel workspace to an existing project.
The current approach assumes that the schematics is working on the same
tree as that of ng-new, which includes the top-level directory. Instead,
the schematic should work on the tree rooted at `appRoot` to enable
Bazel files to be added to existing project.

This change uses the newly implemented ScopedTree
a0ac4b0e3d
to achieve this.

NOTE: The version of `@angular-devkit/schematics` that is installed is
used to run the `@angular/bazel` schematic. Even if a different version
is used in the schematic itself, it has no effect.
Therefore, the *latest* Angular CLI should be used to generate the
files. As of this commit, the latest version is @angular/cli@7.3.0-rc.0

PR Close #28349
2019-01-28 12:00:16 -08:00
Paul Gschwendtner
aed48e00d2 build: update sauce connect version (#28378)
PR Close #28378
2019-01-28 11:55:07 -08:00
Keen Yee Liau
a9d46e4952 fix(bazel): ng-new should run yarn install (#28381)
yarn install was disabled in ng-new for Bazel schematics because
Bazel manages its own node_modules dependencies and therefore
there is no need to install dependencies twice.

However, the first yarn install is needed for `ng` commands to work,
most notably `ng build`.

This commit restores the original behavior.

PR Close #28381
2019-01-28 11:54:37 -08:00
WilliamKoza
2f19ad9b46 fix(docs-infra): upgrade codelyzer to 4.5.0 (#28389)
PR Close #28389
2019-01-28 11:51:57 -08:00
Greg Magolan
81678e62db build(bazel): update to bazel 0.22.0 and turn on --incompatible_strict_action_env flag (#28404)
PR Close #28404
2019-01-28 11:48:42 -08:00
Alex Eagle
cf82fbceba build: set a default module_name for ts_library rules (#28051) (#28241)
PR Close #28051

PR Close #28241
2019-01-25 12:52:27 -08:00
George Kalpakas
1d67cb0ce1 test(docs-infra): increase timeout for redirection tests more (#28290)
Occasionally, external URLs take even longer than the previously set 60s
to load, which causes CI flakes.

PR Close #28290
2019-01-25 12:51:38 -08:00
George Kalpakas
318bd83a6e test(docs-infra): unregister the SW after each test (#28290)
This ensures that the SW is cleaned up, even in cases where
synchronization is disabled (and thus the clean-up inside `goTo()`
happens without waiting for Angular).

PR Close #28290
2019-01-25 12:51:38 -08:00
George Kalpakas
f767c22b31 test(docs-infra): unregister the SW after waitForAngular() (#28290)
This increases the chances that the clean-up will take place _after_ the
SW has been registered.

PR Close #28290
2019-01-25 12:51:38 -08:00
George Kalpakas
8346a6dca2 test(docs-infra): properly report errors if page.init() fails/rejects (#28290)
For asynchronous callbacks, this can be done either by calling
`done.fail()` or by returning the promise directly (without requesting a
`done` callback). (Using the latter, because it is shorter.)

PR Close #28290
2019-01-25 12:51:37 -08:00
Keen Yee Liau
6397885e74 test(bazel): Cleanup bazel-schematics integration test (#28351)
PR Close #28351
2019-01-25 12:47:27 -08:00
Greg Magolan
8cee56e8c5 fix(bazel): add @npm//tslib dep to e2e ts_library target in bazel-workspace schematic (#28358)
PR Close #28358
2019-01-25 12:38:35 -08:00
Jason Aden
a1b9995731 refactor(router): initalize browserUrlTree to empty tree (#28376)
The value here is unimportant on initialization since it's not looked at until the second navigation. However, sometimes in testing  the `Location` service is mocked out, or the Router constructor manually called. Assuming `Location` exists in the constructor leads to test failures in `google3` therefore we initialize to a value that will not cause errors.

PR Close #28376
2019-01-25 12:37:57 -08:00
Judy Bogart
35f7ff047a docs: add api doc for ngif (#27376) (#28344)
PR Close #27376

PR Close #28344
2019-01-24 15:45:06 -08:00
Judy Bogart
4ad691a33d docs: add api doc for ngfor (#27377) (#28344)
PR Close #27377

PR Close #28344
2019-01-24 15:45:06 -08:00
Judy Bogart
c5af3f8617 docs: add api doc to template_ref (#28344)
PR Close #28344
2019-01-24 15:45:06 -08:00
WilliamKoza
bc1032866c fix(docs-infra): change the key used to find out the cli section (#28293)
PR Close #28293
2019-01-24 15:41:45 -08:00
Carlos Schneider
63e6d1a896 docs(docs-infra): show top menu at 992px screen width (#26418)
Show top menu at 992px screen width. The JS expression was checking just for screen widths
strictly greater than 992px to show the menu, while the CSS media query was showing the hamburger
icon just for screen widths strictly smaller than 992px, so there was a gap of 1px that the user
could't navigate through the top menu.

closes #24324

PR Close #26418
2019-01-24 10:26:55 -08:00
WilliamKoza
cb9fd9b4d7 feat(docs-infra): saves the scroll position before the change of location (#28037)
Issue #27916, #17308

PR Close #28037
2019-01-24 10:24:43 -08:00
George Kalpakas
d5dca0764c fix(docs-infra): align property names to the top (#28104)
This looks better when the property descriptions span multiple lines;
especially when scrolling to a specific property (e.g.
[AbstractControl#status][1]).

[1]: https://next.angular.io/api/forms/AbstractControl#status

PR Close #28104
2019-01-24 10:24:04 -08:00
George Kalpakas
bcd1a09dec refactor(docs-infra): remove unused CSS style rule (#28104)
The `.properties-table` selector does not match any element and the
styles don't look relevant for the similarly named `.property-table`
class.

PR Close #28104
2019-01-24 10:24:04 -08:00
Dario Braun
898c0134e7 docs: fix typo and add parenthesis to method in HTTP tutorial (#28289)
Merge remote-tracking branch 'origin/TOH' into TOH


PR Close #28289
2019-01-24 10:23:25 -08:00
Felix Lemke
763d2150cc docs(animations): fix group and sequence function usage examples (#28305)
animate functions now contain style functions instead of plain objects
e.g. animate(1s, { background: black }))
to   animate(1s, style({ background: black }))

PR Close #28305
2019-01-24 10:21:35 -08:00
George Kalpakas
beacbfcb8e build(docs-infra): upgrade cli command docs sources to 699743282 (#28329)
Updating [angular#7.2.x](https://github.com/angular/angular/tree/7.2.x) from [cli-builds#7.2.x](https://github.com/angular/cli-builds/tree/7.2.x).
Relevant changes in [commit range](02d2ec250...699743282):

**Modified**
- help/generate.json
- help/new.json

PR Close #28329
2019-01-24 10:18:56 -08:00
William Neely
f72319cf6e docs(router): removed additional to (#25989)
PR Close #25989
2019-01-23 11:00:20 -08:00
Daniel Ruf
5877b3f702 refactor: remove unused parameter in _main method invocation (#28203)
PR Close #28203
2019-01-23 10:58:39 -08:00
Daniel Ruf
cf310ba1fa refactor: fix code style (#28203)
PR Close #28203
2019-01-23 10:58:38 -08:00
Daniel Ruf
c2d2953ee4 refactor: remove unused parameters (#28203)
PR Close #28203
2019-01-23 10:58:38 -08:00
Alex Rickabaugh
5c5fe34241 release: cut the v7.2.2 release 2019-01-22 15:27:48 -08:00
Jason Aden
32737a6bf7 fix(router): skipLocationChange with named outlets (#28301)
With #27680, a bug was fixed where multiple redirects using `eager` URL update could cause navigation to fail. However, that fix introduced a problem where with `skipLocationChange` enabled, the URL tree rendered was not properly stored for reference. This specifically caused an issue with named router outlets and subsequent navigations not being recognized.

This PR stores the correct `UrlTree` for reference with later navigations. It fixes the regression introdued with #27680.

Fixes #28200

PR Close #28301
2019-01-22 15:15:34 -08:00
Judy Bogart
7642308c14 docs: correct array to map (#27379)
PR Close #27379
2019-01-22 12:16:46 -08:00
Judy Bogart
f1c08d83b0 docs: add input doc (#27379)
PR Close #27379
2019-01-22 12:16:46 -08:00
Judy Bogart
617412f9c3 docs: add api doc for ng_style directive (#27379)
PR Close #27379
2019-01-22 12:16:46 -08:00
Jason Aden
cf716684a9 build: hide vscode settings e.g. debug launch config (#28299)
PR Close #28299
2019-01-22 11:38:16 -08:00
Luiz Machado
54565ed389 docs: fix crisis-detail milestone files (#27025)
Crisis Detail's template was being added two times and the component's TS none.
PR Close #27025
2019-01-22 11:19:51 -08:00
Alex Eagle
ab08385336 build: create dist/bin symlink with Bazel outputs (#27781)
Note that we had nasty problems in the past when this was enabled, but those have supposedly been fixed.

PR Close #27781
2019-01-22 09:52:46 -08:00
WilliamKoza
eb8ccf65d1 fix(docs-infra): removal of the use of the ChildNode.remove() method that it isn't supported by IE (#28188)
fixes #28177

PR Close #28188
2019-01-22 09:48:20 -08:00
Keen Yee Liau
cb93027f32 build: Fix gulp format for Node >= 10.14 (#28213)
With Node.js v10.14 and greater, running `yarn gulp format` produces
the following error:

```
$ nvm current
v10.15.0
$ yarn gulp format:changed
yarn run v1.12.3
$ /usr/local/google/home/kyliau/Documents/GitHub/angular/node_modules/.bin/gulp format:changed
internal/util/inspect.js:31
const types = internalBinding('types');
              ^

ReferenceError: internalBinding is not defined
    at internal/util/inspect.js:31:15
    at req_ (/usr/local/google/home/kyliau/Documents/GitHub/angular/node_modules/natives/index.js:137:5)
    at require (/usr/local/google/home/kyliau/Documents/GitHub/angular/node_modules/natives/index.js:110:12)
    at util.js:25:21
    at req_ (/usr/local/google/home/kyliau/Documents/GitHub/angular/node_modules/natives/index.js:137:5)
    at require (/usr/local/google/home/kyliau/Documents/GitHub/angular/node_modules/natives/index.js:110:12)
    at fs.js:42:21
    at req_ (/usr/local/google/home/kyliau/Documents/GitHub/angular/node_modules/natives/index.js:137:5)
    at Object.req [as require] (/usr/local/google/home/kyliau/Documents/GitHub/angular/node_modules/natives/index.js:54:10)
    at Object.<anonymous> (/usr/local/google/home/kyliau/Documents/GitHub/angular/node_modules/vinyl-fs/node_modules/graceful-fs/fs.js:1:99)
```

A search on GitHub reveals this issue is due to natives@1.1.4:
gulpjs/gulp#2246

```
$ yarn why natives
yarn why v1.12.3
[1/4] Why do we have the module "natives"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "natives@1.1.6"
info Reasons this module exists
   - "gulp#vinyl-fs#graceful-fs" depends on it
   - Hoisted from "gulp#vinyl-fs#graceful-fs#natives"
   - Hoisted from "browserstacktunnel-wrapper#unzip#fstream#graceful-fs#natives"
```

The solution is to add a manual resolution for natives@1.1.6

PR Close #28213
2019-01-22 09:45:51 -08:00
Daniel Ruf
607fd8e970 refactor: remove unused case in switch statement (#28253)
PR Close #28253
2019-01-22 09:44:35 -08:00
WilliamKoza
f4ac96d0ff style(docs-infra): Active tslint rule semicolon (#28282)
PR Close #28282
2019-01-22 09:38:45 -08:00
Igor Minar
1c7d156abd ci: add a rebase check to the merge-pr script (#28250)
Adds a check to verify that each PR branch to be merged upstream contains SHAs of commits that significantly changed our CI infrastructure.

This check is used to enforce that we don't merge PRs that have not been rebased recently and could result in merging of non-approved or otherwise bad changes.

PR Close #28250
2019-01-22 09:26:54 -08:00
Alex Eagle
4c00059260 feat(compiler-cli): resolve generated Sass/Less files to .css inputs (#28166)
Users might have run the CSS Preprocessor tool *before* the Angular
compiler. For example, we do it that way under Bazel. This means that
the design-time reference is different from the compile-time one - the
input to the Angular compiler is a plain .css file.

We assume that the preprocessor does a trivial 1:1 mapping using the same
basename with a different extension.

PR Close #28166
2019-01-18 09:49:19 -08:00
Keen Yee Liau
93d78c9c51 build(bazel): Use local rollup & build-optimizer for ng_rollup_bundle (#28215)
The current build workflow depends on cross workspace dependency by
installing angular-cli as a Bazel repository. This is not ideal because
it introduces separate node_module directories other than the one
installed by Angular through the yarn_install rule (ngdeps).

This commit removes angular-cli from the Bazel workspace and installs
rollup and @angular-devkit/build-optimizer locally.

PR Close #28215
2019-01-18 09:07:53 -08:00
George Kalpakas
49bee4c0d8 ci(docs-infra): do not automatically post preview comments on PRs for team (#28211)
Right now, we post such comments whenever a file has been touched that
could potentially have affected the docs. Since the API docs are built
from comments in the source code, almost all non-docs changes are
generating such preview comments, even though most of the time they are
irrelevant to the author and create unnecessary noise on the PR
(especially for actively worked-on PRs).

This commit removes the `team` GitHub team from the list of teams whose
members will automatically get preview comments.
(Adding the `aio: preview` label would still work on any PR.)

Jira: FW-967

PR Close #28211
2019-01-17 14:11:43 -08:00
Kapunahele Wong
d8c75f1bb0 docs: fix comments in services example (#26194)
PR Close #26194
2019-01-16 17:38:24 -08:00
WilliamKoza
6d40ef2d6b fix(docs-infra): improve a11y (#28086)
Issue #27723

PR Close #28086
2019-01-16 17:37:46 -08:00
Keen Yee Liau
4ea6c27dcf build(bazel): Use @angular/cli from root package.json (#28139)
A few integration tests now depend on @angular/cli.

This commit changes the affected tests to use the dependency
on @angular/cli defined at root package.json.

PR Close #28139
2019-01-16 17:37:23 -08:00
Keen Yee Liau
a4d9192fbc feat(bazel): Add support for SASS (#28167)
This commit adds the appropriate rules to the WORKSPACE for a project
that requires SASS support.

PR Close #28167
2019-01-16 17:35:55 -08:00
Keen Yee Liau
7b772e93a3 fix(bazel): Fix integration test after v8 bump (#28194)
The integration test for bazel-schematics installs Angular in
two different locations:

1. Bazel workspace
2. package.json -> fetched from npm

Pull request #28142 changes the test to always install (1) from
source. This breaks when there's a major version bump since the
versions locally and the version in package.json no longer match.

This change updates package.json to fetch @angular/* packages
locally as well.

PR Close #28194
2019-01-16 16:50:52 -08:00
Andrew Kushnir
05168395b0 release: cut the v7.2.1 release 2019-01-16 13:23:06 -08:00
Alan
03293c4fec fix(ivy): normalize summary and factory shim files paths (#28173)
At the moment, paths stored in `maps` are not normalized and in Windows is causing files not to be found when enabling factory shimming.

For example, the map contents will be
```
Map {
  'C:\\git\\cli-repos\\ng-factory-shims\\index.ngfactory.ts' => 'C:\\git\\cli-repos\\ng-factory-shims\\index.ts' }
```

However, ts compiler normalized the paths and is causing;
```
error TS6053: File 'C:/git/cli-repos/ng-factory-shims/index.ngfactory.ts' not found.
error TS6053: File 'C:/git/cli-repos/ng-factory-shims/index.ngsummary.ts' not found.
```

The changes normalized the paths that are stored within the factory and summary maps.

PR Close #28173
2019-01-16 11:56:53 -08:00
George Kalpakas
479019f457 test(upgrade): clean up global state after test (#28181)
In ngUpgradeLite, when a downgraded component
[requests its downgraded module][1], the AngularJS injector is
[temporarily stored][2] with the intention of grabbing it
[once the module has been bootstrapped][3] (which also cleans up the
[temporary injector reference][4]).

In [some tests][5], bootstrapping a component might throw an error,
which causes the test to fail immediatelly and move on to the next
test. In slow browsers (e.g. on CI/Saucelabs), the (successful)
bootstrapping of another downgraded module might not have been
completed in time and thus the temporary injector reference not cleaned
up.

In such a case, if the following test (in our randomized test suite)
happens to rely on the temporary injector reference's being initially
unset (such as [this test][6]), it will fail. This might appear as a
flake on CI, because it depends on a race condition and specific order
of tests, so it usually goes away after a rerun.

This commit fixes it by ensuring the temporary injector reference is
manually cleaned up, when necessary.

Jira issue: FW-939

[1]: f983e99fb2/packages/upgrade/src/common/downgrade_component.ts (L120)
[2]: f983e99fb2/packages/upgrade/src/static/downgrade_module.ts (L165)
[3]: f983e99fb2/packages/upgrade/src/static/downgrade_module.ts (L169)
[4]: f983e99fb2/packages/upgrade/src/static/angular1_providers.ts (L25)
[5]: f983e99fb2/packages/upgrade/test/static/integration/downgrade_module_spec.ts (L1331-L1381)
[6]: f983e99fb2/packages/upgrade/test/static/angular1_providers_spec.ts (L31-L45)

PR Close #28181
2019-01-16 11:56:53 -08:00
Benedikt Meurer
68515818b9 perf(platform-server): use shared DomElementSchemaRegistry instance (#28150) (#28151)
Right now the `ServerRendererFactory2` creates a new instance of the
`DomElementSchemaRegistry` for each and every request, which is quite
costly (for the Tour of Heroes SSR this takes around **30%** of the
overall execution time). Since the schema is never modified, but only
used in a read-only fashion, it should be possible to re-use a single
instance instead.

Naive performance testing with 100 concurrent connections and 1000
requests in total shows an approximate **33%** improvement in Req/Sec
on the Tour of Heroes SSR example.

PR Close #28150

PR Close #28151
2019-01-16 11:56:53 -08:00
Jason Aden
8bc369f828 docs(router): add clarification for Router config (#28159)
PR Close #28159
2019-01-16 11:56:53 -08:00
Judy Bogart
3d1a4d5cc3 docs: add api doc for switch directives (#27378)
PR Close #27378
2019-01-16 11:56:53 -08:00
Ernest Galbrun
5c56b778e0 docs(core): fix typo (#28042)
PR Close #28042
2019-01-16 11:56:53 -08:00
Serginho
585e871c96 fix(service-worker): navigation urls backwards compatibility (#27244)
PR Close #27244
2019-01-16 11:56:53 -08:00
Jason Aden
6ae7aee2c3 fix(router): ensure URL is updated after second redirect with UrlUpdateStrategy="eager" (#27680)
Navigating to a route such as `/users`, you may get redirected to `/login`. Previously, if you go then route to `/users` again the URL will end up showing `/users` after the second redirect. This only happened in `UrlUpdateStrategy="eager"`. This is now fixed so after the second redirect, the URL shows the correct page.

Fixes #27116

PR Close #27680
2019-01-16 11:56:53 -08:00
Keen Yee Liau
701270d039 test(bazel): Use local_repository to load Angular (#28142)
The current integration test for Bazel schematics downloads a
published version of Angular as required by the http_archive
rule in the CLI created WORKSPACE.
However, this makes the test less useful because it does not
actually test any changes to the Angular repo at source.
This PR replaces the http_archive method in the WORSPACE
with local_repository so that any local changes to the Angular
repo are tested accordingly.

With Typescript 3.2, the file e2e/src/app.po.ts generated by CLI
no longer compiles under Bazel due to missing type annotations.
A temporary file is placed in the integration/bazel-schematics
directory while the change is pending in CLI repo.
https://github.com/angular/angular-cli/pull/13406

PR Close #28142
2019-01-16 11:56:53 -08:00
Keen Yee Liau
02a852a34a fix(bazel): Bazel schematics should add router package (#28141)
This commit fixes a bug whereby a Bazel project created by the
schematics would not compiled if project contains routing module.

It is missing a dependency on the router package.

PR Close #28141
2019-01-16 11:56:52 -08:00
赵正阳
531f940212 docs(ivy): remove duplicated words in architecture doc (#27471)
PR Close #27471
2019-01-16 11:56:52 -08:00
krzysztof-grzybek
de80f1b6dd docs: update testing doc example style for HostListener (#26372)
HostListener is preferred over host metadata by official style guide

PR Close #26372
2019-01-16 11:56:52 -08:00
Paul Gschwendtner
ca3965afe0 fix(bazel): incorrectly always uses ngc-wrapped from "npm" workspace (#28137)
* This is a follow-up to cd0451305a which fixes that "ngc-wrapped" from the "npm" workspace is always used if "angular" is fetched as an external dependency.

PR Close #28137
2019-01-16 11:56:52 -08:00
Malgosia
f269e433a7 docs: ng config link fix (#28115)
Fixed 'ng config' link to lead to proper CLI command site
PR Close #28115
2019-01-16 11:56:52 -08:00
WilliamKoza
8750b09fca fix(docs-infra): Add crossed through styling (#28111)
PR Close #28111
2019-01-16 11:56:52 -08:00
WilliamKoza
ea2eef737b fix(docs-infra): change style of deprecated markers (#28111)
PR Close #28111
2019-01-16 11:56:52 -08:00
WilliamKoza
0ceab97a03 fix(docs-infra): render deprecated markers for CLI command options (#28111)
fixes #27563
fixes #27423

PR Close #28111
2019-01-16 11:56:52 -08:00
Paul Gschwendtner
fbbdaaacc0 fix(bazel): replay compilation uses wrong compiler for building esm5 (#28053)
With the update to TypeScript 3.2.x, a big issue seems to have appeared for downstream Bazel users. If the downstream user still uses a lower TypeScript version, normal Bazel targets using the `ng_module` rule are still compiled with the correct/old TypeScript version (assuming they set the `node_modules` attribute properly).

But, if they build the previous Bazel targets by specifying them within a `ng_package` rule, the TypeScript version from the Angular `workspace` is being used for the replayed ESM5 compilation. This is because we resolve the replay compiler to `ngc_wrapped` or `tsc_wrapped` Bazel executables which are defined as part of the `angular` workspace. This means that the compilers are different if the downstream user uses `ngc-wrapped` from the `@npm` repository because the replayed compilation would use the compiler with `@ngdeps//typescript`.

In order to fix this, we should just use the compiler that is defined in the `@angular//BUILD.bazel` file. This target by defaults to the "@npm" workspace which is working for downstream users. This is similar to how it is handled for `tsc-wrapped`. `tsc-wrapped` works as expected for downstream users.

**Note**: This is not the ideal solution because ideally we would
completely respect the `compiler` option from the base `ng_module`, but
this is not possible in a hermetic way, unless we somehow accept the
`compiler` as an attribute that builds all transitive deps. This is
something we should explore in the future. For now, we just fix this in
a reasonable way that is also used for `tsc_wrapped` from the TypeScript
rules.

PR Close #28053
2019-01-16 11:56:52 -08:00
Keen Yee Liau
080de58a88 refactor(bazel): use web_package rule for index.html (#27995)
index.html needs to have the zone.js and the project bundle injected
using script tags. This used to be done explicitly by specifying a
new index.html but with `web_package` rule introduced in rules_nodejs,
it is now possible to perform the injection dynamically.

PR Close #27995
2019-01-16 11:56:52 -08:00
javatutorials2016
5390948360 docs: fix typo in singleton services guide (#27948)
PR Close #27948
2019-01-16 11:56:51 -08:00
Shivam_Vyas
0d860051af docs: change in(what should I import? answer) NgModule FAQs (#27677)
I think only should be after BrowserModule , because we can import more than BrowserModule and I think we need to import other modules to AppModule in most of cases and we should import BrowserModule only in AppModule,so that thing seems okay.

PR Close #27677
2019-01-16 11:56:51 -08:00
Ashinze Ekene
edbba24b60 docs: fix typo in dependency injection guide (#27616)
~~`HeroService` must provided in some parent injector~~
*`HeroService` must be provided in some parent injector*

PR Close #27616
2019-01-16 11:56:51 -08:00
Brad Brandhorst
6ae8d7691d docs: fix typo in docs.md (#27484)
Added a period to the end of the last sentence in the first paragraph
PR Close #27484
2019-01-16 11:56:51 -08:00
kwiateusz
af3cf36ce9 docs: ngComponentOutlet doc updated with new Injector creation (#27291)
PR Close #27291
2019-01-16 11:56:51 -08:00
coultonluke
1be2f11965 docs: updates to minor spelling mistakes in pipes guide (#27208)
PR Close #27208
2019-01-16 11:56:51 -08:00
Brandon Roberts
495ce325b2 docs: add browser polyfills for IE11 with hash-based routing (#27135)
Closes #26511

PR Close #27135
2019-01-16 11:56:51 -08:00
Sasidhar Vanga
92411043d1 docs: fix GitHub pages deployment command (#26896)
closes #26803
PR Close #26896
2019-01-16 11:56:51 -08:00
Steve Dignan
aa3f75b3c9 docs: minor wording change in code example comment (#26835)
PR Close #26835
2019-01-16 11:56:51 -08:00
Courtney Pattison
d64aadf57a docs: fix typo in testing guide (#26828)
PR Close #26828
2019-01-16 11:56:51 -08:00
cyraid
51f7f081a3 docs: update link in universal guide (#26628)
Link to the document "53 percent of mobile site visits" was changed, updated link. Old link led to a page that didn't have the statistics on it.

PR Close #26628
2019-01-16 11:56:50 -08:00
Alan Agius
b9fd62413f docs: fix scripts section and some minor issues in universal documentation (#26444)
PR Close #26444
2019-01-16 11:56:50 -08:00
George Kalpakas
c5664bf245 test(docs-infra): increase timeout for all redirection tests (#28103)
Occasionally, URLs take longer to load, which causes CI flakes.
In #27903, the timeout for external URLs was increased, but internal
URLs turned out to be affected as well.

PR Close #28103
2019-01-16 11:56:50 -08:00
Judy Bogart
c66a076614 docs: add library doc to guides in aio (#27581)
PR Close #27581
2019-01-16 11:56:50 -08:00
Keen Yee Liau
28d34b699d fix(bazel): Add ibazel to deps of Bazel project (#28090)
Incremental rebuilds is a fundamental part of the development
workflow. `@bazel/ibazel` should be added to the dev dependencies
of a Bazel project.

PR Close #28090
2019-01-16 11:56:50 -08:00
Pete Bacon Darwin
47840bee71 docs(forms): fix up @see tags for AbstractContol (#28069)
PR Close #28069
2019-01-16 11:56:50 -08:00
Pete Bacon Darwin
305331f634 build(docs-infra): render @see information in members (#28069)
Previously `@see` tags were only rendered for top level class-like
docs. Now these tags are rendered for methods and properties too.

PR Close #28069
2019-01-16 11:56:50 -08:00
George Kalpakas
5e6c24cb01 build: update version in package.json (#28075)
The version was updated on master (with 0efbb3738), but the commit was
not backported to 7.2.x. As a result, the version on angular.io appears
as `7.2.0-rc.0` (instead of 7.2.0).

PR Close #28075
2019-01-16 11:56:40 -08:00
George Kalpakas
0ec4e1372a docs(service-worker): fix example of manually checking for updates (#28020)
Poll for updates in a way that does not prevent the SW from being
registered. Discussed in https://github.com/angular/angular/pull/27332#pullrequestreview-179504620.

PR Close #28020
2019-01-16 11:55:47 -08:00
George Kalpakas
84c1bad3a1 style(service-worker): fix code formatting in service-worker-getting-started example (#28020)
PR Close #28020
2019-01-16 11:55:47 -08:00
George Kalpakas
1640832f56 docs(service-worker): fix the service-worker-getting-started docs example (#28020)
Changes:
- Change the project type to `service-worker`, so that it gets
  appropriate `package.json` (with `@angular/service-worker` dependency)
  and `angular.json` (with `serviceWorker: true` in production config).
- Move `ngsw-config.json` to the correct directory.
- Specify custom test commands for aio's `yarn example-e2e` to also
  verify that the ServiceWorker bits are set up correctly.

PR Close #28020
2019-01-16 11:55:47 -08:00
George Kalpakas
8ab036262d feat(docs-infra): add support for custom test commands in cli-based docs examples (#28020)
Previously, cli-based docs examples were tested using `yarn e2e ...`. In
some cases, it might make sense to run different or additional checks
for a docs example (when running `yarn example-e2e` in `aio/`).

Currently, the only option is to define a custom project type and
overwrite the `e2e` yarn script in `package.json`. Doing so (in addition
to being cumbersome and verbose) would also end up in the `.zip` archive
that users can download to run the example locally. This would be
confusing, if these custom tests are specific to our CI needs.

This commit adds support for defining a custom list of commands per
example. These commands (if specified) would be run instead of the
default `yarn e2e ...`, when testing the docs examples on CI (via
`yarn example-e2e`).

(This feature will be used to verify that the
`service-worker-getting-started` example is set up correctly in a
subsequent commit, but can be useful in other cases as well.)

PR Close #28020
2019-01-16 11:55:47 -08:00
George Kalpakas
76e8c0ac7b feat(docs-infra): add service-worker project type (#28020)
File overwrites:
- **angular.json**: Add `serviceWorker: true` to production config.
- **package.json**: Add `@angular/service-worker` to dependencies.

This will make any `service-worker` examples work out-of-the-box, when
downloading and running locally from the `.zip` archives.

PR Close #28020
2019-01-16 11:55:47 -08:00
Judy Bogart
0e81e418fb docs: add schematics terms to glossary (#27862)
PR Close #27862
2019-01-16 11:55:47 -08:00
Kapunahele Wong
60255b68c0 docs: re-write interpolation section and add example (#25170)
PR Close #25170
2019-01-16 11:55:47 -08:00
Karanveer Plaha
ae7b3c8d45 docs(router): fixed a typo in CanLoad title text (#27894)
* Interface that a class can implement to be a guard deciding if a children can be loaded.
'...if a children...' changed to '...if children...'
 * Interface that a class can implement to be a guard deciding if children can be loaded.

PR Close #27894
2019-01-16 11:55:47 -08:00
Joseph Harrison-Lim
9556ba7bca docs(router): fix misnamed path (#27879)
This change matches the routes found in the following code example
for auth.guard.ts as well as the login.component.1.ts in the "Add
the LoginComponent" section.

PR Close #27879
2019-01-16 11:55:47 -08:00
Mark Goho
80994b25b9 docs: fix typo (#27865)
PR Close #27865
2019-01-16 11:55:47 -08:00
Johannes Hoppe
2f154b980f docs: fix broken html for deployment.md (#27851)
without the closing quote the text and link are not displayed correctly

PR Close #27851
2019-01-16 11:55:46 -08:00
Teamop
342d352a00 refactor(core): improve type for EventEmitter (#27228)
PR Close #27228
2019-01-16 11:55:46 -08:00
Keen Yee Liau
f240ae5084 build(bazel): Bump @bazel/typescript & @bazel/karma to 0.22.1 (#28031)
PR Close #28031
2019-01-16 11:55:46 -08:00
Suguru Inatomi
e4fc8bad35 fix(bazel): Add /bazel-out to .gitignore (#27874)
PR Close #27874
2019-01-16 11:55:46 -08:00
George Kalpakas
5c680d4aa8 test(upgrade): log more info to help debug CI flakes (#28045)
Related Jira issue: FW-939

PR Close #28045
2019-01-16 11:55:46 -08:00
Paul Gschwendtner
f05c5f82c8 fix(bazel): protractor rule does not run spec files with underscore (#28022)
There are various e2e tests with the `_spec.ts` suffix in the Angular project. Currently the protractor Bazel rule does not pick up these files and just ignores them. Since underscore is commonly used, we should support this.

Needed for the conversion fo the `examples` to Bazel.

PR Close #28022
2019-01-16 11:55:46 -08:00
George Kalpakas
2e0c58ec3e docs: document why not using compare-url orb (#28010)
Discussed in
https://github.com/angular/angular/pull/27775#issuecomment-452565603.

PR Close #28010
2019-01-16 11:55:46 -08:00
Keen Yee Liau
21093b9090 fix(bazel): Add @bazel/bazel to dev deps (#28032)
Project created by @angular/cli depends on Bazel at build time and
we should not assume that Bazel is available globally.
Instead, the project should specify an explicit dev dependency on
`@bazel/bazel`.

PR Close #28032
2019-01-16 11:55:46 -08:00
George Kalpakas
a6153accf0 docs: remove deprecated fromPromise from RxJS guide (#28015)
Follow-up to #27443.

PR Close #28015
2019-01-16 11:55:46 -08:00
Meknassih
dee789c204 docs(core): add missing closing backtick (`) (#27908)
PR Close #27908
2019-01-16 11:55:46 -08:00
Ivan Tham
12dd552fcd docs(forms): remove duplicated link (#27884)
PR Close #27884
2019-01-16 11:55:45 -08:00
Michael De Wree
079bcffe07 docs: fix typo PageNotFoundCompponent (#27799)
closes: #27795

PR Close #27799
2019-01-16 11:55:45 -08:00
Igor Minar
30256e8fe8 ci: add brandonroberts to @angular/docs-infra codeowners (#28023)
Brandon is joining the docs-infra team in addition to the docs team.

PR Close #28023
2019-01-16 11:55:45 -08:00
Keen Yee Liau
8ee69831fc build(bazel): List explicit dependencies in WORKSPACE (#28000)
Instead of relying on implicit dependencies through Angular, the WORKSPACE
of the project should explicitly add rules_nodejs and rules_typescript so
it can better control the versions.

PR Close #28000
2019-01-16 11:55:45 -08:00
Paul Gschwendtner
c3d8e2888d fix(bazel): flat module misses AMD module name on windows (#27839)
* Fixes that the flat module out files do not have a proper AMD module name on Windows. This is currently blocking serving a `ng_module` using the Bazel TypeScript `devserver` on Windows.

PR Close #27839
2019-01-16 11:55:45 -08:00
Paul Gschwendtner
bea677136b build: re-enable disabled e2e tests (#27979)
Re-enables a few e2e tests which have been disabled a long time ago. Since these pass now, we should re-enable them.

PR Close #27979
2019-01-16 11:55:45 -08:00
Paul Gschwendtner
11728bbbd9 build: remove travisci leftovers (#27979)
PR Close #27979
2019-01-16 11:55:45 -08:00
WilliamKoza
1da4b03940 fix(aio): Treating some deprecated (#27981)
PR Close #27981
2019-01-16 11:55:45 -08:00
Dario Braun
54ba0f021f docs(core): fix characters that corrupt link (#27982)
PR Close #27982
2019-01-16 11:55:45 -08:00
George Kalpakas
836a5c72a0 build(docs-infra): remove unnecessary script to workaround cli issue (#28012)
The cli issue has been fixed and we no longer need to work around it.
This is essentially reverting #23470.

PR Close #28012
2019-01-16 11:55:45 -08:00
George Kalpakas
f589933440 test(upgrade): properly clean up after tests to avoid errors in unrelated tests (#28013)
Many `ngUpgrade` tests need to manually [bootstrap modules][1] (instead
of using `TestBed` which automatically cleans up) and thus need to also
manually clean up afterwards (e.g. by calling [destroyPlatform()][2]
after each test).

Failing to destroy the platform is usually not a problem, unless the
next test tries to manually destroy it (as a precaution), as happens
[here][3] (among other places).

More specifically, the problem happens, because (as part of the clean-up
happening on platform destruction) upgraded components will try to
[call a method][4] on `angular.element` after `angular` has been
[set to `undefined`][5] (assuming the last test was using the
[withEachNg1Version()][6] helper).

Because the test order is pseudo-random and thus different on each run,
these errors did not always come up and - when they did- they would go
away after a couple of reruns, making them appear as flakes on CI.

(For reference, the issue was introduced in 43c33d566.)

This commit eliminates the issue by always destroying the platform after
each `ngUpgrade` test.

Jira issue: FW-924

[1]: c3aa24c3f9/packages/upgrade/test/static/test_helpers.ts (L21)
[2]: c3aa24c3f9/packages/upgrade/test/static/integration/upgrade_component_spec.ts (L24)
[3]: c3aa24c3f9/packages/elements/test/create-custom-element_spec.ts (L31)
[4]: c3aa24c3f9/packages/upgrade/src/common/upgrade_helper.ts (L134-L135)
[5]: c3aa24c3f9/packages/upgrade/test/common/test_helpers.ts (L115)
[6]: c3aa24c3f9/packages/upgrade/test/common/test_helpers.ts (L31)

PR Close #28013
2019-01-16 11:55:45 -08:00
Andrew Crites
ef3ec34aa3 docs: use static zip function as an Observable creator. (#26790)
The existing example makes it seem like zip is a pipeable operator. It can be used this way, but I think that is for backwards compatibility. You can achieve the same functionality by using it as an Observable creator. I think this also makes the example clearer.

PR Close #26790
2019-01-16 11:55:44 -08:00
Kara Erickson
37a6d2d033 Revert "test(ivy): re-enable passing animation tests (#27997)"
This reverts commit 097af5ae2b75b6040d22348d75e2923fa6ada8ec.
It was accidentally merged on both master and patch branches when
it should have only been merged on master.
2019-01-16 11:55:44 -08:00
Zheng Kai
354f3639bb docs: update rxjs example and change fromPromise to from (#27443)
the first example at https://angular.io/guide/rx-library,
https://github.com/ReactiveX/rxjs-tslint/issues/7

PR Close #27443
2019-01-16 11:55:44 -08:00
cexbrayat
c4b06868b1 test: fix outDir in TS 3.2 integration test (#27774)
PR Close #27774
2019-01-16 11:55:44 -08:00
Igor Minar
e3853e842e ci: fix public api rule in codeowners (#27999)
@alxhub spotted that the public api rule in codeowners is being overriden by the Build & CI Owners rule.

swapping the two sections fixes the problem.

PR Close #27999
2019-01-16 11:55:44 -08:00
Kara Erickson
aee5cbd057 test(ivy): re-enable passing animation tests (#27997)
PR Close #27997
2019-01-16 11:55:44 -08:00
Kara Erickson
e9614eff1a ci: update payload size for cli-hello-world (#27994)
PR Close #27994
2019-01-16 11:55:44 -08:00
Kara Erickson
80f9f7e8ef docs: group fixes and features for 7.2.0 in changelog desc (#27974)
PR Close #27974
2019-01-16 11:55:37 -08:00
Alex Eagle
7d2589556f docs: remove Travis status from README (#27973)
we no longer use TravisCI
PR Close #27973
2019-01-16 11:54:04 -08:00
George Kalpakas
468fcab59d ci: compute commit range for rerun workflows (#27775)
On push builds, CircleCI provides `CIRCLE_COMPARE_URL`, which we use to
extract the commit range for a given build. When a workflow is rerun
(e.g. to recover from a flaked job), `CIRCLE_COMPARE_URL` is not
defined, causing some jobs to fail.

This commit fixes it by retrieving the compare URL from the original
workflow. It uses a slow process involving a (potentially large) number
of requests to CircleCI API.
It depends on the (undocumented) fact, that the `workspace_id` is the
same on all rerun workflows and the same as the original `workflow_id`.

PR Close #27775
2019-01-16 11:54:04 -08:00
Igor Minar
f720e972d4 ci: remove required ci status for travis from angular-robot.yaml (#27970)
we missed this one!! oops

the robot should not expect travis status check on PRs any more.

PR Close #27970
2019-01-16 11:54:04 -08:00
Paul Gschwendtner
b51ae7e59a build: increase parallelism for "test_docs_examples" job (#27937)
PR Close #27937
2019-01-16 11:54:04 -08:00
Paul Gschwendtner
eedb06936f build: group sharded "test_docs_examples" jobs within circleci (#27937)
* Groups the two sharded `test_docs_examples` job using CircleCI's `parallelism` feature.  This makes the amount of jobs that show up on a PR, more reduced and also reduces code duplication for maintaining the Circle job definition.

PR Close #27937
2019-01-16 11:54:04 -08:00
Paul Gschwendtner
ee5a094424 build: bazel integration test using limited resources (#27937)
PR Close #27937
2019-01-16 11:54:04 -08:00
Paul Gschwendtner
9773b5a173 build: shard integration tests on circleci (#27937)
PR Close #27937
2019-01-16 11:54:04 -08:00
Igor Minar
eed171839e test: fix integration/platform-server test which had missing @types/node devDep (#27937)
I'm not sure why this problem is visible only now or how this worked before, but the CI
is now failing because @types/node is missing.

I also added the yarn.lock file which was previously omitted. We want the yarn.lock file in so that
our deps don't change over time without us knowing.

PR Close #27937
2019-01-16 11:54:04 -08:00
Paul Gschwendtner
1057b52def build: remove "build.sh" script (#27937)
this script is now obsolete and not needed any more. yay!!!

PR Close #27937
2019-01-16 11:54:04 -08:00
Paul Gschwendtner
302506e940 build: remove "test.sh" script (#27937)
test.sh is no longer needed... all the tests should now be executed via bazel.

if for whatever reason we need to run the legacy unit test setup, we should should follow the commands that we use to execute those tests in .circle/config.yaml

PR Close #27937
2019-01-16 11:54:04 -08:00
Paul Gschwendtner
cc35feb445 ci: remove travis ci setup (#27937)
we no longer need it... yay!!!

PR Close #27937
2019-01-16 11:54:03 -08:00
Paul Gschwendtner
21b875d4d0 ci: run legacy e2e tests in parallel (#27937)
PR Close #27937
2019-01-16 11:54:03 -08:00
Paul Gschwendtner
dac9c09235 ci: move e2e tests from travis to circleci (#27937)
PR Close #27937
2019-01-16 11:54:03 -08:00
Igor Minar
5cba438eb5 ci: remove build steps that are no longer needed (#27937)
the metadata build seems to be needed only by the offline compiler tests which is currently disabled

PR Close #27937
2019-01-16 11:54:03 -08:00
Igor Minar
2b001cb2b1 ci: move local and saucelabs unit tests to circle (#27937)
Moving the tests over to CircleCI in pretty much "as-is" state just so that we can drop the dependency on Travis.

In the followup changes we plan to migrate these tests to run on sauce under bazel. @gregmagolan is working on that.

I've previously verified that all the tests executed in legacy-unit-tests-local already under bazel.
Therefore the legacy-unit-tests-local job is strictly not necessary any more, but given how flaky legacy-unit-tests-saucelabs is,
it is good to have the -local job just so that we can quickly determine if any failure is a flake or legit issue
(the bazel version of these tests could theoretically run in a slightly different way and fail or not fail in a different way, so having -lcoal job is just an extra safety check).

This change was coauthored with @devversion

PR Close #27937
2019-01-16 11:54:03 -08:00
Paul Gschwendtner
0be8487f09 fix(bazel): protractor utils cannot start server on windows (#27915)
* Currently the protractor utils assume that the specified Bazel server runfile can be resolved by just using the real file system. This is not the case on Windows because the runfiles are not symlinked into the working directory and need to be resolved through the runfile manifest.

PR Close #27915
2019-01-16 11:54:03 -08:00
Paul Gschwendtner
e1e69ca828 test(bazel): re-enable ng_package golden testing on ci (#27829)
* Enables the ng_package golden testing on the CI
* Fixes the ng_package golden testing for Windows

PR Close #27829
2019-01-16 11:54:03 -08:00
Paul Gschwendtner
f376c46d78 test(bazel): fix all ng_package tests not working on windows (#27829)
PR Close #27829
2019-01-16 11:54:03 -08:00
Paul Gschwendtner
fad4145f48 fix(bazel): packager not properly removing amd directives on windows (#27829)
PR Close #27829
2019-01-16 11:54:03 -08:00
Paul Gschwendtner
6b394f62be fix(bazel): ng_package creates invalid typings reexport on windows (#27829)
Currently when building a package on Windows, the typings re-export for secondary entry-points is not valid TypeScript. Similarly the metadata and the "package.json" files use non-posix paths and cause inconsistency within the NPM package.

For example:

_package.json_
```
  "esm5": "./esm5\\core.js",
  "esm2015": "./esm2015\\core.js",
```

_testing.d.t.s_ (of the `core` package)
```
export * from './testing\testing';
```

PR Close #27829
2019-01-16 11:54:03 -08:00
Enmanuel
16aad8b2d8 docs: add Alyle UI to resources (#27954)
PR Close #27954
2019-01-16 11:54:03 -08:00
Igor Minar
25bbcbcbe5 ci: add brandonroberts to @angular/framework-global-approvers-for-docs-only-changes (#27949)
I’ve observed that Brandon reviews many docs-only PRs and then we still need me or Jeniffer to approve them.

In most cases, Brandon is perfectly qualified to approve these, so I’m proposing that Brandon is added to the framework-global-approvers-for-docs-only-changes group.

PR Close #27949
2019-01-16 11:54:02 -08:00
8125 changed files with 378424 additions and 757585 deletions

View File

@ -1,97 +1,6 @@
# Bazel does not yet support wildcards or other .gitignore semantics for
# .bazelignore. Two issues for this feature request are outstanding:
# https://github.com/bazelbuild/bazel/issues/7093
# https://github.com/bazelbuild/bazel/issues/8106
.git
node_modules node_modules
dist dist
aio/content aio/content
aio/node_modules aio/node_modules
aio/tools/examples/shared/node_modules aio/tools/examples/shared/node_modules
packages/bazel/node_modules integration/bazel
integration/bazel/bazel-bazel
integration/bazel/bazel-bin
integration/bazel/bazel-out
integration/bazel/bazel-testlogs
integration/bazel-schematics/demo
# All integration test node_modules folders
integration/bazel/node_modules
integration/bazel-schematics/node_modules
integration/cli-hello-world/node_modules
integration/cli-hello-world-ivy-compat/node_modules
integration/cli-hello-world-ivy-i18n/node_modules
integration/cli-hello-world-ivy-minimal/node_modules
integration/cli-hello-world-lazy/node_modules
integration/cli-hello-world-lazy-rollup/node_modules
integration/dynamic-compiler/node_modules
integration/hello_world__closure/node_modules
integration/hello_world__systemjs_umd/node_modules
integration/i18n/node_modules
integration/injectable-def/node_modules
integration/ivy-i18n/node_modules
integration/language_service_plugin/node_modules
integration/ng_elements/node_modules
integration/ng_elements_schematics/node_modules
integration/ng_update/node_modules
integration/ng_update_migrations/node_modules
integration/ngcc/node_modules
integration/platform-server/node_modules
integration/service-worker-schema/node_modules
integration/side-effects/node_modules
integration/terser/node_modules
integration/typings_test_ts36/node_modules
integration/typings_test_ts37/node_modules
# All integration test .yarn_local_cache folders
integration/bazel/.yarn_local_cache
integration/bazel-schematics/.yarn_local_cache
integration/cli-hello-world/.yarn_local_cache
integration/cli-hello-world-ivy-compat/.yarn_local_cache
integration/cli-hello-world-ivy-i18n/.yarn_local_cache
integration/cli-hello-world-ivy-minimal/.yarn_local_cache
integration/cli-hello-world-lazy/.yarn_local_cache
integration/cli-hello-world-lazy-rollup/.yarn_local_cache
integration/dynamic-compiler/.yarn_local_cache
integration/hello_world__closure/.yarn_local_cache
integration/hello_world__systemjs_umd/.yarn_local_cache
integration/i18n/.yarn_local_cache
integration/injectable-def/.yarn_local_cache
integration/ivy-i18n/.yarn_local_cache
integration/language_service_plugin/.yarn_local_cache
integration/ng_elements/.yarn_local_cache
integration/ng_elements_schematics/.yarn_local_cache
integration/ng_update/.yarn_local_cache
integration/ng_update_migrations/.yarn_local_cache
integration/ngcc/.yarn_local_cache
integration/platform-server/.yarn_local_cache
integration/service-worker-schema/.yarn_local_cache
integration/side-effects/.yarn_local_cache
integration/terser/.yarn_local_cache
integration/typings_test_ts36/.yarn_local_cache
integration/typings_test_ts37/.yarn_local_cache
# All integration test NPM_PACKAGE_MANIFEST.json folders
integration/bazel/NPM_PACKAGE_MANIFEST.json
integration/bazel-schematics/NPM_PACKAGE_MANIFEST.json
integration/cli-hello-world/NPM_PACKAGE_MANIFEST.json
integration/cli-hello-world-ivy-compat/NPM_PACKAGE_MANIFEST.json
integration/cli-hello-world-ivy-i18n/NPM_PACKAGE_MANIFEST.json
integration/cli-hello-world-ivy-minimal/NPM_PACKAGE_MANIFEST.json
integration/cli-hello-world-lazy/NPM_PACKAGE_MANIFEST.json
integration/cli-hello-world-lazy-rollup/NPM_PACKAGE_MANIFEST.json
integration/dynamic-compiler/NPM_PACKAGE_MANIFEST.json
integration/hello_world__closure/NPM_PACKAGE_MANIFEST.json
integration/hello_world__systemjs_umd/NPM_PACKAGE_MANIFEST.json
integration/i18n/NPM_PACKAGE_MANIFEST.json
integration/injectable-def/NPM_PACKAGE_MANIFEST.json
integration/ivy-i18n/NPM_PACKAGE_MANIFEST.json
integration/language_service_plugin/NPM_PACKAGE_MANIFEST.json
integration/ng_elements/NPM_PACKAGE_MANIFEST.json
integration/ng_elements_schematics/NPM_PACKAGE_MANIFEST.json
integration/ng_update/NPM_PACKAGE_MANIFEST.json
integration/ng_update_migrations/NPM_PACKAGE_MANIFEST.json
integration/ngcc/NPM_PACKAGE_MANIFEST.json
integration/platform-server/NPM_PACKAGE_MANIFEST.json
integration/service-worker-schema/NPM_PACKAGE_MANIFEST.json
integration/side-effects/NPM_PACKAGE_MANIFEST.json
integration/terser/NPM_PACKAGE_MANIFEST.json
integration/typings_test_ts36/NPM_PACKAGE_MANIFEST.json
integration/typings_test_ts37/NPM_PACKAGE_MANIFEST.json

115
.bazelrc
View File

@ -1,3 +1,18 @@
################################
# Settings for Angular team members only
################################
# To enable this feature check the "Remote caching" section in docs/BAZEL.md.
build:angular-team --remote_http_cache=https://storage.googleapis.com/angular-team-cache
###############################
# Typescript / Angular / Sass #
###############################
# Make compilation fast, by keeping a few copies of the compilers
# running as daemons, and cache SourceFile AST's to reduce parse time.
build --strategy=TypeScriptCompile=worker
build --strategy=AngularTemplateCompile=worker
# Enable debugging tests with --config=debug # Enable debugging tests with --config=debug
test:debug --test_arg=--node_options=--inspect-brk --test_output=streamed --test_strategy=exclusive --test_timeout=9999 --nocache_test_results test:debug --test_arg=--node_options=--inspect-brk --test_output=streamed --test_strategy=exclusive --test_timeout=9999 --nocache_test_results
@ -18,8 +33,10 @@ test:debug --test_arg=--node_options=--inspect-brk --test_output=streamed --test
# See https://github.com/bazelbuild/bazel/issues/4603 # See https://github.com/bazelbuild/bazel/issues/4603
build --symlink_prefix=dist/ build --symlink_prefix=dist/
# Performance: avoid stat'ing input files
build --watchfs
# Turn off legacy external runfiles # Turn off legacy external runfiles
build --nolegacy_external_runfiles
run --nolegacy_external_runfiles run --nolegacy_external_runfiles
test --nolegacy_external_runfiles test --nolegacy_external_runfiles
@ -33,11 +50,6 @@ build --incompatible_strict_action_env
run --incompatible_strict_action_env run --incompatible_strict_action_env
test --incompatible_strict_action_env test --incompatible_strict_action_env
# Do not build runfile trees by default. If an execution strategy relies on runfile
# symlink teee, the tree is created on-demand. See: https://github.com/bazelbuild/bazel/issues/6627
# and https://github.com/bazelbuild/bazel/commit/03246077f948f2790a83520e7dccc2625650e6df
build --nobuild_runfile_links
############################### ###############################
# Release support # # Release support #
# Turn on these settings with # # Turn on these settings with #
@ -45,10 +57,7 @@ build --nobuild_runfile_links
############################### ###############################
# Releases should always be stamped with version control info # Releases should always be stamped with version control info
# This command assumes node on the path and is a workaround for build:release --workspace_status_command=./tools/bazel_stamp_vars.sh
# https://github.com/bazelbuild/bazel/issues/4802
build:release --workspace_status_command="yarn -s ng-dev release build-env-stamp"
build:release --stamp
############################### ###############################
# Output # # Output #
@ -61,86 +70,52 @@ query --output=label_kind
# By default, failing tests don't print any output, it goes to the log file # By default, failing tests don't print any output, it goes to the log file
test --test_output=errors test --test_output=errors
# Show which actions are run under workers,
# and print all the actions running in parallel.
# Helps to demonstrate that bazel uses all the cores on the machine.
build --experimental_ui
test --experimental_ui
################################ ################################
# Settings for CircleCI # # Settings for CircleCI #
################################ ################################
# Bazel flags for CircleCI are in /.circleci/bazel.linux.rc and /.circleci/bazel.windows.rc # Bazel flags for CircleCI are in /.circleci/bazel.rc
##################################
# Settings for integration tests #
##################################
# Trick bazel into treating BUILD files under integration/bazel as being regular files
# This lets us glob() up all the files inside this integration test to make them inputs to tests
# (Note, we cannot use common --deleted_packages because the bazel version command doesn't support it)
build --deleted_packages=integration/bazel,integration/bazel/src,integration/bazel/src/hello-world,integration/bazel/test,integration/bazel/test/e2e
query --deleted_packages=integration/bazel,integration/bazel/src,integration/bazel/src/hello-world,integration/bazel/test,integration/bazel/test/e2e
################################ ################################
# Temporary Settings for Ivy # # Temporary Settings for Ivy #
################################ ################################
# To determine if the compiler used should be Ivy instead of ViewEngine, one can use `--config=ivy` # to determine if the compiler used should be Ivy or ViewEngine one can use `--define=compile=aot` on
# on any bazel target. This is a temporary flag until codebase is permanently switched to Ivy. # any bazel target. This is a temporary flag until codebase is permanently switched to Ivy.
build --define=angular_ivy_enabled=False build --define=compile=legacy
build:view-engine --define=angular_ivy_enabled=False ###############################
build:ivy --define=angular_ivy_enabled=True # Remote Build Execution support
# Turn on these settings with
# --config=remote
###############################
################################## # Load default settings for Remote Build Execution
# Remote Build Execution support # # When updating, the URLs of bazel_toolchains in packages/bazel/package.bzl
# Turn on these settings with # # may also need to be updated (see https://github.com/angular/angular/pull/27935)
# --config=remote # import %workspace%/third_party/github.com/bazelbuild/bazel-toolchains/bazelrc/bazel-0.21.0.bazelrc
##################################
# The following --define=EXECUTOR=remote will be able to be removed
# once https://github.com/bazelbuild/bazel/issues/7254 is fixed
build:remote --define=EXECUTOR=remote
# Set a higher timeout value, just in case.
build:remote --remote_timeout=600
# Increase the default number of jobs by 50% because our build has lots of # Increase the default number of jobs by 50% because our build has lots of
# parallelism # parallelism
build:remote --jobs=150 build:remote --jobs=150
build:remote --google_default_credentials
# Force remote exeuctions to consider the entire run as linux # Point to our custom execution platform; see tools/BUILD.bazel
build:remote --cpu=k8
build:remote --host_cpu=k8
# Toolchain and platform related flags
build:remote --host_javabase=@rbe_ubuntu1604_angular//java:jdk
build:remote --javabase=@rbe_ubuntu1604_angular//java:jdk
build:remote --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
build:remote --java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
build:remote --crosstool_top=@rbe_ubuntu1604_angular//cc:toolchain
build:remote --extra_toolchains=@rbe_ubuntu1604_angular//config:cc-toolchain
build:remote --extra_execution_platforms=//tools:rbe_ubuntu1604-angular build:remote --extra_execution_platforms=//tools:rbe_ubuntu1604-angular
build:remote --host_platform=//tools:rbe_ubuntu1604-angular build:remote --host_platform=//tools:rbe_ubuntu1604-angular
build:remote --platforms=//tools:rbe_ubuntu1604-angular build:remote --platforms=//tools:rbe_ubuntu1604-angular
# Remote instance and caching # Remote instance.
build:remote --remote_instance_name=projects/internal-200822/instances/default_instance build:remote --remote_instance_name=projects/internal-200822/instances/default_instance
build:remote --project_id=internal-200822
build:remote --remote_cache=remotebuildexecution.googleapis.com
build:remote --remote_executor=remotebuildexecution.googleapis.com
################################## # Do not accept remote cache.
# Saucelabs tests settings # # We need to understand the security risks of using prior build artifacts.
# Turn on these settings with # build:remote --remote_accept_cached=false
# --config=saucelabs #
##################################
# For saucelabs tests we don't want to enable flaky test attempts. Karma has its own integrated # Load any settings specific to the current user. Needs to be last statement in this
# retry mechanism and we do not want to retry unnecessarily if Karma already tried multiple times. # config, as the user configuration should be able to overwrite flags from this file.
test:saucelabs --flaky_test_attempts=1
####################################################
# User bazel configuration
# NOTE: This needs to be the *last* entry in the config.
####################################################
# Load any settings which are specific to the current user. Needs to be *last* statement
# in this config, as the user configuration should be able to overwrite flags from this file.
try-import .bazelrc.user try-import .bazelrc.user

View File

@ -1,3 +0,0 @@
3.2.0
# [NB: this comment has to be after the first line, see https://github.com/bazelbuild/bazelisk/issues/117]
# When updating the Bazel version you also need to update the RBE toolchains version in package.bzl

42
.buildkite/Dockerfile Normal file
View File

@ -0,0 +1,42 @@
# Heavily based on https://github.com/StefanScherer/dockerfiles-windows/ images.
# Combines the node windowsservercore image with the Bazel Prerequisites (https://docs.bazel.build/versions/master/install-windows.html).
# msys install taken from https://github.com/StefanScherer/dockerfiles-windows/issues/30
# VS redist install taken from https://github.com/StefanScherer/dockerfiles-windows/blob/master/apache/Dockerfile
# The nanoserver image won't work because MSYS2 does not run in it https://github.com/Alexpux/MSYS2-packages/issues/1493
# Before building this image, you must locally build node-windows:10.13.0-windowsservercore-1803.
# Clone https://github.com/StefanScherer/dockerfiles-windows/commit/4ce7101a766b9b880ac262479dd9126b64d656cf and build using
# docker build -t node-windows:10.13.0-windowsservercore-1803 --build-arg core=microsoft/windowsservercore:1803 --build-arg target=microsoft/windowsservercore:1803 .
FROM node-windows:10.13.0-windowsservercore-1803
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
# Install 7zip to extract msys2
RUN Invoke-WebRequest -UseBasicParsing 'https://www.7-zip.org/a/7z1805-x64.exe' -OutFile 7z.exe
# For some reason the last letter in the destination directory is lost. So '/D=C:\\7zip0' will extract to '/D=C:\\7zip'.
RUN Start-Process -FilePath 'C:\\7z.exe' -ArgumentList '/S', '/D=C:\\7zip0' -NoNewWindow -Wait
# Extract msys2
RUN Invoke-WebRequest -UseBasicParsing 'http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20180531.tar.xz' -OutFile msys2.tar.xz
RUN Start-Process -FilePath 'C:\\7zip\\7z' -ArgumentList 'e', 'msys2.tar.xz' -Wait
RUN Start-Process -FilePath 'C:\\7zip\\7z' -ArgumentList 'x', 'msys2.tar', '-oC:\\' -Wait
RUN Remove-Item msys2.tar.xz
RUN Remove-Item msys2.tar
RUN Remove-Item 7z.exe
RUN Remove-Item -Recurse 7zip
# Add MSYS2 to PATH, and set BAZEL_SH
RUN [Environment]::SetEnvironmentVariable('Path', $env:Path + ';C:\msys64\usr\bin', [System.EnvironmentVariableTarget]::Machine)
RUN [Environment]::SetEnvironmentVariable('BAZEL_SH', 'C:\msys64\usr\bin\bash.exe', [System.EnvironmentVariableTarget]::Machine)
# Install Microsoft Visual C++ Redistributable for Visual Studio 2015
RUN Invoke-WebRequest -UseBasicParsing 'https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x64.exe' -OutFile vc_redist.x64.exe
RUN Start-Process 'c:\\vc_redist.x64.exe' -ArgumentList '/Install', '/Passive', '/NoRestart' -NoNewWindow -Wait
RUN Remove-Item vc_redist.x64.exe
# Add a fix for https://github.com/docker/for-win/issues/2920 as entry point to the container.
SHELL ["cmd", "/c"]
COPY "fix-msys64.cmd" "C:\\fix-msys64.cmd"
ENTRYPOINT cmd /C C:\\fix-msys64.cmd && cmd /c
CMD ["cmd.exe"]

96
.buildkite/README.md Normal file
View File

@ -0,0 +1,96 @@
# BuildKite configuration
This folder contains configuration for the [BuildKite](https://buildkite.com) based CI checks for
this repository.
BuildKite is a CI provider that provides build coordination and reports while we provide the
infrastructure.
CI runs are triggered by new PRs and will show up on the GitHub checks interface, along with the
other current CI solutions.
Currently it is only used for tests on Windows platforms.
## The build pipeline
BuildKite uses a pipeline for each repository. The `pipeline.yml` file defines pipeline
[build steps](https://buildkite.com/docs/pipelines/defining-steps) for this repository.
Run results can be seen in the GitHub checks interface and in the
[pipeline dashboard](https://buildkite.com/angular/angular).
Although most configuration is done via `pipeline.yml`, some options are only available
in the online [pipeline settings](https://buildkite.com/angular/angular/settings).
## Infrastructure
BuildKite does not provide the host machines where the builds runs, providing instead the
[BuildKite Agent](https://buildkite.com/docs/agent/v3) that should be run our own infrastructure.
### Agents
This agent polls the BuildKite API for builds, runs them, and reports back the results.
Agents are the unit of concurrency: each agent can run one build at any given time.
Adding agents allows more builds to be ran at the same time.
Individual agents can have tags, and pipeline steps can target only agents with certain tags via the
`agents` field in `pipeline.yml`.
For example: agents on Windows machines are tagged as `windows`, and the Windows specific build
steps list `windows: true` in their `agents` field.
You can see the current agent pool, along with their tags, in the
[agents list](https://buildkite.com/organizations/angular/agents).
### Our host machines
We use [Google Cloud](https://cloud.google.com/) as our cloud provider, under the
[Angular project](https://console.cloud.google.com/home/dashboard?project=internal-200822).
To access this project you need need to be logged in with a Google account that's a member of
team@angular.io.
For googlers this may be your google.com account, for others it is an angular.io account.
In this project we have a number of Windows VMs running, each of them with several agents.
The `provision-windows-buildkite.ps1` file contains instructions on how to create new host VMs that
are fully configured to run the BuildKite agents as services.
Our pipeline uses [docker-buildkite-plugin](https://github.com/buildkite-plugins/docker-buildkite-plugin)
to run build steps inside docker containers.
This way we achieve isolation and hermeticity.
The `Dockerfile` file describes a custom Docker image that includes NodeJs, Yarn, and the Bazel
pre-requisites on Windows.
To upload a new version of the docker image, follow any build instructions in `Dockerfile` and then
run `docker build -t angular/node-bazel-windows:NEW_VERSION`, followed by
`docker push angular/node-bazel-windows:NEW_VERSION`.
After being pushed it should be available online, and you can use the new version in `pipeline.yml`.
## Caretaker
BuildKite status can be found at https://www.buildkitestatus.com/.
Issues related to the BuildKite setup should be escalated to the Tools Team via the current
caretaker, followed by Alex Eagle and Filipe Silva.
Support requests should be submitted via email to support@buildkite.com and cc Igor, Misko, Alex,
Jeremy and Manu
## Rollout strategy
At the moment our BuildKite CI uses 1 host VM running 4 agents, thus being capable of 4 concurrent
builds.
The only test running is `bazel test //tools/ts-api-guardian:all`, and the PR check is not
mandatory.
In the future we should add cache support to speed up the initial `yarn` install, and also Bazel
remote caching to speed up Bazel builds.
After the current setup is verified as stable and reliable the GitHub PR check can become mandatory.
The tests ran should also be expanded to cover most, if not all, of the Bazel tests.

View File

@ -0,0 +1,6 @@
@echo off
REM Fix for https://github.com/docker/for-win/issues/2920
REM echo "Fixing msys64 folder..."
REM Touch all .dll files inside C:\msys64\
forfiles /p C:\msys64\ /s /m *.dll /c "cmd /c Copy /B @path+,, >NUL"
REM echo "Fixed msys64 folder."

10
.buildkite/pipeline.yml Normal file
View File

@ -0,0 +1,10 @@
steps:
- label: windows-test
commands:
- "yarn install --frozen-lockfile --non-interactive --network-timeout 100000"
- "yarn bazel test //tools/ts-api-guardian:all --noshow_progress"
plugins:
- docker#v2.1.0:
image: "filipesilva/node-bazel-windows:0.0.2"
agents:
windows: true

View File

@ -0,0 +1,92 @@
# PowerShell script to provision a Windows Server with BuildKite
# This script follows https://buildkite.com/docs/agent/v3/windows.
# Instructions
# VM creation:
# In Google Cloud Platform, create a Compute Engine instance.
# We recommend machine type n1-highcpu-16 (16 vCPUs, 14.4 GB memory).
# Use a windows boot disk with container support such as
# "Windows Server version 1803 Datacenter Core for Containers".
# Give it a name, then click "Create".
# VM setup:
# In the Compute Engine menu, select "VM Instances". Click on the VM name you chose before.
# Click "Set Windows Password" to choose a username and password.
# Click RDP to open a remote desktop via browser, using the username and password.
# In the Windows command prompt start an elevated powershell by inputing
# "powershell -Command "Start-Process PowerShell -Verb RunAs" followed by Enter.
# Download and execute this script from GitHub, passing the token (mandatory), tags (optional)
# and number of agents (optional) as args:
# ```
# Invoke-WebRequest -Uri https://raw.githubusercontent.com/angular/angular/master/.buildkite/provision-windows-buildkite.ps1 -OutFile provision.ps1
# .\provision.ps1 -token "MY_TOKEN" -tags "windows=true,another_tag=true" -agents 4
# ```
# The VM should restart and be fully configured.
# Creating extra VMs
# You can create an image of the current VM by following the instructions below.
# https://cloud.google.com/compute/docs/instances/windows/creating-windows-os-image
# Then create a new VM and choose "Custom images".
# Script proper.
# Get the token and tags from arguments.
param (
[Parameter(Mandatory=$true)][string]$token,
[string]$tags = ""
[Int]$agents = 1
)
# Allow HTTPS
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"
# Helper to add to PATH.
# Will take current PATH so avoid running it after anything to modifies only the powershell session path.
function Add-Path ([string]$newPathItem) {
$Env:Path+= ";" + $newPathItem + ";"
[Environment]::SetEnvironmentVariable("Path",$env:Path, [System.EnvironmentVariableTarget]::Machine)
}
# Install Git for Windows
Write-Host "Installing Git for Windows."
Invoke-WebRequest -Uri https://github.com/git-for-windows/git/releases/download/v2.19.1.windows.1/Git-2.19.1-64-bit.exe -OutFile git.exe
.\git.exe /VERYSILENT /NORESTART /NOCANCEL /SP- /CLOSEAPPLICATIONS /RESTARTAPPLICATIONS /COMPONENTS="icons,ext\reg\shellhere,assoc,assoc_sh" /DIR="C:\git"
Add-Path "C:\git\bin"
Remove-Item git.exe
# Download NSSM (https://nssm.cc/) to run the BuildKite agent as a service.
Write-Host "Downloading NSSM."
Invoke-WebRequest -Uri https://nssm.cc/ci/nssm-2.24-101-g897c7ad.zip -OutFile nssm.zip
Expand-Archive -Path nssm.zip -DestinationPath C:\nssm
Add-Path "C:\nssm\nssm-2.24-101-g897c7ad\win64"
Remove-Item nssm.zip
# Run the BuildKite agent install script
Write-Host "Installing BuildKite agent."
$env:buildkiteAgentToken = $token
$env:buildkiteAgentTags = $tags
Set-ExecutionPolicy Bypass -Scope Process -Force
iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/buildkite/agent/master/install.ps1'))
# Configure the BuildKite agent clone and timestamp behavior
Add-Content C:\buildkite-agent\buildkite-agent.cfg "`ngit-clone-flags=--config core.autocrlf=input --config core.eol=lf --config core.longpaths=true --config core.symlinks=true`n"
Add-Content C:\buildkite-agent\buildkite-agent.cfg "`ntimestamp-lines=true`n"
# Register the BuildKite agent service using NSSM, so that it persists through restarts and is
# restarted if the process dies.
for ($i=1; $i -le $agents; $i++)
{
$agentName = "buildkite-agent-$i"
Write-Host "Registering $agentName as a service."
nssm.exe install $agentName "C:\buildkite-agent\bin\buildkite-agent.exe" "start"
nssm.exe set $agentName AppStdout "C:\buildkite-agent\$agentName.log"
nssm.exe set $agentName AppStderr "C:\buildkite-agent\$agentName.log"
nssm.exe status $agentName
nssm.exe start $agentName
nssm.exe status $agentName
}
# Restart the machine.
Restart-Computer

View File

@ -12,8 +12,8 @@ We use this as a symmetric AES encryption key to encrypt tokens like
a GitHub token that enables publishing snapshots. a GitHub token that enables publishing snapshots.
To create the github_token file, we take this approach: To create the github_token file, we take this approach:
- Find the angular-builds:token in the internal pw database - Find the angular-builds:token in http://valentine
- Go inside the CircleCI default docker image so you use the same version of openssl as we will at runtime: `docker run --rm -it circleci/node:10.12` - Go inside the CircleCI default docker image so you use the same version of openssl as we will at runtime: `docker run --rm -it circleci/node:10.12`
- echo "https://[token]:@github.com" > credentials - echo "https://[token]:@github.com" > credentials
- openssl aes-256-cbc -e -in credentials -out .circleci/github_token -k $KEY - openssl aes-256-cbc -e -in credentials -out .circleci/github_token -k $KEY
- If needed, base64-encode the result so you can copy-paste it out of docker: `base64 github_token` - If needed, base64-encode the result so you can copy-paste it out of docker: `base64 github_token`

View File

@ -1,15 +0,0 @@
# Settings in this file should be OS agnostic. Use the bazel.<OS>.rc files for OS specific settings.
# Don't be spammy in the logs
build --noshow_progress
# Print all the options that apply to the build.
# This helps us diagnose which options override others
# (e.g. /etc/bazel.bazelrc vs. tools/bazel.rc)
build --announce_rc
# Retry in the event of flakes, eg. https://circleci.com/gh/angular/angular/31309
test --flaky_test_attempts=2
# More details on failures
build --verbose_failures=true

View File

@ -1,30 +0,0 @@
# These options are enabled when running on CI
# We do this by copying this file to /etc/bazel.bazelrc at the start of the build.
# See documentation in /docs/BAZEL.md
# Import config items common to both Linux and Windows setups.
# https://docs.bazel.build/versions/master/guide.html#bazelrc-syntax-and-semantics
try-import %workspace%/.circleci/bazel.common.rc
# Save downloaded repositories in a location that can be cached by CircleCI. This helps us
# speeding up the analysis time significantly with Bazel managed node dependencies on the CI.
build --repository_cache=/home/circleci/bazel_repository_cache
# Workaround https://github.com/bazelbuild/bazel/issues/3645
# Bazel doesn't calculate the memory ceiling correctly when running under Docker.
# Limit Bazel to consuming resources that fit in CircleCI "xlarge" class
# https://circleci.com/docs/2.0/configuration-reference/#resource_class
build --local_cpu_resources=8
build --local_ram_resources=14336
# All build executed remotely should be done using our RBE configuration.
build:remote --google_default_credentials
# Upload to GCP's Build Status viewer to allow for us to have better viewing of execution/build
# logs. This is only done on CI as the BES (GCP's Build Status viewer) API requires credentials
# from service accounts, rather than end user accounts.
build:remote --bes_backend=buildeventservice.googleapis.com
build:remote --bes_timeout=30s
build:remote --bes_results_url="https://source.cloud.google.com/results/invocations/"
build --config=remote

30
.circleci/bazel.rc Normal file
View File

@ -0,0 +1,30 @@
# These options are enabled when running on CI
# We do this by copying this file to /etc/bazel.bazelrc at the start of the build.
# See documentation in /docs/BAZEL.md
# Save downloaded repositories in a location that can be cached by CircleCI. This helps us
# speeding up the analysis time significantly with Bazel managed node dependencies on the CI.
build --repository_cache=/home/circleci/bazel_repository_cache
# Don't be spammy in the logs
# TODO(gmagolan): Hide progress again once build performance improves
# Presently, CircleCI can timeout during bazel test ... with the following
# error: Too long with no output (exceeded 10m0s)
# build --noshow_progress
# Print all the options that apply to the build.
# This helps us diagnose which options override others
# (e.g. /etc/bazel.bazelrc vs. tools/bazel.rc)
build --announce_rc
# Workaround https://github.com/bazelbuild/bazel/issues/3645
# Bazel doesn't calculate the memory ceiling correctly when running under Docker.
# Limit Bazel to consuming resources that fit in CircleCI "xlarge" class
# https://circleci.com/docs/2.0/configuration-reference/#resource_class
build --local_resources=14336,8.0,1.0
# Retry in the event of flakes, eg. https://circleci.com/gh/angular/angular/31309
test --flaky_test_attempts=2
# More details on failures
build --verbose_failures=true

View File

@ -1,21 +0,0 @@
# These options are enabled when running on CI
# We do this by copying this file to $env:ProgramData\bazel.bazelrc at the start of the build.
# See documentation in /docs/BAZEL.md
# Import config items common to both Linux and Windows setups.
# https://docs.bazel.build/versions/master/guide.html#bazelrc-syntax-and-semantics
try-import %workspace%/.circleci/bazel.common.rc
# Save downloaded repositories in a location that can be cached by CircleCI. This helps us
# speeding up the analysis time significantly with Bazel managed node dependencies on the CI.
build --repository_cache=C:/Users/circleci/bazel_repository_cache
# Manually set the local resources used in windows CI runs
build --local_ram_resources=13500
build --local_cpu_resources=4
# All windows jobs run on master and should use http caching
build --remote_http_cache=https://storage.googleapis.com/angular-team-cache
build --remote_accept_cached=true
build --remote_upload_local_results=true
build --google_default_credentials

View File

@ -7,220 +7,128 @@
# To validate changes, use an online parser, eg. # To validate changes, use an online parser, eg.
# http://yaml-online-parser.appspot.com/ # http://yaml-online-parser.appspot.com/
# CircleCI configuration version # Note that the browser docker image comes with Chrome and Firefox preinstalled. This is just
# Version 2.1 allows for extra config reuse features # needed for jobs that run tests without Bazel. Bazel runs tests with browsers that will be
# https://circleci.com/docs/2.0/reusing-config/#getting-started-with-config-reuse # fetched by the Webtesting rules. Therefore for jobs that run tests with Bazel, we don't need a
version: 2.1 # docker image with browsers pre-installed.
# **NOTE 1**: If you change the version of the `*-browsers` docker image, make sure the
# `CI_CHROMEDRIVER_VERSION_ARG` env var (in `.circleci/env.sh`) points to a ChromeDriver
# version that is compatible with the Chrome version in the image.
# **NOTE 2**: If you change the version of the docker images, also change the `cache_key` suffix.
var_1: &default_docker_image circleci/node:10.12
var_2: &browsers_docker_image circleci/node:10.12-browsers
# We don't want to include the current branch name in the cache key because that would prevent # We don't want to include the current branch name in the cache key because that would prevent
# PRs from being able to restore the cache since the branch names are always different for PRs. # PRs from being able to restore the cache since the branch names are always different for PRs.
# The cache key should only consist of dynamic values that change whenever something in the # The cache key should only consist of dynamic values that change whenever something in the
# cache changes. For example: # cache changes. For example:
# 1) yarn lock file changes --> cached "node_modules" are different. # 1) yarn lock file changes --> cached "node_modules" are different.
# 2) bazel repository definitions change --> cached bazel repositories are different. # 2) bazel repository definitions change --> cached bazel repositories are different.
# Windows needs its own cache key because binaries in node_modules are different. # **NOTE 1 **: If you change the cache key prefix, also sync the restore_cache fallback to match.
# **NOTE 1 **: If you change the cache key prefix, also sync the cache_key_fallback to match.
# **NOTE 2 **: Keep the static part of the cache key as prefix to enable correct fallbacks. # **NOTE 2 **: Keep the static part of the cache key as prefix to enable correct fallbacks.
# See https://circleci.com/docs/2.0/caching/#restoring-cache for how prefixes work in CircleCI. # See https://circleci.com/docs/2.0/caching/#restoring-cache for how prefixes work in CircleCI.
var_3: &cache_key v7-angular-node-12-{{ checksum ".bazelversion" }}-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "packages/bazel/package.bzl" }}-{{ checksum "aio/yarn.lock" }} var_3: &cache_key v3-angular-node-10.12-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "packages/bazel/package.bzl" }}-{{ checksum "aio/yarn.lock" }}
# We invalidate the cache if the Bazel version changes because otherwise the `bazelisk` cache
# folder will contain all previously used versions and ultimately cause the cache restoring to
# be slower due to its growing size.
var_4: &cache_key_fallback v7-angular-node-12-{{ checksum ".bazelversion" }}
var_3_win: &cache_key_win v7-angular-win-node-12-{{ checksum ".bazelversion" }}-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "packages/bazel/package.bzl" }}-{{ checksum "aio/yarn.lock" }}
var_4_win: &cache_key_win_fallback v7-angular-win-node-12-{{ checksum ".bazelversion" }}
# Workspace initially persisted by the `setup` job, and then enhanced by `build-npm-packages` and # Initializes the CI environment by setting up common environment variables.
# `build-ivy-npm-packages`. var_4: &init_environment
run:
name: Initializing environment (setting up variables, overwriting Yarn)
# Overwrite the yarn installed in the docker container with our own version.
command: |
./.circleci/env.sh
ourYarn=$(realpath ./third_party/github.com/yarnpkg/yarn/releases/download/v1.13.0/bin/yarn.js)
sudo chmod a+x $ourYarn
sudo ln -fs $ourYarn /usr/local/bin/yarn
echo "Yarn version: $(yarn --version)"
# Add GitHub to known hosts.
mkdir -p ~/.ssh
echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==' >> ~/.ssh/known_hosts
# use git+ssh instead of https
git config --global url."ssh://git@github.com".insteadOf "https://github.com" || true
git config --global gc.auto 0 || true
var_5: &setup_bazel_remote_execution
run:
name: "Setup bazel RBE remote execution"
command: |
openssl aes-256-cbc -d -in .circleci/gcp_token -k "$CI_REPO_NAME" -out /home/circleci/.gcp_credentials
echo "export GOOGLE_APPLICATION_CREDENTIALS=/home/circleci/.gcp_credentials" >> $BASH_ENV
sudo bash -c "echo 'build --config=remote' >> /etc/bazel.bazelrc"
# Settings common to each job
var_6: &job_defaults
working_directory: ~/ng
docker:
- image: *default_docker_image
# After checkout, rebase on top of target branch.
var_7: &post_checkout
run:
name: Rebase PR on target branch
command: >
if [[ -n "${CIRCLE_PR_NUMBER}" ]]; then
# User is required for rebase.
git config user.name "angular-ci"
git config user.email "angular-ci"
# Rebase PR on top of target branch.
node tools/rebase-pr.js angular/angular ${CIRCLE_PR_NUMBER}
else
echo "This build is not over a PR, nothing to do."
fi
var_8: &yarn_install
run:
name: Running Yarn install
command: |
# Yarn's requests sometimes take more than 10mins to complete.
# Print something to stdout, to prevent CircleCI from failing due to not output.
while true; do sleep 60; echo "[`date`] Keeping alive..."; done &
KEEP_ALIVE_PID=$!
yarn install --frozen-lockfile --non-interactive
kill $KEEP_ALIVE_PID
var_9: &setup_circleci_bazel_config
run:
name: Setting up CircleCI bazel configuration
command: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
var_10: &restore_cache
restore_cache:
keys:
- *cache_key
# This fallback should be the cache_key without variables.
- v3-angular-node-10.12-
# Branch filter that can be specified for jobs that should only run on publish branches
# (e.g. master or the patch branch)
var_12: &publish_branches_filter
branches:
only:
- master
# e.g. 7.0.x, 7.1.x, etc.
- /\d+\.\d+\.x/
# Workspace initially persisted by the `install` job, and then enhanced by `test_aio` and
# `build-npm-packages`.
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs # https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
# https://circleci.com/blog/deep-diving-into-circleci-workspaces/ # https://circleci.com/blog/deep-diving-into-circleci-workspaces/
var_7: &workspace_location ~/ var_13: &attach_workspace
attach_workspace:
at: ~/
# Filter to run a job on builds for pull requests only. version: 2
var_8: &only_on_pull_requests
filters:
branches:
only:
- /pull\/\d+/
# Filter to skip a job on builds for pull requests.
var_9: &skip_on_pull_requests
filters:
branches:
ignore:
- /pull\/\d+/
# Filter to run a job on builds for the master branch only.
var_10: &only_on_master
filters:
branches:
only:
- master
# Executor Definitions
# https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-executors
# **NOTE 1**: Pin to exact images using an ID (SHA). See https://circleci.com/docs/2.0/circleci-images/#using-a-docker-image-id-to-pin-an-image-to-a-fixed-version.
# (Using the tag in not necessary when pinning by ID, but include it anyway for documentation purposes.)
# **NOTE 2**: If you change the version of the docker images, also change the `cache_key` suffix.
executors:
default-executor:
parameters:
resource_class:
type: string
default: medium
docker:
- image: circleci/node:12.14.1@sha256:f9de24fc0017059cc42ef7d07db060008af65a98b1f0cdd1ef3339213226bf6d
resource_class: << parameters.resource_class >>
working_directory: ~/ng
windows-executor:
working_directory: ~/ng
resource_class: windows.medium
# CircleCI windows VMs do have the GitBash shell available:
# https://github.com/CircleCI-Public/windows-preview-docs#shells
# But in this specific case we really should not use it because Bazel must not be ran from
# GitBash. These issues discuss why:
# https://github.com/bazelbuild/bazel/issues/5751
# https://github.com/bazelbuild/bazel/issues/5724#issuecomment-410194038
# https://github.com/bazelbuild/bazel/issues/6339#issuecomment-441600879
shell: powershell.exe -ExecutionPolicy Bypass
machine:
# Windows preview image that includes the following:
# - Visual Studio 2019 build tools
# - Node 12
# - yarn 1.17
# - Python 3 3.7.4
image: windows-server-2019-vs2019:201908-02
# Command Definitions
# https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-commands
commands:
custom_attach_workspace:
description: Attach workspace at a predefined location
steps:
- attach_workspace:
at: *workspace_location
# Install shared libs used by Chrome that is either provisioned by
# rules_webtesting or by puppeteer.
install_chrome_libs:
description: Install shared Chrome libs
steps:
- run:
name: Install shared Chrome libs
command: |
sudo apt-get update
# Install GTK+ graphical user interface (libgtk-3-0), advanced linux sound architecture (libasound2)
# and network security service libraries (libnss3) & X11 Screen Saver extension library (libssx1)
# which are dependencies of chrome & needed for karma & protractor headless chrome tests.
# This is a very small install which takes around 7s in comparing to using the full
# circleci/node:x.x.x-browsers image.
sudo apt-get -y install libgtk-3-0 libasound2 libnss3 libxss1
# Install java runtime which is required by some integration tests such as
# //integration:hello_world__closure_test, //integration:i18n_test and
# //integration:ng_elements_test to run the closure compiler
install_java:
description: Install java
steps:
- run:
name: Install java
command: |
sudo apt-get update
# Install java runtime
sudo apt-get install default-jre
# Initializes the CI environment by setting up common environment variables.
init_environment:
description: Initializing environment (setting up variables)
steps:
- run:
name: Set up environment
environment:
CIRCLE_GIT_BASE_REVISION: << pipeline.git.base_revision >>
CIRCLE_GIT_REVISION: << pipeline.git.revision >>
command: ./.circleci/env.sh
- run:
# Configure git as the CircleCI `checkout` command does.
# This is needed because we only checkout on the setup job.
# Add GitHub to known hosts
name: Configure git
command: |
mkdir -p ~/.ssh
echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==' >> ~/.ssh/known_hosts
git config --global url."ssh://git@github.com".insteadOf "https://github.com" || true
git config --global gc.auto 0 || true
# Normally this would be an individual job instead of a command.
# But startup and setup time for each individual windows job are high enough to discourage
# many small jobs, so instead we use a command for setup unless the gain becomes significant.
setup_win:
description: Setup windows node environment
steps:
# Use the Linux workspace directly, as it already has checkout, rebased and node modules.
- custom_attach_workspace
# Install Bazel pre-requisites that aren't in the preconfigured CircleCI Windows VM.
- run: ./.circleci/windows-env.ps1
- run: node --version
- run: yarn --version
- restore_cache:
keys:
- *cache_key_win
- *cache_key_win_fallback
# Reinstall to get windows binaries.
- run: yarn install --frozen-lockfile --non-interactive
# Install @bazel/bazelisk globally and use that for the first run.
# Workaround for https://github.com/bazelbuild/rules_nodejs/issues/894
# NB: the issue was for @bazel/bazel but the same problem applies to @bazel/bazelisk
- run: yarn global add @bazel/bazelisk@$env:BAZELISK_VERSION
- run: bazelisk info
notify_webhook_on_fail:
description: Notify a webhook about failure
parameters:
# `webhook_url_env_var` are secret env vars defined in CircleCI project settings.
# The URLs come from https://angular-team.slack.com/apps/A0F7VRE7N-circleci.
webhook_url_env_var:
type: env_var_name
steps:
- run:
when: on_fail
command: |
notificationJson="{\"text\":\":x: \`$CIRCLE_JOB\` job for $CIRCLE_BRANCH branch failed on build $CIRCLE_BUILD_NUM: $CIRCLE_BUILD_URL :scream:\"}"
curl --request POST --header "Content-Type: application/json" --data "$notificationJson" ${<< parameters.webhook_url_env_var >>}
# Job definitions
# Jobs can include parameters that are passed in the workflow job invocation.
# https://circleci.com/docs/2.0/reusing-config/#authoring-parameterized-jobs
jobs: jobs:
setup: setup:
executor: default-executor <<: *job_defaults
steps: steps:
- checkout - checkout
- init_environment - *post_checkout
- run:
name: Rebase PR on target branch
# After checkout, rebase on top of target branch.
command: >
if [[ -n "${CIRCLE_PR_NUMBER}" ]]; then
# User is required for rebase.
git config user.name "angular-ci"
git config user.email "angular-ci"
# Rebase PR on top of target branch.
node tools/rebase-pr.js
else
echo "This build is not over a PR, nothing to do."
fi
# This cache is saved in the build-npm-packages so that Bazel cache is also included. # This cache is saved in the build-npm-packages so that Bazel cache is also included.
- restore_cache: - *restore_cache
keys: - *init_environment
- *cache_key - *yarn_install
- *cache_key_fallback
- run:
name: Running Yarn install
command: yarn install --frozen-lockfile --non-interactive
# Yarn's requests sometimes take more than 10mins to complete.
no_output_timeout: 45m
- run: yarn --cwd aio install --frozen-lockfile --non-interactive - run: yarn --cwd aio install --frozen-lockfile --non-interactive
# Make the bazel directories and add a file to them if they don't exist already so that # Make the bazel directories and add a file to them if they don't exist already so that
# persist_to_workspace does not fail. # persist_to_workspace does not fail.
@ -230,77 +138,151 @@ jobs:
touch ~/bazel_repository_cache/MARKER touch ~/bazel_repository_cache/MARKER
fi fi
# Persist any changes at this point to be reused by further jobs. # Persist any changes at this point to be reused by further jobs.
# **NOTE**: To add new content to the workspace, always persist on the same root. # **NOTE 1 **: Folders persisted here should be kept in sync with `var_13: &attach_workspace`.
# **NOTE 2 **: To add new content to the workspace, always persist on the same root.
- persist_to_workspace: - persist_to_workspace:
root: *workspace_location root: ~/
paths: paths:
- ./ng - ./ng
- ./bazel_repository_cache - ./bazel_repository_cache
lint: lint:
executor: default-executor <<: *job_defaults
steps: steps:
- custom_attach_workspace - *attach_workspace
- init_environment - *init_environment
- run: yarn -s tslint - run: 'yarn bazel:format -mode=check ||
- run: yarn -s ng-dev format changed $CI_GIT_BASE_REVISION --check (echo "BUILD files not formatted. Please run ''yarn bazel:format''" ; exit 1)'
- run: yarn -s ts-circular-deps:check # Run the skylark linter to check our Bazel rules
- run: yarn -s ng-dev commit-message validate-range --range $CI_COMMIT_RANGE - run: 'yarn bazel:lint ||
(echo -e "\n.bzl files have lint errors. Please run ''yarn bazel:lint-fix''"; exit 1)'
- run: yarn gulp lint
test:
<<: *job_defaults
resource_class: xlarge
steps:
- *attach_workspace
- *init_environment
- *setup_circleci_bazel_config
# Setup remote execution and run RBE-compatible tests.
- *setup_bazel_remote_execution
- run: yarn bazel test //... --build_tag_filters=-ivy-only --test_tag_filters=-ivy-only,-local
# Now run RBE incompatible tests locally.
- run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
- run: yarn bazel test //... --build_tag_filters=-ivy-only,local --test_tag_filters=-ivy-only,local
# Temporary job to test what will happen when we flip the Ivy flag to true
test_ivy_aot:
<<: *job_defaults
resource_class: xlarge
steps:
- *attach_workspace
- *init_environment
- *setup_circleci_bazel_config
- *setup_bazel_remote_execution
# We need to explicitly specify the --symlink_prefix option because otherwise we would
# not be able to easily find the output bin directory when uploading artifacts for size
# measurements.
- run: yarn test-ivy-aot //... --symlink_prefix=dist/
# Publish bundle artifacts which will be used to calculate the size change. **Note**: Make
# sure that the size plugin from the Angular robot fetches the artifacts from this CircleCI
# job (see .github/angular-robot.yml). Additionally any artifacts need to be stored with the
# following path format: "{projectName}/{context}/{fileName}". This format is necessary
# because otherwise the bot is not able to pick up the artifacts from CircleCI. See:
# https://github.com/angular/github-robot/blob/master/functions/src/plugins/size.ts#L392-L394
- store_artifacts:
path: dist/bin/packages/core/test/bundling/hello_world/bundle.min.js
destination: core/hello_world/bundle
- store_artifacts:
path: dist/bin/packages/core/test/bundling/todo/bundle.min.js
destination: core/todo/bundle
- store_artifacts:
path: dist/bin/packages/core/test/bundling/hello_world/bundle.min.js.br
destination: core/hello_world/bundle.br
- store_artifacts:
path: dist/bin/packages/core/test/bundling/todo/bundle.min.js.br
destination: core/todo/bundle.br
test_aio: test_aio:
executor: default-executor <<: *job_defaults
docker:
# Needed because the AIO tests and the PWA score test depend on Chrome being available.
- image: *browsers_docker_image
steps: steps:
- custom_attach_workspace - *attach_workspace
- init_environment - *init_environment
- install_chrome_libs
# Build aio # Build aio
- run: yarn --cwd aio build --progress=false - run: yarn --cwd aio build --progress=false
# Lint the code # Lint the code
- run: yarn --cwd aio lint - run: yarn --cwd aio lint
# Run PWA-score tests
# (Run before unit and e2e tests, which destroy the `dist/` directory.)
- run: yarn --cwd aio test-pwa-score-localhost $CI_AIO_MIN_PWA_SCORE
# Check the bundle sizes.
# (Run before unit and e2e tests, which destroy the `dist/` directory.)
- run: yarn --cwd aio payload-size
# Run unit tests # Run unit tests
- run: yarn --cwd aio test --progress=false --watch=false - run: yarn --cwd aio test --progress=false --watch=false
# Run e2e tests # Run e2e tests
- run: yarn --cwd aio e2e --configuration=ci - run: yarn --cwd aio e2e --configuration=ci
# Run PWA-score tests # Run unit tests for Firebase redirects
- run: yarn --cwd aio test-pwa-score-localhost $CI_AIO_MIN_PWA_SCORE - run: yarn --cwd aio redirects-test
# Run accessibility tests
- run: yarn --cwd aio test-a11y-score-localhost
deploy_aio: deploy_aio:
executor: default-executor <<: *job_defaults
docker:
# Needed because before deploying the deploy-production script runs the PWA score tests.
- image: *browsers_docker_image
steps: steps:
- custom_attach_workspace - *attach_workspace
- init_environment - *init_environment
- install_chrome_libs
# Deploy angular.io to production (if necessary) # Deploy angular.io to production (if necessary)
- run: setPublicVar_CI_STABLE_BRANCH - run: setPublicVar CI_STABLE_BRANCH "$(npm info @angular/core dist-tags.latest | sed -r 's/^\s*([0-9]+\.[0-9]+)\.[0-9]+.*$/\1.x/')"
- run: yarn --cwd aio deploy-production - run: yarn --cwd aio deploy-production
test_aio_local: test_aio_local:
parameters: <<: *job_defaults
viewengine: docker:
type: boolean # Needed because the AIO tests and the PWA score test depend on Chrome being available.
default: false - image: *browsers_docker_image
executor: default-executor
steps: steps:
- custom_attach_workspace - *attach_workspace
- init_environment - *init_environment
- install_chrome_libs
# Build aio (with local Angular packages) # Build aio (with local Angular packages)
- run: yarn --cwd aio build-local<<# parameters.viewengine >>-with-viewengine<</ parameters.viewengine >>-ci - run: yarn --cwd aio build-local --progress=false
# Run PWA-score tests
# (Run before unit and e2e tests, which destroy the `dist/` directory.)
- run: yarn --cwd aio test-pwa-score-localhost $CI_AIO_MIN_PWA_SCORE
# Run unit tests # Run unit tests
- run: yarn --cwd aio test --progress=false --watch=false - run: yarn --cwd aio test --progress=false --watch=false
# Run e2e tests # Run e2e tests
- run: yarn --cwd aio e2e --configuration=ci - run: yarn --cwd aio e2e --configuration=ci
# Run PWA-score tests
- run: yarn --cwd aio test-pwa-score-localhost $CI_AIO_MIN_PWA_SCORE test_aio_local_ivy:
<<: *job_defaults
steps:
- *attach_workspace
- *init_environment
# Rename the Ivy packages dist folder to "dist/packages-dist" as the AIO
# package installer picks up the locally built packages from that location.
# *Note*: We could also adjust the packages installer, but given we won't have
# two different folders of Angular distributions in the future, it's likely not
# worth the efforts to change the AIO packages installer.
- run: mv dist/packages-dist-ivy-aot dist/packages-dist
# Build aio with Ivy (using local Angular packages)
- run: yarn --cwd aio build-with-ivy --progress=false
test_aio_tools: test_aio_tools:
executor: default-executor <<: *job_defaults
steps: steps:
- custom_attach_workspace - *attach_workspace
- init_environment - *init_environment
# Install # Install
- run: yarn --cwd aio install --frozen-lockfile --non-interactive - run: yarn --cwd aio install --frozen-lockfile --non-interactive
- run: yarn --cwd aio extract-cli-command-docs - run: yarn --cwd aio extract-cli-command-docs
@ -308,14 +290,57 @@ jobs:
- run: yarn --cwd aio tools-test - run: yarn --cwd aio tools-test
- run: ./aio/aio-builds-setup/scripts/test.sh - run: ./aio/aio-builds-setup/scripts/test.sh
test_docs_examples:
<<: *job_defaults
docker:
# Needed because the example e2e tests depend on Chrome.
- image: *browsers_docker_image
parallelism: 4
resource_class: xlarge
steps:
- *attach_workspace
- *init_environment
# Install aio
- run: yarn --cwd aio install --frozen-lockfile --non-interactive
# Run examples tests. The "CIRCLE_NODE_INDEX" will be set if "parallelism" is enabled.
# Since the parallelism is set to "3", there will be three parallel CircleCI containers
# with either "0", "1" or "2" as node index. This can be passed to the "--shard" argument.
- run: yarn --cwd aio example-e2e --setup --local --cliSpecsConcurrency=5 --shard=${CIRCLE_NODE_INDEX}/${CIRCLE_NODE_TOTAL}
test_docs_examples_ivy:
<<: *job_defaults
docker:
# Needed because the example e2e tests depend on Chrome.
- image: *browsers_docker_image
resource_class: xlarge
# We increase the parallelism here to five while the "test_docs_examples" job runs with
# a parallelism of four. This is necessary because this job also need to run NGCC which
# takes up more time and we don't want these jobs to impact the overall CI turnaround.
parallelism: 5
steps:
- *attach_workspace
- *init_environment
# Install aio
- run: yarn --cwd aio install --frozen-lockfile --non-interactive
# Rename the Ivy packages dist folder to "dist/packages-dist" as the AIO
# package installer picks up the locally built packages from that location.
# *Note*: We could also adjust the packages installer, but given we won't have
# two different folders of Angular distributions in the future, we should keep
# the packages installer unchanged.
- run: mv dist/packages-dist-ivy-aot dist/packages-dist
# Run examples tests with ivy. The "CIRCLE_NODE_INDEX" will be set if "parallelism" is enabled.
# Since the parallelism is set to "3", there will be three parallel CircleCI containers
# with either "0", "1" or "2" as node index. This can be passed to the "--shard" argument.
- run: yarn --cwd aio example-e2e --setup --local --ivy --cliSpecsConcurrency=5 --shard=${CIRCLE_NODE_INDEX}/${CIRCLE_NODE_TOTAL}
# This job should only be run on PR builds, where `CI_PULL_REQUEST` is not `false`. # This job should only be run on PR builds, where `CI_PULL_REQUEST` is not `false`.
aio_preview: aio_preview:
executor: default-executor <<: *job_defaults
environment: environment:
AIO_SNAPSHOT_ARTIFACT_PATH: &aio_preview_artifact_path 'aio/tmp/snapshot.tgz' AIO_SNAPSHOT_ARTIFACT_PATH: &aio_preview_artifact_path 'aio/tmp/snapshot.tgz'
steps: steps:
- custom_attach_workspace - *attach_workspace
- init_environment - *init_environment
- run: ./aio/scripts/build-artifacts.sh $AIO_SNAPSHOT_ARTIFACT_PATH $CI_PULL_REQUEST $CI_COMMIT - run: ./aio/scripts/build-artifacts.sh $AIO_SNAPSHOT_ARTIFACT_PATH $CI_PULL_REQUEST $CI_COMMIT
- store_artifacts: - store_artifacts:
path: *aio_preview_artifact_path path: *aio_preview_artifact_path
@ -326,16 +351,19 @@ jobs:
# This job should only be run on PR builds, where `CI_PULL_REQUEST` is not `false`. # This job should only be run on PR builds, where `CI_PULL_REQUEST` is not `false`.
test_aio_preview: test_aio_preview:
executor: default-executor <<: *job_defaults
docker:
# Needed because the test-preview script runs e2e tests and the PWA score test with Chrome.
- image: *browsers_docker_image
steps: steps:
- custom_attach_workspace - *attach_workspace
- init_environment - *init_environment
- install_chrome_libs
- run: yarn --cwd aio install --frozen-lockfile --non-interactive - run: yarn --cwd aio install --frozen-lockfile --non-interactive
- run: - run:
name: Wait for preview and run tests name: Wait for preview and run tests
command: node aio/scripts/test-preview.js $CI_PULL_REQUEST $CI_COMMIT $CI_AIO_MIN_PWA_SCORE command: node aio/scripts/test-preview.js $CI_PULL_REQUEST $CI_COMMIT $CI_AIO_MIN_PWA_SCORE
# The `build-npm-packages` tasks exist for backwards-compatibility with old scripts and # The `build-npm-packages` tasks exist for backwards-compatibility with old scripts and
# tests that rely on the pre-Bazel `dist/packages-dist` output structure (build.sh). # tests that rely on the pre-Bazel `dist/packages-dist` output structure (build.sh).
# Having multiple jobs that independently build in this manner duplicates some work; we build # Having multiple jobs that independently build in this manner duplicates some work; we build
@ -345,20 +373,21 @@ jobs:
# Build the view engine npm packages. No new jobs should depend on this. # Build the view engine npm packages. No new jobs should depend on this.
build-npm-packages: build-npm-packages:
executor: <<: *job_defaults
name: default-executor resource_class: xlarge
resource_class: medium
steps: steps:
- custom_attach_workspace - *attach_workspace
- init_environment - *init_environment
- run: node scripts/build/build-packages-dist.js - *setup_circleci_bazel_config
- *setup_bazel_remote_execution
- run: scripts/build-packages-dist.sh
# Save the npm packages from //packages/... for other workflow jobs to read # Save the npm packages from //packages/... for other workflow jobs to read
- persist_to_workspace: - persist_to_workspace:
root: *workspace_location root: ~/
paths: paths:
- ng/dist/packages-dist - ng/dist/packages-dist
- ng/dist/zone.js-dist
# Save dependencies and bazel repository cache to use on subsequent runs. # Save dependencies and bazel repository cache to use on subsequent runs.
- save_cache: - save_cache:
@ -367,40 +396,223 @@ jobs:
- "node_modules" - "node_modules"
- "aio/node_modules" - "aio/node_modules"
- "~/bazel_repository_cache" - "~/bazel_repository_cache"
- "~/.cache/bazelisk"
# Build the ivy npm packages.
build-ivy-npm-packages:
<<: *job_defaults
resource_class: xlarge
steps:
- *attach_workspace
- *init_environment
- *setup_circleci_bazel_config
- *setup_bazel_remote_execution
- run: scripts/build-ivy-npm-packages.sh
# Save the npm packages from //packages/... for other workflow jobs to read
- persist_to_workspace:
root: ~/
paths:
- ng/dist/packages-dist-ivy-aot
# We run the integration tests outside of Bazel for now.
# They are a separate workflow job so that they can be easily re-run.
# When the tests are ported to bazel test targets, they should move to the "test"
# job above, as part of the bazel test command. That has flaky_test_attempts so the
# need to re-run manually should be alleviated.
# See comments inside the integration/run_tests.sh script.
integration_test:
<<: *job_defaults
parallelism: 4
docker:
# Needed because the integration tests expect Chrome to be installed (e.g cli-hello-world)
- image: *browsers_docker_image
# Note: we run Bazel in one of the integration tests, and it can consume >2G
# of memory. Together with the system under test, this can exhaust the RAM
# on a 4G worker so we use a larger machine here too.
resource_class: xlarge
steps:
- *attach_workspace
- *init_environment
# Runs the integration tests in parallel across multiple CircleCI container instances. The
# amount of container nodes for this job is controlled by the "parallelism" option.
- run: ./integration/run_tests.sh ${CIRCLE_NODE_INDEX} ${CIRCLE_NODE_TOTAL}
# This job updates the content of repos like github.com/angular/core-builds
# for every green build on angular/angular.
publish_snapshot:
<<: *job_defaults
steps:
# See below - ideally this job should not trigger for non-upstream builds.
# But since it does, we have to check this condition.
- run:
name: Skip this job for Pull Requests and Fork builds
# Note: Using `CIRCLE_*` env variables (instead of those defined in `env.sh` so that this
# step can be run before `init_environment`.
command: >
if [[ -n "${CIRCLE_PR_NUMBER}" ]] ||
[[ "$CIRCLE_PROJECT_USERNAME" != "angular" ]] ||
[[ "$CIRCLE_PROJECT_REPONAME" != "angular" ]]; then
circleci step halt
fi
- *attach_workspace
- *init_environment
# CircleCI has a config setting to force SSH for all github connections
# This is not compatible with our mechanism of using a Personal Access Token
# Clear the global setting
- run: git config --global --unset "url.ssh://git@github.com.insteadof"
- run:
name: Decrypt github credentials
command: 'openssl aes-256-cbc -d -in .circleci/github_token -k "${KEY}" -out ~/.git_credentials'
- run: ./scripts/ci/publish-build-artifacts.sh
aio_monitoring:
<<: *job_defaults
docker:
# This job needs Chrome to be globally installed because the tests run with Protractor
# which does not load the browser through the Bazel webtesting rules.
- image: *browsers_docker_image
steps:
- *attach_workspace
- *init_environment
- run:
name: Run tests against the deployed apps
command: ./aio/scripts/test-production.sh $CI_AIO_MIN_PWA_SCORE
- run:
name: Notify caretaker about failure
# `$SLACK_CARETAKER_WEBHOOK_URL` is a secret env var defined in CircleCI project settings.
# The URL comes from https://angular-team.slack.com/apps/A0F7VRE7N-circleci.
command: 'curl --request POST --header "Content-Type: application/json" --data "{\"text\":\":x: \`$CIRCLE_JOB\` job failed on build $CIRCLE_BUILD_NUM: $CIRCLE_BUILD_URL :scream:\"}" $SLACK_CARETAKER_WEBHOOK_URL'
when: on_fail
legacy-unit-tests-saucelabs:
<<: *job_defaults
# In order to avoid the bottleneck of having a slow host machine, we acquire a better
# container for this job. This is necessary because we launch a lot of browsers concurrently
# and therefore the tunnel and Karma need to process a lot of file requests and tests.
resource_class: xlarge
steps:
- *attach_workspace
- *init_environment
- run:
name: Preparing environment for running tests on Saucelabs.
command: |
setPublicVar KARMA_JS_BROWSERS $(node -e 'console.log(require("./browser-providers.conf").sauceAliases.CI_REQUIRED.join(","))')
setSecretVar SAUCE_ACCESS_KEY $(echo $SAUCE_ACCESS_KEY | rev)
- run:
name: Starting Saucelabs tunnel
command: ./scripts/saucelabs/start-tunnel.sh
background: true
- run: yarn tsc -p packages
- run: yarn tsc -p modules
# Waits for the Saucelabs tunnel to be ready. This ensures that we don't run tests
# too early without Saucelabs not being ready.
- run: ./scripts/saucelabs/wait-for-tunnel.sh
- run: yarn karma start ./karma-js.conf.js --single-run --browsers=${KARMA_JS_BROWSERS}
- run: ./scripts/saucelabs/stop-tunnel.sh
legacy-misc-tests:
<<: *job_defaults
steps:
- *attach_workspace
- *init_environment
- run: yarn gulp check-cycle
# TODO: disabled because the Bazel packages-dist does not seem to have map files for
# the ESM5/ES2015 output. See: https://github.com/angular/angular/issues/27966
# - run: yarn gulp source-map-test
workflows: workflows:
version: 2 version: 2
default_workflow: default_workflow:
jobs: jobs:
- setup: - setup
filters:
branches:
ignore: g3
- lint: - lint:
requires: requires:
- setup - setup
- test:
requires:
- setup
- test_ivy_aot:
requires:
- setup
- build-npm-packages: - build-npm-packages:
requires: requires:
- setup - setup
- test_aio: - test_aio:
requires: requires:
- setup - setup
- legacy-unit-tests-saucelabs:
requires:
- setup
- deploy_aio: - deploy_aio:
requires: requires:
- test_aio - test_aio
- legacy-misc-tests:
requires:
- build-npm-packages
- test_aio_local: - test_aio_local:
requires: requires:
- build-npm-packages - build-npm-packages
# - test_aio_local_ivy:
# requires:
# - build-ivy-npm-packages
- test_aio_tools: - test_aio_tools:
requires: requires:
- build-npm-packages - build-npm-packages
- test_docs_examples:
requires:
- build-npm-packages
# - test_docs_examples_ivy:
# requires:
# - build-ivy-npm-packages
- aio_preview: - aio_preview:
# Only run on PR builds. (There can be no previews for non-PR builds.)
<<: *only_on_pull_requests
requires: requires:
- setup - setup
# Only run on PR builds. (There can be no previews for non-PR builds.)
filters:
branches:
only: /pull\/\d+/
- test_aio_preview: - test_aio_preview:
requires: requires:
- aio_preview - aio_preview
- integration_test:
requires:
- build-npm-packages
- publish_snapshot:
# Note: no filters on this job because we want it to run for all upstream branches
# We'd really like to filter out pull requests here, but not yet available:
# https://discuss.circleci.com/t/workflows-pull-request-filter/14396/4
# Instead, the job just exits immediately at the first step.
requires:
# Only publish if tests and integration tests pass
- test
- test_ivy_aot
- integration_test
# Only publish if `aio`/`docs` tests using the locally built Angular packages pass
- test_aio_local
# - test_aio_local_ivy
- test_docs_examples
# - test_docs_examples_ivy
# Get the artifacts to publish from the build-packages-dist job
# since the publishing script expects the legacy outputs layout.
- build-npm-packages
- legacy-unit-tests-saucelabs
- legacy-misc-tests
aio_monitoring:
jobs:
- aio_monitoring
triggers:
- schedule:
# Runs AIO monitoring job at 00:00AM every day.
cron: "0 0 * * *"
filters:
branches:
only:
- master
# TODO:
# - don't build the g3 branch
# - verify that we are bootstrapping with the right yarn version coming from the docker image
# - check local chrome version pulled from docker image
# - remove /tools/ngcontainer

View File

@ -36,38 +36,3 @@ function setSecretVar() {
# Restore original shell options. # Restore original shell options.
eval "$originalShellOptions"; eval "$originalShellOptions";
} }
# Create a function to set an environment variable, when called.
#
# Use this function for creating setter for public environment variables that require expensive or
# time-consuming computaions and may not be needed. When needed, you can call this function to set
# the environment variable (which will be available through `$BASH_ENV` from that point onwards).
#
# Arguments:
# - `<name>`: The name of the environment variable. The generated setter function will be
# `setPublicVar_<name>`.
# - `<code>`: The code to run to compute the value for the variable. Since this code should be
# executed lazily, it must be properly escaped. For example:
# ```sh
# # DO NOT do this:
# createPublicVarSetter MY_VAR "$(whoami)"; # `whoami` will be evaluated eagerly
#
# # DO this isntead:
# createPublicVarSetter MY_VAR "\$(whoami)"; # `whoami` will NOT be evaluated eagerly
# ```
#
# Usage: `createPublicVarSetter <name> <code>`
#
# Example:
# ```sh
# createPublicVarSetter MY_VAR 'echo "FOO"';
# echo $MY_VAR; # Not defined
#
# setPublicVar_MY_VAR;
# source $BASH_ENV;
# echo $MY_VAR; # FOO
# ```
function createPublicVarSetter() {
echo "setPublicVar_$1() { setPublicVar $1 \"$2\"; }" >> $BASH_ENV;
}

View File

@ -3,7 +3,7 @@
# Variables # Variables
readonly projectDir=$(realpath "$(dirname ${BASH_SOURCE[0]})/..") readonly projectDir=$(realpath "$(dirname ${BASH_SOURCE[0]})/..")
readonly envHelpersPath="$projectDir/.circleci/env-helpers.inc.sh"; readonly envHelpersPath="$projectDir/.circleci/env-helpers.inc.sh";
readonly bashEnvCachePath="$projectDir/.circleci/bash_env_cache"; readonly getCommitRangePath="$projectDir/.circleci/get-commit-range.js";
# Load helpers and make them available everywhere (through `$BASH_ENV`). # Load helpers and make them available everywhere (through `$BASH_ENV`).
source $envHelpersPath; source $envHelpersPath;
@ -15,30 +15,23 @@ echo "source $envHelpersPath;" >> $BASH_ENV;
#################################################################################################### ####################################################################################################
# See https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables for more info. # See https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables for more info.
#################################################################################################### ####################################################################################################
setPublicVar CI "$CI"
setPublicVar PROJECT_ROOT "$projectDir"; setPublicVar PROJECT_ROOT "$projectDir";
setPublicVar CI_AIO_MIN_PWA_SCORE "62"; setPublicVar CI_AIO_MIN_PWA_SCORE "95";
# This is the branch being built; e.g. `pull/12345` for PR builds. # This is the branch being built; e.g. `pull/12345` for PR builds.
setPublicVar CI_BRANCH "$CIRCLE_BRANCH"; setPublicVar CI_BRANCH "$CIRCLE_BRANCH";
setPublicVar CI_BUILD_URL "$CIRCLE_BUILD_URL"; # ChromeDriver version compatible with the Chrome version included in the docker image used in
# `.circleci/config.yml`. See http://chromedriver.chromium.org/downloads for a list of versions.
# This variable is intended to be passed as an arg to the `webdriver-manager update` command (e.g.
# `"postinstall": "webdriver-manager update $CI_CHROMEDRIVER_VERSION_ARG"`).
setPublicVar CI_CHROMEDRIVER_VERSION_ARG "--versions.chrome 2.45";
setPublicVar CI_COMMIT "$CIRCLE_SHA1"; setPublicVar CI_COMMIT "$CIRCLE_SHA1";
# `CI_COMMIT_RANGE` is only used on push builds (a.k.a. non-PR, non-scheduled builds and rerun # `CI_COMMIT_RANGE` will only be available when `CIRCLE_COMPARE_URL` is also available (or can be
# workflows of such builds). # retrieved via `get-compare-url.js`), i.e. on push builds (a.k.a. non-PR, non-scheduled builds and
setPublicVar CI_GIT_BASE_REVISION "${CIRCLE_GIT_BASE_REVISION}"; # rerun workflows of such builds). That is fine, since we only need it in push builds.
setPublicVar CI_GIT_REVISION "${CIRCLE_GIT_REVISION}"; setPublicVar CI_COMMIT_RANGE "`[[ ${CIRCLE_PR_NUMBER:-false} != false ]] && echo "" || node $getCommitRangePath "$CIRCLE_BUILD_NUM" "$CIRCLE_COMPARE_URL"`";
setPublicVar CI_COMMIT_RANGE "$CIRCLE_GIT_BASE_REVISION..$CIRCLE_GIT_REVISION";
setPublicVar CI_PULL_REQUEST "${CIRCLE_PR_NUMBER:-false}"; setPublicVar CI_PULL_REQUEST "${CIRCLE_PR_NUMBER:-false}";
setPublicVar CI_REPO_NAME "$CIRCLE_PROJECT_REPONAME"; setPublicVar CI_REPO_NAME "$CIRCLE_PROJECT_REPONAME";
setPublicVar CI_REPO_OWNER "$CIRCLE_PROJECT_USERNAME"; setPublicVar CI_REPO_OWNER "$CIRCLE_PROJECT_USERNAME";
setPublicVar CI_PR_REPONAME "$CIRCLE_PR_REPONAME";
setPublicVar CI_PR_USERNAME "$CIRCLE_PR_USERNAME";
####################################################################################################
# Define "lazy" PUBLIC environment variables for CircleCI.
# (I.e. functions to set an environment variable when called.)
####################################################################################################
createPublicVarSetter CI_STABLE_BRANCH "\$(npm info @angular/core dist-tags.latest | sed -r 's/^\\s*([0-9]+\\.[0-9]+)\\.[0-9]+.*$/\\1.x/')";
#################################################################################################### ####################################################################################################
@ -51,63 +44,24 @@ setSecretVar CI_SECRET_PAYLOAD_FIREBASE_TOKEN "$ANGULAR_PAYLOAD_TOKEN";
#################################################################################################### ####################################################################################################
# Define SauceLabs environment variables for CircleCI. # Define SauceLabs environment variables for CircleCI.
#################################################################################################### ####################################################################################################
setPublicVar SAUCE_USERNAME "angular-framework"; # In order to have a meaningful SauceLabs badge on the repo page,
setSecretVar SAUCE_ACCESS_KEY "0c731274ed5f-cbc9-16f4-021a-9835e39f"; # the angular2-ci account is used only when pushing commits to master;
# TODO(josephperrott): Remove environment variables once all saucelabs tests are via bazel method. # in all other cases, the regular angular-ci account is used.
if [ "${CI_PULL_REQUEST}" = "false" ] && [ "${CI_REPO_OWNER}" = "angular" ] && [ "${CI_BRANCH}" = "master" ]; then
setPublicVar SAUCE_USERNAME "angular2-ci";
setSecretVar SAUCE_ACCESS_KEY "693ebc16208a-0b5b-1614-8d66-a2662f4e";
else
setPublicVar SAUCE_USERNAME "angular-ci";
setSecretVar SAUCE_ACCESS_KEY "9b988f434ff8-fbca-8aa4-4ae3-35442987";
fi
setPublicVar SAUCE_LOG_FILE /tmp/angular/sauce-connect.log setPublicVar SAUCE_LOG_FILE /tmp/angular/sauce-connect.log
setPublicVar SAUCE_READY_FILE /tmp/angular/sauce-connect-ready-file.lock setPublicVar SAUCE_READY_FILE /tmp/angular/sauce-connect-ready-file.lock
setPublicVar SAUCE_PID_FILE /tmp/angular/sauce-connect-pid-file.lock setPublicVar SAUCE_PID_FILE /tmp/angular/sauce-connect-pid-file.lock
setPublicVar SAUCE_TUNNEL_IDENTIFIER "angular-framework-${CIRCLE_BUILD_NUM}-${CIRCLE_NODE_INDEX}" setPublicVar SAUCE_TUNNEL_IDENTIFIER "angular-${CIRCLE_BUILD_NUM}-${CIRCLE_NODE_INDEX}"
# Amount of seconds we wait for sauceconnect to establish a tunnel instance. In order to not # Amount of seconds we wait for sauceconnect to establish a tunnel instance. In order to not
# acquire CircleCI instances for too long if sauceconnect failed, we need a connect timeout. # acquire CircleCI instances for too long if sauceconnect failed, we need a connect timeout.
setPublicVar SAUCE_READY_FILE_TIMEOUT 120 setPublicVar SAUCE_READY_FILE_TIMEOUT 120
#################################################################################################### # Source `$BASH_ENV` to make the variables available immediately.
# Define environment variables for the `angular/components` repo unit tests job.
####################################################################################################
# We specifically use a directory within "/tmp" here because we want the cloned repo to be
# completely isolated from angular/angular in order to avoid any bad interactions between
# their separate build setups. **NOTE**: When updating the temporary directory, also update
# the `save_cache` path configuration in `config.yml`
setPublicVar COMPONENTS_REPO_TMP_DIR "/tmp/angular-components-repo"
setPublicVar COMPONENTS_REPO_URL "https://github.com/angular/components.git"
setPublicVar COMPONENTS_REPO_BRANCH "master"
# **NOTE**: When updating the commit SHA, also update the cache key in the CircleCI `config.yml`.
setPublicVar COMPONENTS_REPO_COMMIT "09e68db8ed5b1253f2fe38ff954ef0df019fc25a"
####################################################################################################
# Decrypt GCP Credentials and store them as the Google default credentials.
####################################################################################################
mkdir -p "$HOME/.config/gcloud";
openssl aes-256-cbc -d -in "${projectDir}/.circleci/gcp_token" \
-md md5 -k "$CIRCLE_PROJECT_REPONAME" -out "$HOME/.config/gcloud/application_default_credentials.json"
####################################################################################################
# Set bazel configuration for CircleCI runs.
####################################################################################################
cp "${projectDir}/.circleci/bazel.linux.rc" "$HOME/.bazelrc";
####################################################################################################
# Create shell script in /tmp for Bazel actions to access CI envs without
# busting the cache. Used by payload-size.sh script in integration tests.
####################################################################################################
readonly bazelVarEnv="/tmp/bazel-ci-env.sh"
echo "# Setup by /.circle/env.sh" > $bazelVarEnv
echo "export PROJECT_ROOT=\"${PROJECT_ROOT}\";" >> $bazelVarEnv
echo "export CI_BRANCH=\"${CI_BRANCH}\";" >> $bazelVarEnv
echo "export CI_BUILD_URL=\"${CI_BUILD_URL}\";" >> $bazelVarEnv
echo "export CI_COMMIT=\"${CI_COMMIT}\";" >> $bazelVarEnv
echo "export CI_COMMIT_RANGE=\"${CI_COMMIT_RANGE}\";" >> $bazelVarEnv
echo "export CI_PULL_REQUEST=\"${CI_PULL_REQUEST}\";" >> $bazelVarEnv
echo "export CI_REPO_NAME=\"${CI_REPO_NAME}\";" >> $bazelVarEnv
echo "export CI_REPO_OWNER=\"${CI_REPO_OWNER}\";" >> $bazelVarEnv
echo "export CI_SECRET_PAYLOAD_FIREBASE_TOKEN=\"${CI_SECRET_PAYLOAD_FIREBASE_TOKEN}\";" >> $bazelVarEnv
####################################################################################################
####################################################################################################
## Source `$BASH_ENV` to make the variables available immediately. ##
## ***NOTE: This must remain the the last action in this script*** ##
####################################################################################################
####################################################################################################
source $BASH_ENV; source $BASH_ENV;

Binary file not shown.

View File

@ -0,0 +1,159 @@
#!/usr/bin/env node
/**
* **Usage:**
* ```
* node get-commit-range <build-number> [<compare-url> [<circle-token>]]
* ```
*
* Returns the value of the `CIRCLE_COMPARE_URL` environment variable (if defined) or, if this is
* not a PR build (i.e. `CIRCLE_PR_NUMBER` is not defined), retrieves the equivalent of
* `CIRCLE_COMPARE_URL` for jobs that are part of a rerun workflow.
*
* **Context:**
* CircleCI sets the `CIRCLE_COMPARE_URL` environment variable (from which we can extract the commit
* range) on push builds (a.k.a. non-PR, non-scheduled builds). Yet, when a workflow is rerun
* (either from the beginning or from failed jobs) - e.g. when a job flakes - CircleCI does not set
* the `CIRCLE_COMPARE_URL`.
*
* **Implementation details:**
* This script relies on the fact that all rerun workflows share the same CircleCI workspace and the
* (undocumented) fact that the workspace ID happens to be the same as the workflow ID that first
* created it.
*
* For example, for a job on push build workflow, the CircleCI API will return data that look like:
* ```js
* {
* compare: 'THE_COMPARE_URL_WE_ARE_LOOKING_FOR',
* //...
* previous: {
* // ...
* build_num: 12345,
* },
* //...
* workflows: {
* //...
* workflow_id: 'SOME_ID_A',
* workspace_id: 'SOME_ID_A', // Same as `workflow_id`.
* }
* }
* ```
*
* If the workflow is rerun, the data for jobs on the new workflow will look like:
* ```js
* {
* compare: null, // ¯\_(ツ)_/¯
* //...
* previous: {
* // ...
* build_num: 23456,
* },
* //...
* workflows: {
* //...
* workflow_id: 'SOME_ID_B',
* workspace_id: 'SOME_ID_A', // Different from current `workflow_id`.
* // Same as original `workflow_id`. \o/
* }
* }
* ```
*
* This script uses the `previous.build_num` (which points to the previous build number on the same
* branch) to traverse the jobs backwards, until it finds a job from the original workflow. Such a
* job (if found) should also contain the compare URL.
*
* **NOTE 1:**
* This is only useful on workflows which are created by rerunning a workflow for which
* `CIRCLE_COMPARE_URL` was defined.
*
* **NOTE 2:**
* The `circleToken` will be used for CircleCI API requests if provided, but it is not needed for
* accessing the read-only endpoints that we need (as long as the current project is FOSS and the
* corresponding setting is turned on in "Advanced Settings" in the project dashboard).
*
* ---
* Inspired by https://circleci.com/orbs/registry/orb/iynere/compare-url
* (source code: https://github.com/iynere/compare-url-orb).
*
* We are not using the `compare-url` orb for the following reasons:
* 1. (By looking at the code) it would only work if the rerun workflow is the latest workflow on
* the branch (which is not guaranteed to be true).
* 2. It is less efficient (e.g. makes unnecessary CircleCI API requests for builds on different
* branches, installs extra dependencies, persists files to the workspace (as a means of passing
* the result to the calling job), etc.).
* 3. It is slightly more complicated to setup and consume than our own script.
* 4. Its implementation is more complicated than needed for our usecase (e.g. handles different git
* providers, handles newly created branches, etc.).
*/
// Imports
const {get: httpsGet} = require('https');
// Constants
const API_URL_BASE = 'https://circleci.com/api/v1.1/project/github/angular/angular';
const COMPARE_URL_RE = /^.*\/([0-9a-f]+\.\.\.[0-9a-f]+)$/i;
// Run
_main(process.argv.slice(2));
// Helpers
async function _main([buildNumber, compareUrl = '', circleToken = '']) {
try {
if (!buildNumber || isNaN(buildNumber)) {
throw new Error(
'Missing or invalid arguments.\n' +
'Expected: buildNumber (number), compareUrl? (string), circleToken? (string)');
}
if (!compareUrl) {
compareUrl = await getCompareUrl(buildNumber, circleToken);
}
const commitRangeMatch = COMPARE_URL_RE.exec(compareUrl)
const commitRange = commitRangeMatch ? commitRangeMatch[1] : '';
console.log(commitRange);
} catch (err) {
console.error(err);
process.exit(1);
}
}
function getBuildInfo(buildNumber, circleToken) {
console.error(`BUILD ${buildNumber}`);
const url = `${API_URL_BASE}/${buildNumber}?circle-token=${circleToken}`;
return getJson(url);
}
async function getCompareUrl(buildNumber, circleToken) {
let info = await getBuildInfo(buildNumber, circleToken);
const targetWorkflowId = info.workflows.workspace_id;
while (info.workflows.workflow_id !== targetWorkflowId) {
info = await getBuildInfo(info.previous.build_num, circleToken);
}
return info.compare || '';
}
function getJson(url) {
return new Promise((resolve, reject) => {
const opts = {headers: {Accept: 'application/json'}};
const onResponse = res => {
const statusCode = res.statusCode || -1;
const isSuccess = (200 <= statusCode) && (statusCode <= 400);
let responseText = '';
res.
on('error', reject).
on('data', d => responseText += d).
on('end', () => isSuccess ?
resolve(JSON.parse(responseText)) :
reject(`Error getting '${url}' (status ${statusCode}):\n${responseText}`));
};
httpsGet(url, opts, onResponse).
on('error', reject).
end();
});
}

View File

@ -60,15 +60,14 @@ if (require.resolve === module) {
// Helpers // Helpers
function _main(args) { function _main(args) {
triggerWebhook(...args) triggerWebhook(...args).
.then( then(({statusCode, responseText}) => (200 <= statusCode && statusCode < 400) ?
({statusCode, responseText}) => (200 <= statusCode && statusCode < 400) ? console.log(`Status: ${statusCode}\n${responseText}`) :
console.log(`Status: ${statusCode}\n${responseText}`) : Promise.reject(new Error(`Request failed (status: ${statusCode}): ${responseText}`))).
Promise.reject(new Error(`Request failed (status: ${statusCode}): ${responseText}`))) catch(err => {
.catch(err => { console.error(err);
console.error(err); process.exit(1);
process.exit(1); });
});
} }
function postJson(url, data) { function postJson(url, data) {
@ -78,12 +77,15 @@ function postJson(url, data) {
const statusCode = res.statusCode || -1; const statusCode = res.statusCode || -1;
let responseText = ''; let responseText = '';
res.on('error', reject) res.
.on('data', d => responseText += d) on('error', reject).
.on('end', () => resolve({statusCode, responseText})); on('data', d => responseText += d).
on('end', () => resolve({statusCode, responseText}));
}; };
request(url, opts, onResponse).on('error', reject).end(JSON.stringify(data)); request(url, opts, onResponse).
on('error', reject).
end(JSON.stringify(data));
}); });
} }

View File

@ -1,56 +0,0 @@
# Install Bazel pre-reqs on Windows
# https://docs.bazel.build/versions/master/install-windows.html
# https://docs.bazel.build/versions/master/windows.html
# Install MSYS2 and packages
choco install msys2 --version 20180531.0.0 --no-progress --package-parameters "/NoUpdate"
C:\tools\msys64\usr\bin\bash.exe -l -c "pacman --needed --noconfirm -S zip unzip patch diffutils git"
# Add PATH modifications to the Powershell profile. This is the win equivalent of .bash_profile.
# https://docs.microsoft.com/en-us/previous-versions//bb613488(v=vs.85)
new-item -path $profile -itemtype file -force
# Paths for nodejs, npm, yarn, and msys2. Use single quotes to prevent interpolation.
# Add before the original path to use msys2 instead of the installed gitbash.
Add-Content $profile '$Env:path = "${Env:ProgramFiles}\nodejs\;C:\Users\circleci\AppData\Roaming\npm\;${Env:ProgramFiles(x86)}\Yarn\bin\;C:\Users\circleci\AppData\Local\Yarn\bin\;C:\tools\msys64\usr\bin\;" + $Env:path'
# Environment variables for Bazel
Add-Content $profile '$Env:BAZEL_SH = "C:\tools\msys64\usr\bin\bash.exe"'
# Get the bazelisk version devdep and store it in a global var for use in the circleci job.
$bazeliskVersion = & ${Env:ProgramFiles}\nodejs\node.exe -e "console.log(require('./package.json').devDependencies['@bazel/bazelisk'])"
# This is a tricky situation: we want $bazeliskVersion to be evaluated but not $Env:BAZELISK_VERSION.
# Formatting works https://stackoverflow.com/questions/32127583/expand-variable-inside-single-quotes
$bazeliskVersionGlobalVar = '$Env:BAZELISK_VERSION = "{0}"' -f $bazeliskVersion
Add-Content $profile $bazeliskVersionGlobalVar
# Remove the CircleCI checkout SSH override, because it breaks cloning repositories through Bazel.
# See https://circleci.com/gh/angular/angular/401454 for an example.
# TODO: is this really needed? Maybe there's a better way. It doesn't happen on Linux or on Codefresh.
git config --global --unset url.ssh://git@github.com.insteadOf
####################################################################################################
# Decrypt GCP Credentials and store them as the Google default credentials.
####################################################################################################
mkdir ${env:APPDATA}\gcloud
openssl aes-256-cbc -d -in .circleci\gcp_token -md md5 -out "$env:APPDATA\gcloud\application_default_credentials.json" -k "$env:CIRCLE_PROJECT_REPONAME"
####################################################################################################
# Set bazel configuration for CircleCI runs.
####################################################################################################
copy .circleci\bazel.windows.rc ${Env:USERPROFILE}\.bazelrc
####################################################################################################
# Install specific version of node.
####################################################################################################
choco install nodejs --version 12.14.1 --no-progress
# These Bazel prereqs aren't needed because the CircleCI image already includes them.
# choco install yarn --version 1.16.0 --no-progress
# choco install vcredist2015 --version 14.0.24215.20170201
# We don't need VS Build Tools for the tested bazel targets.
# If it's needed again, uncomment these lines.
# VS Build Tools are needed for Bazel C++ targets (like com_google_protobuf)
# choco install visualstudio2019buildtools --version 16.1.2.0 --no-progress --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.Component.VC.Runtime.UCRTSDK --add Microsoft.VisualStudio.Component.Windows10SDK.17763"
# Add-Content $profile '$Env:BAZEL_VC = "${Env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\BuildTools\VC\"'
# Python is needed for Bazel Python targets
# choco install python --version 3.5.1 --no-progress

View File

@ -1,31 +0,0 @@
# VSCode Remote Development - Developing inside a Containers
This folder contains configuration files that can be used to opt into working on this repository in a [Docker container](https://www.docker.com/resources/what-container) via [VSCode](https://code.visualstudio.com/)'s Remote Development feature (see below).
Info on remote development and developing inside a container with VSCode:
- [VSCode: Remote Development](https://code.visualstudio.com/docs/remote/remote-overview)
- [VSCode: Developing inside a Container](https://code.visualstudio.com/docs/remote/containers)
- [VSCode: Remote Development FAQ](https://code.visualstudio.com/docs/remote/faq)
## Usage
_Prerequisite: [Install Docker](https://docs.docker.com/install) on your local environment._
To get started, read and follow the instuctions in [Developing inside a Container](https://code.visualstudio.com/docs/remote/containers). The [.devcontainer/](.) directory contains pre-configured `devcontainer.json` and `Dockerfile` files, which you can use to set up remote development with a docker container.
In a nutshell, you need to:
- Install the [Remote - Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension.
- Copy [recommended-Dockerfile](./recommended-Dockerfile) to `Dockerfile` (and optionally tweak to suit your needs).
- Copy [recommended-devcontainer.json](./recommended-devcontainer.json) to `devcontainer.json` (and optionally tweak to suit your needs).
- Open VSCode and bring up the [Command Palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette).
- Type `Remote-Containers: Open Folder in Container` and choose your local clone of [angular/angular](https://github.com/angular/angular).
The `.devcontainer/devcontainer.json` and `.devcontainer/Dockerfile` files are ignored by git, so you can have your own local versions. We may occasionally update the template files ([recommended-devcontainer.json](./recommended-devcontainer.json), [recommended-Dockerfile](./recommended-Dockerfile)), in which case you will need to manually update your local copies (if desired).
## Updating `recommended-devcontainer.json` and `recommended-Dockerfile`
You can update and commit the recommended config files (which people use as basis for their local configs), if you find that something is broken, out-of-date or can be improved.
Please, keep in mind that any changes you make will potentially be used by many people on different environments. Try to keep these config files cross-platform compatible and free of personal preferences.

View File

@ -1,24 +0,0 @@
# Image metadata and config.
FROM circleci/node:10-browsers # Ideally, the image version should be what we use on CI.
# See `executors > browsers-executor` in `.circleci/config.yml`.
LABEL name="Angular dev environment" \
description="This image can be used to create a dev environment for building Angular." \
vendor="angular" \
version="1.0"
EXPOSE 4000 4200 4433 5000 8080 9876
# Switch to `root` (CircleCI images use `circleci` as the user).
USER root
# Configure `Node.js`/`npm` and install utilities.
RUN npm config --global set user root
RUN npm install --global yarn@latest # Ideally, the version should be what we use on CI.
# See `commands > overwrite_yarn` in `.circleci/config.yml`.
# Go! (And keep going.)
CMD ["tail", "--follow", "/dev/null"]

View File

@ -1,16 +0,0 @@
// Reference: https://code.visualstudio.com/docs/remote/containers#_devcontainerjson-reference
{
"name": "Angular dev container",
"dockerFile": "Dockerfile",
"appPort": [4000, 4200, 4433, 5000, 8080, 9876],
"postCreateCommand": "yarn install",
"extensions": [
"devondcarew.bazel-code",
"gkalpak.aio-docs-utils",
"ms-vscode.vscode-typescript-tslint-plugin",
"xaver.clang-format",
// The following extensions are useful when working on angular.io (i.e. inside the `aio/` directory).
//"angular.ng-template",
//"dbaeumer.vscode-eslint",
],
}

3
.gitattributes vendored
View File

@ -5,8 +5,5 @@
*.js eol=lf *.js eol=lf
*.ts eol=lf *.ts eol=lf
# API guardian patch must always use LF for tests to work
*.patch eol=lf
# Must keep Windows line ending to be parsed correctly # Must keep Windows line ending to be parsed correctly
scripts/windows/packages.txt eol=crlf scripts/windows/packages.txt eol=crlf

852
.github/CODEOWNERS vendored Normal file
View File

@ -0,0 +1,852 @@
# ==================================================================================
# ==================================================================================
# Angular CODEOWNERS
# ==================================================================================
# ==================================================================================
#
# Configuration of code ownership and review approvals for the angular/angular repo.
#
# More info: https://help.github.com/articles/about-codeowners/
#
# ================================================
# General rules / philosophy
# ================================================
#
# - we trust that people do the right thing and not approve changes they don't feel confident reviewing
# - we use github teams so that we funnel code reviews to the most appropriate reviewer, this is why the team structure is fine-grained
# - we enforce that only approved PRs get merged to ensure that unreviewed code doesn't get accidentally merged
# - we delegate approval rights as much as possible so that we can scale better
# - each group must have at least one person, but several people are preferable to avoid a single point of failure issues
# - most file groups have one or two global approvers groups as fallbacks:
# - @angular/fw-global-approvers: for approving minor changes, large-scale refactorings, and emergency situations.
# - @angular/fw-global-approvers-for-docs-only-changes: for approving minor documentation-only changes that don't require engineering review
# - a small number of file groups have very limited number of reviewers because incorrect changes to the files they guard would have serious consequences (e.g. security, public api)
#
# Configuration nuances:
#
# - This configuration works in conjunction with the protected branch settings that require all changes to be made via pull requests with at least one approval.
# - This approval can come from an appropriate codeowner, or any repo collaborator (person with write access) if the PR is authored by a codeowner.
# - Each codeowners team must have write access to the repo, otherwise their reviews won't count.
#
# In the case of emergency, the repo administrators which include angular-caretaker can bypass this requirement.
# ================================================
# GitHub username registry
# (just to make this file easier to understand)
# ================================================
# alan-agius4 - Alan Agius
# alexeagle - Alex Eagle
# alxhub - Alex Rickabaugh
# AndrewKushnir - Andrew Kushnir
# andrewseguin - Andrew Seguin
# benlesh - Ben Lesh
# brandonroberts - Brandon Roberts
# devversion - Paul Gschwendtner
# filipesilva - Filipe Silva
# gkalpak - George Kalpakas
# hansl - Hans Larsen
# IgorMinar - Igor Minar
# jasonaden - Jason Aden
# jenniferfell - Jennifer Fell
# kara - Kara Erickson
# kyliau - Keen Yee Liau
# matsko - Matias Niemelä
# mgechev - Minko Gechev
# mhevery - Misko Hevery
# ocombe - Olivier Combe
# petebacondarwin - Pete Bacon Darwin
# pkozlowski-opensource - Pawel Kozlowski
# robwormald - Rob Wormald
# stephenfluin - Stephen Fluin
# vikerman - Vikram Subramanian
######################################################################################################
#
# Team structure and memberships
# ------------------------------
#
# This section is here just because the GitHub UI is too hard to navigate and audit.
#
# Any changes to team structure or memberships must first be made in this file and only then
# implemented in the GitHub UI.
#######################################################################################################
# ===========================================================
# @angular/framework-global-approvers
# ===========================================================
# Used for approving minor changes, large-scale refactorings, and emergency situations.
# (secret team to avoid review requests, it also doesn't inherit from @angular/framework because nested teams can't be secret)
#
# - IgorMinar
# - kara
# - mhevery
# - alexeagle
# ===========================================================
# @angular/framework-global-approvers-for-docs-only-changes
# ===========================================================
# Used for approving minor documentation-only changes that don't require engineering review.
# (secret team to avoid review requests, it also doesn't inherit from @angular/framework because nested teams can't be secret)
#
# - brandonroberts
# - gkalpak
# - jenniferfell
# - petebacondarwin
# ===========================================================
# @angular/fw-animations
# ===========================================================
#
# - matsko
# ===========================================================
# @angular/tools-bazel
# ===========================================================
#
# - alexeagle
# - kyliau
# - IgorMinar
# - mgechev
# ===========================================================
# @angular/tools-cli
# ===========================================================
#
# - alexeagle
# - filipesilva
# - hansl
# - mgechev
# ===========================================================
# @angular/fw-compiler
# ===========================================================
#
# - alxhub
# ===========================================================
# @angular/fw-ngcc
# ===========================================================
#
# - alxhub
# - gkalpak
# - petebacondarwin
# ===========================================================
# @angular/fw-core
# ===========================================================
#
# - alxhub
# - AndrewKushnir
# - kara
# - mhevery
# - pkozlowski-opensource
# ===========================================================
# @angular/fw-http
# ===========================================================
#
# - alxhub
# - IgorMinar
# ===========================================================
# @angular/fw-elements
# ===========================================================
#
# - andrewseguin
# - gkalpak
# - robwormald
# ===========================================================
# @angular/fw-forms
# ===========================================================
#
# - kara
# ===========================================================
# @angular/tools-language-service
# ===========================================================
#
# - kyliau
# ===========================================================
# @angular/fw-server
# ===========================================================
#
# - alxhub
# - vikerman
# ===========================================================
# @angular/fw-router
# ===========================================================
#
# - jasonaden
# ===========================================================
# @angular/fw-service-worker
# ===========================================================
#
# - alxhub
# - gkalpak
# - IgorMinar
# ===========================================================
# @angular/fw-upgrade
# ===========================================================
#
# - gkalpak
# - petebacondarwin
# ===========================================================
# @angular/fw-testing
# ===========================================================
#
# - vikerman
# ===========================================================
# @angular/fw-i18n
# ===========================================================
#
# - AndrewKushnir
# - mhevery
# - ocombe
# - vikerman
# ===========================================================
# @angular/fw-security
# ===========================================================
#
# - IgorMinar
# - mhevery
# ===========================================================
# @angular/tools-benchpress
# ===========================================================
#
# - alxhub
# ===========================================================
# @angular/fw-integration
# ===========================================================
#
# - alexeagle
# - IgorMinar
# - mhevery
# ===========================================================
# @angular/docs-infra
# ===========================================================
#
# - brandonroberts
# - gkalpak
# - IgorMinar
# - petebacondarwin
# ===========================================================
# @angular/fw-docs-intro
# ===========================================================
#
# - brandonroberts
# - IgorMinar
# - stephenfluin
# ===========================================================
# @angular/fw-docs-observables
# ===========================================================
#
# - benlesh
# - jasonaden
# ===========================================================
# @angular/fw-docs-packaging
# ===========================================================
#
# - alexeagle
# - IgorMinar
# ===========================================================
# @angular/tools-docs-libraries
# ===========================================================
#
# - alan-agius4
# - alexeagle
# - hansl
# - IgorMinar
# - mgechev
# ===========================================================
# @angular/fw-docs-marketing
# ===========================================================
#
# - IgorMinar
# - stephenfluin
# ===========================================================
# @angular/fw-public-api
# ===========================================================
#
# - IgorMinar
# ===========================================================
# @angular/fw-dev-infra
# ===========================================================
#
# - alexeagle
# - devversion
# - filipesilva
# - gkalpak
# - IgorMinar
######################################################################################################
#
# CODEOWNERS rules
# -----------------
#
# All the following rules are applied in the order specified in this file.
# The last rule that matches wins!
#
# See https://git-scm.com/docs/gitignore#_pattern_format for pattern syntax docs.
#
######################################################################################################
# ================================================
# Default Owners
# (in case no pattern matches a path in a PR - this should be treated as a bug and result in adding the path to CODEOWNERS)
# ================================================
* @IgorMinar @angular/framework-global-approvers
# ================================================
# @angular/animations
# ================================================
/packages/animations/** @angular/fw-animations @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/packages/platform-browser/animations/** @angular/fw-animations @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/animations.md @angular/fw-animations @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/animations/** @angular/fw-animations @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/animations/** @angular/fw-animations @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/complex-animation-sequences.md @angular/fw-animations @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/reusable-animations.md @angular/fw-animations @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/route-animations.md @angular/fw-animations @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/transition-and-triggers.md @angular/fw-animations @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
# ================================================
# @angular/bazel
# ================================================
/packages/bazel/** @angular/tools-bazel @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
# ================================================
# @angular/compiler
# @angular/compiler-cli
# ================================================
/packages/compiler/** @angular/fw-compiler @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/packages/compiler-cli/** @angular/fw-compiler @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/aot-compiler.md @angular/fw-compiler @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
# ================================================
# packages/compiler-cli/src/ngcc/
# ================================================
/packages/compiler-cli/src/ngcc/** @angular/fw-ngcc @angular/framework-global-approvers
# ================================================
# Framework/cli integration
#
# a rule to control API changes between @angular/compiler-cli and @angular/cli
# ================================================
/packages/compiler-cli/src/ngtools/** @angular/tools-cli @angular/framework-global-approvers
/aio/content/guide/ivy.md @angular/tools-cli @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
# ================================================
# @angular/core
# @angular/common (except @angular/common/http)
# @angular/platform-browser
# @angular/platform-browser-dynamic
# @angular/platform-webworker
# @angular/platform-webworker-dynamic
# ================================================
/packages/core/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/packages/common/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/packages/platform-browser/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/packages/platform-browser-dynamic/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/packages/platform-webworker/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/packages/platform-webworker-dynamic/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/architecture-components.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/architecture-modules.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/architecture-next-steps.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/architecture-services.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/architecture.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/architecture/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/architecture/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/attribute-directives.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/attribute-directives/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/attribute-directives/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/bootstrapping.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/bootstrapping/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/cheatsheet.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/component-interaction.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/component-interaction/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/component-interaction/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/component-styles.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/component-styles/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/dependency-injection.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/dependency-injection/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/dependency-injection/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/dependency-injection-in-action.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/dependency-injection-in-action/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/dependency-injection-in-action/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/dependency-injection-navtree.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/dependency-injection-providers.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/displaying-data.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/displaying-data/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/displaying-data/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/dynamic-component-loader.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/dynamic-component-loader/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/dynamic-component-loader/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/entry-components.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/feature-modules.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/feature-modules/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/feature-modules/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/frequent-ngmodules.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/frequent-ngmodules/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/hierarchical-dependency-injection.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/hierarchical-dependency-injection/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/lazy-loading-ngmodules.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/lazy-loading-ngmodules/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/lazy-loading-ngmodules/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/lifecycle-hooks.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/lifecycle-hooks/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/lifecycle-hooks/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/ngcontainer/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/ngmodules.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/ngmodules/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/ngmodule-api.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/ngmodule-faq.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/ngmodule-faq/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/ngmodule-vs-jsmodule.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/module-types.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/template-syntax.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/event-binding/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/interpolation/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/template-syntax/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/template-syntax/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/pipes.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/pipes/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/pipes/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/providers.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/providers/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/singleton-services.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/set-document-title.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/set-document-title/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/set-document-title/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/sharing-ngmodules.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/structural-directives.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/structural-directives/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/structural-directives/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/user-input.md @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/user-input/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/user-input/** @angular/fw-core @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
# ================================================
# @angular/common/http
# @angular/http
# ================================================
/packages/common/http/** @angular/fw-http @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/packages/http/** @angular/fw-http @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/http.md @angular/fw-http @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/http/** @angular/fw-http @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/http/** @angular/fw-http @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
# ================================================
# @angular/elements
# ================================================
/packages/elements/** @angular/fw-elements @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/elements/** @angular/fw-elements @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/elements/** @angular/fw-elements @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/elements.md @angular/fw-elements @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
# ================================================
# @angular/forms
# ================================================
/packages/forms/** @angular/fw-forms @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/forms.md @angular/fw-forms @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/forms/** @angular/fw-forms @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/forms/** @angular/fw-forms @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/forms-overview.md @angular/fw-forms @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/forms-overview/** @angular/fw-forms @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/forms-overview/** @angular/fw-forms @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/form-validation.md @angular/fw-forms @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/form-validation/** @angular/fw-forms @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/form-validation/** @angular/fw-forms @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/dynamic-form.md @angular/fw-forms @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/dynamic-form/** @angular/fw-forms @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/dynamic-form/** @angular/fw-forms @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/reactive-forms.md @angular/fw-forms @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/reactive-forms/** @angular/fw-forms @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/reactive-forms/** @angular/fw-forms @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
# ================================================
# @angular/language-service
# ================================================
/packages/language-service/** @angular/tools-language-service @angular/framework-global-approvers
/aio/content/guide/language-service.md @angular/tools-language-service @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/language-service/** @angular/tools-language-service @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
# ================================================
# @angular/platform-server
# ================================================
/packages/platform-server/** @angular/fw-server @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/universal.md @angular/fw-server @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/universal/** @angular/fw-server @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
# ================================================
# @angular/router
# ================================================
/packages/router/** @angular/fw-router @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/router.md @angular/fw-router @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/router/** @angular/fw-router @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/router/** @angular/fw-router @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
# ================================================
# @angular/service-worker
# ================================================
/packages/service-worker/** @angular/fw-service-worker @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/service-worker-getting-started.md @angular/fw-service-worker @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/service-worker-getting-started/** @angular/fw-service-worker @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/service-worker-communications.md @angular/fw-service-worker @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/service-worker-config.md @angular/fw-service-worker @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/service-worker-devops.md @angular/fw-service-worker @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/service-worker-intro.md @angular/fw-service-worker @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/service-worker/** @angular/fw-service-worker @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
# ================================================
# @angular/upgrade
# ================================================
/packages/upgrade/** @angular/fw-upgrade @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/packages/examples/upgrade/** @angular/fw-upgrade @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/upgrade.md @angular/fw-upgrade @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/upgrade-module/** @angular/fw-upgrade @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/upgrade/** @angular/fw-upgrade @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/upgrade-phonecat-1-typescript/** @angular/fw-upgrade @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/upgrade-phonecat-2-hybrid/** @angular/fw-upgrade @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/upgrade-phonecat-3-final/** @angular/fw-upgrade @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/upgrade-performance.md @angular/fw-upgrade @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/ajs-quick-reference.md @angular/fw-upgrade @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/ajs-quick-reference/** @angular/fw-upgrade @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
# ================================================
# @angular/**/testing
# ================================================
testing/** @angular/fw-testing @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/testing.md @angular/fw-testing @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/testing/** @angular/fw-testing @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/testing/** @angular/fw-testing @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
# ================================================
# @angular i18n
# ================================================
/packages/core/src/i18n/** @angular/fw-i18n @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/packages/core/src/render3/i18n.ts @angular/fw-i18n @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/packages/core/src/render3/i18n.md @angular/fw-i18n @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/packages/core/src/render3/interfaces/i18n.ts @angular/fw-i18n @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/packages/common/locales/** @angular/fw-i18n @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/packages/common/src/i18n/** @angular/fw-i18n @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/packages/common/src/pipes/date_pipe.ts @angular/fw-i18n @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/packages/common/src/pipes/i18n_plural_pipe.ts @angular/fw-i18n @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/packages/common/src/pipes/i18n_select_pipe.ts @angular/fw-i18n @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/packages/common/src/pipes/number_pipe.ts @angular/fw-i18n @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/packages/compiler/src/i18n/** @angular/fw-i18n @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/packages/compiler/src/render3/view/i18n/** @angular/fw-i18n @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/packages/compiler-cli/src/extract_i18n.ts @angular/fw-i18n @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/i18n.md @angular/fw-i18n @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/i18n/** @angular/fw-i18n @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
# ================================================
# @angular security
# ================================================
/packages/core/src/sanitization/** @angular/fw-security
/packages/core/test/linker/security_integration_spec.ts @angular/fw-security
/packages/compiler/src/schema/** @angular/fw-security
/packages/platform-browser/src/security/** @angular/fw-security
/aio/content/guide/security.md @angular/fw-security @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/security/** @angular/fw-security @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/security/** @angular/fw-security @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
# ================================================
# benchpress
# ================================================
/packages/benchpress/** @angular/tools-benchpress @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
# ================================================
# /integration/*
# ================================================
/integration/** @angular/fw-integration @angular/framework-global-approvers
# ================================================
# docs-infra
# ================================================
/aio/* @angular/docs-infra @angular/framework-global-approvers
/aio/aio-builds-setup/** @angular/docs-infra @angular/framework-global-approvers
/aio/scripts/** @angular/docs-infra @angular/framework-global-approvers
/aio/src/** @angular/docs-infra @angular/framework-global-approvers
/aio/tests/** @angular/docs-infra @angular/framework-global-approvers
/aio/tools/** @angular/docs-infra @angular/framework-global-approvers
# Hidden docs
/aio/content/guide/change-log.md @angular/docs-infra @angular/framework-global-approvers
/aio/content/guide/docs-style-guide.md @angular/docs-infra @angular/framework-global-approvers
/aio/content/examples/docs-style-guide/** @angular/docs-infra @angular/framework-global-approvers
/aio/content/images/guide/docs-style-guide/** @angular/docs-infra @angular/framework-global-approvers
/aio/content/guide/visual-studio-2015.md @angular/docs-infra @angular/framework-global-approvers
/aio/content/examples/visual-studio-2015/** @angular/docs-infra @angular/framework-global-approvers
# ================================================
# Docs: getting started & tutorial
# ================================================
/aio/content/guide/quickstart.md @angular/fw-docs-intro @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/cli-quickstart/** @angular/fw-docs-intro @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/cli-quickstart/** @angular/fw-docs-intro @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/tutorial/** @angular/fw-docs-intro @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/toh/** @angular/fw-docs-intro @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/toh-pt0/** @angular/fw-docs-intro @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/toh-pt1/** @angular/fw-docs-intro @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/toh-pt2/** @angular/fw-docs-intro @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/toh-pt3/** @angular/fw-docs-intro @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/toh-pt4/** @angular/fw-docs-intro @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/toh-pt5/** @angular/fw-docs-intro @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/toh-pt6/** @angular/fw-docs-intro @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
# ================================================
# Docs: observables
# ================================================
/aio/content/guide/observables.md @angular/fw-docs-observables @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/observables/** @angular/fw-docs-observables @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/comparing-observables.md @angular/fw-docs-observables @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/observables-in-angular.md @angular/fw-docs-observables @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/observables-in-angular/** @angular/fw-docs-observables @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/practical-observable-usage.md @angular/fw-docs-observables @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/practical-observable-usage/** @angular/fw-docs-observables @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/rx-library.md @angular/fw-docs-observables @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/rx-library/** @angular/fw-docs-observables @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
# ================================================
# Docs: packaging, tooling, releasing
# ================================================
/aio/content/guide/npm-packages.md @angular/fw-docs-packaging @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/browser-support.md @angular/fw-docs-packaging @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/typescript-configuration.md @angular/fw-docs-packaging @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/quickstart/** @angular/fw-docs-packaging @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/setup.md @angular/fw-docs-packaging @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/examples/setup/** @angular/fw-docs-packaging @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/build.md @angular/fw-docs-packaging @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/guide/build/** @angular/fw-docs-packaging @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/deployment.md @angular/fw-docs-packaging @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/file-structure.md @angular/fw-docs-packaging @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/releases.md @angular/fw-docs-packaging @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/updating.md @angular/fw-docs-packaging @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/workspace-config.md @angular/fw-docs-packaging @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
# ================================================
# Docs: libraries
# ================================================
/aio/content/guide/creating-libraries.md @angular/tools-docs-libraries @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/libraries.md @angular/tools-docs-libraries @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/using-libraries.md @angular/tools-docs-libraries @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
# ================================================
# Docs: marketing
# ================================================
/aio/content/marketing/** @angular/fw-docs-marketing @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/bios/** @angular/fw-docs-marketing @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/images/marketing/** @angular/fw-docs-marketing @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/navigation.json @angular/fw-docs-marketing @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/license.md @angular/fw-docs-marketing @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
# ================================================
# Build & CI Owners
# ================================================
/* @angular/fw-dev-infra
/.buildkite/** @angular/fw-dev-infra
/.circleci/** @angular/fw-dev-infra
/.codefresh/** @angular/fw-dev-infra
/.github/** @angular/fw-dev-infra
/.vscode/** @angular/fw-dev-infra
/docs/BAZEL.md @angular/fw-dev-infra
/packages/* @angular/fw-dev-infra
/scripts/** @angular/fw-dev-infra
/third_party/** @angular/fw-dev-infra
/tools/** @angular/fw-dev-infra
*.bzl @angular/fw-dev-infra
# ================================================
# Public API
# ================================================
/tools/public_api_guard/** @angular/fw-public-api
/aio/content/guide/glossary.md @angular/fw-public-api
/aio/content/guide/styleguide.md @angular/fw-public-api
/aio/content/examples/styleguide/** @angular/fw-public-api
/aio/content/images/guide/styleguide/** @angular/fw-public-api
# ================================================
# CODEOWNERS Owners owners ...
# ================================================
/.github/CODEOWNERS @IgorMinar @angular/framework-global-approvers

69
.github/ISSUE_TEMPLATE/1-bug-report.md vendored Normal file
View File

@ -0,0 +1,69 @@
---
name: "\U0001F41EBug report"
about: Report a bug in the Angular Framework
---
<!--🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅
Oh hi there! 😄
To expedite issue processing please search open and closed issues before submitting a new one.
Existing issues often contain information about workarounds, resolution, or progress updates.
🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅-->
# 🐞 bug report
### Affected Package
<!-- Can you pin-point one or more @angular/* packages as the source of the bug? -->
<!-- ✍edit: --> The issue is caused by package @angular/....
### Is this a regression?
<!-- Did this behavior use to work in the previous version? -->
<!-- ✍️--> Yes, the previous version in which this bug was not present was: ....
### Description
<!-- ✍️--> A clear and concise description of the problem...
## 🔬 Minimal Reproduction
<!--
Please create and share minimal reproduction of the issue starting with this template: https://stackblitz.com/fork/angular-issue-repro2
-->
<!-- ✍️--> https://stackblitz.com/...
<!--
If StackBlitz is not suitable for reproduction of your issue, please create a minimal GitHub repository with the reproduction of the issue.
A good way to make a minimal reproduction is to create a new app via `ng new repro-app` and add the minimum possible code to show the problem.
Share the link to the repo below along with step-by-step instructions to reproduce the problem, as well as expected and actual behavior.
Issues that don't have enough info and can't be reproduced will be closed.
You can read more about issue submission guidelines here: https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-submitting-an-issue
-->
## 🔥 Exception or Error
<pre><code>
<!-- If the issue is accompanied by an exception or an error, please share it below: -->
<!-- ✍️-->
</code></pre>
## 🌍 Your Environment
**Angular Version:**
<pre><code>
<!-- run `ng version` and paste output below -->
<!-- ✍️-->
</code></pre>
**Anything else relevant?**
<!--Is this a browser specific issue? If so, please specify the browser and version. -->
<!--Do any of these matter: operating system, IDE, package manager, HTTP server, ...? If so, please mention it below. -->

View File

@ -0,0 +1,32 @@
---
name: "\U0001F680Feature request"
about: Suggest a feature for Angular Framework
---
<!--🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅
Oh hi there! 😄
To expedite issue processing please search open and closed issues before submitting a new one.
Existing issues often contain information about workarounds, resolution, or progress updates.
🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅-->
# 🚀 feature request
### Relevant Package
<!-- Can you pin-point one or more @angular/* packages the are relevant for this feature request? -->
<!-- ✍edit: --> This feature request is for @angular/....
### Description
<!-- ✍️--> A clear and concise description of the problem or missing capability...
### Describe the solution you'd like
<!-- ✍️--> If you have a solution in mind, please describe it.
### Describe alternatives you've considered
<!-- ✍️--> Have you considered any alternative solutions or workarounds?

55
.github/ISSUE_TEMPLATE/3-docs-bug.md vendored Normal file
View File

@ -0,0 +1,55 @@
---
name: "📚 Docs or angular.io issue report"
about: Report an issue in Angular's documentation or angular.io application
---
<!--🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅
Oh hi there! 😄
To expedite issue processing please search open and closed issues before submitting a new one.
Existing issues often contain information about workarounds, resolution, or progress updates.
🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅-->
# 📚 Docs or angular.io bug report
### Description
<!--edit:--> A clear and concise description of the problem...
## 🔬 Minimal Reproduction
### What's the affected URL?**
<!--edit:--> https://angular.io/...
### Reproduction Steps**
<!-- If applicable please list the steps to take to reproduce the issue -->
<!--edit:-->
### Expected vs Actual Behavior**
<!-- If applicable please describe the difference between the expected and actual behavior after following the repro steps. -->
<!--edit:-->
## 📷Screenshot
<!-- Often a screenshot can help to capture the issue better than a long description. -->
<!--upload a screenshot:-->
## 🔥 Exception or Error
<pre><code>
<!-- If the issue is accompanied by an exception or an error, please share it below: -->
<!-- ✍️-->
</code></pre>
## 🌍 Your Environment
### Browser info
<!--Is this a browser specific issue? If so, please specify the device, browser, and version. -->
### Anything else relevant?
<!--Please provide additional info if necessary. -->

View File

@ -0,0 +1,11 @@
---
name: ⚠️ Security issue disclosure
about: Report a security issue in Angular Framework, Material, or CLI
---
🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑
Please read https://angular.io/guide/security#report-issues on how to disclose security related issues.
🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑

View File

@ -0,0 +1,16 @@
---
name: "❓Support request"
about: Questions and requests for support
---
🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑
Please do not file questions or support requests on the GitHub issues tracker.
You can get your questions answered using other communication channels. Please see:
https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Thank you!
🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑

13
.github/ISSUE_TEMPLATE/6-angular-cli.md vendored Normal file
View File

@ -0,0 +1,13 @@
---
name: "\U0001F6E0Angular CLI"
about: Issues and feature requests for Angular CLI
---
🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑
Please file any Angular CLI issues at: https://github.com/angular/angular-cli/issues/new
For the time being, we keep Angular CLI issues in a separate repository.
🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑

View File

@ -0,0 +1,13 @@
---
name: "\U0001F48EAngular Material"
about: Issues and feature requests for Angular Material
---
🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑
Please file any Angular Material issues at: https://github.com/angular/material2/issues/new
For the time being, we keep Angular Material issues in a separate repository.
🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑

View File

@ -1,22 +0,0 @@
---
name: "📚Traducir doc al español"
about: Solicitud para traducir ciertos docs al español
---
📚Traducir: <!-- ✍️ editar: --> creating-libraries.md
<!--🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅
Traducción de la documentación oficial de Angular a español
🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅-->
## Nombre del archivo:
<!-- ✍️ editar: --> creating-libraries.md
## Ruta donde se encuentra el archivo dentro del proyecto de Angular
<!-- ✍️ editar: --> https://github.com/angular-hispano/angular/blob/master/aio/content/guide/creating-libraries.md

View File

@ -1,35 +1,43 @@
## Lista de Verificación del PR ## PR Checklist
Comprueba si tu PR cumple los siguientes requisitos: Please check if your PR fulfills the following requirements:
- [ ] El mensaje de commit esta conforme con [nuestras reglas](https://github.com/angular-hispano/angular/blob/master/CONTRIBUTING.md#-formato-para-el-mensaje-de-los-commits) - [ ] The commit message follows our guidelines: https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit
- [ ] Probe los cambios que agregué (arreglo de bugs / funcionalidades) - [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Revisé previamente las traducciones o cambios de contenido - [ ] Docs have been added / updated (for bug fixes / features)
- [ ] Consulté el [diccionario de términos](https://github.com/angular-hispano/angular/blob/master/aio/diccionario-de-términos.md) en español
- [ ] He creado dos archivos con la extensión correspondiente(.en.md para el archivo en inglés y .md para el Archivo en español)
- [ ] He enlazado el commit con el issue correspondiente <!-- ejemplo Fixes #X -->
## Tipo de PR ## PR Type
¿Qué tipo de cambio introduce este PR? What kind of change does this PR introduce?
<!-- Marca con una "x" las opciones que aplican. --> <!-- Please check the one that applies to this PR using "x". -->
- [ ] Bugfix - [ ] Bugfix
- [ ] Funcionalidad - [ ] Feature
- [ ] Actualización de el estilo del código (formato, variables locales) - [ ] Code style update (formatting, local variables)
- [ ] Refactorización (no cambios en la funcionalidad, no cambios en el api) - [ ] Refactoring (no functional changes, no api changes)
- [ ] Cambios relacionados al build - [ ] Build related changes
- [ ] Cambios relacionados al CI (Integración continua) - [ ] CI related changes
- [ ] Cambios en el contenido de la documentación - [ ] Documentation content changes
- [ ] Cambios en la aplicación / infraestructura de angular.io - [ ] angular.io application / infrastructure changes
- [ ] Otro... Por favor describe la: - [ ] Other... Please describe:
## ¿Cuál es el comportamiento actual?
<!-- Describe el comportamiento actual que está modificando o vincule a un problema relevante.
-->
## ¿Cuál es el nuevo comportamiento? ## What is the current behavior?
<!-- <!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->
Ejemplo: Archivo en inglés traducido al español
--> Issue Number: N/A
## What is the new behavior?
## Does this PR introduce a breaking change?
- [ ] Yes
- [ ] No
<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->
## Other information

View File

@ -30,29 +30,26 @@ merge:
# text to show when the status is success # text to show when the status is success
successDesc: "Does not affect google3" successDesc: "Does not affect google3"
# link to use for the details # link to use for the details
url: "http://go/angular/g3sync" url: "http://go/angular-g3sync"
# list of patterns to check for the files changed by the PR # list of patterns to check for the files changed by the PR
# this list must be manually kept in sync with google3/third_party/javascript/angular2/copy.bara.sky # this list must be manually kept in sync with google3/third_party/javascript/angular2/copy.bara.sky
include: include:
- "LICENSE" - "LICENSE"
- "modules/benchmarks/**" - "modules/**"
- "modules/system.d.ts"
- "packages/**" - "packages/**"
# list of patterns to ignore for the files changed by the PR # list of patterns to ignore for the files changed by the PR
exclude: exclude:
- "packages/*" - "packages/*"
- "packages/bazel/*" - "packages/bazel/*"
- "packages/bazel/src/api-extractor/**"
- "packages/bazel/src/builders/**" - "packages/bazel/src/builders/**"
- "packages/bazel/src/ng_package/**" - "packages/bazel/src/ng_package/**"
- "packages/bazel/src/protractor/**" - "packages/bazel/src/protractor/**"
- "packages/bazel/src/schematics/**" - "packages/bazel/src/schematics/**"
- "packages/compiler-cli/ngcc/**" - "packages/compiler-cli/src/ngcc/**"
- "packages/docs/**" - "packages/docs/**"
- "packages/elements/schematics/**" - "packages/elements/schematics/**"
- "packages/examples/**" - "packages/examples/**"
- "packages/language-service/**" - "packages/language-service/**"
- "packages/localize/**"
- "packages/private/**" - "packages/private/**"
- "packages/service-worker/**" - "packages/service-worker/**"
- "**/.gitignore" - "**/.gitignore"
@ -62,15 +59,10 @@ merge:
- "**/third_party/**" - "**/third_party/**"
- "**/tsconfig-build.json" - "**/tsconfig-build.json"
- "**/tsconfig.json" - "**/tsconfig.json"
- "**/rollup.config.js"
- "**/BUILD.bazel" - "**/BUILD.bazel"
- "**/*.md" - "**/*.md"
- "packages/**/integrationtest/**" - "packages/**/integrationtest/**"
- "packages/**/test/**" - "packages/**/test/**"
- "packages/zone.js/*"
- "packages/zone.js/doc/**"
- "packages/zone.js/example/**"
- "packages/zone.js/scripts/**"
# comment that will be added to a PR when there is a conflict, leave empty or set to false to disable # comment that will be added to a PR when there is a conflict, leave empty or set to false to disable
mergeConflictComment: "Hi @{{PRAuthor}}! This PR has merge conflicts due to recent upstream merges. mergeConflictComment: "Hi @{{PRAuthor}}! This PR has merge conflicts due to recent upstream merges.
@ -115,7 +107,6 @@ merge:
- "ci/angular: size" - "ci/angular: size"
- "cla/google" - "cla/google"
- "google3" - "google3"
- "pullapprove"
# the comment that will be added when the merge label is added despite failing checks, leave empty or set to false to disable # the comment that will be added when the merge label is added despite failing checks, leave empty or set to false to disable
@ -154,12 +145,6 @@ triage:
- -
- "type: RFC / Discussion / question" - "type: RFC / Discussion / question"
- "comp: *" - "comp: *"
-
- "type: confusing"
- "comp: *"
-
- "type: use-case"
- "comp: *"
# options for the triage PR plugin # options for the triage PR plugin
triagePR: triagePR:
@ -180,10 +165,3 @@ triagePR:
- "effort*" - "effort*"
- "risk*" - "risk*"
- "comp: *" - "comp: *"
# options for rerunning CI
rerunCircleCI:
# set to true to disable
disabled: false
# the label which when added triggers a rerun of the default CircleCI workflow
triggerRerunLabel: "PR action: rerun CI at HEAD"

View File

@ -1,15 +0,0 @@
name: Lock closed inactive issues
on:
schedule:
# Run at 16:00 every day
- cron: '0 16 * * *'
jobs:
lock_closed:
if: github.repository == 'angular/angular'
runs-on: ubuntu-latest
steps:
- uses: angular/dev-infra/github-actions/lock-closed@66462f6
with:
lock-bot-key: ${{ secrets.LOCK_BOT_PRIVATE_KEY }}

19
.gitignore vendored
View File

@ -1,28 +1,22 @@
.DS_STORE .DS_STORE
/dist/ /dist/
/bazel-out /bazel-out/
/integration/bazel/bazel-* /integration/bazel/bazel-*
*.log e2e_test.*
node_modules node_modules
bower_components
tools/gulp-tasks/cldr/cldr-data/
# Include when developing application packages. # Include when developing application packages.
pubspec.lock pubspec.lock
.c9 .c9
.idea/ .idea/
.devcontainer/*
!.devcontainer/README.md
!.devcontainer/recommended-devcontainer.json
!.devcontainer/recommended-Dockerfile
.settings/ .settings/
.vscode/launch.json .vscode/launch.json
.vscode/settings.json
.vscode/tasks.json
*.swo *.swo
modules/.settings modules/.settings
modules/.vscode modules/.vscode
.vimrc
.nvimrc
# Don't check in secret files # Don't check in secret files
*secret.js *secret.js
@ -40,8 +34,3 @@ yarn-error.log
# User specific bazel settings # User specific bazel settings
.bazelrc.user .bazelrc.user
.notes.md
baseline.json
# Ignore .history for the xyz.local-history VSCode extension
.history

View File

@ -1,145 +0,0 @@
<type>(<scope>): <summary>
<Describe the motivation behind this change - explain WHY you are making this change. Wrap all lines
at 100 characters.>
Fixes #<issue number>
# ────────────────────────────────────────── 100 chars ────────────────────────────────────────────┤
# Example Commit Messages
# =======================
# ─── Example: Simple refactor ────────────────────────────────────────────────────────────────────┤
# refactor(core): rename refreshDynamicEmbeddedViews to refreshEmbeddedViews
#
# Improve code readability. The original name no longer matches how the function is used.
# ─────────────────────────────────────────────────────────────────────────────────────────────────┤
# ─── Example: Simple docs change ─────────────────────────────────────────────────────────────────┤
# docs: clarify the service limitation in providers.md guide
#
# Fixes #36332
# ─────────────────────────────────────────────────────────────────────────────────────────────────┤
# ─── Example: A bug fix ──────────────────────────────────────────────────────────────────────────┤
# fix(ngcc): ensure lockfile is removed when `analyzeFn` fails
#
# Previously an error thrown in the `analyzeFn` would cause the ngcc process to exit immediately
# without removing the lockfile, and potentially before the unlocker process had been successfully
# spawned resulting in the lockfile being orphaned and left behind.
#
# Now we catch these errors and remove the lockfile as needed.
# ─────────────────────────────────────────────────────────────────────────────────────────────────┤
# ─── Example: Breaking change ────────────────────────────────────────────────────────────────────┤
# feat(bazel): simplify ng_package by dropping esm5 and fesm5
#
# esm5 and fesm5 distributions are no longer needed and have been deprecated in the past.
#
# https://v9.angular.io/guide/deprecations#esm5-and-fesm5-code-formats-in-angular-npm-packages
#
# This commit modifies ng_package to no longer distribute these two formats in npm packages built by
# ng_package (e.g. @angular/core).
#
# This commit intentionally doesn't fully clean up the ng_package rule to remove all traces of esm5
# and fems5 build artifacts as that is a bigger cleanup and currently we are narrowing down the
# scope of this change to the MVP needed for v10, which in this case is 'do not put esm5 and fesm5'
# into the npm packages.
#
# More cleanup to follow: https://angular-team.atlassian.net/browse/FW-2143
#
# BREAKING CHANGE: esm5 and fesm5 format is no longer distributed in Angular's npm packages e.g.
# @angular/core
#
# Angular CLI will automatically downlevel the code to es5 if differential loading is enabled in the
# Angular project, so no action is required from Angular CLI users.
#
# If you are not using Angular CLI to build your application or library, and you need to be able to
# build es5 artifacts, then you will need to downlevel the distributed Angular code to es5 on your
# own.
#
#
# Fixes #1234
# ─────────────────────────────────────────────────────────────────────────────────────────────────┤
# Angular Commit Message Format
# =============================
#
# The full specification of the Angular Commit Message Format can be found at
# https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit
#
# The following is an excerpt of the specification with the most commonly needed info.
#
# Each commit message consists of a *header*, a *body*, and a *footer*.
#
# <header>
# <BLANK LINE>
# <body>
# <BLANK LINE>
# <footer>
#
# The header is mandatory.
#
# The body is mandatory for all commits except for those of scope "docs". When the body is required
# it must be at least 20 characters long.
#
# The footer is optional.
#
# Any line of the commit message cannot be longer than 100 characters.
#
#
# Commit Message Header
# ---------------------
#
# <type>(<scope>): <short summary>
# │ │ │
# │ │ └─⫸ Summary in present tense. Not capitalized. No period at the end.
# │ │
# │ └─⫸ Commit Scope: animations|bazel|benchpress|common|compiler|compiler-cli|core|
# │ elements|forms|http|language-service|localize|platform-browser|
# │ platform-browser-dynamic|platform-server|platform-webworker|
# │ platform-webworker-dynamic|router|service-worker|upgrade|zone.js|
# │ packaging|changelog|dev-infra|docs-infra|migrations|ngcc|ve
# │ https://github.com/angular/angular/blob/master/CONTRIBUTING.md#scope
# │
# └─⫸ Commit Type: build|ci|docs|feat|fix|perf|refactor|style|test
# https://github.com/angular/angular/blob/master/CONTRIBUTING.md#type
#
#
# Commit Message Body
# ---------------------
#
# Just as in the summary, use the imperative, present tense: "fix" not "fixed" nor "fixes".
#
# Explain the motivation for the change in the commit message body. This commit message should
# explain WHY you are making the change. You can include a comparison of the previous behavior with
# the new behavior in order to illustrate the impact of the change.
#
#
# Commit Message Footer
# ---------------------
#
# The footer can contain information about breaking changes and is also the place to reference
# GitHub issues, Jira tickets, and other PRs that this commit closes or is related to.
#
# ```
# BREAKING CHANGE: <breaking change summary>
# <BLANK LINE>
# <breaking change description + migration instructions>
# <BLANK LINE>
# <BLANK LINE>
# Fixes #<issue number>
# ```
#
# Breaking Change section should start with the phrase "BREAKING CHANGE: " followed by a summary of
# the breaking change, a blank line, and a detailed description of the breaking change that also
# includes migration instructions.
#

View File

@ -1,53 +0,0 @@
import {CommitMessageConfig} from '../dev-infra/commit-message/config';
/**
* The configuration for `ng-dev commit-message` commands.
*/
export const commitMessage: CommitMessageConfig = {
maxLineLength: 120,
minBodyLength: 20,
minBodyLengthTypeExcludes: ['docs', 'upstream'],
types: [
'build',
'ci',
'docs',
'feat',
'fix',
'perf',
'refactor',
'release',
'style',
'test',
'upstream',
],
scopes: [
'animations',
'bazel',
'benchpress',
'changelog',
'common',
'compiler',
'compiler-cli',
'core',
'dev-infra',
'docs-infra',
'elements',
'forms',
'http',
'language-service',
'localize',
'migrations',
'ngcc',
'packaging',
'platform-browser',
'platform-browser-dynamic',
'platform-server',
'platform-webworker',
'platform-webworker-dynamic',
'router',
'service-worker',
'upgrade',
've',
'zone.js',
]
};

View File

@ -1,11 +0,0 @@
import {commitMessage} from './commit-message';
import {format} from './format';
import {github} from './github';
import {merge} from './merge';
module.exports = {
commitMessage,
format,
github,
merge,
};

View File

@ -1,22 +0,0 @@
import {FormatConfig} from '../dev-infra/format/config';
/**
* Configuration for the `ng-dev format` command.
*/
export const format: FormatConfig = {
'clang-format': {
'matchers': [
'**/*.{js,ts}',
// TODO: burn down format failures and remove aio and integration exceptions.
'!aio/**',
'!integration/**',
// Both third_party and .yarn are directories containing copied code which should
// not be modified.
'!third_party/**',
'!.yarn/**',
// Do not format d.ts files as they are generated
'!**/*.d.ts',
]
},
'buildifier': true
};

View File

@ -1,15 +0,0 @@
# The file is inert unless it's explicitly included into the local git config via:
#
# ```
# git config --add include.path '../.ng-dev/gitconfig'
# ```
#
# Calling that command will append the following into `.git/config` of the current git workspace
# (i.e. $GIT_DIR, typically `angular/.git/config`):
#
# ```
# [include]
# path = ../.ng-dev/gitconfig
# ```
[commit]
template = .gitmessage

View File

@ -1,11 +0,0 @@
import {GithubConfig} from '../dev-infra/utils/config';
/**
* Github configuration for the `ng-dev` command. This repository is used as
* remote for the merge script and other utilities like `ng-dev pr rebase`.
*/
export const github: GithubConfig = {
owner: 'angular',
name: 'angular'
};

View File

@ -1,38 +0,0 @@
import {MergeConfig} from '../dev-infra/pr/merge/config';
/**
* Configuration for the merge tool in `ng-dev`. This sets up the labels which
* are respected by the merge script (e.g. the target labels).
*/
export const merge = (): MergeConfig => {
// TODO: resume dynamically determining patch branch
const patch = '10.0.x';
return {
githubApiMerge: false,
claSignedLabel: 'cla: yes',
mergeReadyLabel: /^PR action: merge(-assistance)?/,
caretakerNoteLabel: 'PR action: merge-assistance',
commitMessageFixupLabel: 'commit message fixup',
labels: [
{
pattern: 'PR target: master-only',
branches: ['master'],
},
{
pattern: 'PR target: patch-only',
branches: [patch],
},
{
pattern: 'PR target: master & patch',
branches: ['master', patch],
},
],
requiredBaseCommits: {
// PRs that target either `master` or the patch branch, need to be rebased
// on top of the latest commit message validation fix.
// These SHAs are the commits that update the required license text in the header.
'master': '5aeb9a4124922d8ac08eb73b8f322905a32b0b3a',
[patch]: '27b95ba64a5d99757f4042073fd1860e20e3ed24'
},
};
};

2
.nvmrc
View File

@ -1 +1 @@
12.14.1 10.9.0

File diff suppressed because it is too large Load Diff

25
.vscode/README.md vendored
View File

@ -1,25 +0,0 @@
# VSCode Configuration
This folder contains opt-in [Workspace Settings](https://code.visualstudio.com/docs/getstarted/settings), [Tasks](https://code.visualstudio.com/docs/editor/tasks), [Launch Configurations](https://code.visualstudio.com/Docs/editor/debugging#_launch-configurations) and [Extension Recommendations](https://code.visualstudio.com/docs/editor/extension-gallery#_workspace-recommended-extensions) that the Angular team recommends using when working on this repository.
## Usage
To use the recommended configurations follow the steps below:
- install the recommneded extensions in `.vscode/extensions.json`
- copy (or link) `.vscode/recommended-settings.json` to `.vscode/settings.json`
- copy (or link) `.vscode/recommended-launch.json` to `.vscode/launch.json`
- copy (or link) `.vscode/recommended-tasks.json` to `.vscode/tasks.json`
- restart the editor
If you already have your custom workspace settings you should instead manually merge the file contents.
This isn't an automatic process so you will need to repeat it when settings are updated.
To see the recommended extensions select "Extensions: Show Recommended Extensions" in the [Command Palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette).
## Editing `.vscode/recommended-*.json` files
If you wish to add extra configuration items please keep in mind any modifications you make here will be used by many users.
Try to keep these settings/configuations to things that help facilitate the development process and avoid altering the user workflow whenever possible.

View File

@ -8,8 +8,5 @@
"gkalpak.aio-docs-utils", "gkalpak.aio-docs-utils",
"ms-vscode.vscode-typescript-tslint-plugin", "ms-vscode.vscode-typescript-tslint-plugin",
"xaver.clang-format", "xaver.clang-format",
// The following extensions are useful when working on angular.io (i.e. inside the `aio/` directory).
//"angular.ng-template",
//"dbaeumer.vscode-eslint",
], ],
} }

View File

@ -1,85 +0,0 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Attach to bazel test ... --config=debug",
"type": "node",
"request": "attach",
"port": 9229,
"address": "localhost",
"restart": false,
"sourceMaps": true,
"localRoot": "${workspaceRoot}",
"remoteRoot": "${workspaceRoot}",
"stopOnEntry": false,
"timeout": 600000,
},
{
"name": "Attach to bazel test ... --config=debug (no source maps)",
"type": "node",
"request": "attach",
"port": 9229,
"address": "localhost",
"restart": false,
"sourceMaps": false,
"localRoot": "${workspaceRoot}",
"remoteRoot": "${workspaceRoot}",
"stopOnEntry": false,
"timeout": 600000,
},
{
"name": "IVY:packages/core/test/acceptance",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/bazelisk",
"args": [
"test",
"--config=ivy",
"packages/core/test/acceptance",
"--config=debug"
],
"port": 9229,
"address": "localhost",
"restart": true,
"sourceMaps": true,
"timeout": 600000,
},
{
"name": "IVY:packages/core/test/render3",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/bazelisk",
"args": [
"test",
"--config=ivy",
"packages/core/test/render3",
"--config=debug"
],
"port": 9229,
"address": "localhost",
"restart": true,
"sourceMaps": true,
"timeout": 600000,
},
{
"name": "IVY:packages/core/test",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/bazelisk",
"args": [
"test",
"--config=ivy",
"packages/core/test",
"--config=debug"
],
"port": 9229,
"address": "localhost",
"restart": true,
"sourceMaps": true,
"timeout": 600000,
},
]
}

View File

@ -1,32 +0,0 @@
{
// Format js and ts files on save with `clang-format.executable`
// If `clang-format.executable` is not being used, these two settings should be removed otherwise it will break existing formatting.
// You can instead run `yarn gulp format` to manually format your code.
"[javascript]": {
"editor.formatOnSave": true,
},
"[typescript]": {
"editor.formatOnSave": true,
},
// Please install https://marketplace.visualstudio.com/items?itemName=xaver.clang-format to take advantage of `clang-format` in VSCode.
// (See https://clang.llvm.org/docs/ClangFormat.html for more info `clang-format`.)
"clang-format.executable": "${workspaceRoot}/node_modules/.bin/clang-format",
// Exclude third party modules and build artifacts from the editor watchers/searches.
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/**": true,
"**/bazel-out/**": true,
"**/dist/**": true,
"**/aio/src/generated/**": true,
},
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/bazel-out": true,
"**/dist": true,
"**/aio/src/generated": true,
".history": true,
},
"git.ignoreLimitWarning": true,
}

View File

@ -1,113 +0,0 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "IVY:packages/core/test/...",
"type": "shell",
"command": "${workspaceFolder}/node_modules/.bin/bazelisk",
"args": [
"test",
"--config=ivy",
"packages/core/test",
"packages/core/test/acceptance",
"packages/core/test/render3",
],
"group": "test",
"presentation": {
"reveal": "always",
"panel": "dedicated",
},
},
{
"label": "VE:packages/core/test/...",
"type": "shell",
"command": "${workspaceFolder}/node_modules/.bin/bazelisk",
"args": [
"test",
"packages/core/test",
"packages/core/test/acceptance",
"packages/core/test/render3",
],
"group": "test",
"presentation": {
"reveal": "always",
"panel": "dedicated",
},
},
{
"label": "IVY:packages/core/test/acceptance",
"type": "shell",
"command": "${workspaceFolder}/node_modules/.bin/bazelisk",
"args": [
"test",
"--config=ivy",
"packages/core/test/acceptance",
],
"group": "test",
"presentation": {
"reveal": "always",
"panel": "dedicated",
},
},
{
"label": "VE:packages/core/test/acceptance",
"type": "shell",
"command": "${workspaceFolder}/node_modules/.bin/bazelisk",
"args": [
"test",
"packages/core/test/acceptance",
],
"group": "test",
"presentation": {
"reveal": "always",
"panel": "dedicated",
},
},
{
"label": "IVY:packages/core/test",
"type": "shell",
"command": "${workspaceFolder}/node_modules/.bin/bazelisk",
"args": [
"test",
"--config=ivy",
"packages/core/test",
],
"group": "test",
"presentation": {
"reveal": "always",
"panel": "dedicated",
},
},
{
"label": "VE:packages/core/test",
"type": "shell",
"command": "${workspaceFolder}/node_modules/.bin/bazelisk",
"args": [
"test",
"packages/core/test",
],
"group": "test",
"presentation": {
"reveal": "always",
"panel": "dedicated",
},
},
{
"label": "IVY:packages/core/test/render3",
"type": "shell",
"command": "${workspaceFolder}/node_modules/.bin/bazelisk",
"args": [
"test",
"--config=ivy",
"packages/core/test/render3",
],
"group": "test",
"presentation": {
"reveal": "always",
"panel": "dedicated",
},
},
],
}

27
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,27 @@
{
"[javascript]": {
"editor.formatOnSave": true,
},
"[typescript]": {
"editor.formatOnSave": true,
},
// Please install https://marketplace.visualstudio.com/items?itemName=xaver.clang-format to take advantage of `clang-format` in VSCode.
// (See https://clang.llvm.org/docs/ClangFormat.html for more info `clang-format`.)
"clang-format.executable": "${workspaceRoot}/node_modules/.bin/clang-format",
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/**": true,
"**/bazel-out/**": true,
"**/dist/**": true,
"**/aio/src/generated/**": true,
},
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/bazel-out": true,
"**/dist": true,
"**/aio/src/generated": true,
},
"git.ignoreLimitWarning": true,
}

View File

@ -1,13 +0,0 @@
# Yarn Vendoring
We utilize Yarn's `yarn-path` configuration in a shared `.yarnrc` file to enforce
everyone using the same version of Yarn. Yarn checks the `.yarnrc` file to
determine if yarn should delegate the command to a vendored version at the
provided path.
## How to update
To update to the latest version of Yarn as our vendored version:
- Run this command
```sh
yarn policies set-version latest
```
- Remove the previous version

File diff suppressed because one or more lines are too long

View File

@ -1,5 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
yarn-path ".yarn/releases/yarn-1.22.4.js"

View File

@ -1,33 +1,20 @@
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
exports_files([ exports_files([
"tsconfig.json",
"LICENSE", "LICENSE",
"karma-js.conf.js", "protractor-perf.conf.js",
"browser-providers.conf.js",
"scripts/ci/track-payload-size.sh",
"scripts/ci/payload-size.sh",
"scripts/ci/payload-size.js",
"package.json",
]) ])
alias(
name = "tsconfig.json",
actual = "//packages:tsconfig-build.json",
)
filegroup( filegroup(
name = "web_test_bootstrap_scripts", name = "web_test_bootstrap_scripts",
# do not sort # do not sort
srcs = [ srcs = [
"@npm//:node_modules/core-js/client/core.js", "@npm//node_modules/reflect-metadata:Reflect.js",
"//packages/zone.js/bundles:zone.umd.js", "@npm//node_modules/zone.js:dist/zone.js",
"//packages/zone.js/bundles:zone-testing.umd.js", "@npm//node_modules/zone.js:dist/zone-testing.js",
"//packages/zone.js/bundles:task-tracking.umd.js", "@npm//node_modules/zone.js:dist/task-tracking.js",
"//:test-events.js", "//:test-events.js",
"//:third_party/shims_for_IE.js",
# Including systemjs because it defines `__eval`, which produces correct stack traces.
"@npm//:node_modules/systemjs/dist/system.src.js",
"@npm//:node_modules/reflect-metadata/Reflect.js",
], ],
) )
@ -36,14 +23,14 @@ filegroup(
srcs = [ srcs = [
# We also declare the unminfied AngularJS files since these can be used for # We also declare the unminfied AngularJS files since these can be used for
# local debugging (e.g. see: packages/upgrade/test/common/test_helpers.ts) # local debugging (e.g. see: packages/upgrade/test/common/test_helpers.ts)
"@npm//:node_modules/angular/angular.js", "@npm//node_modules/angular:angular.js",
"@npm//:node_modules/angular/angular.min.js", "@npm//node_modules/angular:angular.min.js",
"@npm//:node_modules/angular-1.5/angular.js", "@npm//node_modules/angular-1.5:angular.js",
"@npm//:node_modules/angular-1.5/angular.min.js", "@npm//node_modules/angular-1.5:angular.min.js",
"@npm//:node_modules/angular-1.6/angular.js", "@npm//node_modules/angular-1.6:angular.js",
"@npm//:node_modules/angular-1.6/angular.min.js", "@npm//node_modules/angular-1.6:angular.min.js",
"@npm//:node_modules/angular-mocks/angular-mocks.js", "@npm//node_modules/angular-mocks:angular-mocks.js",
"@npm//:node_modules/angular-mocks-1.5/angular-mocks.js", "@npm//node_modules/angular-mocks-1.5:angular-mocks.js",
"@npm//:node_modules/angular-mocks-1.6/angular-mocks.js", "@npm//node_modules/angular-mocks-1.6:angular-mocks.js",
], ],
) )

File diff suppressed because it is too large Load Diff

View File

@ -1,72 +1,12 @@
# Código de Conducta # Contributor Code of Conduct
## Version 0.3b-angular
## 1. Propósito As contributors and maintainers of the Angular project, we pledge to respect everyone who contributes by posting issues, updating documentation, submitting pull requests, providing feedback in comments, and any other activities.
“Prometemos brindar cortesía y respeto a cualquier persona involucrada en esta comunidad, sin importar el género con el que se identifique, su orientación sexual, limitación física, edad, raza, etnia, religión o nivel de conocimiento. Esperamos que cualquiera que desee contribuir en este proyecto brinde el mismo comportamiento” Communication through any of Angular's channels (GitHub, Gitter, IRC, mailing lists, Google+, Twitter, etc.) must be constructive and never resort to personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
Bajo ese principio queremos enfocar esta comunidad, una comunidad de respeto por el otro, donde cualquiera que sienta pasión por Angular y desee involucrarse con cualquier tipo de actividad deberá ayudar a mantener una atmósfera de cortesía por el otro, respetando los pensamientos, acciones, ideales y propuestas del otro. We promise to extend courtesy and respect to everyone involved in this project regardless of gender, gender identity, sexual orientation, disability, age, race, ethnicity, religion, or level of experience. We expect anyone contributing to the Angular project to do the same.
## 2. Comportamiento esperado If any member of the community violates this code of conduct, the maintainers of the Angular project may take action, removing issues, comments, and PRs or blocking accounts as deemed appropriate.
- Evitar usar expresiones o gestos insultantes, humillantes o intimidatorios para referirnos a otros. If you are subject to or witness unacceptable behavior, or have any other concerns, please email us at [conduct@angular.io](mailto:conduct@angular.io).
- Ejercita la consideración y el respeto en tus comunicaciones y acciones.
- Absténte de adoptar una conducta y un lenguaje degradantes, discriminatorios, abusivos o acosadores.
- Evitar comportamientos que agredan las expresiones de identidad, género, creencias religiosas, acciones que lastimen o los aíslen a otros.
- Evitar comentarios sobre ideas políticas.
- No se toleran conductas físicas y actitudes dirigidas al descrédito personal, físico o emocional de cualquier persona.
- No se toleran chistes y comentarios excluyentes, sexistas y racistas.
- Se rechaza actitudes de hostigamiento.
- Se rechaza el acoso: este se entiende como cualquier tipo de comentario verbal que refuerce discriminación por género, identidad y expresión de género, orientación sexual, discapacidad, apariencia física, tamaño corporal, raza, edad o religión en contextos laborales o sociales.
- No se tolera el contacto físico y/o la atención sexual no deseada.
- Promover la igualdad de oportunidades de formación, educación, intercambio y retroalimentación antes, durante y después de los eventos.
- Intenta colaborar en lugar de generar conflicto.
- Sé consciente de tu entorno y de tus compañeros participantes. Alerta a líderes de la comunidad si notas una situación peligrosa, alguien en apuros, o violaciones de este Código de Conducta, incluso si parecen intrascendentes.
## 3. Comportamiento inaceptable
Comportamientos inaceptables incluyen: intimidación, acoso, abuso, discriminación, comunicación despectiva o degradante o acciones por cualquier participante en nuestra comunidad ya sea virtual, o en las comunicaciones uno-a-uno que se realizan en el contexto de la comunidad. Por favor ser respetuoso con todos.
El acoso incluye: comentarios nocivos o perjudiciales, verbales o escritos relacionados con el género, la orientación sexual, raza, religión, discapacidad; uso inadecuado de desnudos y / o imágenes sexuales en espacios públicos (incluyendo la presentación diapositivas); intimidación deliberada, acecho o seguimiento; fotografías o grabaciones acosadoras; interrupción sostenida de charlas y otros eventos; contacto físico inapropiado, y atención sexual no deseada.
## 4. Consecuencias de comportamiento inaceptable
Se espera que personas a quienes se les solicite que detengan su comportamiento inaceptable lo hagan de manera inmediata esto será válido para cualquier miembro de la comunidad.
En caso de presentarse una violación al código de conducta de manera repetida se tendrá cero tolerancia a este comportamiento por parte de los organizadores.
Si un miembro de la comunidad participa en una conducta inaceptable, los organizadores pueden tomar cualquier acción que consideren apropiada, hasta e incluyendo una prohibición temporal o expulsión permanente de la comunidad, sin previo aviso.
Priorizamos la seguridad de las personas marginadas sobre la comodidad de las personas privilegiadas. Nos reservamos el derecho de no actuar sobre las quejas relacionadas con:
- El "racismo inverso", "sexismo inverso" y "cisfobia".
- Comunicación razonable de límites, como "déjame en paz", "vete" o "no estoy discutiendo esto contigo".
- Al comunicarse en un "tono", no se encuentra agradable.
- Identificando comportamientos o suposiciones racistas, sexistas, cissexistas u opresivas.
## 5. ¿Qué hacer si se incumple el código de conducta?
Si eres víctima o testigo de una conducta inaceptable, o tienes cualquier inquietud, por favor comunícate con el equipo organizador lo antes posible:
- Mensaje directo: Michael Prentice (@splaktar)
- Mensaje directo: Jorge Cano (@jorgeucano)
- Mensaje directo: Andrés Villanueva (@villanuevand)
- Email: [soporte@angular.lat](mailto:soporte@angular.lat)
### ¿Qué pasa después?
- Una vez haya sido notificada el no cumplimiento de la norma, el equipo de liderazgo se reunirán y analizarán el caso.
- Los incidentes presentados se manejarán con discreción.
- Los organizadores se comunicarán con la persona que incumplió la norma y tomarán las medidas respectivas.
- Se realizará un acompañamiento a la persona agredida y se apoyará.
- Si el incidente se hace público, Angular Hispano no se hace responsable de los perjuicios que esto pueda ocasionar en el agresor o el agredido.
## 6. Alcance
Esperamos que todos los participantes de la comunidad (organizadores, voluntarios, contribuyentes pagados o de otro modo; patrocinadores; y otros invitados) se atengan a este Código de Conducta en todos los espacios virtuales y presenciales, así como en todas las comunicaciones de uno-a-uno pertinentes la comunidad.
### Colaboradores
- Alejandra Giraldo
- Vanessa Marely
- Mariano Alvarez
- Andrés Villanueva
- Michael Prentice
- javascript&friends
- Angular
- She Codes Angular
- Colombia dev

View File

@ -1,359 +0,0 @@
# Contributing to Angular
We would love for you to contribute to Angular and help make it even better than it is today!
As a contributor, here are the guidelines we would like you to follow:
- [Code of Conduct](#coc)
- [Question or Problem?](#question)
- [Issues and Bugs](#issue)
- [Feature Requests](#feature)
- [Submission Guidelines](#submit)
- [Coding Rules](#rules)
- [Commit Message Guidelines](#commit)
- [Signing the CLA](#cla)
## <a name="coc"></a> Code of Conduct
Help us keep Angular open and inclusive.
Please read and follow our [Code of Conduct][coc].
## <a name="question"></a> Got a Question or Problem?
Do not open issues for general support questions as we want to keep GitHub issues for bug reports and feature requests.
Instead, we recommend using [Stack Overflow](https://stackoverflow.com/questions/tagged/angular) to ask support-related questions. When creating a new question on Stack Overflow, make sure to add the `angular` tag.
Stack Overflow is a much better place to ask questions since:
- there are thousands of people willing to help on Stack Overflow
- questions and answers stay available for public viewing so your question/answer might help someone else
- Stack Overflow's voting system assures that the best answers are prominently visible.
To save your and our time, we will systematically close all issues that are requests for general support and redirect people to Stack Overflow.
If you would like to chat about the question in real-time, you can reach out via [our gitter channel][gitter].
## <a name="issue"></a> Found a Bug?
If you find a bug in the source code, you can help us by [submitting an issue](#submit-issue) to our [GitHub Repository][github].
Even better, you can [submit a Pull Request](#submit-pr) with a fix.
## <a name="feature"></a> Missing a Feature?
You can *request* a new feature by [submitting an issue](#submit-issue) to our GitHub Repository.
If you would like to *implement* a new feature, please consider the size of the change in order to determine the right steps to proceed:
* For a **Major Feature**, first open an issue and outline your proposal so that it can be discussed.
This process allows us to better coordinate our efforts, prevent duplication of work, and help you to craft the change so that it is successfully accepted into the project.
**Note**: Adding a new topic to the documentation, or significantly re-writing a topic, counts as a major feature.
* **Small Features** can be crafted and directly [submitted as a Pull Request](#submit-pr).
## <a name="submit"></a> Submission Guidelines
### <a name="submit-issue"></a> Submitting an Issue
Before you submit an issue, please search the issue tracker, maybe an issue for your problem already exists and the discussion might inform you of workarounds readily available.
We want to fix all the issues as soon as possible, but before fixing a bug we need to reproduce and confirm it.
In order to reproduce bugs, we require that you provide a minimal reproduction.
Having a minimal reproducible scenario gives us a wealth of important information without going back and forth to you with additional questions.
A minimal reproduction allows us to quickly confirm a bug (or point out a coding problem) as well as confirm that we are fixing the right problem.
We require a minimal reproduction to save maintainers' time and ultimately be able to fix more bugs.
Often, developers find coding problems themselves while preparing a minimal reproduction.
We understand that sometimes it might be hard to extract essential bits of code from a larger codebase but we really need to isolate the problem before we can fix it.
Unfortunately, we are not able to investigate / fix bugs without a minimal reproduction, so if we don't hear back from you, we are going to close an issue that doesn't have enough info to be reproduced.
You can file new issues by selecting from our [new issue templates](https://github.com/angular/angular/issues/new/choose) and filling out the issue template.
### <a name="submit-pr"></a> Submitting a Pull Request (PR)
Before you submit your Pull Request (PR) consider the following guidelines:
1. Search [GitHub](https://github.com/angular/angular/pulls) for an open or closed PR that relates to your submission.
You don't want to duplicate existing efforts.
2. Be sure that an issue describes the problem you're fixing, or documents the design for the feature you'd like to add.
Discussing the design upfront helps to ensure that we're ready to accept your work.
3. Please sign our [Contributor License Agreement (CLA)](#cla) before sending PRs.
We cannot accept code without a signed CLA.
Make sure you author all contributed Git commits with email address associated with your CLA signature.
4. Fork the angular/angular repo.
5. Make your changes in a new git branch:
```shell
git checkout -b my-fix-branch master
```
6. Create your patch, **including appropriate test cases**.
7. Follow our [Coding Rules](#rules).
8. Run the full Angular test suite, as described in the [developer documentation][dev-doc], and ensure that all tests pass.
9. Commit your changes using a descriptive commit message that follows our [commit message conventions](#commit).
Adherence to these conventions is necessary because release notes are automatically generated from these messages.
```shell
git commit -a
```
Note: the optional commit `-a` command line option will automatically "add" and "rm" edited files.
10. Push your branch to GitHub:
```shell
git push origin my-fix-branch
```
11. In GitHub, send a pull request to `angular:master`.
If we ask for changes via code reviews then:
* Make the required updates.
* Re-run the Angular test suites to ensure tests are still passing.
* Rebase your branch and force push to your GitHub repository (this will update your Pull Request):
```shell
git rebase master -i
git push -f
```
That's it! Thank you for your contribution!
#### After your pull request is merged
After your pull request is merged, you can safely delete your branch and pull the changes from the main (upstream) repository:
* Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows:
```shell
git push origin --delete my-fix-branch
```
* Check out the master branch:
```shell
git checkout master -f
```
* Delete the local branch:
```shell
git branch -D my-fix-branch
```
* Update your master with the latest upstream version:
```shell
git pull --ff upstream master
```
## <a name="rules"></a> Coding Rules
To ensure consistency throughout the source code, keep these rules in mind as you are working:
* All features or bug fixes **must be tested** by one or more specs (unit-tests).
* All public API methods **must be documented**.
* We follow [Google's JavaScript Style Guide][js-style-guide], but wrap all code at **100 characters**.
An automated formatter is available, see [DEVELOPER.md](docs/DEVELOPER.md#clang-format).
## <a name="commit"></a> Commit Message Format
*This specification is inspired and supersedes the [AngularJS commit message format][commit-message-format].*
We have very precise rules over how our Git commit messages must be formatted.
This format leads to **easier to read commit history**.
Each commit message consists of a **header**, a **body**, and a **footer**.
```
<header>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
```
The `header` is mandatory and must conform to the [Commit Message Header](#commit-header) format.
The `body` is mandatory for all commits except for those of scope "docs".
When the body is required it must be at least 20 characters long.
The `footer` is optional.
Any line of the commit message cannot be longer than 100 characters.
#### <a href="commit-header"></a>Commit Message Header
```
<type>(<scope>): <short summary>
│ │ │
│ │ └─⫸ Summary in present tense. Not capitalized. No period at the end.
│ │
│ └─⫸ Commit Scope: animations|bazel|benchpress|common|compiler|compiler-cli|core|
│ elements|forms|http|language-service|localize|platform-browser|
│ platform-browser-dynamic|platform-server|platform-webworker|
│ platform-webworker-dynamic|router|service-worker|upgrade|zone.js|
│ packaging|changelog|dev-infra|docs-infra|migrations|ngcc|ve
└─⫸ Commit Type: build|ci|docs|feat|fix|perf|refactor|style|test
```
The `<type>` and `<summary>` fields are mandatory, the `(<scope>)` field is optional.
##### Type
Must be one of the following:
* **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
* **ci**: Changes to our CI configuration files and scripts (example scopes: Circle, BrowserStack, SauceLabs)
* **docs**: Documentation only changes
* **feat**: A new feature
* **fix**: A bug fix
* **perf**: A code change that improves performance
* **refactor**: A code change that neither fixes a bug nor adds a feature
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
* **test**: Adding missing tests or correcting existing tests
##### Scope
The scope should be the name of the npm package affected (as perceived by the person reading the changelog generated from commit messages).
The following is the list of supported scopes:
* `animations`
* `bazel`
* `benchpress`
* `common`
* `compiler`
* `compiler-cli`
* `core`
* `elements`
* `forms`
* `http`
* `language-service`
* `localize`
* `platform-browser`
* `platform-browser-dynamic`
* `platform-server`
* `platform-webworker`
* `platform-webworker-dynamic`
* `router`
* `service-worker`
* `upgrade`
* `zone.js`
There are currently a few exceptions to the "use package name" rule:
* `packaging`: used for changes that change the npm package layout in all of our packages, e.g. public path changes, package.json changes done to all packages, d.ts file/format changes, changes to bundles, etc.
* `changelog`: used for updating the release notes in CHANGELOG.md
* `dev-infra`: used for dev-infra related changes within the directories /scripts, /tools and /dev-infra
* `docs-infra`: used for docs-app (angular.io) related changes within the /aio directory of the repo
* `migrations`: used for changes to the `ng update` migrations.
* `ngcc`: used for changes to the [Angular Compatibility Compiler](./packages/compiler-cli/ngcc/README.md)
* `ve`: used for changes specific to ViewEngine (legacy compiler/renderer).
* none/empty string: useful for `style`, `test` and `refactor` changes that are done across all packages (e.g. `style: add missing semicolons`) and for docs changes that are not related to a specific package (e.g. `docs: fix typo in tutorial`).
##### Summary
Use the summary field to provide a succinct description of the change:
* use the imperative, present tense: "change" not "changed" nor "changes"
* don't capitalize the first letter
* no dot (.) at the end
#### Commit Message Body
Just as in the summary, use the imperative, present tense: "fix" not "fixed" nor "fixes".
Explain the motivation for the change in the commit message body. This commit message should explain _why_ you are making the change.
You can include a comparison of the previous behavior with the new behavior in order to illustrate the impact of the change.
#### Commit Message Footer
The footer can contain information about breaking changes and is also the place to reference GitHub issues, Jira tickets, and other PRs that this commit closes or is related to.
```
BREAKING CHANGE: <breaking change summary>
<BLANK LINE>
<breaking change description + migration instructions>
<BLANK LINE>
<BLANK LINE>
Fixes #<issue number>
```
Breaking Change section should start with the phrase "BREAKING CHANGE: " followed by a summary of the breaking change, a blank line, and a detailed description of the breaking change that also includes migration instructions.
### Revert commits
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit.
The content of the commit message body should contain:
- information about the SHA of the commit being reverted in the following format: `This reverts commit <SHA>`,
- a clear description of the reason for reverting the commit message.
## <a name="cla"></a> Signing the CLA
Please sign our Contributor License Agreement (CLA) before sending pull requests. For any code
changes to be accepted, the CLA must be signed. It's a quick process, we promise!
* For individuals, we have a [simple click-through form][individual-cla].
* For corporations, we'll need you to
[print, sign and one of scan+email, fax or mail the form][corporate-cla].
If you have more than one GitHub accounts, or multiple email addresses associated with a single GitHub account, you must sign the CLA using the primary email address of the GitHub account used to author Git commits and send pull requests.
The following documents can help you sort out issues with GitHub accounts and multiple email addresses:
* https://help.github.com/articles/setting-your-commit-email-address-in-git/
* https://stackoverflow.com/questions/37245303/what-does-usera-committed-with-userb-13-days-ago-on-github-mean
* https://help.github.com/articles/about-commit-email-addresses/
* https://help.github.com/articles/blocking-command-line-pushes-that-expose-your-personal-email-address/
[angular-group]: https://groups.google.com/forum/#!forum/angular
[coc]: https://github.com/angular/code-of-conduct/blob/master/CODE_OF_CONDUCT.md
[commit-message-format]: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#
[corporate-cla]: http://code.google.com/legal/corporate-cla-v1.0.html
[dev-doc]: https://github.com/angular/angular/blob/master/docs/DEVELOPER.md
[github]: https://github.com/angular/angular
[gitter]: https://gitter.im/angular/angular
[individual-cla]: http://code.google.com/legal/individual-cla-v1.0.html
[js-style-guide]: https://google.github.io/styleguide/jsguide.html
[jsfiddle]: http://jsfiddle.net
[plunker]: http://plnkr.co/edit
[runnable]: http://runnable.com
[stackoverflow]: http://stackoverflow.com/questions/tagged/angular

View File

@ -1,340 +1,280 @@
# Contribuye a Angular # Contributing to Angular
¡Nos encantaría que contribuyeras a Angular y que ayudaras a hacerlo aún mejor de lo que es hoy! We would love for you to contribute to Angular and help make it even better than it is
Como colaborador, estos son los lineamientos que nos gustaría que siguieras: today! As a contributor, here are the guidelines we would like you to follow:
- [Código de conducta](#coc) - [Code of Conduct](#coc)
- [¿Preguntas o problemas?](#question) - [Question or Problem?](#question)
- [_Issues_ y _bugs_](#issue) - [Issues and Bugs](#issue)
- [Solicitud de funcionalidades](#feature) - [Feature Requests](#feature)
- [Guía para la creación de issues y PRs](#submit) - [Submission Guidelines](#submit)
- [Reglas del código](#rules) - [Coding Rules](#rules)
- [Convención para el mensaje de los _commits_](#commit) - [Commit Message Guidelines](#commit)
- [Firma del Acuerdo de Licencia de Colaborador (CLA)](#cla) - [Signing the CLA](#cla)
## <a name="coc"></a> Code of Conduct
Help us keep Angular open and inclusive. Please read and follow our [Code of Conduct][coc].
## <a name="question"></a> Got a Question or Problem?
Do not open issues for general support questions as we want to keep GitHub issues for bug reports and feature requests. You've got much better chances of getting your question answered on [Stack Overflow](https://stackoverflow.com/questions/tagged/angular) where the questions should be tagged with tag `angular`.
Stack Overflow is a much better place to ask questions since:
- there are thousands of people willing to help on Stack Overflow
- questions and answers stay available for public viewing so your question / answer might help someone else
- Stack Overflow's voting system assures that the best answers are prominently visible.
To save your and our time, we will systematically close all issues that are requests for general support and redirect people to Stack Overflow.
If you would like to chat about the question in real-time, you can reach out via [our gitter channel][gitter].
## <a name="issue"></a> Found a Bug?
If you find a bug in the source code, you can help us by
[submitting an issue](#submit-issue) to our [GitHub Repository][github]. Even better, you can
[submit a Pull Request](#submit-pr) with a fix.
## <a name="feature"></a> Missing a Feature?
You can *request* a new feature by [submitting an issue](#submit-issue) to our GitHub
Repository. If you would like to *implement* a new feature, please submit an issue with
a proposal for your work first, to be sure that we can use it.
Please consider what kind of change it is:
* For a **Major Feature**, first open an issue and outline your proposal so that it can be
discussed. This will also allow us to better coordinate our efforts, prevent duplication of work,
and help you to craft the change so that it is successfully accepted into the project.
* **Small Features** can be crafted and directly [submitted as a Pull Request](#submit-pr).
## <a name="submit"></a> Submission Guidelines
### <a name="submit-issue"></a> Submitting an Issue
Before you submit an issue, please search the issue tracker, maybe an issue for your problem already exists and the discussion might inform you of workarounds readily available.
We want to fix all the issues as soon as possible, but before fixing a bug we need to reproduce and confirm it. In order to reproduce bugs, we will systematically ask you to provide a minimal reproduction. Having a minimal reproducible scenario gives us a wealth of important information without going back & forth to you with additional questions.
A minimal reproduction allows us to quickly confirm a bug (or point out a coding problem) as well as confirm that we are fixing the right problem.
We will be insisting on a minimal reproduction scenario in order to save maintainers time and ultimately be able to fix more bugs. Interestingly, from our experience users often find coding problems themselves while preparing a minimal reproduction. We understand that sometimes it might be hard to extract essential bits of code from a larger code-base but we really need to isolate the problem before we can fix it.
Unfortunately, we are not able to investigate / fix bugs without a minimal reproduction, so if we don't hear back from you we are going to close an issue that doesn't have enough info to be reproduced.
You can file new issues by selecting from our [new issue templates](https://github.com/angular/angular/issues/new/choose) and filling out the issue template.
## <a name="coc"></a> Código de conducta ### <a name="submit-pr"></a> Submitting a Pull Request (PR)
Before you submit your Pull Request (PR) consider the following guidelines:
Ayúdanos a mantener Angular abierto e inclusivo. 1. Search [GitHub](https://github.com/angular/angular/pulls) for an open or closed PR
Por favor lee y sigue nuestro [Código de conducta][coc]. that relates to your submission. You don't want to duplicate effort.
1. Be sure that an issue describes the problem you're fixing, or documents the design for the feature you'd like to add.
Discussing the design up front helps to ensure that we're ready to accept your work.
## <a name="question"></a> ¿Tienes alguna pregunta o problema? 1. Please sign our [Contributor License Agreement (CLA)](#cla) before sending PRs.
We cannot accept code without this. Make sure you sign with the primary email address of the Git identity that has been granted access to the Angular repository.
No abras *issues* para preguntas de soporte general ya que queremos mantener los *issues* de GitHub para reporte de *bugs* y solicitud de funcionalidades. 1. Fork the angular/angular repo.
En su lugar, recomendamos utilizar [Stack Overflow](https://stackoverflow.com/questions/tagged/angular) para hacer preguntas relacionadas con soporte. Al crear una nueva pregunta en Stack Overflow, asegúrate de agregar el etiqueta (tag) de `angular`. 1. Make your changes in a new git branch:
Stack Overflow es mucho mejor para hacer preguntas ya que:
- Hay miles de personas dispuestas a ayudar en preguntas y respuestas de Stack Overflow
que permanecen disponibles para el público, por lo que tu pregunta o respuesta podría ayudar a otra persona.
- El sistema de votación de Stack Overflow asegura que las mejores respuestas sobresalgan y sean visibles.
Para ahorrar tu tiempo y el nuestro, cerraremos sistemáticamente todos los *issues* que sean solicitudes de soporte general y redirigiremos a las personas a Stack Overflow.
Si deseas chatear sobre alguna pregunta en tiempo real, puedes hacerlo a través de nuestro [canal de Gitter][gitter].
## <a name="issue"></a> ¿Encontraste un Bug?
Si encontraste un error en el código fuente, puedes ayudarnos [creando un *issue*](#submit-issue) en nuestro [repositorio de GitHub][github].
O incluso mejor, puedes [crear un *Pull Request*](#submit-pr) con la solución.
## <a name="feature"></a> ¿Falta alguna funcionalidad?
Puedes solicitar una nueva funcionalidad [creando un *issue*](#submit-issue) en nuestro repositorio de GitHub.
Si deseas implementar una nueva funcionalidad, por favor considera el tamaño del cambio para determinar los pasos correctos para continuar:
* Para un **cambio significativo**, primero abre un *issue* y describe tu propuesta para que pueda ser discutida.
Este proceso nos permite coordinar mejor nuestros esfuerzos, evitar trabajo duplicado y ayudarte a diseñar el cambio para que sea aceptado con éxito en el proyecto.
**Nota**: Agregar un nuevo tema a la documentación o reescribir significativamente un tema, también cuenta como *cambio significativo*.
* **Cambios pequeños** pueden ser elaborados y directamente [creados como un _pull request_](#submit-pr).
## <a name="submit"></a> Guía para la creación de issues y PRs
### <a name="submit-issue"></a> Creación de _issues_
Antes de crear un *issue*, por favor busca en el el *issue tracker*, quizá un *issue* para tu problema ya existe y la discusión puede informarte sobre soluciones alternativas disponibles.
Queremos solucionar todos los problemas lo antes posible, pero antes de corregir un bug necesitamos reproducirlo y confirmarlo.
Para reproducir errores, requerimos que proporciones una reproducción mínima.
Tener un escenario reproducible mínimo nos brinda una gran cantidad de información importante sin tener que ir y venir con preguntas adicionales.
Una reproducción mínima nos permite confirmar rápidamente un bug (o señalar un problema de código), así también confirmar que estamos solucionando el problema correcto.
Requerimos una reproducción mínima para ahorrar tiempo a los encargados del mantenimiento y en última instancia, poder corregir más bugs.
A menudo los desarrolladores encuentran problemas de código mientras preparan una reproducción mínima.
Entendemos que a veces puede ser difícil extraer porciones esenciales de código de un código más grande, pero realmente necesitamos aislar el problema antes de poder solucionarlo.
Desafortunadamente no podemos investigar/corregir errores sin una reproducción mínima, por lo que si no tenemos tu retroalimentación del bug, vamos a cerrar el *issue* ya que no tiene suficiente información para reproducirse.
Puedes presentar nuevos *issues* seleccionando nuestra [plantilla de _issues_](https://github.com/angular/angular/issues/new/choose) y complentando la plantilla.
### <a name="submit-pr"></a> Creación de un Pull Requests (PR)
Antes de crear tu Pull Request (PR) considera los siguientes lineamientos:
1. Busca en [GitHub](https://github.com/angular/angular/pulls) PRs que estén abiertos o cerrados y que estén relacionados con el que vas a crear.
No deseas duplicar los esfuerzos existentes.
2. Asegúrate de que el PR describa el problema que estás solucionando o que documente el diseño de la funcionalidad que deseas agregar.
Discutir el diseño por adelantado ayuda a garantizar que estemos listos para aceptar tu trabajo.
3. Por favor firma nuestro [Acuerdo de Licencia de Colaborador (CLA)](#cla) antes de crear PRs.
No podemos aceptar el código sin el Acuerdo de Licencia de Colaborador (CLA) firmado.
Asegúrate de crear todas las contribuciones de Git con la dirección de correo electrónico asociada con tu firma del Acuerdo de Licencia de Colaborador (CLA).
4. Haz *fork* del repositorio angular/angular.
5. Haz tus cambios en una nueva rama de Git:
```shell ```shell
git checkout -b my-fix-branch master git checkout -b my-fix-branch master
``` ```
6. Crea tu correción, **incluyendo casos de prueba apropiados**. 1. Create your patch, **including appropriate test cases**.
1. Follow our [Coding Rules](#rules).
7. Sigue nuestras [Reglas de código](#rules). 1. Run the full Angular test suite, as described in the [developer documentation][dev-doc],
and ensure that all tests pass.
8. Ejecuta todo el conjunto de pruebas de Angular, tal como está descrito en la [documentación del desarrollador][dev-doc], y asegúrate de que todas las pruebas pasen. 1. Commit your changes using a descriptive commit message that follows our
[commit message conventions](#commit). Adherence to these conventions
9. Crea un commit de tus cambios utilizando un mensaje de commit descriptivo que siga nuestra [convención para el mensaje de los commits](#commit). is necessary because release notes are automatically generated from these messages.
Es necesario cumplir con estas convenciones porque las notas de las versiones se generan automáticamente a partir de estos mensajes.
```shell ```shell
git commit -a git commit -a
``` ```
Nota: la opción de la línea de comandos de Git `-a` automaticamente hará "add" y "rm" a los archivos editados. Note: the optional commit `-a` command line option will automatically "add" and "rm" edited files.
10. Haz push de tu rama a GitHub: 1. Push your branch to GitHub:
```shell ```shell
git push origin my-fix-branch git push origin my-fix-branch
``` ```
11. En GitHub, crea un pull request a `angular:master`. 1. In GitHub, send a pull request to `angular:master`.
* If we suggest changes then:
* Make the required updates.
* Re-run the Angular test suites to ensure tests are still passing.
* Rebase your branch and force push to your GitHub repository (this will update your Pull Request):
Si solicitamos cambios a través de revisiones de código, sigue las siguientes indicaciones: ```shell
git rebase master -i
git push -f
```
* Haz los cambios requeridos. That's it! Thank you for your contribution!
* Ejecuta nuevamente el conjunto de pruebas de Angular para asegurar que todas las pruebas aún están pasando.
* Haz rebase de tu rama a la rama master y haz push con la opción `-f` a tu repositorio de Github (esto actualizará tu Pull Request):
```shell #### After your pull request is merged
git rebase master -i
git push -f
```
¡Es todo! ¡Muchas gracias por tu contribución! After your pull request is merged, you can safely delete your branch and pull the changes
from the main (upstream) repository:
* Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows:
#### Después del merge de tu pull request
Después de que se hizo merge de tu pull request, puedes eliminar de forma segura tu rama y hacer pull de los cambios del repositorio principal (upstream):
* Elimina la rama remota en GitHub a través de la interfaz de usuario web de GitHub o en tu línea de comandos de la siguiente manera:
```shell ```shell
git push origin --delete my-fix-branch git push origin --delete my-fix-branch
``` ```
* Muévete a la rama master: * Check out the master branch:
```shell ```shell
git checkout master -f git checkout master -f
``` ```
* Elimina tu rama local: * Delete the local branch:
```shell ```shell
git branch -D my-fix-branch git branch -D my-fix-branch
``` ```
* Actualiza tu rama master con la última versión del fork (upstream): * Update your master with the latest upstream version:
```shell ```shell
git pull --ff upstream master git pull --ff upstream master
``` ```
## <a name="rules"></a> Coding Rules
To ensure consistency throughout the source code, keep these rules in mind as you are working:
## <a name="rules"></a> Reglas del código * All features or bug fixes **must be tested** by one or more specs (unit-tests).
Para garantizar la coherencia en todo el código fuente, ten en cuenta estas reglas mientras trabajas: * All public API methods **must be documented**. (Details TBC).
* We follow [Google's JavaScript Style Guide][js-style-guide], but wrap all code at
**100 characters**. An automated formatter is available, see
[DEVELOPER.md](docs/DEVELOPER.md#clang-format).
* Todas las funcionalidades o solución de bugs **deben ser probadas** por una o más pruebas (pruebas unitarias). ## <a name="commit"></a> Commit Message Guidelines
* Todos los métodos públicos del API **deben ser documentados**.
* Seguimos la [guía de estilo JavaScript de Google][js-style-guide], pero cada línea no debe exceder **100 caracteres**.
Un formateador automatizado está disponible, revisar [DEVELOPER.md](docs/DEVELOPER.md#clang-format). We have very precise rules over how our git commit messages can be formatted. This leads to **more
readable messages** that are easy to follow when looking through the **project history**. But also,
we use the git commit messages to **generate the Angular change log**.
## <a name="commit"></a> Formato para el mensaje de los commits
*Esta especificación está inspirada y reemplaza el [Formato de mensaje de commits de AngularJS][commit-message-format].*
Tenemos reglas muy precisas sobre cómo deben formatearse nuestros mensajes de los commits de Git.
Este formato permite tener **un historial de commits más facil de leer**.
Cada mensaje de un commit consta del **header**, el **body**, y el **footer**.
### Commit Message Format
Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
format that includes a **type**, a **scope** and a **subject**:
``` ```
<header> <type>(<scope>): <subject>
<LINEA VACIA> <BLANK LINE>
<body> <body>
<LINEA VACIA> <BLANK LINE>
<footer> <footer>
``` ```
El `header` es obligatorio y debe ajustarse al formato del [mensaje del header del commit](#commit-header). The **header** is mandatory and the **scope** of the header is optional.
El `body` es obligatorio para todos los commits excepto los que tenga scope "docs". Any line of the commit message cannot be longer 100 characters! This allows the message to be easier
Cuando el body es requerido debe tener al menos 20 caracteres. to read on GitHub as well as in various git tools.
El `footer` es opcional. The footer should contain a [closing reference to an issue](https://help.github.com/articles/closing-issues-via-commit-messages/) if any.
Cualquier línea del mensaje del commit no puede tener más de 100 caracteres. Samples: (even more [samples](https://github.com/angular/angular/commits/master))
#### <a href="commit-header"></a>Mensaje del header del commit
``` ```
<tipo>(<alcance>): <resumen> docs(changelog): update changelog to beta.5
│ │ │ ```
│ │ └─⫸ Resumen corto escrito en modo imperativo, tiempo presente. Sin mayúsculas. Sin punto final. ```
│ │ fix(release): need to depend on latest rxjs and zone.js
│ └─⫸ Alcance del commit: animations|bazel|benchpress|common|compiler|compiler-cli|core|
│ elements|forms|http|language-service|localize|platform-browser| The version in our package.json gets copied to the one we publish, and users need the latest of these.
│ platform-browser-dynamic|platform-server|platform-webworker|
│ platform-webworker-dynamic|router|service-worker|upgrade|zone.js|
│ packaging|changelog|dev-infra|docs-infra|migrations|ngcc|ve
└─⫸ Tipo de commit: build|ci|docs|feat|fix|perf|refactor|style|test
``` ```
El `<tipo>` y `<resumen>` son obligatorios, el `(<alcance>)` es opcional. ### Revert
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit. In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.
### Type
Must be one of the following:
##### Tipo * **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
* **ci**: Changes to our CI configuration files and scripts (example scopes: Circle, BrowserStack, SauceLabs)
* **docs**: Documentation only changes
* **feat**: A new feature
* **fix**: A bug fix
* **perf**: A code change that improves performance
* **refactor**: A code change that neither fixes a bug nor adds a feature
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
* **test**: Adding missing tests or correcting existing tests
El tipo debe ser uno de los siguientes: ### Scope
The scope should be the name of the npm package affected (as perceived by the person reading the changelog generated from commit messages.
* **build**: cambios que afectan el sistema de compilación o dependencias externas (ejemplos de scopes: gulp, broccoli, npm) The following is the list of supported scopes:
* **ci**: cambios en nuestros archivos y scripts de configuración de CI (ejemplos de scopes: Circle, BrowserStack, SauceLabs)
* **docs**: cambios en la documentación
* **feat**: una nueva funcionalidad
* **fix**: una solución de un bug
* **perf**: un cambio de código que mejora el rendimiento.
* **refactor**: un cambio de código que no corrige ningún error ni agrega ninguna funcionalidad
* **style**: cambios que no afectan el significado del código (espacios en blanco, formato, falta de punto y coma, etc.)
* **test**: se agregan pruebas faltantes o se corrigen pruebas existentes
* **animations**
* **common**
* **compiler**
* **compiler-cli**
* **core**
* **elements**
* **forms**
* **http**
* **language-service**
* **platform-browser**
* **platform-browser-dynamic**
* **platform-server**
* **platform-webworker**
* **platform-webworker-dynamic**
* **router**
* **service-worker**
* **upgrade**
##### Alcance There are currently a few exceptions to the "use package name" rule:
El alcance debe ser el nombre del paquete npm afectado (tal como lo percibe la persona que lee el registro de cambios generado a partir de los mensajes de commit).
La siguiente es la lista de alcances permitidos: * **packaging**: used for changes that change the npm package layout in all of our packages, e.g.
public path changes, package.json changes done to all packages, d.ts file/format changes, changes
to bundles, etc.
* **changelog**: used for updating the release notes in CHANGELOG.md
* **docs-infra**: used for docs-app (angular.io) related changes within the /aio directory of the
repo
* none/empty string: useful for `style`, `test` and `refactor` changes that are done across all
packages (e.g. `style: add missing semicolons`) and for docs changes that are not related to a
specific package (e.g. `docs: fix typo in tutorial`).
* `animations` ### Subject
* `bazel` The subject contains a succinct description of the change:
* `benchpress`
* `common`
* `compiler`
* `compiler-cli`
* `core`
* `elements`
* `forms`
* `http`
* `language-service`
* `localize`
* `platform-browser`
* `platform-browser-dynamic`
* `platform-server`
* `platform-webworker`
* `platform-webworker-dynamic`
* `router`
* `service-worker`
* `upgrade`
* `zone.js`
Actualmente hay algunas excepciones a la regla "usar el nombre de paquete": * use the imperative, present tense: "change" not "changed" nor "changes"
* don't capitalize the first letter
* no dot (.) at the end
* `packaging`: usado para cambios que cambian el diseño de los paquetes de npm en todos nuestros paquetes. Ejemplos: cambios de la ruta públic, package.json cambios hechos a todos los paquetes, cambios a archivos o formatos d.ts, cambios a bundles, etc. ### Body
Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes".
The body should include the motivation for the change and contrast this with previous behavior.
* `changelog`: utilizado para actualizar las notas de la versión en CHANGELOG.md ### Footer
The footer should contain any information about **Breaking Changes** and is also the place to
reference GitHub issues that this commit **Closes**.
* `dev-infra`: utilizado para cambios relacionados con dev-infra dentro de los directorios /scripts, /tools y /dev-infra **Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines. The rest of the commit message is then used for this.
* `docs-infra`: utilizado para cambios relacionados con la documentación (angular.io) dentro del directorio /aio del repositorio A detailed explanation can be found in this [document][commit-message-format].
* `migrations`: utilizado para los cambios en las migraciones `ng update`. ## <a name="cla"></a> Signing the CLA
* `ngcc`: usado para los cambios del [Compilador de compatibilidad de Angular](./packages/compiler-cli/ngcc/README.md) Please sign our Contributor License Agreement (CLA) before sending pull requests. For any code
changes to be accepted, the CLA must be signed. It's a quick process, we promise!
* `ve`: utilizado para cambios específicos de ViewEngine (legacy compiler/renderer). * For individuals we have a [simple click-through form][individual-cla].
* For corporations we'll need you to
[print, sign and one of scan+email, fax or mail the form][corporate-cla].
* alcance vacío: útil para cambios de `style`, `test` y `refactor` que se realizan en todos los paquetes (ejemplo: `style: add missing semicolons`) y para cambios de la documentación que no están relacionados a un paquete en específico(ejemplo: `docs: corrige error gramatical en el tutorial`). <hr>
If you have more than one Git identity, you must make sure that you sign the CLA using the primary email address associated with the ID that has been granted access to the Angular repository. Git identities can be associated with more than one email address, and only one is primary. Here are some links to help you sort out multiple Git identities and email addresses:
##### Resumen
Usa el campo resumen para proporcionar una descripción breve del cambio:
* usa el modo imperativo, tiempo presente: "cambia" no "cambió" o "cambios"
* no debe de contener ninguna letra mayúscula
* no debe de conter punto (.) al final
#### Mensaje del cuerpo del commit
Tal como en el resumen, usa el modo imperativo, tiempo presente: "cambia" no "cambió" o "cambios".
Explica la razón del cambio en el el mensaje del cuerpo del commit. Este mensaje de confirmación debe explicar _por qué_ está realizando el cambio.
Puedes incluir una comparación del comportamiento anterior con el nuevo comportamiento para ilustrar el impacto del cambio.
#### Mensaje del footer del commit
El footer puede contener información sobre cambios significativos y también es el lugar para hacer referencia a issues de GitHub, tickets de Jira y otros PRs que están relacionados con el commit.
```
CAMBIO SIGNIFICATIVO: <resumen del cambio significativo>
<LINEA VACIA>
<descripción del cambio significativo + instrucciones para la migración>
<LINEA VACIA>
<LINEA VACIA>
Fix #<issue número>
```
La sección de cambios significativos debería comenzar con la frase "CAMBIO SIGNIFICATIVO: " seguido de un resumen del cambio significativo, una línea en blanco y una descripción detallada del cambio significativo que también incluya instrucciones de migración.
### Revirtiendo commits
Si el commit revierte un commit previo, el commit debería comenzar con `revert: `, seguido por el header del commit revertido.
El contenido del mensaje del commit debería contener:
- Información sobre el SHA del commit que se revierte en el siguiente formato: `Esto revierte el commit <SHA>`,
- Una descripción clara de la razón para revertir el mensaje del _commit_.
## <a name="cla"></a> Firma del Acuerdo de Licencia de Colaborador (CLA)
Por favor firma nuestro Acuerdo de Licencia de Colaborador (CLA) cuando creas tu primer pull request. Para que cualquier cambio de código sea aceptado, el Acuerdo de Licencia de Colaborador (CLA) debe ser firmado. Es un proceso rápido con nuestro CLA assistant que está integrado con nuestro CI.
Los siguientes documentos pueden ayudarte a resolver problemas con cuentas de GitHub y múltiples direcciones de correo electrónico:
* https://help.github.com/articles/setting-your-commit-email-address-in-git/ * https://help.github.com/articles/setting-your-commit-email-address-in-git/
* https://stackoverflow.com/questions/37245303/what-does-usera-committed-with-userb-13-days-ago-on-github-mean * https://stackoverflow.com/questions/37245303/what-does-usera-committed-with-userb-13-days-ago-on-github-mean
* https://help.github.com/articles/about-commit-email-addresses/ * https://help.github.com/articles/about-commit-email-addresses/
* https://help.github.com/articles/blocking-command-line-pushes-that-expose-your-personal-email-address/ * https://help.github.com/articles/blocking-command-line-pushes-that-expose-your-personal-email-address/
Note that if you have more than one Git identity, it is important to verify that you are logged in with the same ID with which you signed the CLA, before you commit changes. If not, your PR will fail the CLA check.
<hr>
[angular-group]: https://groups.google.com/forum/#!forum/angular [angular-group]: https://groups.google.com/forum/#!forum/angular

View File

@ -1,6 +1,6 @@
The MIT License The MIT License
Copyright (c) 2010-2020 Google LLC. http://angular.io/license Copyright (c) 2010-2019 Google LLC. http://angular.io/license
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,26 +0,0 @@
[![CircleCI](https://circleci.com/gh/angular/angular/tree/master.svg?style=shield)](https://circleci.com/gh/angular/workflows/angular/tree/master)
[![Join the chat at https://gitter.im/angular/angular](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/angular/angular?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![npm version](https://badge.fury.io/js/%40angular%2Fcore.svg)](https://www.npmjs.com/@angular/core)
# Angular
Angular is a development platform for building mobile and desktop web applications using TypeScript/JavaScript and other languages.
## Quickstart
[Get started in 5 minutes][quickstart].
## Changelog
[Learn about the latest improvements][changelog].
## Want to help?
Want to file a bug, contribute some code, or improve documentation? Excellent! Read up on our
guidelines for [contributing][contributing] and then check out one of our issues in the [hotlist: community-help](https://github.com/angular/angular/labels/hotlist%3A%20community-help).
[contributing]: https://github.com/angular/angular/blob/master/CONTRIBUTING.md
[quickstart]: https://angular.io/start
[changelog]: https://github.com/angular/angular/blob/master/CHANGELOG.md
[ng]: https://angular.io

View File

@ -1,25 +1,28 @@
# Angular en español [![CircleCI](https://circleci.com/gh/angular/angular/tree/master.svg?style=shield)](https://circleci.com/gh/angular/angular/tree/master)
[![BrowserStack Status](https://www.browserstack.com/automate/badge.svg?badge_key=LzF3RzBVVGt6VWE2S0hHaC9uYllOZz09LS1BVjNTclBKV0x4eVRlcjA4QVY1M0N3PT0=--eb4ce8c8dc2c1c5b2b5352d473ee12a73ac20e06)](https://www.browserstack.com/automate/public-build/LzF3RzBVVGt6VWE2S0hHaC9uYllOZz09LS1BVjNTclBKV0x4eVRlcjA4QVY1M0N3PT0=--eb4ce8c8dc2c1c5b2b5352d473ee12a73ac20e06)
[![Join the chat at https://gitter.im/angular/angular](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/angular/angular?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![npm version](https://badge.fury.io/js/%40angular%2Fcore.svg)](https://www.npmjs.com/@angular/core)
Angular es una plataforma de desarrollo para construir aplicaciones web y móviles que usa
TypeScript/JavaScript y otros lenguajes de programación.
## ¿Quieres ayudar? # Angular
### Documentación en español Angular is a development platform for building mobile and desktop web applications using Typescript/JavaScript and other languages.
¿Quieres mejorar la documentación? ¡Excelente! Lee nuestras pautas para ## Quickstart
[colaborar](CONTRIBUTING.md) y luego revisa algunos de nuestras
[issues](https://github.com/angular-hispano/angular/issues).
### El framework [Get started in 5 minutes][quickstart].
La colaboración para corregir errores y agregar funciones en el framework debe realizarse en inglés a través ## Changelog
del repositorio [angular/angular](https://github.com/angular/angular) upstream.
## Guía rápida [Learn about the latest improvements][changelog].
[Comienza a usarlo en 5 minutos](https://docs.angular.lat/start). ## Want to help?
## Registro de cambios (Changelog) Want to file a bug, contribute some code, or improve documentation? Excellent! Read up on our
guidelines for [contributing][contributing] and then check out one of our issues in the [hotlist: community-help](https://github.com/angular/angular/labels/hotlist%3A%20community-help).
[Últimas mejoras realizadas](CHANGELOG.md). [browserstack]: https://www.browserstack.com/automate/public-build/LzF3RzBVVGt6VWE2S0hHaC9uYllOZz09LS1BVjNTclBKV0x4eVRlcjA4QVY1M0N3PT0=--eb4ce8c8dc2c1c5b2b5352d473ee12a73ac20e06
[contributing]: https://github.com/angular/angular/blob/master/CONTRIBUTING.md
[quickstart]: https://angular.io/guide/quickstart
[changelog]: https://github.com/angular/angular/blob/master/CHANGELOG.md
[ng]: https://angular.io

110
WORKSPACE
View File

@ -1,44 +1,77 @@
workspace( workspace(name = "angular")
name = "angular",
managed_directories = {"@npm": ["node_modules"]},
)
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Uncomment for local bazel rules development
#local_repository(
# name = "build_bazel_rules_nodejs",
# path = "../rules_nodejs",
#)
#local_repository(
# name = "npm_bazel_typescript",
# path = "../rules_typescript",
#)
# Fetch rules_nodejs so we can install our npm dependencies # Fetch rules_nodejs so we can install our npm dependencies
http_archive( http_archive(
name = "build_bazel_rules_nodejs", name = "build_bazel_rules_nodejs",
sha256 = "84abf7ac4234a70924628baa9a73a5a5cbad944c4358cf9abdb4aab29c9a5b77", sha256 = "5c86b055c57e15bf32d9009a15bcd6d8e190c41b1ff2fb18037b75e0012e4e7c",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/1.7.0/rules_nodejs-1.7.0.tar.gz"], urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.26.0/rules_nodejs-0.26.0.tar.gz"],
) )
# Check the rules_nodejs version and download npm dependencies # Check the bazel version and download npm dependencies
# Note: bazel (version 2 and after) will check the .bazelversion file so we don't need to load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories", "yarn_install")
# assert on that. load("@build_bazel_rules_nodejs//:package.bzl", "check_rules_nodejs_version")
load("@build_bazel_rules_nodejs//:index.bzl", "check_rules_nodejs_version", "node_repositories", "yarn_install")
check_rules_nodejs_version(minimum_version_string = "1.7.0") # Bazel version must be at least v0.21.0 because:
# - 0.21.0 Using --incompatible_strict_action_env flag fixes cache when running `yarn bazel`
# (see https://github.com/angular/angular/issues/27514#issuecomment-451438271)
check_bazel_version(
message = """
You no longer need to install Bazel on your machine.
Angular has a dependency on the @bazel/bazel package which supplies it.
Try running `yarn bazel` instead.
(If you did run that, check that you've got a fresh `yarn install`)
""",
minimum_bazel_version = "0.21.0",
)
# The NodeJS rules version must be at least v0.15.3 because:
# - 0.15.2 Re-introduced the prod_only attribute on yarn_install
# - 0.15.3 Includes a fix for the `jasmine_node_test` rule ignoring target tags
# - 0.16.8 Supports npm installed bazel workspaces
# - 0.26.0 Fix for data files in yarn_install and npm_install
check_rules_nodejs_version("0.26.0")
# Setup the Node.js toolchain # Setup the Node.js toolchain
node_repositories( node_repositories(
node_repositories = { node_version = "10.9.0",
"12.14.1-darwin_amd64": ("node-v12.14.1-darwin-x64.tar.gz", "node-v12.14.1-darwin-x64", "0be10a28737527a1e5e3784d3ad844d742fe8b0718acd701fd48f718fd3af78f"),
"12.14.1-linux_amd64": ("node-v12.14.1-linux-x64.tar.xz", "node-v12.14.1-linux-x64", "07cfcaa0aa9d0fcb6e99725408d9e0b07be03b844701588e3ab5dbc395b98e1b"),
"12.14.1-windows_amd64": ("node-v12.14.1-win-x64.zip", "node-v12.14.1-win-x64", "1f96ccce3ba045ecea3f458e189500adb90b8bc1a34de5d82fc10a5bf66ce7e3"),
},
node_version = "12.14.1",
package_json = ["//:package.json"], package_json = ["//:package.json"],
preserve_symlinks = True,
yarn_version = "1.12.1",
) )
load("//integration:angular_integration_test.bzl", "npm_package_archives")
yarn_install( yarn_install(
name = "npm", name = "npm",
manual_build_file_contents = npm_package_archives(), data = [
"//:tools/npm/@angular_bazel/index.js",
"//:tools/npm/@angular_bazel/package.json",
"//:tools/postinstall-patches.js",
"//:tools/yarn/check-yarn.js",
],
package_json = "//:package.json", package_json = "//:package.json",
# Don't install devDependencies, they are large and not used under Bazel
prod_only = True,
yarn_lock = "//:yarn.lock", yarn_lock = "//:yarn.lock",
) )
yarn_install(
name = "ts-api-guardian_deps",
package_json = "@angular//tools/ts-api-guardian:package.json",
yarn_lock = "@angular//tools/ts-api-guardian:yarn.lock",
)
# Install all bazel dependencies of the @npm npm packages # Install all bazel dependencies of the @npm npm packages
load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies") load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
@ -49,22 +82,19 @@ load("//packages/bazel:package.bzl", "rules_angular_dev_dependencies")
rules_angular_dev_dependencies() rules_angular_dev_dependencies()
# Load protractor dependencies
load("@npm_bazel_protractor//:package.bzl", "npm_bazel_protractor_dependencies")
npm_bazel_protractor_dependencies()
# Load karma dependencies # Load karma dependencies
load("@npm_bazel_karma//:package.bzl", "npm_bazel_karma_dependencies") load("@npm_bazel_karma//:package.bzl", "rules_karma_dependencies")
npm_bazel_karma_dependencies() rules_karma_dependencies()
# Setup the rules_webtesting toolchain # Setup the rules_webtesting toolchain
load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories") load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories")
web_test_repositories() web_test_repositories()
load("//dev-infra/browsers:browser_repositories.bzl", "browser_repositories") # Temporary work-around for https://github.com/angular/angular/issues/28681
# TODO(gregmagolan): go back to @io_bazel_rules_webtesting browser_repositories
load("@npm_bazel_karma//:browser_repositories.bzl", "browser_repositories")
browser_repositories() browser_repositories()
@ -82,27 +112,3 @@ sass_repositories()
load("@io_bazel_skydoc//skylark:skylark.bzl", "skydoc_repositories") load("@io_bazel_skydoc//skylark:skylark.bzl", "skydoc_repositories")
skydoc_repositories() skydoc_repositories()
load("@bazel_toolchains//rules:environments.bzl", "clang_env")
load("@bazel_toolchains//rules:rbe_repo.bzl", "rbe_autoconfig")
rbe_autoconfig(
name = "rbe_ubuntu1604_angular",
# Need to specify a base container digest in order to ensure that we can use the checked-in
# platform configurations for the "ubuntu16_04" image. Otherwise the autoconfig rule would
# need to pull the image and run it in order determine the toolchain configuration. See:
# https://github.com/bazelbuild/bazel-toolchains/blob/3.2.0/configs/ubuntu16_04_clang/versions.bzl
base_container_digest = "sha256:5e750dd878df9fcf4e185c6f52b9826090f6e532b097f286913a428290622332",
# Note that if you change the `digest`, you might also need to update the
# `base_container_digest` to make sure marketplace.gcr.io/google/rbe-ubuntu16-04-webtest:<digest>
# and marketplace.gcr.io/google/rbe-ubuntu16-04:<base_container_digest> have
# the same Clang and JDK installed. Clang is needed because of the dependency on
# @com_google_protobuf. Java is needed for the Bazel's test executor Java tool.
digest = "sha256:f743114235a43355bf8324e2ba0fa6a597236fe06f7bc99aaa9ac703631c306b",
env = clang_env(),
registry = "marketplace.gcr.io",
# We can't use the default "ubuntu16_04" RBE image provided by the autoconfig because we need
# a specific Linux kernel that comes with "libx11" in order to run headless browser tests.
repository = "google/rbe-ubuntu16-04-webtest",
use_checked_in_confs = "Force",
)

View File

@ -1,12 +0,0 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# Googlebot uses an older version of Chrome
# For additional information see: https://developers.google.com/search/docs/guides/rendering
> 0.5%
last 2 major versions
Firefox ESR
not dead
IE 11

View File

@ -1,131 +1,135 @@
# Proyecto de documentación Angular (https://docs.angular.lat) # Angular documentation project (https://angular.io)
Todo en esta carpeta es parte del proyecto de documentación. Esto incluye: Everything in this folder is part of the documentation project. This includes
* El sitio web para mostrar la documentación * the web site for displaying the documentation
* La configuración de dgeni para convertir los archivos de origen a archivos renderizados que se pueden vizualizar en el sitio web. * the dgeni configuration for converting source files to rendered files that can be viewed in the web site.
* Las herramientas para establecer ejemplos para el desarrollo; y generar archivos en tiempo real y archivos zip desde los ejemplos. * the tooling for setting up examples for development; and generating live-example and zip files from the examples.
## Tareas de desarrollador ## Developer tasks
Nosotros usamos [Yarn](https://yarnpkg.com) para gestionar las dependencias y crear tareas de compilación. We use [Yarn](https://yarnpkg.com) to manage the dependencies and to run build tasks.
Debes ejecutar todas estas tareas desde la carpeta `angular/aio`. You should run all these tasks from the `angular/aio` folder.
Aquí están las tareas más importantes que podrías necesitar usar: Here are the most important tasks you might need to use:
* `yarn` - instalar todas las dependencias. * `yarn` - install all the dependencies.
* `yarn setup` - instalar todas las dependencias, boilerplate, stackblitz, zips y ejecuta dgeni en los documentos. * `yarn setup` - install all the dependencies, boilerplate, stackblitz, zips and run dgeni on the docs.
* `yarn setup-local` - igual que `setup`, pero crea los paquetes de Angular a partir del código y usa estas versiones construidas localmente (en lugar de las recuperadas desde npm) para aio y ejemplos de documentos boilerplate. * `yarn setup-local` - same as `setup`, but use the locally built Angular packages for aio and docs examples boilerplate.
* `yarn build` - crear una compilación de producción de la aplicación (después de instalar dependencias, boilerplate, etc). * `yarn build` - create a production build of the application (after installing dependencies, boilerplate, etc).
* `yarn build-local` - igual que `build`, pero usa `setup-local` en lugar de `setup`. * `yarn build-local` - same as `build`, but use `setup-local` instead of `setup`.
* `yarn build-local-with-viewengine` - igual que `build-local`, pero además también enciende el modo `ViewEngine` (pre-Ivy) en aio.
(Nota: Encender el modo `ViewEngine` en ejemplos de documentos, ver `yarn boilerplate:add:viewengine` abajo.)
* `yarn start` - ejecutar un servidor web de desarrollo que observa los archivos; luego crea el doc-viewer y vuelve a cargar la página, según sea necesario. * `yarn start` - run a development web server that watches the files; then builds the doc-viewer and reloads the page, as necessary.
* `yarn serve-and-sync` - ejecutar ambos, el `docs-watch` y `start` en la misma consola. * `yarn serve-and-sync` - run both the `docs-watch` and `start` in the same console.
* `yarn lint` - comprobar que el código del doc-viewer sigue nuestras reglas de estilo. * `yarn lint` - check that the doc-viewer code follows our style rules.
* `yarn test` - observar todos los archivos de origen, para el doc-viewer, y ejecuta todas las pruebas unitarias cuando haya algún cambio. * `yarn test` - watch all the source files, for the doc-viewer, and run all the unit tests when any change.
* `yarn test --watch=false` -ejecutar todas las pruebas unitarias una sola vez. * `yarn test --watch=false` - run all the unit tests once.
* `yarn e2e` - ejecutar todas las pruebas de e2e para el doc-viewer. * `yarn e2e` - run all the e2e tests for the doc-viewer.
* `yarn docs` - generar toda la documentación desde los archivos fuente. * `yarn docs` - generate all the docs from the source files.
* `yarn docs-watch` - observar el código Angular, los archivos de documentación y ejecutar un 'doc-gen' en corto circuito para los documentos que fueron cambiados. * `yarn docs-watch` - watch the Angular source and the docs files and run a short-circuited doc-gen for the docs that changed.
* `yarn docs-lint` - comprobar que el código del documento generado sigue nuestras reglas de estilo. * `yarn docs-lint` - check that the doc gen code follows our style rules.
* `yarn docs-test` - ejecutar las pruebas unitarias para el código de generación de doc. * `yarn docs-test` - run the unit tests for the doc generation code.
* `yarn boilerplate:add` - generar todo el código boilerplate para los ejemplos, para que puedan ejecutarse localmente. * `yarn boilerplate:add` - generate all the boilerplate code for the examples, so that they can be run locally. Add the option `--local` to use your local version of Angular contained in the "dist" folder.
* `yarn boilerplate:add:viewengine` - igual que `boilerplate:add` pero también enciende el modo `ViewEngine` (pre-Ivy). * `yarn boilerplate:remove` - remove all the boilerplate code that was added via `yarn boilerplate:add`.
* `yarn generate-stackblitz` - generate the stackblitz files that are used by the `live-example` tags in the docs.
* `yarn generate-zips` - generate the zip files from the examples. Zip available via the `live-example` tags in the docs.
* `yarn boilerplate:remove` - eliminar todo el código boilerplate que fue añadido a través`yarn boilerplate:add`. * `yarn example-e2e` - run all e2e tests for examples
* `yarn generate-stackblitz` - generar los archivos stackblitz que están usados por la etiqueta `live-example` en documentos. - `yarn example-e2e --setup` - force webdriver update & other setup, then run tests
* `yarn generate-zips` - generar los archivos zip desde los ejemplos. Zip está disponible a través de la etiqueta `live-example` en los documentos. - `yarn example-e2e --filter=foo` - limit e2e tests to those containing the word "foo"
- `yarn example-e2e --setup --local` - run e2e tests with the local version of Angular contained in the "dist" folder
* `yarn example-e2e` - ejecutar todas las pruebas e2e para ejemplos. Opciones disponibles: ## Developing on Windows
- `--setup`: generar boilerplate, forzar la actualización del controlador web y otras configuraciones, luego ejecutar las pruebas. The `packages/` directory may contain Linux-specific symlinks, which are not recognized by Windows.
- `--local`: ejecutar pruebas e2e con la versión local de Angular contenida en la carpeta "dist". These unresolved links cause the docs generation process to fail because it cannot locate certain files.
_Requiere `--setup` para que surta efecto._
- `--viewengine`: ejecutar pruebas e2e en modo `ViewEngine` (pre-Ivy).
- `--filter=foo`: limitar pruebas e2e a las que contienen la palabra "foo".
> **Nota para usuarios Windows** > Hint: The following steps require administration rights or [Windows Developer Mode](https://docs.microsoft.com/en-us/windows/uwp/get-started/enable-your-device-for-development) enabled!
>
> Configurar los ejemplos implica crear algunos [enlaces simbólicos](https://es.wikipedia.org/wiki/Enlace_simb%C3%B3lico) (ver [Aquí](./tools/examples/README.md#symlinked-node_modules) para más detalles). En Windows, esto requiere tener [Habilitado el Modo de desarrollador ](https://blogs.windows.com/windowsdeveloper/2016/12/02/symlinks-windows-10) (compatible con Windows 10 o más reciente) o ejecutar los comandos de configuración cómo administrador.
>
> Los comandos afectados son:
> - `yarn setup` / `yarn setup-*`
> - `yarn build` / `yarn build-*`
> - `yarn boilerplate:add`
> - `yarn example-e2e --setup`
## Usando ServiceWorker localmente To fix this problem, run `scripts/windows/create-symlinks.sh`. This command creates temporary files where the symlinks used to be. Make sure not to commit those files with your documentation changes.
When you are done making and testing your documentation changes, you can restore the original symlinks and delete the temporary files by running `scripts/windows/remove-symlinks.sh`.
Ejecutando `yarn start` (incluso cuando se apunta explícitamente al modo de producción) no configura el It's necessary to remove the temporary files, because otherwise they're displayed as local changes in your git working copy and certain operations are blocked.
ServiceWorker. Si quieres probar el ServiceWorker localmente, puedes usar `yarn build` y luego
ejecutar los archivos en `dist/` con `yarn http-server dist -p 4200`. ## Using ServiceWorker locally
Running `yarn start` (even when explicitly targeting production mode) does not set up the
ServiceWorker. If you want to test the ServiceWorker locally, you can use `yarn build` and then
serve the files in `dist/` with `yarn http-server dist -p 4200`.
## Guía de autoría ## Guide to authoring
Existen dos tipos de contenido en la documentación:
* **Documentación de API**: descripciones de los módulos, clases, interfaces, decoradores, etc que son parte de la plataforma Angular. There are two types of content in the documentation:
La documentacion de API está generada directamente desde el código fuente.
El código fuente está contenido en archivos TypeScript , almacenados en la carpeta `angular/packages`.
Cada elemento de la API puede tener un comentario anterior, el cual contiene etiquetas y contenido de estilos JSDoc.
El contenido está escrito en markdown.
* **Otro contenido**: guias, tutoriales, y otro material de marketing. * **API docs**: descriptions of the modules, classes, interfaces, decorators, etc that make up the Angular platform.
Todos los demás contenidos se escriben utilizando markdown en archivos de texto, ubicados en la carpeta `angular/aio/content`. API docs are generated directly from the source code.
Más específicamente, hay subcarpetas que contienen tipos particulares de contenido: guías, tutoriales y marketing. The source code is contained in TypeScript files, located in the `angular/packages` folder.
Each API item may have a preceding comment, which contains JSDoc style tags and content.
The content is written in markdown.
* **Ejempos de código**: los ejemplos de código deben ser comprobables para garantizar su precisión. * **Other content**: guides, tutorials, and other marketing material.
Además, nuestros ejemplos tienen un aspecto específico y permiten al usuario copiar el código fuente. Para mayor All other content is written using markdown in text files, located in the `angular/aio/content` folder.
ejemplos se representan en una interfaz con pestañas (e.g. template, HTML, y TypeScript en pestañas separadas). Adicionalmente, algunos son ejemplos en acción, que proporcionan enlaces donde se puede editar el código, ejecutar, y/o descargar. Para obtener más detalles sobre cómo trabajar con ejemplos de código, lea los [fragmentos de código](https://docs.angular.lat/guide/docs-style-guide#code-snippets), [código fuente de marcado ](https://docs.angular.lat/guide/docs-style-guide#source-code-markup), y [ ejemplos en acción ](https://docs.angular.lat/guide/docs-style-guide#live-examples) paginas de los [ autores de guías de estilo ](https://docs.angular.lat/guide/docs-style-guide). More specifically, there are sub-folders that contain particular types of content: guides, tutorial and marketing.
Usamos la herramienta [dgeni](https://github.com/angular/dgeni) para convertir estos archivos en docs que se pueden ver en el doc-viewer. * **Code examples**: code examples need to be testable to ensure their accuracy.
Las [guías de estilo para Autores](https://docs.angular.lat/guide/docs-style-guide) prescriben pautas para Also, our examples have a specific look and feel and allow the user to copy the source code. For larger
escribir páginas de guía, explica cómo usar la documentación de clases y componentes, y cómo marcar el código fuente para producir fragmentos de código. examples they are rendered in a tabbed interface (e.g. template, HTML, and TypeScript on separate
tabs). Additionally, some are live examples, which provide links where the code can be edited, executed, and/or downloaded. For details on working with code examples, please read the [Code snippets](https://angular.io/guide/docs-style-guide#code-snippets), [Source code markup](https://angular.io/guide/docs-style-guide#source-code-markup), and [Live examples](https://angular.io/guide/docs-style-guide#live-examples) pages of the [Authors Style Guide](https://angular.io/guide/docs-style-guide).
### Generando documentos completos We use the [dgeni](https://github.com/angular/dgeni) tool to convert these files into docs that can be viewed in the doc-viewer.
La principal tarea para generar los documentos es `yarn docs`. Esto procesará todos los archivos fuente (API y otros), extrayendo la documentación y generando archivos JSON que pueden ser consumidos por el doc-viewer. The [Authors Style Guide](https://angular.io/guide/docs-style-guide) prescribes guidelines for
writing guide pages, explains how to use the documentation classes and components, and how to markup sample source code to produce code snippets.
### Generación parcial de doc para editores ### Generating the complete docs
La generación completa de documentos puede llevar hasta un minuto. Eso es demasiado lento para la creación y edición eficiente de documentos. The main task for generating the docs is `yarn docs`. This will process all the source files (API and other),
extracting the documentation and generating JSON files that can be consumed by the doc-viewer.
Puedes ealizar pequeños cambios en un editor inteligente que muestre un markdown con formato: ### Partial doc generation for editors
>En VS Code, _Cmd-K, V_ abre la vista previa de markdown en el panel lateral; _Cmd-B_ alterna la barra izquierda
Puedes también mirar los cambios que se muestran correctamente en el doc-viewer Full doc generation can take up to one minute. That's too slow for efficient document creation and editing.
con un tiempo de ciclo rápido de edición / visualización.
Para este propósito, usa la tarea `yarn docs-watch`, que observa los cambios en los archivos de origen y solo vuelve a procesar los archivos necesarios para generar los documentos relacionados con el archivo que ha cambiado. You can make small changes in a smart editor that displays formatted markdown:
Dado que esta tarea tiene accesos directos, es mucho más rápido (a menudo menos de 1 segundo) pero no producirá contenido de fidelidad completa. Por ejemplo, los enlaces a otros documentoss y ejemplos de código pueden no mostrarse correctamente. Esto se nota especialmente en los enlaces a otros documentos y en los ejemplos incrustados, que no siempre se representan correctamente. >In VS Code, _Cmd-K, V_ opens markdown preview in side pane; _Cmd-B_ toggles left sidebar
La configuración general es la siguiente: You also want to see those changes displayed properly in the doc viewer
with a quick, edit/view cycle time.
* Abrir una terminal, estar seguro que las dependencias están instaladas; ejecutar una generación inicial del doc; luego iniciar el doc-viewer: For this purpose, use the `yarn docs-watch` task, which watches for changes to source files and only
re-processes the the files necessary to generate the docs that are related to the file that has changed.
Since this task takes shortcuts, it is much faster (often less than 1 second) but it won't produce full
fidelity content. For example, links to other docs and code examples may not render correctly. This is
most particularly noticed in links to other docs and in the embedded examples, which may not always render
correctly.
The general setup is as follows:
* Open a terminal, ensure the dependencies are installed; run an initial doc generation; then start the doc-viewer:
```bash ```bash
yarn setup yarn setup
yarn start yarn start
``` ```
* Abrir una segunda terminal e iniciar el observador de documentos. * Open a second terminal and start watching the docs
```bash ```bash
yarn docs-watch yarn docs-watch
``` ```
>Alternativamente, prueba el comando fusionado `serve-and-sync` que crea, observa y ejecuta en la misma ventana de la terminal >Alternatively, try the consolidated `serve-and-sync` command that builds, watches and serves in the same terminal window
```bash ```bash
yarn serve-and-sync yarn serve-and-sync
``` ```
* Abre un navegador con la siguiente dirección https://localhost:4200/ y navega hasta el documento en el que quieras trabajar. * Open a browser at https://localhost:4200/ and navigate to the document on which you want to work.
Puedes automáticamente abrir el navegador utilizando `yarn start -o` en la primera terminal. You can automatically open the browser by using `yarn start -o` in the first terminal.
* Realiza cambios en la página de documentación asociada o en los archivos de ejemplo. Cada vez que un archivo es guardado, la documentación se regenerará, la aplicación se reconstruirá y la página se volverá a cargar. * Make changes to the page's associated doc or example files. Every time a file is saved, the doc will
be regenerated, the app will rebuild and the page will reload.
*Si recibes un error de compilación acerca de los ejemplos o cualquier otro error, asegúrate de consultar las * If you get a build error complaining about examples or any other odd behavior, be sure to consult
[guías de estilo para Autores](https://angular.io/guide/docs-style-guide) para más información. the [Authors Style Guide](https://angular.io/guide/docs-style-guide).

View File

@ -1,5 +1,5 @@
# Image metadata and config # Image metadata and config
FROM debian:buster FROM debian:jessie
LABEL name="angular.io PR preview" \ LABEL name="angular.io PR preview" \
description="This image implements the PR preview functionality for angular.io." \ description="This image implements the PR preview functionality for angular.io." \
@ -37,10 +37,10 @@ ARG TEST_AIO_NGINX_PORT_HTTPS=4433
ARG AIO_SIGNIFICANT_FILES_PATTERN='^(?:aio|packages)/(?!.*[._]spec\\.[jt]s$)' ARG AIO_SIGNIFICANT_FILES_PATTERN='^(?:aio|packages)/(?!.*[._]spec\\.[jt]s$)'
ARG TEST_AIO_SIGNIFICANT_FILES_PATTERN=$AIO_SIGNIFICANT_FILES_PATTERN ARG TEST_AIO_SIGNIFICANT_FILES_PATTERN=$AIO_SIGNIFICANT_FILES_PATTERN
ARG AIO_TRUSTED_PR_LABEL="aio: preview" ARG AIO_TRUSTED_PR_LABEL="aio: preview"
ARG TEST_AIO_TRUSTED_PR_LABEL=$AIO_TRUSTED_PR_LABEL ARG TEST_AIO_TRUSTED_PR_LABEL="aio: preview"
ARG AIO_PREVIEW_SERVER_HOSTNAME=preview.localhost ARG AIO_PREVIEW_SERVER_HOSTNAME=preview.localhost
ARG TEST_AIO_PREVIEW_SERVER_HOSTNAME=$AIO_PREVIEW_SERVER_HOSTNAME ARG TEST_AIO_PREVIEW_SERVER_HOSTNAME=preview.localhost
ARG AIO_ARTIFACT_MAX_SIZE=26214400 ARG AIO_ARTIFACT_MAX_SIZE=20971520
ARG TEST_AIO_ARTIFACT_MAX_SIZE=200 ARG TEST_AIO_ARTIFACT_MAX_SIZE=200
ARG AIO_PREVIEW_SERVER_PORT=3000 ARG AIO_PREVIEW_SERVER_PORT=3000
ARG TEST_AIO_PREVIEW_SERVER_PORT=3001 ARG TEST_AIO_PREVIEW_SERVER_PORT=3001
@ -72,29 +72,25 @@ RUN mkdir /var/log/aio
# Add extra package sources # Add extra package sources
RUN apt-get update -y && apt-get install -y curl=7.64.0-4+deb10u1 RUN apt-get update -y && apt-get install -y curl
RUN curl --silent --show-error --location https://deb.nodesource.com/setup_12.x | bash - RUN curl --silent --show-error --location https://deb.nodesource.com/setup_10.x | bash -
RUN curl --silent --show-error https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - RUN curl --silent --show-error https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN echo "deb http://ftp.debian.org/debian jessie-backports main" | tee /etc/apt/sources.list.d/backports.list
# Install packages # Install packages
# NOTE: Some packages (such as `nginx`, `nodejs`, `openssl`) make older versions unavailable on the
# repositories, so we cannot pin to specific versions for these packages :(
# See for example:
# - https://github.com/nodesource/distributions/issues/33
# - https://askubuntu.com/questions/715104/how-can-i-downgrade-openssl-via-apt-get
RUN apt-get update -y && apt-get install -y \ RUN apt-get update -y && apt-get install -y \
cron=3.0pl1-134+deb10u1 \ chkconfig \
dnsmasq=2.80-1 \ cron \
nano=3.2-3 \ dnsmasq \
nginx \ nano \
nodejs \ nodejs \
openssl \ openssl \
rsyslog=8.1901.0-1 \ rsyslog \
vim=2:8.1.0875-5 \ yarn
yarn=1.22.4-1 RUN apt-get install -t jessie-backports -y nginx
RUN yarn global add pm2@4.4.0 RUN yarn global add pm2@2
# Set up log rotation # Set up log rotation
@ -155,7 +151,8 @@ RUN sed -i "s|{{\$AIO_PREVIEW_SERVER_PORT}}|$TEST_AIO_PREVIEW_SERVER_PORT|g" /et
# Set up pm2 # Set up pm2
RUN pm2 startup --user root > /dev/null RUN pm2 startup systemv -u root > /dev/null
RUN chkconfig pm2-root on
# Set up the shell scripts # Set up the shell scripts
@ -167,7 +164,8 @@ RUN find $AIO_SCRIPTS_SH_DIR -maxdepth 1 -type f -printf "%P\n" \
# Set up the Node.js scripts # Set up the Node.js scripts
COPY scripts-js/ $AIO_SCRIPTS_JS_DIR/ COPY scripts-js/ $AIO_SCRIPTS_JS_DIR/
RUN yarn --cwd="$AIO_SCRIPTS_JS_DIR/" install --production --frozen-lockfile WORKDIR $AIO_SCRIPTS_JS_DIR/
RUN yarn install --production --frozen-lockfile
# Set up health check # Set up health check

View File

@ -35,7 +35,6 @@ export class BuildCleaner {
]); ]);
} catch (error) { } catch (error) {
this.logger.error('ERROR:', error); this.logger.error('ERROR:', error);
throw error;
} }
} }

View File

@ -1,4 +1,5 @@
import * as express from 'express'; import * as express from 'express';
import {promisify} from 'util';
import {PreviewServerError} from './preview-error'; import {PreviewServerError} from './preview-error';
/** /**
@ -12,7 +13,7 @@ export async function respondWithError(res: express.Response, err: any): Promise
} }
res.status(err.status); res.status(err.status);
return new Promise(resolve => res.end(err.message, resolve)); await promisify(res.end.bind(res))(err.message);
} }
/** /**

View File

@ -1,6 +1,7 @@
// Imports // Imports
import * as cp from 'child_process'; import * as cp from 'child_process';
import * as fs from 'fs'; import * as fs from 'fs';
import * as http from 'http';
import * as path from 'path'; import * as path from 'path';
import * as shell from 'shelljs'; import * as shell from 'shelljs';
import {AIO_DOWNLOADS_DIR, HIDDEN_DIR_PREFIX} from '../common/constants'; import {AIO_DOWNLOADS_DIR, HIDDEN_DIR_PREFIX} from '../common/constants';
@ -93,7 +94,7 @@ class Helper {
return fs.readFileSync(absFilePath, 'utf8'); return fs.readFileSync(absFilePath, 'utf8');
} }
public runCmd(cmd: string, opts: cp.ExecOptions = {}): Promise<CmdResult> { public runCmd(cmd: string, opts: cp.ExecFileOptions = {}): Promise<CmdResult> {
return new Promise(resolve => { return new Promise(resolve => {
const proc = cp.exec(cmd, opts, (err, stdout, stderr) => resolve({success: !err, err, stdout, stderr})); const proc = cp.exec(cmd, opts, (err, stdout, stderr) => resolve({success: !err, err, stdout, stderr}));
this.createCleanUpFn(() => proc.kill()); this.createCleanUpFn(() => proc.kill());
@ -101,10 +102,21 @@ class Helper {
} }
public runForAllSupportedSchemes(suiteFactory: TestSuiteFactory): void { public runForAllSupportedSchemes(suiteFactory: TestSuiteFactory): void {
Object.entries(this.portPerScheme).forEach(([scheme, port]) => suiteFactory(scheme, port)); Object.keys(this.portPerScheme).forEach(scheme => suiteFactory(scheme, this.portPerScheme[scheme]));
} }
public verifyResponse(status: number, regex: string | RegExp = /^/): VerifyCmdResultFn { public verifyResponse(status: number | [number, string], regex: string | RegExp = /^/): VerifyCmdResultFn {
let statusCode: number;
let statusText: string;
if (Array.isArray(status)) {
statusCode = status[0];
statusText = status[1];
} else {
statusCode = status;
statusText = http.STATUS_CODES[statusCode] || 'UNKNOWN_STATUS_CODE';
}
return (result: CmdResult) => { return (result: CmdResult) => {
const [headers, body] = result.stdout. const [headers, body] = result.stdout.
split(/(?:\r?\n){2,}/). split(/(?:\r?\n){2,}/).
@ -119,7 +131,7 @@ class Helper {
} }
expect(result.success).toBe(true); expect(result.success).toBe(true);
expect(headers).toMatch(new RegExp(`HTTP/(?:1\\.1|2) ${status} `)); expect(headers).toContain(`${statusCode} ${statusText}`);
expect(body).toMatch(regex); expect(body).toMatch(regex);
}; };
} }

View File

@ -15,7 +15,7 @@ describe(`nginx`, () => {
afterEach(() => h.cleanUp()); afterEach(() => h.cleanUp());
it('should redirect HTTP to HTTPS', async () => { it('should redirect HTTP to HTTPS', done => {
const httpHost = `${AIO_NGINX_HOSTNAME}:${AIO_NGINX_PORT_HTTP}`; const httpHost = `${AIO_NGINX_HOSTNAME}:${AIO_NGINX_PORT_HTTP}`;
const httpsHost = `${AIO_NGINX_HOSTNAME}:${AIO_NGINX_PORT_HTTPS}`; const httpsHost = `${AIO_NGINX_HOSTNAME}:${AIO_NGINX_PORT_HTTPS}`;
const urlMap = { const urlMap = {
@ -24,15 +24,16 @@ describe(`nginx`, () => {
[`http://foo.${httpHost}/`]: `https://foo.${httpsHost}/`, [`http://foo.${httpHost}/`]: `https://foo.${httpsHost}/`,
}; };
const verifyRedirection = async (fromUrl: string, toUrl: string) => { const verifyRedirection = (httpUrl: string) => h.runCmd(`curl -i ${httpUrl}`).then(result => {
const result = await h.runCmd(`curl -i ${fromUrl}`);
h.verifyResponse(307)(result); h.verifyResponse(307)(result);
const headers = result.stdout.split(/(?:\r?\n){2,}/)[0]; const headers = result.stdout.split(/(?:\r?\n){2,}/)[0];
expect(headers).toContain(`Location: ${toUrl}`); expect(headers).toContain(`Location: ${urlMap[httpUrl]}`);
}; });
await Promise.all(Object.entries(urlMap).map(urls => verifyRedirection(...urls))); Promise.
all(Object.keys(urlMap).map(verifyRedirection)).
then(done);
}); });
@ -61,15 +62,15 @@ describe(`nginx`, () => {
}); });
it('should return /index.html', async () => { it('should return /index.html', done => {
const origin = `${scheme}://pr${pr}-${shortSha9}.${host}`; const origin = `${scheme}://pr${pr}-${shortSha9}.${host}`;
const bodyRegex = new RegExp(`^PR: ${pr} | SHA: ${sha9} | File: /index\\.html$`); const bodyRegex = new RegExp(`^PR: ${pr} | SHA: ${sha9} | File: /index\\.html$`);
await Promise.all([ Promise.all([
h.runCmd(`curl -iL ${origin}/index.html`).then(h.verifyResponse(200, bodyRegex)), h.runCmd(`curl -iL ${origin}/index.html`).then(h.verifyResponse(200, bodyRegex)),
h.runCmd(`curl -iL ${origin}/`).then(h.verifyResponse(200, bodyRegex)), h.runCmd(`curl -iL ${origin}/`).then(h.verifyResponse(200, bodyRegex)),
h.runCmd(`curl -iL ${origin}`).then(h.verifyResponse(200, bodyRegex)), h.runCmd(`curl -iL ${origin}`).then(h.verifyResponse(200, bodyRegex)),
]); ]).then(done);
}); });
@ -89,11 +90,12 @@ describe(`nginx`, () => {
}); });
it('should return /foo/bar.js', async () => { it('should return /foo/bar.js', done => {
const bodyRegex = new RegExp(`^PR: ${pr} | SHA: ${sha9} | File: /foo/bar\\.js$`); const bodyRegex = new RegExp(`^PR: ${pr} | SHA: ${sha9} | File: /foo/bar\\.js$`);
await h.runCmd(`curl -iL ${scheme}://pr${pr}-${shortSha9}.${host}/foo/bar.js`). h.runCmd(`curl -iL ${scheme}://pr${pr}-${shortSha9}.${host}/foo/bar.js`).
then(h.verifyResponse(200, bodyRegex)); then(h.verifyResponse(200, bodyRegex)).
then(done);
}); });
@ -109,46 +111,47 @@ describe(`nginx`, () => {
}); });
it('should respond with 403 for directories', async () => { it('should respond with 403 for directories', done => {
await Promise.all([ Promise.all([
h.runCmd(`curl -iL ${scheme}://pr${pr}-${shortSha9}.${host}/foo/`).then(h.verifyResponse(403)), h.runCmd(`curl -iL ${scheme}://pr${pr}-${shortSha9}.${host}/foo/`).then(h.verifyResponse(403)),
h.runCmd(`curl -iL ${scheme}://pr${pr}-${shortSha9}.${host}/foo`).then(h.verifyResponse(403)), h.runCmd(`curl -iL ${scheme}://pr${pr}-${shortSha9}.${host}/foo`).then(h.verifyResponse(403)),
]); ]).then(done);
}); });
it('should respond with 404 for unknown paths to files', async () => { it('should respond with 404 for unknown paths to files', done => {
await h.runCmd(`curl -iL ${scheme}://pr${pr}-${shortSha9}.${host}/foo/baz.css`). h.runCmd(`curl -iL ${scheme}://pr${pr}-${shortSha9}.${host}/foo/baz.css`).
then(h.verifyResponse(404)); then(h.verifyResponse(404)).
then(done);
}); });
it('should rewrite to \'index.html\' for unknown paths that don\'t look like files', async () => { it('should rewrite to \'index.html\' for unknown paths that don\'t look like files', done => {
const origin = `${scheme}://pr${pr}-${shortSha9}.${host}`; const origin = `${scheme}://pr${pr}-${shortSha9}.${host}`;
const bodyRegex = new RegExp(`^PR: ${pr} | SHA: ${sha9} | File: /index\\.html$`); const bodyRegex = new RegExp(`^PR: ${pr} | SHA: ${sha9} | File: /index\\.html$`);
await Promise.all([ Promise.all([
h.runCmd(`curl -iL ${origin}/foo/baz`).then(h.verifyResponse(200, bodyRegex)), h.runCmd(`curl -iL ${origin}/foo/baz`).then(h.verifyResponse(200, bodyRegex)),
h.runCmd(`curl -iL ${origin}/foo/baz/`).then(h.verifyResponse(200, bodyRegex)), h.runCmd(`curl -iL ${origin}/foo/baz/`).then(h.verifyResponse(200, bodyRegex)),
]); ]).then(done);
}); });
it('should respond with 404 for unknown PRs/SHAs', async () => { it('should respond with 404 for unknown PRs/SHAs', done => {
const otherPr = 54321; const otherPr = 54321;
const otherShortSha = computeShortSha('8'.repeat(40)); const otherShortSha = computeShortSha('8'.repeat(40));
await Promise.all([ Promise.all([
h.runCmd(`curl -iL ${scheme}://pr${pr}9-${shortSha9}.${host}`).then(h.verifyResponse(404)), h.runCmd(`curl -iL ${scheme}://pr${pr}9-${shortSha9}.${host}`).then(h.verifyResponse(404)),
h.runCmd(`curl -iL ${scheme}://pr${otherPr}-${shortSha9}.${host}`).then(h.verifyResponse(404)), h.runCmd(`curl -iL ${scheme}://pr${otherPr}-${shortSha9}.${host}`).then(h.verifyResponse(404)),
h.runCmd(`curl -iL ${scheme}://pr${pr}-${shortSha9}9.${host}`).then(h.verifyResponse(404)), h.runCmd(`curl -iL ${scheme}://pr${pr}-${shortSha9}9.${host}`).then(h.verifyResponse(404)),
h.runCmd(`curl -iL ${scheme}://pr${pr}-${otherShortSha}.${host}`).then(h.verifyResponse(404)), h.runCmd(`curl -iL ${scheme}://pr${pr}-${otherShortSha}.${host}`).then(h.verifyResponse(404)),
]); ]).then(done);
}); });
it('should respond with 404 if the subdomain format is wrong', async () => { it('should respond with 404 if the subdomain format is wrong', done => {
await Promise.all([ Promise.all([
h.runCmd(`curl -iL ${scheme}://xpr${pr}-${shortSha9}.${host}`).then(h.verifyResponse(404)), h.runCmd(`curl -iL ${scheme}://xpr${pr}-${shortSha9}.${host}`).then(h.verifyResponse(404)),
h.runCmd(`curl -iL ${scheme}://prx${pr}-${shortSha9}.${host}`).then(h.verifyResponse(404)), h.runCmd(`curl -iL ${scheme}://prx${pr}-${shortSha9}.${host}`).then(h.verifyResponse(404)),
h.runCmd(`curl -iL ${scheme}://xx${pr}-${shortSha9}.${host}`).then(h.verifyResponse(404)), h.runCmd(`curl -iL ${scheme}://xx${pr}-${shortSha9}.${host}`).then(h.verifyResponse(404)),
@ -157,25 +160,26 @@ describe(`nginx`, () => {
h.runCmd(`curl -iL ${scheme}://${pr}-${shortSha9}.${host}`).then(h.verifyResponse(404)), h.runCmd(`curl -iL ${scheme}://${pr}-${shortSha9}.${host}`).then(h.verifyResponse(404)),
h.runCmd(`curl -iL ${scheme}://pr${pr}${shortSha9}.${host}`).then(h.verifyResponse(404)), h.runCmd(`curl -iL ${scheme}://pr${pr}${shortSha9}.${host}`).then(h.verifyResponse(404)),
h.runCmd(`curl -iL ${scheme}://pr${pr}_${shortSha9}.${host}`).then(h.verifyResponse(404)), h.runCmd(`curl -iL ${scheme}://pr${pr}_${shortSha9}.${host}`).then(h.verifyResponse(404)),
]); ]).then(done);
}); });
it('should reject PRs with leading zeros', async () => { it('should reject PRs with leading zeros', done => {
await h.runCmd(`curl -iL ${scheme}://pr0${pr}-${shortSha9}.${host}`). h.runCmd(`curl -iL ${scheme}://pr0${pr}-${shortSha9}.${host}`).
then(h.verifyResponse(404)); then(h.verifyResponse(404)).
then(done);
}); });
it('should accept SHAs with leading zeros (but not trim the zeros)', async () => { it('should accept SHAs with leading zeros (but not trim the zeros)', done => {
const bodyRegex9 = new RegExp(`^PR: ${pr} | SHA: ${sha9} | File: /index\\.html$`); const bodyRegex9 = new RegExp(`^PR: ${pr} | SHA: ${sha9} | File: /index\\.html$`);
const bodyRegex0 = new RegExp(`^PR: ${pr} | SHA: ${sha0} | File: /index\\.html$`); const bodyRegex0 = new RegExp(`^PR: ${pr} | SHA: ${sha0} | File: /index\\.html$`);
await Promise.all([ Promise.all([
h.runCmd(`curl -iL ${scheme}://pr${pr}-0${shortSha9}.${host}`).then(h.verifyResponse(404)), h.runCmd(`curl -iL ${scheme}://pr${pr}-0${shortSha9}.${host}`).then(h.verifyResponse(404)),
h.runCmd(`curl -iL ${scheme}://pr${pr}-${shortSha9}.${host}`).then(h.verifyResponse(200, bodyRegex9)), h.runCmd(`curl -iL ${scheme}://pr${pr}-${shortSha9}.${host}`).then(h.verifyResponse(200, bodyRegex9)),
h.runCmd(`curl -iL ${scheme}://pr${pr}-${shortSha0}.${host}`).then(h.verifyResponse(200, bodyRegex0)), h.runCmd(`curl -iL ${scheme}://pr${pr}-${shortSha0}.${host}`).then(h.verifyResponse(200, bodyRegex0)),
]); ]).then(done);
}); });
}); });
@ -227,23 +231,23 @@ describe(`nginx`, () => {
describe(`${host}/health-check`, () => { describe(`${host}/health-check`, () => {
it('should respond with 200', async () => { it('should respond with 200', done => {
await Promise.all([ Promise.all([
h.runCmd(`curl -iL ${scheme}://${host}/health-check`).then(h.verifyResponse(200)), h.runCmd(`curl -iL ${scheme}://${host}/health-check`).then(h.verifyResponse(200)),
h.runCmd(`curl -iL ${scheme}://${host}/health-check/`).then(h.verifyResponse(200)), h.runCmd(`curl -iL ${scheme}://${host}/health-check/`).then(h.verifyResponse(200)),
]); ]).then(done);
}); });
it('should respond with 404 if the path does not match exactly', async () => { it('should respond with 404 if the path does not match exactly', done => {
await Promise.all([ Promise.all([
h.runCmd(`curl -iL ${scheme}://${host}/health-check/foo`).then(h.verifyResponse(404)), h.runCmd(`curl -iL ${scheme}://${host}/health-check/foo`).then(h.verifyResponse(404)),
h.runCmd(`curl -iL ${scheme}://${host}/health-check-foo`).then(h.verifyResponse(404)), h.runCmd(`curl -iL ${scheme}://${host}/health-check-foo`).then(h.verifyResponse(404)),
h.runCmd(`curl -iL ${scheme}://${host}/health-checknfoo`).then(h.verifyResponse(404)), h.runCmd(`curl -iL ${scheme}://${host}/health-checknfoo`).then(h.verifyResponse(404)),
h.runCmd(`curl -iL ${scheme}://${host}/foo/health-check`).then(h.verifyResponse(404)), h.runCmd(`curl -iL ${scheme}://${host}/foo/health-check`).then(h.verifyResponse(404)),
h.runCmd(`curl -iL ${scheme}://${host}/foo-health-check`).then(h.verifyResponse(404)), h.runCmd(`curl -iL ${scheme}://${host}/foo-health-check`).then(h.verifyResponse(404)),
h.runCmd(`curl -iL ${scheme}://${host}/foonhealth-check`).then(h.verifyResponse(404)), h.runCmd(`curl -iL ${scheme}://${host}/foonhealth-check`).then(h.verifyResponse(404)),
]); ]).then(done);
}); });
}); });
@ -255,10 +259,10 @@ describe(`nginx`, () => {
it('should disallow non-GET requests', async () => { it('should disallow non-GET requests', async () => {
await Promise.all([ await Promise.all([
h.runCmd(`curl -iLX POST ${baseUrl}/42`).then(h.verifyResponse(405)), h.runCmd(`curl -iLX POST ${baseUrl}/42`).then(h.verifyResponse([405, 'Not Allowed'])),
h.runCmd(`curl -iLX PUT ${baseUrl}/42`).then(h.verifyResponse(405)), h.runCmd(`curl -iLX PUT ${baseUrl}/42`).then(h.verifyResponse([405, 'Not Allowed'])),
h.runCmd(`curl -iLX PATCH ${baseUrl}/42`).then(h.verifyResponse(405)), h.runCmd(`curl -iLX PATCH ${baseUrl}/42`).then(h.verifyResponse([405, 'Not Allowed'])),
h.runCmd(`curl -iLX DELETE ${baseUrl}/42`).then(h.verifyResponse(405)), h.runCmd(`curl -iLX DELETE ${baseUrl}/42`).then(h.verifyResponse([405, 'Not Allowed'])),
]); ]);
}); });
@ -287,28 +291,29 @@ describe(`nginx`, () => {
describe(`${host}/circle-build`, () => { describe(`${host}/circle-build`, () => {
it('should disallow non-POST requests', async () => { it('should disallow non-POST requests', done => {
const url = `${scheme}://${host}/circle-build`; const url = `${scheme}://${host}/circle-build`;
await Promise.all([ Promise.all([
h.runCmd(`curl -iLX GET ${url}`).then(h.verifyResponse(405)), h.runCmd(`curl -iLX GET ${url}`).then(h.verifyResponse([405, 'Not Allowed'])),
h.runCmd(`curl -iLX PUT ${url}`).then(h.verifyResponse(405)), h.runCmd(`curl -iLX PUT ${url}`).then(h.verifyResponse([405, 'Not Allowed'])),
h.runCmd(`curl -iLX PATCH ${url}`).then(h.verifyResponse(405)), h.runCmd(`curl -iLX PATCH ${url}`).then(h.verifyResponse([405, 'Not Allowed'])),
h.runCmd(`curl -iLX DELETE ${url}`).then(h.verifyResponse(405)), h.runCmd(`curl -iLX DELETE ${url}`).then(h.verifyResponse([405, 'Not Allowed'])),
]); ]).then(done);
}); });
it('should pass requests through to the preview server', async () => { it('should pass requests through to the preview server', done => {
await h.runCmd(`curl -iLX POST ${scheme}://${host}/circle-build`). h.runCmd(`curl -iLX POST ${scheme}://${host}/circle-build`).
then(h.verifyResponse(400, /Incorrect body content. Expected JSON/)); then(h.verifyResponse(400, /Incorrect body content. Expected JSON/)).
then(done);
}); });
it('should respond with 404 for unknown paths', async () => { it('should respond with 404 for unknown paths', done => {
const cmdPrefix = `curl -iLX POST ${scheme}://${host}`; const cmdPrefix = `curl -iLX POST ${scheme}://${host}`;
await Promise.all([ Promise.all([
h.runCmd(`${cmdPrefix}/foo/circle-build/`).then(h.verifyResponse(404)), h.runCmd(`${cmdPrefix}/foo/circle-build/`).then(h.verifyResponse(404)),
h.runCmd(`${cmdPrefix}/foo-circle-build/`).then(h.verifyResponse(404)), h.runCmd(`${cmdPrefix}/foo-circle-build/`).then(h.verifyResponse(404)),
h.runCmd(`${cmdPrefix}/fooncircle-build/`).then(h.verifyResponse(404)), h.runCmd(`${cmdPrefix}/fooncircle-build/`).then(h.verifyResponse(404)),
@ -317,7 +322,7 @@ describe(`nginx`, () => {
h.runCmd(`${cmdPrefix}/circle-buildnfoo/`).then(h.verifyResponse(404)), h.runCmd(`${cmdPrefix}/circle-buildnfoo/`).then(h.verifyResponse(404)),
h.runCmd(`${cmdPrefix}/circle-build/pr`).then(h.verifyResponse(404)), h.runCmd(`${cmdPrefix}/circle-build/pr`).then(h.verifyResponse(404)),
h.runCmd(`${cmdPrefix}/circle-build/42`).then(h.verifyResponse(404)), h.runCmd(`${cmdPrefix}/circle-build/42`).then(h.verifyResponse(404)),
]); ]).then(done);
}); });
}); });
@ -327,33 +332,38 @@ describe(`nginx`, () => {
const url = `${scheme}://${host}/pr-updated`; const url = `${scheme}://${host}/pr-updated`;
it('should disallow non-POST requests', async () => { it('should disallow non-POST requests', done => {
await Promise.all([ Promise.all([
h.runCmd(`curl -iLX GET ${url}`).then(h.verifyResponse(405)), h.runCmd(`curl -iLX GET ${url}`).then(h.verifyResponse([405, 'Not Allowed'])),
h.runCmd(`curl -iLX PUT ${url}`).then(h.verifyResponse(405)), h.runCmd(`curl -iLX PUT ${url}`).then(h.verifyResponse([405, 'Not Allowed'])),
h.runCmd(`curl -iLX PATCH ${url}`).then(h.verifyResponse(405)), h.runCmd(`curl -iLX PATCH ${url}`).then(h.verifyResponse([405, 'Not Allowed'])),
h.runCmd(`curl -iLX DELETE ${url}`).then(h.verifyResponse(405)), h.runCmd(`curl -iLX DELETE ${url}`).then(h.verifyResponse([405, 'Not Allowed'])),
]); ]).then(done);
}); });
it('should pass requests through to the preview server', async () => { it('should pass requests through to the preview server', done => {
await h.runCmd(`curl -iLX POST --header "Content-Type: application/json" ${url}`). const cmdPrefix = `curl -iLX POST --header "Content-Type: application/json"`;
then(h.verifyResponse(400, /Missing or empty 'number' field/));
const cmd1 = `${cmdPrefix} ${url}`;
Promise.all([
h.runCmd(cmd1).then(h.verifyResponse(400, /Missing or empty 'number' field/)),
]).then(done);
}); });
it('should respond with 404 for unknown paths', async () => { it('should respond with 404 for unknown paths', done => {
const cmdPrefix = `curl -iLX POST ${scheme}://${host}`; const cmdPrefix = `curl -iLX POST ${scheme}://${host}`;
await Promise.all([ Promise.all([
h.runCmd(`${cmdPrefix}/foo/pr-updated`).then(h.verifyResponse(404)), h.runCmd(`${cmdPrefix}/foo/pr-updated`).then(h.verifyResponse(404)),
h.runCmd(`${cmdPrefix}/foo-pr-updated`).then(h.verifyResponse(404)), h.runCmd(`${cmdPrefix}/foo-pr-updated`).then(h.verifyResponse(404)),
h.runCmd(`${cmdPrefix}/foonpr-updated`).then(h.verifyResponse(404)), h.runCmd(`${cmdPrefix}/foonpr-updated`).then(h.verifyResponse(404)),
h.runCmd(`${cmdPrefix}/pr-updated/foo`).then(h.verifyResponse(404)), h.runCmd(`${cmdPrefix}/pr-updated/foo`).then(h.verifyResponse(404)),
h.runCmd(`${cmdPrefix}/pr-updated-foo`).then(h.verifyResponse(404)), h.runCmd(`${cmdPrefix}/pr-updated-foo`).then(h.verifyResponse(404)),
h.runCmd(`${cmdPrefix}/pr-updatednfoo`).then(h.verifyResponse(404)), h.runCmd(`${cmdPrefix}/pr-updatednfoo`).then(h.verifyResponse(404)),
]); ]).then(done);
}); });
}); });
@ -364,7 +374,7 @@ describe(`nginx`, () => {
beforeEach(() => { beforeEach(() => {
['index.html', 'foo.js', 'foo/index.html'].forEach(relFilePath => { ['index.html', 'foo.js', 'foo/index.html'].forEach(relFilePath => {
const absFilePath = path.join(AIO_BUILDS_DIR, relFilePath); const absFilePath = path.join(AIO_BUILDS_DIR, relFilePath);
h.writeFile(absFilePath, {content: `File: /${relFilePath}`}); return h.writeFile(absFilePath, {content: `File: /${relFilePath}`});
}); });
}); });

View File

@ -105,8 +105,8 @@ describe('preview-server', () => {
describe(`${host}/circle-build`, () => { describe(`${host}/circle-build`, () => {
const curl = makeCurl(`${host}/circle-build`);
const curl = makeCurl(`${host}/circle-build`);
it('should disallow non-POST requests', async () => { it('should disallow non-POST requests', async () => {
const bodyRegex = /^Unknown resource/; const bodyRegex = /^Unknown resource/;
@ -189,7 +189,8 @@ describe('preview-server', () => {
}); });
it('should respond with 201 if a new public build is created', async () => { it('should respond with 201 if a new public build is created', async () => {
await curl(payload(BuildNums.TRUST_CHECK_ACTIVE_TRUSTED_USER)).then(h.verifyResponse(201)); await curl(payload(BuildNums.TRUST_CHECK_ACTIVE_TRUSTED_USER))
.then(h.verifyResponse(201));
expect({ prNum: PrNums.TRUST_CHECK_ACTIVE_TRUSTED_USER }).toExistAsABuild(); expect({ prNum: PrNums.TRUST_CHECK_ACTIVE_TRUSTED_USER }).toExistAsABuild();
}); });
@ -198,7 +199,7 @@ describe('preview-server', () => {
expect({ prNum: PrNums.TRUST_CHECK_UNTRUSTED, isPublic: false }).toExistAsABuild(); expect({ prNum: PrNums.TRUST_CHECK_UNTRUSTED, isPublic: false }).toExistAsABuild();
}); });
[true, false].forEach(isPublic => { [true].forEach(isPublic => {
const build = isPublic ? BuildNums.TRUST_CHECK_ACTIVE_TRUSTED_USER : BuildNums.TRUST_CHECK_UNTRUSTED; const build = isPublic ? BuildNums.TRUST_CHECK_ACTIVE_TRUSTED_USER : BuildNums.TRUST_CHECK_UNTRUSTED;
const prNum = isPublic ? PrNums.TRUST_CHECK_ACTIVE_TRUSTED_USER : PrNums.TRUST_CHECK_UNTRUSTED; const prNum = isPublic ? PrNums.TRUST_CHECK_ACTIVE_TRUSTED_USER : PrNums.TRUST_CHECK_UNTRUSTED;
const label = isPublic ? 'public' : 'non-public'; const label = isPublic ? 'public' : 'non-public';
@ -363,23 +364,23 @@ describe('preview-server', () => {
describe(`${host}/health-check`, () => { describe(`${host}/health-check`, () => {
it('should respond with 200', async () => { it('should respond with 200', done => {
await Promise.all([ Promise.all([
h.runCmd(`curl -iL ${host}/health-check`).then(h.verifyResponse(200)), h.runCmd(`curl -iL ${host}/health-check`).then(h.verifyResponse(200)),
h.runCmd(`curl -iL ${host}/health-check/`).then(h.verifyResponse(200)), h.runCmd(`curl -iL ${host}/health-check/`).then(h.verifyResponse(200)),
]); ]).then(done);
}); });
it('should respond with 404 if the path does not match exactly', async () => { it('should respond with 404 if the path does not match exactly', done => {
await Promise.all([ Promise.all([
h.runCmd(`curl -iL ${host}/health-check/foo`).then(h.verifyResponse(404)), h.runCmd(`curl -iL ${host}/health-check/foo`).then(h.verifyResponse(404)),
h.runCmd(`curl -iL ${host}/health-check-foo`).then(h.verifyResponse(404)), h.runCmd(`curl -iL ${host}/health-check-foo`).then(h.verifyResponse(404)),
h.runCmd(`curl -iL ${host}/health-checknfoo`).then(h.verifyResponse(404)), h.runCmd(`curl -iL ${host}/health-checknfoo`).then(h.verifyResponse(404)),
h.runCmd(`curl -iL ${host}/foo/health-check`).then(h.verifyResponse(404)), h.runCmd(`curl -iL ${host}/foo/health-check`).then(h.verifyResponse(404)),
h.runCmd(`curl -iL ${host}/foo-health-check`).then(h.verifyResponse(404)), h.runCmd(`curl -iL ${host}/foo-health-check`).then(h.verifyResponse(404)),
h.runCmd(`curl -iL ${host}/foonhealth-check`).then(h.verifyResponse(404)), h.runCmd(`curl -iL ${host}/foonhealth-check`).then(h.verifyResponse(404)),
]); ]).then(done);
}); });
}); });
@ -425,18 +426,18 @@ describe('preview-server', () => {
}); });
it('should respond with 404 for unknown paths', async () => { it('should respond with 404 for unknown paths', done => {
const mockPayload = JSON.stringify({number: 1}); // MockExternalApiFlags.TRUST_CHECK_ACTIVE_TRUSTED_USER }); const mockPayload = JSON.stringify({number: 1}); // MockExternalApiFlags.TRUST_CHECK_ACTIVE_TRUSTED_USER });
const cmdPrefix = `curl -iLX POST --data "${mockPayload}" ${host}`; const cmdPrefix = `curl -iLX POST --data "${mockPayload}" ${host}`;
await Promise.all([ Promise.all([
h.runCmd(`${cmdPrefix}/foo/pr-updated`).then(h.verifyResponse(404)), h.runCmd(`${cmdPrefix}/foo/pr-updated`).then(h.verifyResponse(404)),
h.runCmd(`${cmdPrefix}/foo-pr-updated`).then(h.verifyResponse(404)), h.runCmd(`${cmdPrefix}/foo-pr-updated`).then(h.verifyResponse(404)),
h.runCmd(`${cmdPrefix}/foonpr-updated`).then(h.verifyResponse(404)), h.runCmd(`${cmdPrefix}/foonpr-updated`).then(h.verifyResponse(404)),
h.runCmd(`${cmdPrefix}/pr-updated/foo`).then(h.verifyResponse(404)), h.runCmd(`${cmdPrefix}/pr-updated/foo`).then(h.verifyResponse(404)),
h.runCmd(`${cmdPrefix}/pr-updated-foo`).then(h.verifyResponse(404)), h.runCmd(`${cmdPrefix}/pr-updated-foo`).then(h.verifyResponse(404)),
h.runCmd(`${cmdPrefix}/pr-updatednfoo`).then(h.verifyResponse(404)), h.runCmd(`${cmdPrefix}/pr-updatednfoo`).then(h.verifyResponse(404)),
]); ]).then(done);
}); });
@ -550,10 +551,10 @@ describe('preview-server', () => {
describe(`${host}/*`, () => { describe(`${host}/*`, () => {
it('should respond with 404 for requests to unknown URLs', async () => { it('should respond with 404 for requests to unknown URLs', done => {
const bodyRegex = /^Unknown resource/; const bodyRegex = /^Unknown resource/;
await Promise.all([ Promise.all([
h.runCmd(`curl -iL ${host}/index.html`).then(h.verifyResponse(404, bodyRegex)), h.runCmd(`curl -iL ${host}/index.html`).then(h.verifyResponse(404, bodyRegex)),
h.runCmd(`curl -iL ${host}/`).then(h.verifyResponse(404, bodyRegex)), h.runCmd(`curl -iL ${host}/`).then(h.verifyResponse(404, bodyRegex)),
h.runCmd(`curl -iL ${host}`).then(h.verifyResponse(404, bodyRegex)), h.runCmd(`curl -iL ${host}`).then(h.verifyResponse(404, bodyRegex)),
@ -561,7 +562,7 @@ describe('preview-server', () => {
h.runCmd(`curl -iLX POST ${host}`).then(h.verifyResponse(404, bodyRegex)), h.runCmd(`curl -iLX POST ${host}`).then(h.verifyResponse(404, bodyRegex)),
h.runCmd(`curl -iLX PATCH ${host}`).then(h.verifyResponse(404, bodyRegex)), h.runCmd(`curl -iLX PATCH ${host}`).then(h.verifyResponse(404, bodyRegex)),
h.runCmd(`curl -iLX DELETE ${host}`).then(h.verifyResponse(404, bodyRegex)), h.runCmd(`curl -iLX DELETE ${host}`).then(h.verifyResponse(404, bodyRegex)),
]); ]).then(done);
}); });
}); });

View File

@ -14,41 +14,42 @@
"predev": "yarn build || true", "predev": "yarn build || true",
"dev": "run-p ~~build-watch ~~test-watch", "dev": "run-p ~~build-watch ~~test-watch",
"lint": "tslint --project tsconfig.json", "lint": "tslint --project tsconfig.json",
"pretest": "run-s build lint", "pretest": "yarn build",
"test": "yarn ~~test-only", "test": "yarn ~~test-only",
"pretest-watch": "yarn pretest", "pretest-watch": "yarn pretest",
"test-watch": "yarn ~~test-watch", "test-watch": "yarn ~~test-watch",
"~~build": "tsc", "~~build": "tsc",
"~~build-watch": "yarn ~~build --watch", "~~build-watch": "yarn ~~build --watch",
"pre~~test-only": "yarn lint",
"~~test-only": "node dist/test", "~~test-only": "node dist/test",
"~~test-watch": "nodemon --delay 1 --exec \"yarn ~~test-only\" --watch dist" "~~test-watch": "nodemon --delay 1 --exec \"yarn ~~test-only\" --watch dist"
}, },
"dependencies": { "dependencies": {
"body-parser": "^1.19.0", "body-parser": "^1.18.3",
"delete-empty": "^3.0.0", "delete-empty": "^2.0.0",
"express": "^4.17.1", "express": "^4.16.3",
"jasmine": "^3.5.0", "jasmine": "^3.2.0",
"nock": "^12.0.3", "nock": "^9.6.1",
"node-fetch": "^2.6.0", "node-fetch": "^2.2.0",
"shelljs": "^0.8.4", "shelljs": "^0.8.2",
"source-map-support": "^0.5.19", "source-map-support": "^0.5.9",
"tar-stream": "^2.1.2", "tar-stream": "^1.6.1",
"tslib": "^1.11.1" "tslib": "^1.9.3"
}, },
"devDependencies": { "devDependencies": {
"@types/body-parser": "^1.19.0", "@types/body-parser": "^1.17.0",
"@types/express": "^4.17.6", "@types/express": "^4.16.0",
"@types/jasmine": "^3.5.10", "@types/jasmine": "^2.8.8",
"@types/nock": "^11.1.0", "@types/nock": "^9.3.0",
"@types/node": "^13.13.2", "@types/node": "^10.9.2",
"@types/node-fetch": "^2.5.7", "@types/node-fetch": "^2.1.2",
"@types/shelljs": "^0.8.7", "@types/shelljs": "^0.8.0",
"@types/supertest": "^2.0.8", "@types/supertest": "^2.0.5",
"nodemon": "^2.0.3", "nodemon": "^1.18.3",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"supertest": "^4.0.2", "supertest": "^3.1.0",
"tslint": "^6.1.1", "tslint": "^5.11.0",
"tslint-jasmine-noSkipOrFocus": "^1.0.9", "tslint-jasmine-noSkipOrFocus": "^1.0.9",
"typescript": "^3.8.3" "typescript": "^3.0.1"
} }
} }

View File

@ -15,6 +15,7 @@ const EXISTING_DOWNLOADS = [
'20-1234567-build.zip', '20-1234567-build.zip',
]; ];
const OPEN_PRS = [10, 40]; const OPEN_PRS = [10, 40];
const ANY_DATE = jasmine.any(String);
// Tests // Tests
describe('BuildCleaner', () => { describe('BuildCleaner', () => {
@ -76,18 +77,22 @@ describe('BuildCleaner', () => {
let cleanerRemoveUnnecessaryDownloadsSpy: jasmine.Spy; let cleanerRemoveUnnecessaryDownloadsSpy: jasmine.Spy;
beforeEach(() => { beforeEach(() => {
cleanerGetExistingBuildNumbersSpy = spyOn(cleaner, 'getExistingBuildNumbers').and.resolveTo(EXISTING_BUILDS); cleanerGetExistingBuildNumbersSpy = spyOn(cleaner, 'getExistingBuildNumbers')
cleanerGetOpenPrNumbersSpy = spyOn(cleaner, 'getOpenPrNumbers').and.resolveTo(OPEN_PRS); .and.callFake(() => Promise.resolve(EXISTING_BUILDS));
cleanerGetExistingDownloadsSpy = spyOn(cleaner, 'getExistingDownloads').and.resolveTo(EXISTING_DOWNLOADS); cleanerGetOpenPrNumbersSpy = spyOn(cleaner, 'getOpenPrNumbers')
.and.callFake(() => Promise.resolve(OPEN_PRS));
cleanerGetExistingDownloadsSpy = spyOn(cleaner, 'getExistingDownloads')
.and.callFake(() => Promise.resolve(EXISTING_DOWNLOADS));
cleanerRemoveUnnecessaryBuildsSpy = spyOn(cleaner, 'removeUnnecessaryBuilds'); cleanerRemoveUnnecessaryBuildsSpy = spyOn(cleaner, 'removeUnnecessaryBuilds');
cleanerRemoveUnnecessaryDownloadsSpy = spyOn(cleaner, 'removeUnnecessaryDownloads'); cleanerRemoveUnnecessaryDownloadsSpy = spyOn(cleaner, 'removeUnnecessaryDownloads');
}); });
it('should return a promise', async () => { it('should return a promise', async () => {
const promise = cleaner.cleanUp(); const promise = cleaner.cleanUp();
expect(promise).toBeInstanceOf(Promise); expect(promise).toEqual(jasmine.any(Promise));
// Do not complete the test and release the spies synchronously, to avoid running the actual implementations. // Do not complete the test and release the spies synchronously, to avoid running the actual implementations.
await promise; await promise;
@ -125,32 +130,52 @@ describe('BuildCleaner', () => {
it('should reject if \'getOpenPrNumbers()\' rejects', async () => { it('should reject if \'getOpenPrNumbers()\' rejects', async () => {
cleanerGetOpenPrNumbersSpy.and.rejectWith('Test'); try {
await expectAsync(cleaner.cleanUp()).toBeRejectedWith('Test'); cleanerGetOpenPrNumbersSpy.and.callFake(() => Promise.reject('Test'));
await cleaner.cleanUp();
} catch (err) {
expect(err).toBe('Test');
}
}); });
it('should reject if \'getExistingBuildNumbers()\' rejects', async () => { it('should reject if \'getExistingBuildNumbers()\' rejects', async () => {
cleanerGetExistingBuildNumbersSpy.and.rejectWith('Test'); try {
await expectAsync(cleaner.cleanUp()).toBeRejectedWith('Test'); cleanerGetExistingBuildNumbersSpy.and.callFake(() => Promise.reject('Test'));
await cleaner.cleanUp();
} catch (err) {
expect(err).toBe('Test');
}
}); });
it('should reject if \'getExistingDownloads()\' rejects', async () => { it('should reject if \'getExistingDownloads()\' rejects', async () => {
cleanerGetExistingDownloadsSpy.and.rejectWith('Test'); try {
await expectAsync(cleaner.cleanUp()).toBeRejectedWith('Test'); cleanerGetExistingDownloadsSpy.and.callFake(() => Promise.reject('Test'));
await cleaner.cleanUp();
} catch (err) {
expect(err).toBe('Test');
}
}); });
it('should reject if \'removeUnnecessaryBuilds()\' rejects', async () => { it('should reject if \'removeUnnecessaryBuilds()\' rejects', async () => {
cleanerRemoveUnnecessaryBuildsSpy.and.rejectWith('Test'); try {
await expectAsync(cleaner.cleanUp()).toBeRejectedWith('Test'); cleanerRemoveUnnecessaryBuildsSpy.and.callFake(() => Promise.reject('Test'));
await cleaner.cleanUp();
} catch (err) {
expect(err).toBe('Test');
}
}); });
it('should reject if \'removeUnnecessaryDownloads()\' rejects', async () => { it('should reject if \'removeUnnecessaryDownloads()\' rejects', async () => {
cleanerRemoveUnnecessaryDownloadsSpy.and.rejectWith('Test'); try {
await expectAsync(cleaner.cleanUp()).toBeRejectedWith('Test'); cleanerRemoveUnnecessaryDownloadsSpy.and.callFake(() => Promise.reject('Test'));
await cleaner.cleanUp();
} catch (err) {
expect(err).toBe('Test');
}
}); });
}); });
@ -162,15 +187,13 @@ describe('BuildCleaner', () => {
let promise: Promise<number[]>; let promise: Promise<number[]>;
beforeEach(() => { beforeEach(() => {
fsReaddirSpy = spyOn(fs, 'readdir').and.callFake( fsReaddirSpy = spyOn(fs, 'readdir').and.callFake((_: string, cb: typeof readdirCb) => readdirCb = cb);
((_: string, cb: typeof readdirCb) => readdirCb = cb) as unknown as typeof fs.readdir,
);
promise = cleaner.getExistingBuildNumbers(); promise = cleaner.getExistingBuildNumbers();
}); });
it('should return a promise', () => { it('should return a promise', () => {
expect(promise).toBeInstanceOf(Promise); expect(promise).toEqual(jasmine.any(Promise));
}); });
@ -180,27 +203,43 @@ describe('BuildCleaner', () => {
}); });
it('should reject if an error occurs while getting the files', async () => { it('should reject if an error occurs while getting the files', done => {
promise.catch(err => {
expect(err).toBe('Test');
done();
});
readdirCb('Test'); readdirCb('Test');
await expectAsync(promise).toBeRejectedWith('Test');
}); });
it('should resolve with the returned files (as numbers)', async () => { it('should resolve with the returned files (as numbers)', done => {
promise.then(result => {
expect(result).toEqual([12, 34, 56]);
done();
});
readdirCb(null, ['12', '34', '56']); readdirCb(null, ['12', '34', '56']);
await expectAsync(promise).toBeResolvedTo([12, 34, 56]);
}); });
it('should remove `HIDDEN_DIR_PREFIX` from the filenames', async () => { it('should remove `HIDDEN_DIR_PREFIX` from the filenames', done => {
promise.then(result => {
expect(result).toEqual([12, 34, 56]);
done();
});
readdirCb(null, [`${HIDDEN_DIR_PREFIX}12`, '34', `${HIDDEN_DIR_PREFIX}56`]); readdirCb(null, [`${HIDDEN_DIR_PREFIX}12`, '34', `${HIDDEN_DIR_PREFIX}56`]);
await expectAsync(promise).toBeResolvedTo([12, 34, 56]);
}); });
it('should ignore files with non-numeric (or zero) names', async () => { it('should ignore files with non-numeric (or zero) names', done => {
promise.then(result => {
expect(result).toEqual([12, 34, 56]);
done();
});
readdirCb(null, ['12', 'foo', '34', 'bar', '56', '000']); readdirCb(null, ['12', 'foo', '34', 'bar', '56', '000']);
await expectAsync(promise).toBeResolvedTo([12, 34, 56]);
}); });
}); });
@ -220,7 +259,7 @@ describe('BuildCleaner', () => {
it('should return a promise', () => { it('should return a promise', () => {
expect(promise).toBeInstanceOf(Promise); expect(promise).toEqual(jasmine.any(Promise));
}); });
@ -229,15 +268,31 @@ describe('BuildCleaner', () => {
}); });
it('should reject if an error occurs while fetching PRs', async () => { it('should reject if an error occurs while fetching PRs', done => {
promise.catch(err => {
expect(err).toBe('Test');
done();
});
prDeferred.reject('Test'); prDeferred.reject('Test');
await expectAsync(promise).toBeRejectedWith('Test');
}); });
it('should resolve with the numbers of the fetched PRs', async () => { it('should resolve with the numbers of the fetched PRs', done => {
promise.then(prNumbers => {
expect(prNumbers).toEqual([1, 2, 3]);
done();
});
prDeferred.resolve([{id: 0, number: 1}, {id: 1, number: 2}, {id: 2, number: 3}]); prDeferred.resolve([{id: 0, number: 1}, {id: 1, number: 2}, {id: 2, number: 3}]);
await expectAsync(promise).toBeResolvedTo([1, 2, 3]); });
it('should log the number of open PRs', () => {
promise.then(prNumbers => {
expect(loggerLogSpy).toHaveBeenCalledWith(
ANY_DATE, 'BuildCleaner: ', `Open pull requests: ${prNumbers}`);
});
}); });
}); });
@ -249,15 +304,13 @@ describe('BuildCleaner', () => {
let promise: Promise<string[]>; let promise: Promise<string[]>;
beforeEach(() => { beforeEach(() => {
fsReaddirSpy = spyOn(fs, 'readdir').and.callFake( fsReaddirSpy = spyOn(fs, 'readdir').and.callFake((_: string, cb: typeof readdirCb) => readdirCb = cb);
((_: string, cb: typeof readdirCb) => readdirCb = cb) as unknown as typeof fs.readdir,
);
promise = cleaner.getExistingDownloads(); promise = cleaner.getExistingDownloads();
}); });
it('should return a promise', () => { it('should return a promise', () => {
expect(promise).toBeInstanceOf(Promise); expect(promise).toEqual(jasmine.any(Promise));
}); });
@ -267,21 +320,33 @@ describe('BuildCleaner', () => {
}); });
it('should reject if an error occurs while getting the files', async () => { it('should reject if an error occurs while getting the files', done => {
promise.catch(err => {
expect(err).toBe('Test');
done();
});
readdirCb('Test'); readdirCb('Test');
await expectAsync(promise).toBeRejectedWith('Test');
}); });
it('should resolve with the returned file names', async () => { it('should resolve with the returned file names', done => {
promise.then(result => {
expect(result).toEqual(EXISTING_DOWNLOADS);
done();
});
readdirCb(null, EXISTING_DOWNLOADS); readdirCb(null, EXISTING_DOWNLOADS);
await expectAsync(promise).toBeResolvedTo(EXISTING_DOWNLOADS);
}); });
it('should ignore files that do not match the artifactPath', async () => { it('should ignore files that do not match the artifactPath', done => {
promise.then(result => {
expect(result).toEqual(['10-ABCDEF-build.zip', '30-FFFFFFF-build.zip']);
done();
});
readdirCb(null, ['10-ABCDEF-build.zip', '20-AAAAAAA-otherfile.zip', '30-FFFFFFF-build.zip']); readdirCb(null, ['10-ABCDEF-build.zip', '20-AAAAAAA-otherfile.zip', '30-FFFFFFF-build.zip']);
await expectAsync(promise).toBeResolvedTo(['10-ABCDEF-build.zip', '30-FFFFFFF-build.zip']);
}); });
}); });
@ -299,7 +364,7 @@ describe('BuildCleaner', () => {
}); });
it('should test if the directory exists (and return if it does not)', () => { it('should test if the directory exists (and return if is does not)', () => {
shellTestSpy.and.returnValue(false); shellTestSpy.and.returnValue(false);
cleaner.removeDir('/foo/bar'); cleaner.removeDir('/foo/bar');
@ -316,19 +381,22 @@ describe('BuildCleaner', () => {
it('should make the directory and its content writable before removing', () => { it('should make the directory and its content writable before removing', () => {
shellRmSpy.and.callFake(() => expect(shellChmodSpy).toHaveBeenCalledWith('-R', 'a+w', '/foo/bar'));
cleaner.removeDir('/foo/bar'); cleaner.removeDir('/foo/bar');
expect(shellChmodSpy).toHaveBeenCalledBefore(shellRmSpy);
expect(shellChmodSpy).toHaveBeenCalledWith('-R', 'a+w', '/foo/bar');
expect(shellRmSpy).toHaveBeenCalled(); expect(shellRmSpy).toHaveBeenCalled();
}); });
it('should catch errors and log them', () => { it('should catch errors and log them', () => {
shellRmSpy.and.throwError('Test'); shellRmSpy.and.callFake(() => {
// tslint:disable-next-line: no-string-throw
throw 'Test';
});
cleaner.removeDir('/foo/bar'); cleaner.removeDir('/foo/bar');
expect(loggerErrorSpy).toHaveBeenCalledWith('ERROR: Unable to remove \'/foo/bar\' due to:', new Error('Test')); expect(loggerErrorSpy).toHaveBeenCalledWith('ERROR: Unable to remove \'/foo/bar\' due to:', 'Test');
}); });
}); });
@ -381,7 +449,7 @@ describe('BuildCleaner', () => {
expect(cleanerRemoveDirSpy).toHaveBeenCalledTimes(0); expect(cleanerRemoveDirSpy).toHaveBeenCalledTimes(0);
cleanerRemoveDirSpy.calls.reset(); cleanerRemoveDirSpy.calls.reset();
cleaner.removeUnnecessaryBuilds([1, 2, 3, 4], []); (cleaner as any).removeUnnecessaryBuilds([1, 2, 3, 4], []);
expect(cleanerRemoveDirSpy).toHaveBeenCalledTimes(8); expect(cleanerRemoveDirSpy).toHaveBeenCalledTimes(8);
expect(cleanerRemoveDirSpy).toHaveBeenCalledWith(normalize('/foo/bar/1')); expect(cleanerRemoveDirSpy).toHaveBeenCalledWith(normalize('/foo/bar/1'));
expect(cleanerRemoveDirSpy).toHaveBeenCalledWith(normalize('/foo/bar/2')); expect(cleanerRemoveDirSpy).toHaveBeenCalledWith(normalize('/foo/bar/2'));

View File

@ -45,15 +45,25 @@ describe('CircleCIApi', () => {
const errorMessage = 'Invalid request'; const errorMessage = 'Invalid request';
const request = nock(BASE_URL).get(`/${buildNum}?circle-token=${TOKEN}`); const request = nock(BASE_URL).get(`/${buildNum}?circle-token=${TOKEN}`);
request.replyWithError(errorMessage); try {
await expectAsync(api.getBuildInfo(buildNum)).toBeRejectedWithError( request.replyWithError(errorMessage);
await api.getBuildInfo(buildNum);
throw new Error('Exception Expected');
} catch (err) {
expect(err.message).toEqual(
`CircleCI build info request failed ` + `CircleCI build info request failed ` +
`(request to ${BASE_URL}/${buildNum}?circle-token=${TOKEN} failed, reason: ${errorMessage})`); `(request to ${BASE_URL}/${buildNum}?circle-token=${TOKEN} failed, reason: ${errorMessage})`);
}
request.reply(404, errorMessage); try {
await expectAsync(api.getBuildInfo(buildNum)).toBeRejectedWithError( request.reply(404, errorMessage);
await api.getBuildInfo(buildNum);
throw new Error('Exception Expected');
} catch (err) {
expect(err.message).toEqual(
`CircleCI build info request failed ` + `CircleCI build info request failed ` +
`(request to ${BASE_URL}/${buildNum}?circle-token=${TOKEN} failed, reason: ${errorMessage})`); `(request to ${BASE_URL}/${buildNum}?circle-token=${TOKEN} failed, reason: ${errorMessage})`);
}
}); });
}); });
@ -68,7 +78,8 @@ describe('CircleCIApi', () => {
.get(`/${buildNum}/artifacts?circle-token=${TOKEN}`) .get(`/${buildNum}/artifacts?circle-token=${TOKEN}`)
.reply(200, [artifact0, artifact1, artifact2]); .reply(200, [artifact0, artifact1, artifact2]);
await expectAsync(api.getBuildArtifactUrl(buildNum, 'some/path/1')).toBeResolvedTo('https://url/1'); const artifactUrl = await api.getBuildArtifactUrl(buildNum, 'some/path/1');
expect(artifactUrl).toEqual('https://url/1');
request.done(); request.done();
}); });
@ -79,15 +90,25 @@ describe('CircleCIApi', () => {
const errorMessage = 'Invalid request'; const errorMessage = 'Invalid request';
const request = nock(BASE_URL).get(`/${buildNum}/artifacts?circle-token=${TOKEN}`); const request = nock(BASE_URL).get(`/${buildNum}/artifacts?circle-token=${TOKEN}`);
request.replyWithError(errorMessage); try {
await expectAsync(api.getBuildArtifactUrl(buildNum, 'some/path/1')).toBeRejectedWithError( request.replyWithError(errorMessage);
await api.getBuildArtifactUrl(buildNum, 'some/path/1');
throw new Error('Exception Expected');
} catch (err) {
expect(err.message).toEqual(
`CircleCI artifact URL request failed ` + `CircleCI artifact URL request failed ` +
`(request to ${BASE_URL}/${buildNum}/artifacts?circle-token=${TOKEN} failed, reason: ${errorMessage})`); `(request to ${BASE_URL}/${buildNum}/artifacts?circle-token=${TOKEN} failed, reason: ${errorMessage})`);
}
request.reply(404, errorMessage); try {
await expectAsync(api.getBuildArtifactUrl(buildNum, 'some/path/1')).toBeRejectedWithError( request.reply(404, errorMessage);
await api.getBuildArtifactUrl(buildNum, 'some/path/1');
throw new Error('Exception Expected');
} catch (err) {
expect(err.message).toEqual(
`CircleCI artifact URL request failed ` + `CircleCI artifact URL request failed ` +
`(request to ${BASE_URL}/${buildNum}/artifacts?circle-token=${TOKEN} failed, reason: ${errorMessage})`); `(request to ${BASE_URL}/${buildNum}/artifacts?circle-token=${TOKEN} failed, reason: ${errorMessage})`);
}
}); });
it('should throw an error if the response does not contain the specified artifact', async () => { it('should throw an error if the response does not contain the specified artifact', async () => {
@ -100,9 +121,14 @@ describe('CircleCIApi', () => {
.get(`/${buildNum}/artifacts?circle-token=${TOKEN}`) .get(`/${buildNum}/artifacts?circle-token=${TOKEN}`)
.reply(200, [artifact0, artifact1, artifact2]); .reply(200, [artifact0, artifact1, artifact2]);
await expectAsync(api.getBuildArtifactUrl(buildNum, 'some/path/3')).toBeRejectedWithError( try {
await api.getBuildArtifactUrl(buildNum, 'some/path/3');
throw new Error('Exception Expected');
} catch (err) {
expect(err.message).toEqual(
`CircleCI artifact URL request failed ` + `CircleCI artifact URL request failed ` +
`(Missing artifact (some/path/3) for CircleCI build: ${buildNum})`); `(Missing artifact (some/path/3) for CircleCI build: ${buildNum})`);
}
}); });
}); });
}); });

View File

@ -118,7 +118,7 @@ describe('GithubApi', () => {
it('should return a promise', () => { it('should return a promise', () => {
expect((api as any).getPaginated()).toBeInstanceOf(Promise); expect((api as any).getPaginated()).toEqual(jasmine.any(Promise));
}); });
@ -131,30 +131,45 @@ describe('GithubApi', () => {
}); });
it('should reject if the request fails', async () => { it('should reject if the request fails', done => {
const responsePromise = (api as any).getPaginated('/foo/bar'); (api as any).getPaginated('/foo/bar').catch((err: any) => {
expect(err).toBe('Test');
done();
});
deferreds[0].reject('Test'); deferreds[0].reject('Test');
await expectAsync(responsePromise).toBeRejectedWith('Test');
}); });
it('should resolve with the returned items', async () => { it('should resolve with the returned items', done => {
const items = [{id: 1}, {id: 2}]; const items = [{id: 1}, {id: 2}];
const responsePromise = (api as any).getPaginated('/foo/bar');
deferreds[0].resolve(items);
await expectAsync(responsePromise).toBeResolvedTo(items); (api as any).getPaginated('/foo/bar').then((data: any) => {
expect(data).toEqual(items);
done();
});
deferreds[0].resolve(items);
}); });
it('should iteratively call \'get()\' to fetch all items', async () => { it('should iteratively call \'get()\' to fetch all items', done => {
// Create an array or 250 objects. // Create an array or 250 objects.
const allItems = new Array(250).fill(null).map((_, i) => ({id: i})); const allItems = '.'.repeat(250).split('').map((_, i) => ({id: i}));
const apiGetSpy = api.get as jasmine.Spy; const apiGetSpy = api.get as jasmine.Spy;
const paramsForPage = (page: number) => ({baz: 'qux', page, per_page: 100});
const responsePromise = (api as any).getPaginated('/foo/bar', {baz: 'qux'}); (api as any).getPaginated('/foo/bar', {baz: 'qux'}).then((data: any) => {
const paramsForPage = (page: number) => ({baz: 'qux', page, per_page: 100});
expect(apiGetSpy).toHaveBeenCalledTimes(3);
expect(apiGetSpy.calls.argsFor(0)).toEqual(['/foo/bar', paramsForPage(1)]);
expect(apiGetSpy.calls.argsFor(1)).toEqual(['/foo/bar', paramsForPage(2)]);
expect(apiGetSpy.calls.argsFor(2)).toEqual(['/foo/bar', paramsForPage(3)]);
expect(data).toEqual(allItems);
done();
});
deferreds[0].resolve(allItems.slice(0, 100)); deferreds[0].resolve(allItems.slice(0, 100));
setTimeout(() => { setTimeout(() => {
@ -163,13 +178,6 @@ describe('GithubApi', () => {
deferreds[2].resolve(allItems.slice(200)); deferreds[2].resolve(allItems.slice(200));
}, 0); }, 0);
}, 0); }, 0);
await expectAsync(responsePromise).toBeResolvedTo(allItems);
expect(apiGetSpy).toHaveBeenCalledTimes(3);
expect(apiGetSpy.calls.argsFor(0)).toEqual(['/foo/bar', paramsForPage(1)]);
expect(apiGetSpy.calls.argsFor(1)).toEqual(['/foo/bar', paramsForPage(2)]);
expect(apiGetSpy.calls.argsFor(2)).toEqual(['/foo/bar', paramsForPage(3)]);
}); });
}); });
@ -209,8 +217,8 @@ describe('GithubApi', () => {
describe('request()', () => { describe('request()', () => {
it('should return a promise', () => { it('should return a promise', () => {
nock('https://api.github.com').get('/').reply(200); nock('https://api.github.com').get('').reply(200);
expect((api as any).request()).toBeInstanceOf(Promise); expect((api as any).request()).toEqual(jasmine.any(Promise));
}); });
@ -239,8 +247,9 @@ describe('GithubApi', () => {
nock('https://api.github.com') nock('https://api.github.com')
.intercept('/path', 'method') .intercept('/path', 'method')
.replyWithError('Test'); .replyWithError('Test');
let message = 'Failed to reject error';
await expectAsync((api as any).request('method', '/path')).toBeRejectedWithError('Test'); await (api as any).request('method', '/path').catch((err: any) => message = err.message);
expect(message).toEqual('Test');
}); });
@ -254,69 +263,81 @@ describe('GithubApi', () => {
}); });
it('should reject if response statusCode is <200', async () => { it('should reject if response statusCode is <200', done => {
const requestHandler = nock('https://api.github.com') const requestHandler = nock('https://api.github.com')
.intercept('/path', 'method') .intercept('/path', 'method')
.reply(199); .reply(199);
const responsePromise = (api as any).request('method', '/path');
await expectAsync(responsePromise).toBeRejectedWith(jasmine.stringMatching('failed'));
await expectAsync(responsePromise).toBeRejectedWith(jasmine.stringMatching('status: 199'));
(api as any).request('method', '/path')
.catch((err: string) => {
expect(err).toContain('failed');
expect(err).toContain('status: 199');
done();
});
requestHandler.done(); requestHandler.done();
}); });
it('should reject if response statusCode is >=400', async () => { it('should reject if response statusCode is >=400', done => {
const requestHandler = nock('https://api.github.com') const requestHandler = nock('https://api.github.com')
.intercept('/path', 'method') .intercept('/path', 'method')
.reply(400); .reply(400);
const responsePromise = (api as any).request('method', '/path');
await expectAsync(responsePromise).toBeRejectedWith(jasmine.stringMatching('failed'));
await expectAsync(responsePromise).toBeRejectedWith(jasmine.stringMatching('status: 400'));
(api as any).request('method', '/path')
.catch((err: string) => {
expect(err).toContain('failed');
expect(err).toContain('status: 400');
done();
});
requestHandler.done(); requestHandler.done();
}); });
it('should include the response text in the rejection message', async () => { it('should include the response text in the rejection message', done => {
const requestHandler = nock('https://api.github.com') const requestHandler = nock('https://api.github.com')
.intercept('/path', 'method') .intercept('/path', 'method')
.reply(500, 'Test'); .reply(500, 'Test');
const responsePromise = (api as any).request('method', '/path');
await expectAsync(responsePromise).toBeRejectedWith(jasmine.stringMatching('Test'));
(api as any).request('method', '/path')
.catch((err: string) => {
expect(err).toContain('Test');
done();
});
requestHandler.done(); requestHandler.done();
}); });
it('should resolve if returned statusCode is >=200 and <400', async () => { it('should resolve if returned statusCode is >=200 and <400', done => {
const requestHandler = nock('https://api.github.com') const requestHandler = nock('https://api.github.com')
.intercept('/path', 'method') .intercept('/path', 'method')
.reply(200); .reply(200);
await expectAsync((api as any).request('method', '/path')).toBeResolved(); (api as any).request('method', '/path').then(done);
requestHandler.done(); requestHandler.done();
}); });
it('should parse the response body into an object using \'JSON.parse\'', async () => { it('should parse the response body into an object using \'JSON.parse\'', done => {
const requestHandler = nock('https://api.github.com') const requestHandler = nock('https://api.github.com')
.intercept('/path', 'method') .intercept('/path', 'method')
.reply(300, '{"foo": "bar"}'); .reply(300, '{"foo": "bar"}');
await expectAsync((api as any).request('method', '/path')).toBeResolvedTo({foo: 'bar'}); (api as any).request('method', '/path').then((data: any) => {
expect(data).toEqual({foo: 'bar'});
done();
});
requestHandler.done(); requestHandler.done();
}); });
it('should reject if the response text is malformed JSON', async () => { it('should reject if the response text is malformed JSON', done => {
const requestHandler = nock('https://api.github.com') const requestHandler = nock('https://api.github.com')
.intercept('/path', 'method') .intercept('/path', 'method')
.reply(300, '}'); .reply(300, '}');
await expectAsync((api as any).request('method', '/path')).toBeRejectedWithError(SyntaxError); (api as any).request('method', '/path').catch((err: any) => {
expect(err).toEqual(jasmine.any(SyntaxError));
done();
});
requestHandler.done(); requestHandler.done();
}); });

View File

@ -1,6 +1,6 @@
// Imports // Imports
import {GithubApi} from '../../lib/common/github-api'; import {GithubApi} from '../../lib/common/github-api';
import {GithubPullRequests, PullRequest} from '../../lib/common/github-pull-requests'; import {GithubPullRequests} from '../../lib/common/github-pull-requests';
// Tests // Tests
describe('GithubPullRequests', () => { describe('GithubPullRequests', () => {
@ -47,21 +47,27 @@ describe('GithubPullRequests', () => {
it('should make a POST request to Github with the correct pathname, params and data', () => { it('should make a POST request to Github with the correct pathname, params and data', () => {
githubApi.post.and.resolveTo(); githubApi.post.and.callFake(() => Promise.resolve());
prs.addComment(42, 'body'); prs.addComment(42, 'body');
expect(githubApi.post).toHaveBeenCalledWith('/repos/foo/bar/issues/42/comments', null, {body: 'body'}); expect(githubApi.post).toHaveBeenCalledWith('/repos/foo/bar/issues/42/comments', null, {body: 'body'});
}); });
it('should reject if the request fails', async () => { it('should reject if the request fails', done => {
githubApi.post.and.rejectWith('Test'); githubApi.post.and.callFake(() => Promise.reject('Test'));
await expectAsync(prs.addComment(42, 'body')).toBeRejectedWith('Test'); prs.addComment(42, 'body').catch(err => {
expect(err).toBe('Test');
done();
});
}); });
it('should resolve with the data from the Github POST', async () => { it('should resolve with the data from the Github POST', done => {
githubApi.post.and.resolveTo('Test'); githubApi.post.and.callFake(() => Promise.resolve('Test'));
await expectAsync(prs.addComment(42, 'body')).toBeResolvedTo('Test'); prs.addComment(42, 'body').then(data => {
expect(data).toBe('Test');
done();
});
}); });
}); });
@ -81,11 +87,13 @@ describe('GithubPullRequests', () => {
}); });
it('should resolve with the data returned from GitHub', async () => { it('should resolve with the data returned from GitHub', done => {
const expected: any = {number: 42}; const expected: any = {number: 42};
githubApi.get.and.resolveTo(expected); githubApi.get.and.callFake(() => Promise.resolve(expected));
prs.fetch(42).then(data => {
await expectAsync(prs.fetch(42)).toBeResolvedTo(expected); expect(data).toEqual(expected);
done();
});
}); });
}); });
@ -117,14 +125,9 @@ describe('GithubPullRequests', () => {
}); });
it('should forward the value returned by \'getPaginated()\'', async () => { it('should forward the value returned by \'getPaginated()\'', () => {
const mockPrs: PullRequest[] = [ githubApi.getPaginated.and.returnValue('Test');
{number: 1, user: {login: 'foo'}, labels: []}, expect(prs.fetchAll() as any).toBe('Test');
{number: 2, user: {login: 'bar'}, labels: []},
];
githubApi.getPaginated.and.resolveTo(mockPrs);
expect(await prs.fetchAll()).toBe(mockPrs);
}); });
}); });
@ -144,11 +147,13 @@ describe('GithubPullRequests', () => {
}); });
it('should resolve with the data returned from GitHub', async () => { it('should resolve with the data returned from GitHub', done => {
const expected: any = [{sha: 'ABCDE', filename: 'a/b/c'}, {sha: '12345', filename: 'x/y/z'}]; const expected: any = [{sha: 'ABCDE', filename: 'a/b/c'}, {sha: '12345', filename: 'x/y/z'}];
githubApi.getPaginated.and.resolveTo(expected); githubApi.getPaginated.and.callFake(() => Promise.resolve(expected));
prs.fetchFiles(42).then(data => {
await expectAsync(prs.fetchFiles(42)).toBeResolvedTo(expected); expect(data).toEqual(expected);
done();
});
}); });
}); });

View File

@ -1,5 +1,5 @@
import {GithubApi} from '../../lib/common/github-api'; import {GithubApi} from '../../lib/common/github-api';
import {GithubTeams, Team} from '../../lib/common/github-teams'; import {GithubTeams} from '../../lib/common/github-teams';
// Tests // Tests
describe('GithubTeams', () => { describe('GithubTeams', () => {
@ -16,7 +16,6 @@ describe('GithubTeams', () => {
expect(() => new GithubTeams(githubApi, '')). expect(() => new GithubTeams(githubApi, '')).
toThrowError('Missing or empty required parameter \'githubOrg\'!'); toThrowError('Missing or empty required parameter \'githubOrg\'!');
}); });
}); });
@ -34,14 +33,9 @@ describe('GithubTeams', () => {
}); });
it('should forward the value returned by \'getPaginated()\'', async () => { it('should forward the value returned by \'getPaginated()\'', () => {
const mockTeams: Team[] = [ githubApi.getPaginated.and.returnValue('Test');
{id: 1, slug: 'foo'}, expect(teams.fetchAll() as any).toBe('Test');
{id: 2, slug: 'bar'},
];
githubApi.getPaginated.and.resolveTo(mockTeams);
expect(await teams.fetchAll()).toBe(mockTeams);
}); });
}); });
@ -56,77 +50,100 @@ describe('GithubTeams', () => {
it('should return a promise', () => { it('should return a promise', () => {
githubApi.get.and.resolveTo(); githubApi.get.and.callFake(() => Promise.resolve());
const promise = teams.isMemberById('user', [1]); const promise = teams.isMemberById('user', [1]);
expect(promise).toBeInstanceOf(Promise); expect(promise).toEqual(jasmine.any(Promise));
}); });
it('should resolve with false if called with an empty array', async () => { it('should resolve with false if called with an empty array', done => {
await expectAsync(teams.isMemberById('user', [])).toBeResolvedTo(false); teams.isMemberById('user', []).then(isMember => {
expect(githubApi.get).not.toHaveBeenCalled(); expect(isMember).toBe(false);
expect(githubApi.get).not.toHaveBeenCalled();
done();
});
}); });
it('should call \'get()\' with the correct pathname', async () => { it('should call \'get()\' with the correct pathname', done => {
githubApi.get.and.resolveTo(); githubApi.get.and.callFake(() => Promise.resolve());
await teams.isMemberById('user', [1]); teams.isMemberById('user', [1]).then(() => {
expect(githubApi.get).toHaveBeenCalledWith('/teams/1/memberships/user');
expect(githubApi.get).toHaveBeenCalledWith('/teams/1/memberships/user'); done();
});
}); });
it('should resolve with false if \'get()\' rejects', async () => { it('should resolve with false if \'get()\' rejects', done => {
githubApi.get.and.rejectWith(null); githubApi.get.and.callFake(() => Promise.reject(null));
teams.isMemberById('user', [1]).then(isMember => {
await expectAsync(teams.isMemberById('user', [1])).toBeResolvedTo(false); expect(isMember).toBe(false);
expect(githubApi.get).toHaveBeenCalled(); expect(githubApi.get).toHaveBeenCalled();
done();
});
}); });
it('should resolve with false if the membership is not active', async () => { it('should resolve with false if the membership is not active', done => {
githubApi.get.and.resolveTo({state: 'pending'}); githubApi.get.and.callFake(() => Promise.resolve({state: 'pending'}));
teams.isMemberById('user', [1]).then(isMember => {
await expectAsync(teams.isMemberById('user', [1])).toBeResolvedTo(false); expect(isMember).toBe(false);
expect(githubApi.get).toHaveBeenCalled(); expect(githubApi.get).toHaveBeenCalled();
done();
});
}); });
it('should resolve with true if the membership is active', async () => { it('should resolve with true if the membership is active', done => {
githubApi.get.and.resolveTo({state: 'active'}); githubApi.get.and.callFake(() => Promise.resolve({state: 'active'}));
await expectAsync(teams.isMemberById('user', [1])).toBeResolvedTo(true); teams.isMemberById('user', [1]).then(isMember => {
expect(isMember).toBe(true);
done();
});
}); });
it('should sequentially call \'get()\' until an active membership is found', async () => { it('should sequentially call \'get()\' until an active membership is found', done => {
githubApi.get. const trainedResponses: {[pathname: string]: Promise<{state: string}>} = {
withArgs('/teams/1/memberships/user').and.resolveTo({state: 'pending'}). '/teams/1/memberships/user': Promise.resolve({state: 'pending'}),
withArgs('/teams/2/memberships/user').and.rejectWith(null). '/teams/2/memberships/user': Promise.reject(null),
withArgs('/teams/3/memberships/user').and.resolveTo({state: 'active'}); '/teams/3/memberships/user': Promise.resolve({state: 'active'}),
};
githubApi.get.and.callFake((pathname: string) => trainedResponses[pathname]);
await expectAsync(teams.isMemberById('user', [1, 2, 3, 4])).toBeResolvedTo(true); teams.isMemberById('user', [1, 2, 3, 4]).then(isMember => {
expect(isMember).toBe(true);
expect(githubApi.get).toHaveBeenCalledTimes(3); expect(githubApi.get).toHaveBeenCalledTimes(3);
expect(githubApi.get.calls.argsFor(0)[0]).toBe('/teams/1/memberships/user'); expect(githubApi.get.calls.argsFor(0)[0]).toBe('/teams/1/memberships/user');
expect(githubApi.get.calls.argsFor(1)[0]).toBe('/teams/2/memberships/user'); expect(githubApi.get.calls.argsFor(1)[0]).toBe('/teams/2/memberships/user');
expect(githubApi.get.calls.argsFor(2)[0]).toBe('/teams/3/memberships/user'); expect(githubApi.get.calls.argsFor(2)[0]).toBe('/teams/3/memberships/user');
done();
});
}); });
it('should resolve with false if no active membership is found', async () => { it('should resolve with false if no active membership is found', done => {
githubApi.get. const trainedResponses: {[pathname: string]: Promise<{state: string}>} = {
withArgs('/teams/1/memberships/user').and.resolveTo({state: 'pending'}). '/teams/1/memberships/user': Promise.resolve({state: 'pending'}),
withArgs('/teams/2/memberships/user').and.rejectWith(null). '/teams/2/memberships/user': Promise.reject(null),
withArgs('/teams/3/memberships/user').and.resolveTo({state: 'not active'}). '/teams/3/memberships/user': Promise.resolve({state: 'not active'}),
withArgs('/teams/4/memberships/user').and.rejectWith(null); '/teams/4/memberships/user': Promise.reject(null),
};
githubApi.get.and.callFake((pathname: string) => trainedResponses[pathname]);
await expectAsync(teams.isMemberById('user', [1, 2, 3, 4])).toBeResolvedTo(false); teams.isMemberById('user', [1, 2, 3, 4]).then(isMember => {
expect(isMember).toBe(false);
expect(githubApi.get).toHaveBeenCalledTimes(4); expect(githubApi.get).toHaveBeenCalledTimes(4);
expect(githubApi.get.calls.argsFor(0)[0]).toBe('/teams/1/memberships/user'); expect(githubApi.get.calls.argsFor(0)[0]).toBe('/teams/1/memberships/user');
expect(githubApi.get.calls.argsFor(1)[0]).toBe('/teams/2/memberships/user'); expect(githubApi.get.calls.argsFor(1)[0]).toBe('/teams/2/memberships/user');
expect(githubApi.get.calls.argsFor(2)[0]).toBe('/teams/3/memberships/user'); expect(githubApi.get.calls.argsFor(2)[0]).toBe('/teams/3/memberships/user');
expect(githubApi.get.calls.argsFor(3)[0]).toBe('/teams/4/memberships/user'); expect(githubApi.get.calls.argsFor(3)[0]).toBe('/teams/4/memberships/user');
done();
});
}); });
}); });
@ -140,13 +157,14 @@ describe('GithubTeams', () => {
beforeEach(() => { beforeEach(() => {
teams = new GithubTeams(githubApi, 'foo'); teams = new GithubTeams(githubApi, 'foo');
teamsFetchAllSpy = spyOn(teams, 'fetchAll').and.resolveTo([{id: 1, slug: 'team1'}, {id: 2, slug: 'team2'}]); const mockResponse = Promise.resolve([{id: 1, slug: 'team1'}, {id: 2, slug: 'team2'}]);
teamsFetchAllSpy = spyOn(teams, 'fetchAll').and.returnValue(mockResponse);
teamsIsMemberByIdSpy = spyOn(teams, 'isMemberById'); teamsIsMemberByIdSpy = spyOn(teams, 'isMemberById');
}); });
it('should return a promise', () => { it('should return a promise', () => {
expect(teams.isMemberBySlug('user', ['team-slug'])).toBeInstanceOf(Promise); expect(teams.isMemberBySlug('user', ['team-slug'])).toEqual(jasmine.any(Promise));
}); });
@ -156,46 +174,55 @@ describe('GithubTeams', () => {
}); });
it('should resolve with false if \'fetchAll()\' rejects', async () => { it('should resolve with false if \'fetchAll()\' rejects', done => {
teamsFetchAllSpy.and.rejectWith(null); teamsFetchAllSpy.and.callFake(() => Promise.reject(null));
await expectAsync(teams.isMemberBySlug('user', ['team-slug'])).toBeResolvedTo(false); teams.isMemberBySlug('user', ['team-slug']).then(isMember => {
expect(isMember).toBe(false);
done();
});
}); });
it('should call \'isMemberById()\' with the correct params if no team is found', async () => { it('should call \'isMemberById()\' with the correct params if no team is found', done => {
await teams.isMemberBySlug('user', ['no-match']); teams.isMemberBySlug('user', ['no-match']).then(() => {
expect(teamsIsMemberByIdSpy).toHaveBeenCalledWith('user', []); expect(teamsIsMemberByIdSpy).toHaveBeenCalledWith('user', []);
done();
});
}); });
it('should call \'isMemberById()\' with the correct params if teams are found', async () => { it('should call \'isMemberById()\' with the correct params if teams are found', done => {
await teams.isMemberBySlug('userA', ['team1']); const spy = teamsIsMemberByIdSpy;
expect(teamsIsMemberByIdSpy).toHaveBeenCalledWith('userA', [1]);
await teams.isMemberBySlug('userB', ['team2']); Promise.all([
expect(teamsIsMemberByIdSpy).toHaveBeenCalledWith('userB', [2]); teams.isMemberBySlug('user', ['team1']).then(() => expect(spy).toHaveBeenCalledWith('user', [1])),
teams.isMemberBySlug('user', ['team2']).then(() => expect(spy).toHaveBeenCalledWith('user', [2])),
await teams.isMemberBySlug('userC', ['team1', 'team2']); teams.isMemberBySlug('user', ['team1', 'team2']).then(() => expect(spy).toHaveBeenCalledWith('user', [1, 2])),
expect(teamsIsMemberByIdSpy).toHaveBeenCalledWith('userC', [1, 2]); ]).then(done);
}); });
it('should resolve with false if \'isMemberById()\' rejects', async () => { it('should resolve with false if \'isMemberById()\' rejects', done => {
teamsIsMemberByIdSpy.and.rejectWith(null); teamsIsMemberByIdSpy.and.callFake(() => Promise.reject(null));
teams.isMemberBySlug('user', ['team1']).then(isMember => {
await expectAsync(teams.isMemberBySlug('user', ['team1'])).toBeResolvedTo(false); expect(isMember).toBe(false);
expect(teamsIsMemberByIdSpy).toHaveBeenCalled(); expect(teamsIsMemberByIdSpy).toHaveBeenCalled();
done();
});
}); });
it('should resolve with the value \'isMemberById()\' resolves with', async () => { it('should resolve with the value \'isMemberById()\' resolves with', async () => {
teamsIsMemberByIdSpy.and.resolveTo(true);
await expectAsync(teams.isMemberBySlug('userA', ['team1'])).toBeResolvedTo(true);
expect(teamsIsMemberByIdSpy).toHaveBeenCalledWith('userA', [1]);
teamsIsMemberByIdSpy.and.resolveTo(false); teamsIsMemberByIdSpy.and.callFake(() => Promise.resolve(true));
await expectAsync(teams.isMemberBySlug('userB', ['team1'])).toBeResolvedTo(false); const isMember1 = await teams.isMemberBySlug('user', ['team1']);
expect(teamsIsMemberByIdSpy).toHaveBeenCalledWith('userB', [1]); expect(isMember1).toBe(true);
expect(teamsIsMemberByIdSpy).toHaveBeenCalledWith('user', [1]);
teamsIsMemberByIdSpy.and.callFake(() => Promise.resolve(false));
const isMember2 = await teams.isMemberBySlug('user', ['team1']);
expect(isMember2).toBe(false);
expect(teamsIsMemberByIdSpy).toHaveBeenCalledWith('user', [1]);
}); });
}); });

View File

@ -9,8 +9,7 @@ import {Logger} from '../../lib/common/utils';
import {BuildCreator} from '../../lib/preview-server/build-creator'; import {BuildCreator} from '../../lib/preview-server/build-creator';
import {ChangedPrVisibilityEvent, CreatedBuildEvent} from '../../lib/preview-server/build-events'; import {ChangedPrVisibilityEvent, CreatedBuildEvent} from '../../lib/preview-server/build-events';
import {PreviewServerError} from '../../lib/preview-server/preview-error'; import {PreviewServerError} from '../../lib/preview-server/preview-error';
import {customAsyncMatchers} from './jasmine-custom-async-matchers'; import {expectToBePreviewServerError} from './helpers';
// Tests // Tests
describe('BuildCreator', () => { describe('BuildCreator', () => {
@ -25,7 +24,6 @@ describe('BuildCreator', () => {
const publicShaDir = path.join(publicPrDir, shortSha); const publicShaDir = path.join(publicPrDir, shortSha);
let bc: BuildCreator; let bc: BuildCreator;
beforeEach(() => jasmine.addAsyncMatchers(customAsyncMatchers));
beforeEach(() => bc = new BuildCreator(buildsDir)); beforeEach(() => bc = new BuildCreator(buildsDir));
@ -37,8 +35,8 @@ describe('BuildCreator', () => {
it('should extend EventEmitter', () => { it('should extend EventEmitter', () => {
expect(bc).toBeInstanceOf(BuildCreator); expect(bc).toEqual(jasmine.any(BuildCreator));
expect(bc).toBeInstanceOf(EventEmitter); expect(bc).toEqual(jasmine.any(EventEmitter));
expect(Object.getPrototypeOf(bc)).toBe(BuildCreator.prototype); expect(Object.getPrototypeOf(bc)).toBe(BuildCreator.prototype);
}); });
@ -69,43 +67,47 @@ describe('BuildCreator', () => {
const shaDir = isPublic ? publicShaDir : hiddenShaDir; const shaDir = isPublic ? publicShaDir : hiddenShaDir;
it('should return a promise', async () => { it('should return a promise', done => {
const promise = bc.create(pr, sha, archive, isPublic); const promise = bc.create(pr, sha, archive, isPublic);
expect(promise).toBeInstanceOf(Promise); promise.then(done); // Do not complete the test (and release the spies) synchronously
// to avoid running the actual `extractArchive()`.
// Do not complete the test (and release the spies) synchronously to avoid running the actual expect(promise).toEqual(jasmine.any(Promise));
// `extractArchive()`.
await promise;
}); });
it('should update the PR\'s visibility first if necessary', async () => { it('should update the PR\'s visibility first if necessary', done => {
await bc.create(pr, sha, archive, isPublic); bcUpdatePrVisibilitySpy.and.callFake(() => expect(shellMkdirSpy).not.toHaveBeenCalled());
expect(bcUpdatePrVisibilitySpy).toHaveBeenCalledBefore(shellMkdirSpy); bc.create(pr, sha, archive, isPublic).
expect(bcUpdatePrVisibilitySpy).toHaveBeenCalledWith(pr, isPublic); then(() => {
expect(shellMkdirSpy).toHaveBeenCalled(); expect(bcUpdatePrVisibilitySpy).toHaveBeenCalledWith(pr, isPublic);
expect(shellMkdirSpy).toHaveBeenCalled();
}).
then(done);
}); });
it('should create the build directory (and any parent directories)', async () => { it('should create the build directory (and any parent directories)', done => {
await bc.create(pr, sha, archive, isPublic); bc.create(pr, sha, archive, isPublic).
expect(shellMkdirSpy).toHaveBeenCalledWith('-p', shaDir); then(() => expect(shellMkdirSpy).toHaveBeenCalledWith('-p', shaDir)).
then(done);
}); });
it('should extract the archive contents into the build directory', async () => { it('should extract the archive contents into the build directory', done => {
await bc.create(pr, sha, archive, isPublic); bc.create(pr, sha, archive, isPublic).
expect(bcExtractArchiveSpy).toHaveBeenCalledWith(archive, shaDir); then(() => expect(bcExtractArchiveSpy).toHaveBeenCalledWith(archive, shaDir)).
then(done);
}); });
it('should emit a CreatedBuildEvent on success', async () => { it('should emit a CreatedBuildEvent on success', done => {
let emitted = false; let emitted = false;
bcEmitSpy.and.callFake((type: string, evt: CreatedBuildEvent) => { bcEmitSpy.and.callFake((type: string, evt: CreatedBuildEvent) => {
expect(type).toBe(CreatedBuildEvent.type); expect(type).toBe(CreatedBuildEvent.type);
expect(evt).toBeInstanceOf(CreatedBuildEvent); expect(evt).toEqual(jasmine.any(CreatedBuildEvent));
expect(evt.pr).toBe(+pr); expect(evt.pr).toBe(+pr);
expect(evt.sha).toBe(shortSha); expect(evt.sha).toBe(shortSha);
expect(evt.isPublic).toBe(isPublic); expect(evt.isPublic).toBe(isPublic);
@ -113,108 +115,130 @@ describe('BuildCreator', () => {
emitted = true; emitted = true;
}); });
await bc.create(pr, sha, archive, isPublic); bc.create(pr, sha, archive, isPublic).
expect(emitted).toBe(true); then(() => expect(emitted).toBe(true)).
then(done);
}); });
describe('on error', () => { describe('on error', () => {
let existsValues: {[dir: string]: boolean};
beforeEach(() => { beforeEach(() => {
bcExistsSpy.and.returnValue(false); existsValues = {
[prDir]: false,
[shaDir]: false,
};
bcExistsSpy.and.callFake((dir: string) => existsValues[dir]);
}); });
it('should abort and skip further operations if changing the PR\'s visibility fails', async () => { it('should abort and skip further operations if changing the PR\'s visibility fails', done => {
const mockError = new PreviewServerError(543, 'Test'); const mockError = new PreviewServerError(543, 'Test');
bcUpdatePrVisibilitySpy.and.rejectWith(mockError); bcUpdatePrVisibilitySpy.and.callFake(() => Promise.reject(mockError));
await expectAsync(bc.create(pr, sha, archive, isPublic)).toBeRejectedWith(mockError); bc.create(pr, sha, archive, isPublic).catch(err => {
expect(err).toBe(mockError);
expect(bcExistsSpy).not.toHaveBeenCalled(); expect(bcExistsSpy).not.toHaveBeenCalled();
expect(shellMkdirSpy).not.toHaveBeenCalled(); expect(shellMkdirSpy).not.toHaveBeenCalled();
expect(bcExtractArchiveSpy).not.toHaveBeenCalled(); expect(bcExtractArchiveSpy).not.toHaveBeenCalled();
expect(bcEmitSpy).not.toHaveBeenCalled(); expect(bcEmitSpy).not.toHaveBeenCalled();
done();
});
}); });
it('should abort and skip further operations if the build does already exist', async () => { it('should abort and skip further operations if the build does already exist', done => {
bcExistsSpy.withArgs(shaDir).and.returnValue(true); existsValues[shaDir] = true;
bc.create(pr, sha, archive, isPublic).catch(err => {
await expectAsync(bc.create(pr, sha, archive, isPublic)).toBeRejectedWithPreviewServerError( const publicOrNot = isPublic ? 'public' : 'non-public';
409, `Request to overwrite existing ${isPublic ? '' : 'non-'}public directory: ${shaDir}`); expectToBePreviewServerError(err, 409, `Request to overwrite existing ${publicOrNot} directory: ${shaDir}`);
expect(shellMkdirSpy).not.toHaveBeenCalled();
expect(shellMkdirSpy).not.toHaveBeenCalled(); expect(bcExtractArchiveSpy).not.toHaveBeenCalled();
expect(bcExtractArchiveSpy).not.toHaveBeenCalled(); expect(bcEmitSpy).not.toHaveBeenCalled();
expect(bcEmitSpy).not.toHaveBeenCalled(); done();
});
}); });
it('should detect existing build directory after visibility change', async () => { it('should detect existing build directory after visibility change', done => {
bcUpdatePrVisibilitySpy.and.callFake(() => bcExistsSpy.and.returnValue(true)); bcUpdatePrVisibilitySpy.and.callFake(() => existsValues[prDir] = existsValues[shaDir] = true);
expect(bcExistsSpy(prDir)).toBe(false); expect(bcExistsSpy(prDir)).toBe(false);
expect(bcExistsSpy(shaDir)).toBe(false); expect(bcExistsSpy(shaDir)).toBe(false);
await expectAsync(bc.create(pr, sha, archive, isPublic)).toBeRejectedWithPreviewServerError( bc.create(pr, sha, archive, isPublic).catch(err => {
409, `Request to overwrite existing ${isPublic ? '' : 'non-'}public directory: ${shaDir}`); const publicOrNot = isPublic ? 'public' : 'non-public';
expectToBePreviewServerError(err, 409, `Request to overwrite existing ${publicOrNot} directory: ${shaDir}`);
expect(shellMkdirSpy).not.toHaveBeenCalled(); expect(shellMkdirSpy).not.toHaveBeenCalled();
expect(bcExtractArchiveSpy).not.toHaveBeenCalled(); expect(bcExtractArchiveSpy).not.toHaveBeenCalled();
expect(bcEmitSpy).not.toHaveBeenCalled(); expect(bcEmitSpy).not.toHaveBeenCalled();
done();
});
}); });
it('should abort and skip further operations if it fails to create the directories', async () => { it('should abort and skip further operations if it fails to create the directories', done => {
shellMkdirSpy.and.throwError(''); shellMkdirSpy.and.throwError('');
bc.create(pr, sha, archive, isPublic).catch(() => {
await expectAsync(bc.create(pr, sha, archive, isPublic)).toBeRejected(); expect(shellMkdirSpy).toHaveBeenCalled();
expect(bcExtractArchiveSpy).not.toHaveBeenCalled();
expect(shellMkdirSpy).toHaveBeenCalled(); expect(bcEmitSpy).not.toHaveBeenCalled();
expect(bcExtractArchiveSpy).not.toHaveBeenCalled(); done();
expect(bcEmitSpy).not.toHaveBeenCalled(); });
}); });
it('should abort and skip further operations if it fails to extract the archive', async () => { it('should abort and skip further operations if it fails to extract the archive', done => {
bcExtractArchiveSpy.and.throwError('');
bc.create(pr, sha, archive, isPublic).catch(() => {
expect(shellMkdirSpy).toHaveBeenCalled();
expect(bcExtractArchiveSpy).toHaveBeenCalled();
expect(bcEmitSpy).not.toHaveBeenCalled();
done();
});
});
it('should delete the PR directory (for new PR)', done => {
bcExtractArchiveSpy.and.throwError('');
bc.create(pr, sha, archive, isPublic).catch(() => {
expect(shellRmSpy).toHaveBeenCalledWith('-rf', prDir);
done();
});
});
it('should delete the SHA directory (for existing PR)', done => {
existsValues[prDir] = true;
bcExtractArchiveSpy.and.throwError(''); bcExtractArchiveSpy.and.throwError('');
await expectAsync(bc.create(pr, sha, archive, isPublic)).toBeRejected(); bc.create(pr, sha, archive, isPublic).catch(() => {
expect(shellRmSpy).toHaveBeenCalledWith('-rf', shaDir);
expect(shellMkdirSpy).toHaveBeenCalled(); done();
expect(bcExtractArchiveSpy).toHaveBeenCalled(); });
expect(bcEmitSpy).not.toHaveBeenCalled();
}); });
it('should delete the PR directory (for new PR)', async () => { it('should reject with an PreviewServerError', done => {
bcExtractArchiveSpy.and.throwError('');
await expectAsync(bc.create(pr, sha, archive, isPublic)).toBeRejected();
expect(shellRmSpy).toHaveBeenCalledWith('-rf', prDir);
});
it('should delete the SHA directory (for existing PR)', async () => {
bcExistsSpy.withArgs(prDir).and.returnValue(true);
bcExtractArchiveSpy.and.throwError('');
await expectAsync(bc.create(pr, sha, archive, isPublic)).toBeRejected();
expect(shellRmSpy).toHaveBeenCalledWith('-rf', shaDir);
});
it('should reject with an PreviewServerError', async () => {
// tslint:disable-next-line: no-string-throw // tslint:disable-next-line: no-string-throw
shellMkdirSpy.and.callFake(() => { throw 'Test'; }); shellMkdirSpy.and.callFake(() => { throw 'Test'; });
bc.create(pr, sha, archive, isPublic).catch(err => {
await expectAsync(bc.create(pr, sha, archive, isPublic)).toBeRejectedWithPreviewServerError( expectToBePreviewServerError(err, 500, `Error while creating preview at: ${shaDir}\nTest`);
500, `Error while creating preview at: ${shaDir}\nTest`); done();
});
}); });
it('should pass PreviewServerError instances unmodified', async () => { it('should pass PreviewServerError instances unmodified', done => {
shellMkdirSpy.and.callFake(() => { throw new PreviewServerError(543, 'Test'); }); shellMkdirSpy.and.callFake(() => { throw new PreviewServerError(543, 'Test'); });
await expectAsync(bc.create(pr, sha, archive, isPublic)).toBeRejectedWithPreviewServerError(543, 'Test'); bc.create(pr, sha, archive, isPublic).catch(err => {
expectToBePreviewServerError(err, 543, 'Test');
done();
});
}); });
}); });
@ -241,12 +265,12 @@ describe('BuildCreator', () => {
}); });
it('should return a promise', async () => { it('should return a promise', done => {
const promise = bc.updatePrVisibility(pr, true); const promise = bc.updatePrVisibility(pr, true);
expect(promise).toBeInstanceOf(Promise); promise.then(done); // Do not complete the test (and release the spies) synchronously
// to avoid running the actual `extractArchive()`.
// Do not complete the test (and release the spies) synchronously to avoid running the actual `extractArchive()`. expect(promise).toEqual(jasmine.any(Promise));
await promise;
}); });
@ -255,53 +279,58 @@ describe('BuildCreator', () => {
const newPrDir = makePublic ? publicPrDir : hiddenPrDir; const newPrDir = makePublic ? publicPrDir : hiddenPrDir;
it('should rename the directory', async () => { it('should rename the directory', done => {
await bc.updatePrVisibility(pr, makePublic); bc.updatePrVisibility(pr, makePublic).
expect(shellMvSpy).toHaveBeenCalledWith(oldPrDir, newPrDir); then(() => expect(shellMvSpy).toHaveBeenCalledWith(oldPrDir, newPrDir)).
then(done);
}); });
describe('when the visibility is updated', () => { describe('when the visibility is updated', () => {
it('should resolve to true', async () => { it('should resolve to true', done => {
await expectAsync(bc.updatePrVisibility(pr, makePublic)).toBeResolvedTo(true); bc.updatePrVisibility(pr, makePublic).
then(result => expect(result).toBe(true)).
then(done);
}); });
it('should rename the directory', async () => { it('should rename the directory', done => {
await bc.updatePrVisibility(pr, makePublic); bc.updatePrVisibility(pr, makePublic).
expect(shellMvSpy).toHaveBeenCalledWith(oldPrDir, newPrDir); then(() => expect(shellMvSpy).toHaveBeenCalledWith(oldPrDir, newPrDir)).
then(done);
}); });
it('should emit a ChangedPrVisibilityEvent on success', async () => { it('should emit a ChangedPrVisibilityEvent on success', done => {
let emitted = false; let emitted = false;
bcEmitSpy.and.callFake((type: string, evt: ChangedPrVisibilityEvent) => { bcEmitSpy.and.callFake((type: string, evt: ChangedPrVisibilityEvent) => {
expect(type).toBe(ChangedPrVisibilityEvent.type); expect(type).toBe(ChangedPrVisibilityEvent.type);
expect(evt).toBeInstanceOf(ChangedPrVisibilityEvent); expect(evt).toEqual(jasmine.any(ChangedPrVisibilityEvent));
expect(evt.pr).toBe(+pr); expect(evt.pr).toBe(+pr);
expect(evt.shas).toBeInstanceOf(Array); expect(evt.shas).toEqual(jasmine.any(Array));
expect(evt.isPublic).toBe(makePublic); expect(evt.isPublic).toBe(makePublic);
emitted = true; emitted = true;
}); });
await bc.updatePrVisibility(pr, makePublic); bc.updatePrVisibility(pr, makePublic).
expect(emitted).toBe(true); then(() => expect(emitted).toBe(true)).
then(done);
}); });
it('should include all shas in the emitted event', async () => { it('should include all shas in the emitted event', done => {
const shas = ['foo', 'bar', 'baz']; const shas = ['foo', 'bar', 'baz'];
let emitted = false; let emitted = false;
bcListShasByDate.and.resolveTo(shas); bcListShasByDate.and.callFake(() => Promise.resolve(shas));
bcEmitSpy.and.callFake((type: string, evt: ChangedPrVisibilityEvent) => { bcEmitSpy.and.callFake((type: string, evt: ChangedPrVisibilityEvent) => {
expect(bcListShasByDate).toHaveBeenCalledWith(newPrDir); expect(bcListShasByDate).toHaveBeenCalledWith(newPrDir);
expect(type).toBe(ChangedPrVisibilityEvent.type); expect(type).toBe(ChangedPrVisibilityEvent.type);
expect(evt).toBeInstanceOf(ChangedPrVisibilityEvent); expect(evt).toEqual(jasmine.any(ChangedPrVisibilityEvent));
expect(evt.pr).toBe(+pr); expect(evt.pr).toBe(+pr);
expect(evt.shas).toBe(shas); expect(evt.shas).toBe(shas);
expect(evt.isPublic).toBe(makePublic); expect(evt.isPublic).toBe(makePublic);
@ -309,82 +338,94 @@ describe('BuildCreator', () => {
emitted = true; emitted = true;
}); });
await bc.updatePrVisibility(pr, makePublic); bc.updatePrVisibility(pr, makePublic).
expect(emitted).toBe(true); then(() => expect(emitted).toBe(true)).
then(done);
}); });
}); });
it('should do nothing if the visibility is already up-to-date', async () => { it('should do nothing if the visibility is already up-to-date', done => {
bcExistsSpy.and.callFake((dir: string) => dir === newPrDir); bcExistsSpy.and.callFake((dir: string) => dir === newPrDir);
bc.updatePrVisibility(pr, makePublic).
await expectAsync(bc.updatePrVisibility(pr, makePublic)).toBeResolvedTo(false); then(result => {
expect(result).toBe(false);
expect(shellMvSpy).not.toHaveBeenCalled(); expect(shellMvSpy).not.toHaveBeenCalled();
expect(bcListShasByDate).not.toHaveBeenCalled(); expect(bcListShasByDate).not.toHaveBeenCalled();
expect(bcEmitSpy).not.toHaveBeenCalled(); expect(bcEmitSpy).not.toHaveBeenCalled();
}).
then(done);
}); });
it('should do nothing if the PR directory does not exist', async () => { it('should do nothing if the PR directory does not exist', done => {
bcExistsSpy.and.returnValue(false); bcExistsSpy.and.returnValue(false);
bc.updatePrVisibility(pr, makePublic).
await expectAsync(bc.updatePrVisibility(pr, makePublic)).toBeResolvedTo(false); then(result => {
expect(result).toBe(false);
expect(shellMvSpy).not.toHaveBeenCalled(); expect(shellMvSpy).not.toHaveBeenCalled();
expect(bcListShasByDate).not.toHaveBeenCalled(); expect(bcListShasByDate).not.toHaveBeenCalled();
expect(bcEmitSpy).not.toHaveBeenCalled(); expect(bcEmitSpy).not.toHaveBeenCalled();
}).
then(done);
}); });
describe('on error', () => { describe('on error', () => {
it('should abort and skip further operations if both directories exist', async () => { it('should abort and skip further operations if both directories exist', done => {
bcExistsSpy.and.returnValue(true); bcExistsSpy.and.returnValue(true);
bc.updatePrVisibility(pr, makePublic).catch(err => {
await expectAsync(bc.updatePrVisibility(pr, makePublic)).toBeRejectedWithPreviewServerError( expectToBePreviewServerError(err, 409,
409, `Request to move '${oldPrDir}' to existing directory '${newPrDir}'.`); `Request to move '${oldPrDir}' to existing directory '${newPrDir}'.`);
expect(shellMvSpy).not.toHaveBeenCalled();
expect(shellMvSpy).not.toHaveBeenCalled(); expect(bcListShasByDate).not.toHaveBeenCalled();
expect(bcListShasByDate).not.toHaveBeenCalled(); expect(bcEmitSpy).not.toHaveBeenCalled();
expect(bcEmitSpy).not.toHaveBeenCalled(); done();
});
}); });
it('should abort and skip further operations if it fails to rename the directory', async () => { it('should abort and skip further operations if it fails to rename the directory', done => {
shellMvSpy.and.throwError(''); shellMvSpy.and.throwError('');
bc.updatePrVisibility(pr, makePublic).catch(() => {
await expectAsync(bc.updatePrVisibility(pr, makePublic)).toBeRejected(); expect(shellMvSpy).toHaveBeenCalled();
expect(bcListShasByDate).not.toHaveBeenCalled();
expect(shellMvSpy).toHaveBeenCalled(); expect(bcEmitSpy).not.toHaveBeenCalled();
expect(bcListShasByDate).not.toHaveBeenCalled(); done();
expect(bcEmitSpy).not.toHaveBeenCalled(); });
}); });
it('should abort and skip further operations if it fails to list the SHAs', async () => { it('should abort and skip further operations if it fails to list the SHAs', done => {
bcListShasByDate.and.throwError(''); bcListShasByDate.and.throwError('');
bc.updatePrVisibility(pr, makePublic).catch(() => {
await expectAsync(bc.updatePrVisibility(pr, makePublic)).toBeRejected(); expect(shellMvSpy).toHaveBeenCalled();
expect(bcListShasByDate).toHaveBeenCalled();
expect(shellMvSpy).toHaveBeenCalled(); expect(bcEmitSpy).not.toHaveBeenCalled();
expect(bcListShasByDate).toHaveBeenCalled(); done();
expect(bcEmitSpy).not.toHaveBeenCalled(); });
}); });
it('should reject with an PreviewServerError', async () => { it('should reject with an PreviewServerError', done => {
// tslint:disable-next-line: no-string-throw // tslint:disable-next-line: no-string-throw
shellMvSpy.and.callFake(() => { throw 'Test'; }); shellMvSpy.and.callFake(() => { throw 'Test'; });
await expectAsync(bc.updatePrVisibility(pr, makePublic)).toBeRejectedWithPreviewServerError( bc.updatePrVisibility(pr, makePublic).catch(err => {
500, `Error while making PR ${pr} ${makePublic ? 'public' : 'hidden'}.\nTest`); expectToBePreviewServerError(err, 500,
`Error while making PR ${pr} ${makePublic ? 'public' : 'hidden'}.\nTest`);
done();
});
}); });
it('should pass PreviewServerError instances unmodified', async () => { it('should pass PreviewServerError instances unmodified', done => {
shellMvSpy.and.callFake(() => { throw new PreviewServerError(543, 'Test'); }); shellMvSpy.and.callFake(() => { throw new PreviewServerError(543, 'Test'); });
await expectAsync(bc.updatePrVisibility(pr, makePublic)).toBeRejectedWithPreviewServerError(543, 'Test'); bc.updatePrVisibility(pr, makePublic).catch(err => {
expectToBePreviewServerError(err, 543, 'Test');
done();
});
}); });
}); });
@ -402,14 +443,12 @@ describe('BuildCreator', () => {
beforeEach(() => { beforeEach(() => {
fsAccessCbs = []; fsAccessCbs = [];
fsAccessSpy = spyOn(fs, 'access').and.callFake( fsAccessSpy = spyOn(fs, 'access').and.callFake((_: string, cb: (v?: any) => void) => fsAccessCbs.push(cb));
((_: string, cb: (v?: any) => void) => fsAccessCbs.push(cb)) as unknown as typeof fs.access,
);
}); });
it('should return a promise', () => { it('should return a promise', () => {
expect((bc as any).exists('foo')).toBeInstanceOf(Promise); expect((bc as any).exists('foo')).toEqual(jasmine.any(Promise));
}); });
@ -419,29 +458,25 @@ describe('BuildCreator', () => {
}); });
it('should resolve with \'true\' if \'fs.access()\' succeeds', async () => { it('should resolve with \'true\' if \'fs.access()\' succeeds', done => {
const existsPromises = [ Promise.
(bc as any).exists('foo'), all([(bc as any).exists('foo'), (bc as any).exists('bar')]).
(bc as any).exists('bar'), then(results => expect(results).toEqual([true, true])).
]; then(done);
fsAccessCbs[0](); fsAccessCbs[0]();
fsAccessCbs[1](null); fsAccessCbs[1](null);
await expectAsync(Promise.all(existsPromises)).toBeResolvedTo([true, true]);
}); });
it('should resolve with \'false\' if \'fs.access()\' errors', async () => { it('should resolve with \'false\' if \'fs.access()\' errors', done => {
const existsPromises = [ Promise.
(bc as any).exists('foo'), all([(bc as any).exists('foo'), (bc as any).exists('bar')]).
(bc as any).exists('bar'), then(results => expect(results).toEqual([false, false])).
]; then(done);
fsAccessCbs[0]('Error'); fsAccessCbs[0]('Error');
fsAccessCbs[1](new Error()); fsAccessCbs[1](new Error());
await expectAsync(Promise.all(existsPromises)).toBeResolvedTo([false, false]);
}); });
}); });
@ -460,15 +495,12 @@ describe('BuildCreator', () => {
consoleWarnSpy = spyOn(Logger.prototype, 'warn'); consoleWarnSpy = spyOn(Logger.prototype, 'warn');
shellChmodSpy = spyOn(shell, 'chmod'); shellChmodSpy = spyOn(shell, 'chmod');
shellRmSpy = spyOn(shell, 'rm'); shellRmSpy = spyOn(shell, 'rm');
cpExecSpy = spyOn(cp, 'exec').and.callFake( cpExecSpy = spyOn(cp, 'exec').and.callFake((_: string, cb: (...args: any[]) => void) => cpExecCbs.push(cb));
((_: string, cb: (...args: any[]) => void) =>
cpExecCbs.push(cb)) as unknown as typeof cp.exec,
);
}); });
it('should return a promise', () => { it('should return a promise', () => {
expect((bc as any).extractArchive('foo', 'bar')).toBeInstanceOf(Promise); expect((bc as any).extractArchive('foo', 'bar')).toEqual(jasmine.any(Promise));
}); });
@ -480,68 +512,78 @@ describe('BuildCreator', () => {
}); });
it('should log (as a warning) any stderr output if extracting succeeded', async () => { it('should log (as a warning) any stderr output if extracting succeeded', done => {
const extractPromise = (bc as any).extractArchive('foo', 'bar'); (bc as any).extractArchive('foo', 'bar').
then(() => expect(consoleWarnSpy).toHaveBeenCalledWith('This is stderr')).
then(done);
cpExecCbs[0](null, 'This is stdout', 'This is stderr'); cpExecCbs[0](null, 'This is stdout', 'This is stderr');
await expectAsync(extractPromise).toBeResolved();
expect(consoleWarnSpy).toHaveBeenCalledWith('This is stderr');
}); });
it('should make the build directory non-writable', async () => { it('should make the build directory non-writable', done => {
const extractPromise = (bc as any).extractArchive('foo', 'bar'); (bc as any).extractArchive('foo', 'bar').
cpExecCbs[0](); then(() => expect(shellChmodSpy).toHaveBeenCalledWith('-R', 'a-w', 'bar')).
then(done);
await expectAsync(extractPromise).toBeResolved(); cpExecCbs[0]();
expect(shellChmodSpy).toHaveBeenCalledWith('-R', 'a-w', 'bar');
}); });
it('should delete the build artifact file on success', async () => { it('should delete the build artifact file on success', done => {
const extractPromise = (bc as any).extractArchive('input/file', 'output/dir'); (bc as any).extractArchive('input/file', 'output/dir').
cpExecCbs[0](); then(() => expect(shellRmSpy).toHaveBeenCalledWith('-f', 'input/file')).
then(done);
await expectAsync(extractPromise).toBeResolved(); cpExecCbs[0]();
expect(shellRmSpy).toHaveBeenCalledWith('-f', 'input/file');
}); });
describe('on error', () => { describe('on error', () => {
it('should abort and skip further operations if it fails to extract the archive', async () => { it('should abort and skip further operations if it fails to extract the archive', done => {
const extractPromise = (bc as any).extractArchive('foo', 'bar'); (bc as any).extractArchive('foo', 'bar').catch((err: any) => {
expect(shellChmodSpy).not.toHaveBeenCalled();
expect(shellRmSpy).not.toHaveBeenCalled();
expect(err).toBe('Test');
done();
});
cpExecCbs[0]('Test'); cpExecCbs[0]('Test');
await expectAsync(extractPromise).toBeRejectedWith('Test');
expect(shellChmodSpy).not.toHaveBeenCalled();
expect(shellRmSpy).not.toHaveBeenCalled();
}); });
it('should abort and skip further operations if it fails to make non-writable', async () => { it('should abort and skip further operations if it fails to make non-writable', done => {
// tslint:disable-next-line: no-string-throw (bc as any).extractArchive('foo', 'bar').catch((err: any) => {
shellChmodSpy.and.callFake(() => { throw 'Test'; }); expect(shellChmodSpy).toHaveBeenCalled();
expect(shellRmSpy).not.toHaveBeenCalled();
expect(err).toBe('Test');
done();
});
shellChmodSpy.and.callFake(() => {
// tslint:disable-next-line: no-string-throw
throw 'Test';
});
const extractPromise = (bc as any).extractArchive('foo', 'bar');
cpExecCbs[0](); cpExecCbs[0]();
await expectAsync(extractPromise).toBeRejectedWith('Test');
expect(shellChmodSpy).toHaveBeenCalled();
expect(shellRmSpy).not.toHaveBeenCalled();
}); });
it('should abort and reject if it fails to remove the build artifact file', async () => { it('should abort and reject if it fails to remove the build artifact file', done => {
// tslint:disable-next-line: no-string-throw (bc as any).extractArchive('foo', 'bar').catch((err: any) => {
shellRmSpy.and.callFake(() => { throw 'Test'; }); expect(shellChmodSpy).toHaveBeenCalled();
expect(shellRmSpy).toHaveBeenCalled();
expect(err).toBe('Test');
done();
});
shellRmSpy.and.callFake(() => {
// tslint:disable-next-line: no-string-throw
throw 'Test';
});
const extractPromise = (bc as any).extractArchive('foo', 'bar');
cpExecCbs[0](); cpExecCbs[0]();
await expectAsync(extractPromise).toBeRejectedWith('Test');
expect(shellChmodSpy).toHaveBeenCalled();
expect(shellRmSpy).toHaveBeenCalled();
}); });
}); });
@ -558,54 +600,62 @@ describe('BuildCreator', () => {
}); });
beforeEach(() => { beforeEach(() => {
shellLsSpy = spyOn(shell, 'ls').and.returnValue([] as unknown as shell.ShellArray); shellLsSpy = spyOn(shell, 'ls').and.returnValue([]);
}); });
it('should return a promise', async () => { it('should return a promise', done => {
const promise = (bc as any).listShasByDate('input/dir'); const promise = (bc as any).listShasByDate('input/dir');
expect(promise).toBeInstanceOf(Promise); promise.then(done); // Do not complete the test (and release the spies) synchronously
// to avoid running the actual `ls()`.
// Do not complete the test (and release the spies) synchronously to avoid running the actual `ls()`. expect(promise).toEqual(jasmine.any(Promise));
await promise;
}); });
it('should `ls()` files with their metadata', async () => { it('should `ls()` files with their metadata', done => {
await (bc as any).listShasByDate('input/dir'); (bc as any).listShasByDate('input/dir').
expect(shellLsSpy).toHaveBeenCalledWith('-l', 'input/dir'); then(() => expect(shellLsSpy).toHaveBeenCalledWith('-l', 'input/dir')).
then(done);
}); });
it('should reject if listing files fails', async () => { it('should reject if listing files fails', done => {
shellLsSpy.and.rejectWith('Test'); shellLsSpy.and.callFake(() => Promise.reject('Test'));
await expectAsync((bc as any).listShasByDate('input/dir')).toBeRejectedWith('Test'); (bc as any).listShasByDate('input/dir').catch((err: string) => {
expect(err).toBe('Test');
done();
});
}); });
it('should return the filenames', async () => { it('should return the filenames', done => {
shellLsSpy.and.resolveTo([ shellLsSpy.and.callFake(() => Promise.resolve([
lsResult('foo', 100), lsResult('foo', 100),
lsResult('bar', 200), lsResult('bar', 200),
lsResult('baz', 300), lsResult('baz', 300),
]); ]));
await expectAsync((bc as any).listShasByDate('input/dir')).toBeResolvedTo(['foo', 'bar', 'baz']); (bc as any).listShasByDate('input/dir').
then((shas: string[]) => expect(shas).toEqual(['foo', 'bar', 'baz'])).
then(done);
}); });
it('should sort by date', async () => { it('should sort by date', done => {
shellLsSpy.and.resolveTo([ shellLsSpy.and.callFake(() => Promise.resolve([
lsResult('foo', 300), lsResult('foo', 300),
lsResult('bar', 100), lsResult('bar', 100),
lsResult('baz', 200), lsResult('baz', 200),
]); ]));
await expectAsync((bc as any).listShasByDate('input/dir')).toBeResolvedTo(['bar', 'baz', 'foo']); (bc as any).listShasByDate('input/dir').
then((shas: string[]) => expect(shas).toEqual(['bar', 'baz', 'foo'])).
then(done);
}); });
it('should not break with ShellJS\' custom `sort()` method', async () => { it('should not break with ShellJS\' custom `sort()` method', done => {
const mockArray = [ const mockArray = [
lsResult('foo', 300), lsResult('foo', 300),
lsResult('bar', 100), lsResult('bar', 100),
@ -613,21 +663,26 @@ describe('BuildCreator', () => {
]; ];
mockArray.sort = jasmine.createSpy('sort'); mockArray.sort = jasmine.createSpy('sort');
shellLsSpy.and.resolveTo(mockArray); shellLsSpy.and.callFake(() => Promise.resolve(mockArray));
(bc as any).listShasByDate('input/dir').
await expectAsync((bc as any).listShasByDate('input/dir')).toBeResolvedTo(['bar', 'baz', 'foo']); then((shas: string[]) => {
expect(mockArray.sort).not.toHaveBeenCalled(); expect(shas).toEqual(['bar', 'baz', 'foo']);
expect(mockArray.sort).not.toHaveBeenCalled();
}).
then(done);
}); });
it('should only include directories', async () => { it('should only include directories', done => {
shellLsSpy.and.resolveTo([ shellLsSpy.and.callFake(() => Promise.resolve([
lsResult('foo', 100), lsResult('foo', 100),
lsResult('bar', 200, false), lsResult('bar', 200, false),
lsResult('baz', 300), lsResult('baz', 300),
]); ]));
await expectAsync((bc as any).listShasByDate('input/dir')).toBeResolvedTo(['foo', 'baz']); (bc as any).listShasByDate('input/dir').
then((shas: string[]) => expect(shas).toEqual(['foo', 'baz'])).
then(done);
}); });
}); });

View File

@ -32,18 +32,18 @@ describe('BuildRetriever', () => {
}; };
api = new CircleCiApi('ORG', 'REPO', 'TOKEN'); api = new CircleCiApi('ORG', 'REPO', 'TOKEN');
spyOn(api, 'getBuildInfo').and.resolveTo(BUILD_INFO); spyOn(api, 'getBuildInfo').and.callFake(() => Promise.resolve(BUILD_INFO));
getBuildArtifactUrlSpy = spyOn(api, 'getBuildArtifactUrl').and.resolveTo(BASE_URL + ARTIFACT_PATH); getBuildArtifactUrlSpy = spyOn(api, 'getBuildArtifactUrl')
.and.callFake(() => Promise.resolve(BASE_URL + ARTIFACT_PATH));
WRITEFILE_RESULT = undefined; WRITEFILE_RESULT = undefined;
writeFileSpy = spyOn(fs, 'writeFile').and.callFake( writeFileSpy = spyOn(fs, 'writeFile').and.callFake(
((_path: string, _buffer: Buffer, callback: fs.NoParamCallback) => (_path: string, _buffer: Buffer, callback: (err?: any) => {}) => callback(WRITEFILE_RESULT),
callback(WRITEFILE_RESULT)) as typeof fs.writeFile,
); );
EXISTS_RESULT = false; EXISTS_RESULT = false;
existsSpy = spyOn(fs, 'exists').and.callFake( existsSpy = spyOn(fs, 'exists').and.callFake(
((_path, callback) => callback(EXISTS_RESULT)) as typeof fs.exists, (_path: string, callback: (exists: boolean) => {}) => callback(EXISTS_RESULT),
); );
}); });
@ -56,7 +56,6 @@ describe('BuildRetriever', () => {
expect(() => new BuildRetriever(api, -1, DOWNLOAD_DIR)) expect(() => new BuildRetriever(api, -1, DOWNLOAD_DIR))
.toThrowError(`Invalid parameter "downloadSizeLimit" should be a number greater than 0.`); .toThrowError(`Invalid parameter "downloadSizeLimit" should be a number greater than 0.`);
}); });
it('should fail if the "downloadDir" is missing', () => { it('should fail if the "downloadDir" is missing', () => {
expect(() => new BuildRetriever(api, MAX_DOWNLOAD_SIZE, '')) expect(() => new BuildRetriever(api, MAX_DOWNLOAD_SIZE, ''))
.toThrowError(`Missing or empty required parameter 'downloadDir'!`); .toThrowError(`Missing or empty required parameter 'downloadDir'!`);
@ -73,10 +72,14 @@ describe('BuildRetriever', () => {
}); });
it('should error if it is not possible to extract the PR number from the branch', async () => { it('should error if it is not possible to extract the PR number from the branch', async () => {
BUILD_INFO.branch = 'master';
const retriever = new BuildRetriever(api, MAX_DOWNLOAD_SIZE, DOWNLOAD_DIR); const retriever = new BuildRetriever(api, MAX_DOWNLOAD_SIZE, DOWNLOAD_DIR);
try {
await expectAsync(retriever.getGithubInfo(12345)).toBeRejectedWithError('No PR found in branch field: master'); BUILD_INFO.branch = 'master';
await retriever.getGithubInfo(12345);
throw new Error('Exception Expected');
} catch (error) {
expect(error.message).toEqual('No PR found in branch field: master');
}
}); });
}); });
@ -107,10 +110,12 @@ describe('BuildRetriever', () => {
it('should fail if the artifact is too large', async () => { it('should fail if the artifact is too large', async () => {
const artifactRequest = nock(BASE_URL).get(ARTIFACT_PATH).reply(200, ARTIFACT_CONTENTS); const artifactRequest = nock(BASE_URL).get(ARTIFACT_PATH).reply(200, ARTIFACT_CONTENTS);
retriever = new BuildRetriever(api, 10, DOWNLOAD_DIR); retriever = new BuildRetriever(api, 10, DOWNLOAD_DIR);
try {
await expectAsync(retriever.downloadBuildArtifact(12345, 777, 'COMMIT', ARTIFACT_PATH)). await retriever.downloadBuildArtifact(12345, 777, 'COMMIT', ARTIFACT_PATH);
toBeRejectedWith(jasmine.objectContaining({status: 413})); throw new Error('Exception Expected');
} catch (error) {
expect(error.status).toEqual(413);
}
artifactRequest.done(); artifactRequest.done();
}); });
@ -138,40 +143,50 @@ describe('BuildRetriever', () => {
artifactRequest.done(); artifactRequest.done();
}); });
it('should fail if the CircleCI API fails', async () => { it('should fail if the CircleCI API fails', async () => {
getBuildArtifactUrlSpy.and.rejectWith('getBuildArtifactUrl failed'); try {
await expectAsync(retriever.downloadBuildArtifact(12345, 777, 'COMMIT', ARTIFACT_PATH)). getBuildArtifactUrlSpy.and.callFake(() => Promise.reject('getBuildArtifactUrl failed'));
toBeRejectedWithError('CircleCI artifact download failed (getBuildArtifactUrl failed)'); await retriever.downloadBuildArtifact(12345, 777, 'COMMIT', ARTIFACT_PATH);
throw new Error('Exception Expected');
} catch (error) {
expect(error.message).toEqual('CircleCI artifact download failed (getBuildArtifactUrl failed)');
}
}); });
it('should fail if the URL fetch errors', async () => { it('should fail if the URL fetch errors', async () => {
// create a new handler that errors // create a new handler that errors
const artifactRequest = nock(BASE_URL).get(ARTIFACT_PATH).replyWithError('Artifact Request Failed'); const artifactRequest = nock(BASE_URL).get(ARTIFACT_PATH).replyWithError('Artifact Request Failed');
try {
await expectAsync(retriever.downloadBuildArtifact(12345, 777, 'COMMIT', ARTIFACT_PATH)).toBeRejectedWithError( await retriever.downloadBuildArtifact(12345, 777, 'COMMIT', ARTIFACT_PATH);
'CircleCI artifact download failed ' + throw new Error('Exception Expected');
} catch (error) {
expect(error.message).toEqual('CircleCI artifact download failed ' +
'(request to http://test.com/some/path/build.zip failed, reason: Artifact Request Failed)'); '(request to http://test.com/some/path/build.zip failed, reason: Artifact Request Failed)');
}
artifactRequest.done(); artifactRequest.done();
}); });
it('should fail if the URL fetch 404s', async () => { it('should fail if the URL fetch 404s', async () => {
// create a new handler that errors // create a new handler that errors
const artifactRequest = nock(BASE_URL).get(ARTIFACT_PATH).reply(404, 'No such artifact'); const artifactRequest = nock(BASE_URL).get(ARTIFACT_PATH).reply(404, 'No such artifact');
try {
await expectAsync(retriever.downloadBuildArtifact(12345, 777, 'COMMIT', ARTIFACT_PATH)). await retriever.downloadBuildArtifact(12345, 777, 'COMMIT', ARTIFACT_PATH);
toBeRejectedWithError('CircleCI artifact download failed (Error 404 - Not Found)'); throw new Error('Exception Expected');
} catch (error) {
expect(error.message).toEqual('CircleCI artifact download failed (Error 404 - Not Found)');
}
artifactRequest.done(); artifactRequest.done();
}); });
it('should fail if file write fails', async () => { it('should fail if file write fails', async () => {
const artifactRequest = nock(BASE_URL).get(ARTIFACT_PATH).reply(200, ARTIFACT_CONTENTS); const artifactRequest = nock(BASE_URL).get(ARTIFACT_PATH).reply(200, ARTIFACT_CONTENTS);
WRITEFILE_RESULT = 'Test Error'; try {
WRITEFILE_RESULT = 'Test Error';
await expectAsync(retriever.downloadBuildArtifact(12345, 777, 'COMMIT', ARTIFACT_PATH)). await retriever.downloadBuildArtifact(12345, 777, 'COMMIT', ARTIFACT_PATH);
toBeRejectedWithError('CircleCI artifact download failed (Test Error)'); throw new Error('Exception Expected');
} catch (error) {
expect(error.message).toEqual('CircleCI artifact download failed (Test Error)');
}
artifactRequest.done(); artifactRequest.done();
}); });
}); });

View File

@ -51,10 +51,7 @@ describe('BuildVerifier', () => {
describe('getSignificantFilesChanged', () => { describe('getSignificantFilesChanged', () => {
it('should return false if none of the fetched files match the given pattern', async () => { it('should return false if none of the fetched files match the given pattern', async () => {
const fetchFilesSpy = spyOn(prs, 'fetchFiles'); const fetchFilesSpy = spyOn(prs, 'fetchFiles');
fetchFilesSpy.and.resolveTo([ fetchFilesSpy.and.callFake(() => Promise.resolve([{filename: 'a/b/c'}, {filename: 'd/e/f'}]));
{filename: 'a/b/c', sha: 'a1'},
{filename: 'd/e/f', sha: 'b2'},
]);
expect(await bv.getSignificantFilesChanged(777, /^x/)).toEqual(false); expect(await bv.getSignificantFilesChanged(777, /^x/)).toEqual(false);
expect(fetchFilesSpy).toHaveBeenCalledWith(777); expect(fetchFilesSpy).toHaveBeenCalledWith(777);
@ -81,30 +78,37 @@ describe('BuildVerifier', () => {
user: {login: 'username'}, user: {login: 'username'},
}; };
prsFetchSpy = spyOn(GithubPullRequests.prototype, 'fetch').and.resolveTo(mockPrInfo); prsFetchSpy = spyOn(GithubPullRequests.prototype, 'fetch').
teamsIsMemberBySlugSpy = spyOn(GithubTeams.prototype, 'isMemberBySlug').and.resolveTo(true); and.callFake(() => Promise.resolve(mockPrInfo));
teamsIsMemberBySlugSpy = spyOn(GithubTeams.prototype, 'isMemberBySlug').
and.callFake(() => Promise.resolve(true));
}); });
it('should return a promise', async () => { it('should return a promise', done => {
const promise = bv.getPrIsTrusted(pr); const promise = bv.getPrIsTrusted(pr);
expect(promise).toBeInstanceOf(Promise); promise.then(done); // Do not complete the test (and release the spies) synchronously
// to avoid running the actual `GithubTeams#isMemberBySlug()`.
// Do not complete the test (and release the spies) synchronously to avoid running the actual expect(promise).toEqual(jasmine.any(Promise));
// `GithubTeams#isMemberBySlug()`.
await promise;
}); });
it('should fetch the corresponding PR', async () => { it('should fetch the corresponding PR', done => {
await bv.getPrIsTrusted(pr); bv.getPrIsTrusted(pr).then(() => {
expect(prsFetchSpy).toHaveBeenCalledWith(pr); expect(prsFetchSpy).toHaveBeenCalledWith(pr);
done();
});
}); });
it('should fail if fetching the PR errors', async () => { it('should fail if fetching the PR errors', done => {
prsFetchSpy.and.rejectWith('Test'); prsFetchSpy.and.callFake(() => Promise.reject('Test'));
await expectAsync(bv.getPrIsTrusted(pr)).toBeRejectedWith('Test'); bv.getPrIsTrusted(pr).catch(err => {
expect(err).toBe('Test');
done();
});
}); });
@ -113,14 +117,19 @@ describe('BuildVerifier', () => {
beforeEach(() => mockPrInfo.labels.push({name: 'trusted: pr-label'})); beforeEach(() => mockPrInfo.labels.push({name: 'trusted: pr-label'}));
it('should resolve to true', async () => { it('should resolve to true', done => {
await expectAsync(bv.getPrIsTrusted(pr)).toBeResolvedTo(true); bv.getPrIsTrusted(pr).then(isTrusted => {
expect(isTrusted).toBe(true);
done();
});
}); });
it('should not try to verify the author\'s membership status', async () => { it('should not try to verify the author\'s membership status', done => {
await expectAsync(bv.getPrIsTrusted(pr)); bv.getPrIsTrusted(pr).then(() => {
expect(teamsIsMemberBySlugSpy).not.toHaveBeenCalled(); expect(teamsIsMemberBySlugSpy).not.toHaveBeenCalled();
done();
});
}); });
}); });
@ -128,27 +137,40 @@ describe('BuildVerifier', () => {
describe('when the PR does not have the "trusted PR" label', () => { describe('when the PR does not have the "trusted PR" label', () => {
it('should verify the PR author\'s membership in the specified teams', async () => { it('should verify the PR author\'s membership in the specified teams', done => {
await bv.getPrIsTrusted(pr); bv.getPrIsTrusted(pr).then(() => {
expect(teamsIsMemberBySlugSpy).toHaveBeenCalledWith('username', ['team1', 'team2']); expect(teamsIsMemberBySlugSpy).toHaveBeenCalledWith('username', ['team1', 'team2']);
done();
});
}); });
it('should fail if verifying membership errors', async () => { it('should fail if verifying membership errors', done => {
teamsIsMemberBySlugSpy.and.rejectWith('Test'); teamsIsMemberBySlugSpy.and.callFake(() => Promise.reject('Test'));
await expectAsync(bv.getPrIsTrusted(pr)).toBeRejectedWith('Test'); bv.getPrIsTrusted(pr).catch(err => {
expect(err).toBe('Test');
done();
});
}); });
it('should resolve to true if the PR\'s author is a member', async () => { it('should resolve to true if the PR\'s author is a member', done => {
teamsIsMemberBySlugSpy.and.resolveTo(true); teamsIsMemberBySlugSpy.and.callFake(() => Promise.resolve(true));
await expectAsync(bv.getPrIsTrusted(pr)).toBeResolvedTo(true);
bv.getPrIsTrusted(pr).then(isTrusted => {
expect(isTrusted).toBe(true);
done();
});
}); });
it('should resolve to false if the PR\'s author is not a member', async () => { it('should resolve to false if the PR\'s author is not a member', done => {
teamsIsMemberBySlugSpy.and.resolveTo(false); teamsIsMemberBySlugSpy.and.callFake(() => Promise.resolve(false));
await expectAsync(bv.getPrIsTrusted(pr)).toBeResolvedTo(false);
bv.getPrIsTrusted(pr).then(isTrusted => {
expect(isTrusted).toBe(false);
done();
});
}); });
}); });

View File

@ -0,0 +1,11 @@
import {PreviewServerError} from '../../lib/preview-server/preview-error';
export const expectToBePreviewServerError = (actual: PreviewServerError, status?: number, message?: string) => {
expect(actual).toEqual(jasmine.any(PreviewServerError));
if (status != null) {
expect(actual.status).toBe(status);
}
if (message != null) {
expect(actual.message).toBe(message);
}
};

View File

@ -1,5 +0,0 @@
declare module jasmine {
interface AsyncMatchers {
toBeRejectedWithPreviewServerError(status: number, message?: string | RegExp): Promise<void>;
}
}

View File

@ -1,59 +0,0 @@
import {PreviewServerError} from '../../lib/preview-server/preview-error';
// Matchers
const toBeRejectedWithPreviewServerError: jasmine.CustomAsyncMatcherFactory = () => {
return {
async compare(actualPromise: Promise<never>, expectedStatus: number, expectedMessage?: string | RegExp) {
if (!(actualPromise instanceof Promise)) {
throw new Error(`Expected '${toBeRejectedWithPreviewServerError.name}()' to be called on a promise.`);
}
try {
await actualPromise;
return {
pass: false,
message: `Expected a promise to be rejected with a '${PreviewServerError.name}', but it was resolved.`,
};
} catch (actualError) {
const actualPrintValue = stringify(actualError);
const expectedPrintValue =
stringify(new PreviewServerError(expectedStatus, expectedMessage && `${expectedMessage}`));
const pass = errorMatches(actualError, expectedStatus, expectedMessage);
const message =
`Expected a promise ${pass ? 'not ' : ''}to be rejected with ${expectedPrintValue}, but is was` +
`${pass ? '' : ` rejected with ${actualPrintValue}`}.`;
return {pass, message};
}
},
};
// Helpers
function errorMatches(actualErr: unknown, expectedStatus: number, expectedMsg?: string | RegExp): boolean {
if (!(actualErr instanceof PreviewServerError)) return false;
if (actualErr.status !== expectedStatus) return false;
return messageMatches(actualErr.message, expectedMsg);
}
function messageMatches(actualMsg: string, expectedMsg?: string | RegExp): boolean {
if (typeof expectedMsg === 'undefined') return true;
if (typeof expectedMsg === 'string') return actualMsg === expectedMsg;
return expectedMsg.test(actualMsg);
}
function stringify(value: unknown): string {
if (value instanceof PreviewServerError) {
return `${PreviewServerError.name}(${value.status}${value.message ? `, ${value.message}` : ''})`;
}
return jasmine.pp(value);
}
};
// Exports
export const customAsyncMatchers: jasmine.CustomAsyncMatcherFactories = {
toBeRejectedWithPreviewServerError,
};

View File

@ -9,8 +9,8 @@ describe('PreviewServerError', () => {
it('should extend Error', () => { it('should extend Error', () => {
expect(err).toBeInstanceOf(PreviewServerError); expect(err).toEqual(jasmine.any(PreviewServerError));
expect(err).toBeInstanceOf(Error); expect(err).toEqual(jasmine.any(Error));
expect(Object.getPrototypeOf(err)).toBe(PreviewServerError.prototype); expect(Object.getPrototypeOf(err)).toBe(PreviewServerError.prototype);
}); });

View File

@ -1,4 +1,5 @@
// Imports // Imports
import * as express from 'express';
import * as http from 'http'; import * as http from 'http';
import * as supertest from 'supertest'; import * as supertest from 'supertest';
import {CircleCiApi} from '../../lib/common/circle-ci-api'; import {CircleCiApi} from '../../lib/common/circle-ci-api';
@ -133,7 +134,7 @@ describe('PreviewServerFactory', () => {
const buildCreator = jasmine.any(BuildCreator); const buildCreator = jasmine.any(BuildCreator);
expect(usfCreateMiddlewareSpy).toHaveBeenCalledWith(buildRetriever, buildVerifier, buildCreator, defaultConfig); expect(usfCreateMiddlewareSpy).toHaveBeenCalledWith(buildRetriever, buildVerifier, buildCreator, defaultConfig);
const middleware = usfCreateMiddlewareSpy.calls.mostRecent().returnValue; const middleware: express.Express = usfCreateMiddlewareSpy.calls.mostRecent().returnValue;
expect(httpCreateServerSpy).toHaveBeenCalledWith(middleware); expect(httpCreateServerSpy).toHaveBeenCalledWith(middleware);
}); });
@ -229,7 +230,7 @@ describe('PreviewServerFactory', () => {
expect(prsAddCommentSpy).toHaveBeenCalledTimes(2); expect(prsAddCommentSpy).toHaveBeenCalledTimes(2);
expect(prs).toBe(allCalls[1].object); expect(prs).toBe(allCalls[1].object);
expect(prs).toBeInstanceOf(GithubPullRequests); expect(prs).toEqual(jasmine.any(GithubPullRequests));
expect(prs.repoSlug).toBe('organisation/repo'); expect(prs.repoSlug).toBe('organisation/repo');
}); });
@ -301,8 +302,9 @@ describe('PreviewServerFactory', () => {
let bvGetSignificantFilesChangedSpy: jasmine.Spy; let bvGetSignificantFilesChangedSpy: jasmine.Spy;
beforeEach(() => { beforeEach(() => {
bvGetPrIsTrustedSpy = spyOn(buildVerifier, 'getPrIsTrusted').and.resolveTo(true); bvGetPrIsTrustedSpy = spyOn(buildVerifier, 'getPrIsTrusted').and.returnValue(Promise.resolve(true));
bvGetSignificantFilesChangedSpy = spyOn(buildVerifier, 'getSignificantFilesChanged').and.resolveTo(true); bvGetSignificantFilesChangedSpy = spyOn(buildVerifier, 'getSignificantFilesChanged').
and.returnValue(Promise.resolve(true));
}); });
@ -329,7 +331,7 @@ describe('PreviewServerFactory', () => {
it('should respond appropriately if the PR did not touch any significant files', async () => { it('should respond appropriately if the PR did not touch any significant files', async () => {
bvGetSignificantFilesChangedSpy.and.resolveTo(false); bvGetSignificantFilesChangedSpy.and.returnValue(Promise.resolve(false));
const expectedResponse = {canHavePublicPreview: false, reason: 'No significant files touched.'}; const expectedResponse = {canHavePublicPreview: false, reason: 'No significant files touched.'};
const expectedLog = `PR:${pr} - Cannot have a public preview, because it did not touch any significant files.`; const expectedLog = `PR:${pr} - Cannot have a public preview, because it did not touch any significant files.`;
@ -343,7 +345,7 @@ describe('PreviewServerFactory', () => {
it('should respond appropriately if the PR is not automatically verifiable as "trusted"', async () => { it('should respond appropriately if the PR is not automatically verifiable as "trusted"', async () => {
bvGetPrIsTrustedSpy.and.resolveTo(false); bvGetPrIsTrustedSpy.and.returnValue(Promise.resolve(false));
const expectedResponse = {canHavePublicPreview: false, reason: 'Not automatically verifiable as "trusted".'}; const expectedResponse = {canHavePublicPreview: false, reason: 'Not automatically verifiable as "trusted".'};
const expectedLog = const expectedLog =
@ -370,7 +372,7 @@ describe('PreviewServerFactory', () => {
it('should respond with error if `getSignificantFilesChanged()` fails', async () => { it('should respond with error if `getSignificantFilesChanged()` fails', async () => {
bvGetSignificantFilesChangedSpy.and.rejectWith('getSignificantFilesChanged error'); bvGetSignificantFilesChangedSpy.and.callFake(() => Promise.reject('getSignificantFilesChanged error'));
await agent.get(url).expect(500, 'getSignificantFilesChanged error'); await agent.get(url).expect(500, 'getSignificantFilesChanged error');
expect(loggerErrorSpy).toHaveBeenCalledWith('Previewability check error', 'getSignificantFilesChanged error'); expect(loggerErrorSpy).toHaveBeenCalledWith('Previewability check error', 'getSignificantFilesChanged error');
@ -378,10 +380,11 @@ describe('PreviewServerFactory', () => {
it('should respond with error if `getPrIsTrusted()` fails', async () => { it('should respond with error if `getPrIsTrusted()` fails', async () => {
bvGetPrIsTrustedSpy.and.throwError('getPrIsTrusted error'); const error = new Error('getPrIsTrusted error');
bvGetPrIsTrustedSpy.and.callFake(() => { throw error; });
await agent.get(url).expect(500, 'getPrIsTrusted error'); await agent.get(url).expect(500, 'getPrIsTrusted error');
expect(loggerErrorSpy).toHaveBeenCalledWith('Previewability check error', new Error('getPrIsTrusted error')); expect(loggerErrorSpy).toHaveBeenCalledWith('Previewability check error', error);
}); });
}); });
@ -494,7 +497,7 @@ describe('PreviewServerFactory', () => {
// Note it is important to put the `reject` into `and.callFake`; // Note it is important to put the `reject` into `and.callFake`;
// If you just `and.returnValue` the rejected promise // If you just `and.returnValue` the rejected promise
// then you get an "unhandled rejection" message in the console. // then you get an "unhandled rejection" message in the console.
getGithubInfoSpy.and.rejectWith('Test Error'); getGithubInfoSpy.and.callFake(() => Promise.reject('Test Error'));
await agent.post(URL).send(BASIC_PAYLOAD).expect(500, 'Test Error'); await agent.post(URL).send(BASIC_PAYLOAD).expect(500, 'Test Error');
expect(getGithubInfoSpy).toHaveBeenCalledWith(BUILD_NUM); expect(getGithubInfoSpy).toHaveBeenCalledWith(BUILD_NUM);
expect(downloadBuildArtifactSpy).not.toHaveBeenCalled(); expect(downloadBuildArtifactSpy).not.toHaveBeenCalled();
@ -515,7 +518,7 @@ describe('PreviewServerFactory', () => {
}); });
it('should fail if the artifact fetch request fails', async () => { it('should fail if the artifact fetch request fails', async () => {
downloadBuildArtifactSpy.and.rejectWith('Test Error'); downloadBuildArtifactSpy.and.callFake(() => Promise.reject('Test Error'));
await agent.post(URL).send(BASIC_PAYLOAD).expect(500, 'Test Error'); await agent.post(URL).send(BASIC_PAYLOAD).expect(500, 'Test Error');
expect(getGithubInfoSpy).toHaveBeenCalledWith(BUILD_NUM); expect(getGithubInfoSpy).toHaveBeenCalledWith(BUILD_NUM);
expect(downloadBuildArtifactSpy).toHaveBeenCalled(); expect(downloadBuildArtifactSpy).toHaveBeenCalled();
@ -524,7 +527,7 @@ describe('PreviewServerFactory', () => {
}); });
it('should fail if verifying the PR fails', async () => { it('should fail if verifying the PR fails', async () => {
getPrIsTrustedSpy.and.rejectWith('Test Error'); getPrIsTrustedSpy.and.callFake(() => Promise.reject('Test Error'));
await agent.post(URL).send(BASIC_PAYLOAD).expect(500, 'Test Error'); await agent.post(URL).send(BASIC_PAYLOAD).expect(500, 'Test Error');
expect(getGithubInfoSpy).toHaveBeenCalledWith(BUILD_NUM); expect(getGithubInfoSpy).toHaveBeenCalledWith(BUILD_NUM);
expect(downloadBuildArtifactSpy).toHaveBeenCalled(); expect(downloadBuildArtifactSpy).toHaveBeenCalled();
@ -533,7 +536,7 @@ describe('PreviewServerFactory', () => {
}); });
it('should fail if creating the preview build fails', async () => { it('should fail if creating the preview build fails', async () => {
createBuildSpy.and.rejectWith('Test Error'); createBuildSpy.and.callFake(() => Promise.reject('Test Error'));
await agent.post(URL).send(BASIC_PAYLOAD).expect(500, 'Test Error'); await agent.post(URL).send(BASIC_PAYLOAD).expect(500, 'Test Error');
expect(getGithubInfoSpy).toHaveBeenCalledWith(BUILD_NUM); expect(getGithubInfoSpy).toHaveBeenCalledWith(BUILD_NUM);
expect(downloadBuildArtifactSpy).toHaveBeenCalled(); expect(downloadBuildArtifactSpy).toHaveBeenCalled();
@ -602,7 +605,7 @@ describe('PreviewServerFactory', () => {
it('should propagate errors from BuildVerifier', async () => { it('should propagate errors from BuildVerifier', async () => {
bvGetPrIsTrustedSpy.and.rejectWith('Test'); bvGetPrIsTrustedSpy.and.callFake(() => Promise.reject('Test'));
await createRequest(+pr).expect(500, 'Test'); await createRequest(+pr).expect(500, 'Test');
@ -612,9 +615,7 @@ describe('PreviewServerFactory', () => {
it('should call \'BuildCreator#updatePrVisibility()\' with the correct arguments', async () => { it('should call \'BuildCreator#updatePrVisibility()\' with the correct arguments', async () => {
bvGetPrIsTrustedSpy. bvGetPrIsTrustedSpy.and.callFake((pr2: number) => Promise.resolve(pr2 === 42));
withArgs(24).and.resolveTo(false).
withArgs(42).and.resolveTo(true);
await createRequest(24); await createRequest(24);
expect(bcUpdatePrVisibilitySpy).toHaveBeenCalledWith(24, false); expect(bcUpdatePrVisibilitySpy).toHaveBeenCalledWith(24, false);
@ -625,7 +626,7 @@ describe('PreviewServerFactory', () => {
it('should propagate errors from BuildCreator', async () => { it('should propagate errors from BuildCreator', async () => {
bcUpdatePrVisibilitySpy.and.rejectWith('Test'); bcUpdatePrVisibilitySpy.and.callFake(() => Promise.reject('Test'));
await createRequest(+pr).expect(500, 'Test'); await createRequest(+pr).expect(500, 'Test');
}); });
@ -633,9 +634,7 @@ describe('PreviewServerFactory', () => {
describe('on success', () => { describe('on success', () => {
it('should respond with 200 (action: undefined)', async () => { it('should respond with 200 (action: undefined)', async () => {
bvGetPrIsTrustedSpy. bvGetPrIsTrustedSpy.and.returnValues(Promise.resolve(true), Promise.resolve(false));
withArgs(2).and.resolveTo(false).
withArgs(4).and.resolveTo(true);
const reqs = [4, 2].map(num => createRequest(num).expect(200, http.STATUS_CODES[200])); const reqs = [4, 2].map(num => createRequest(num).expect(200, http.STATUS_CODES[200]));
await Promise.all(reqs); await Promise.all(reqs);
@ -643,9 +642,7 @@ describe('PreviewServerFactory', () => {
it('should respond with 200 (action: labeled)', async () => { it('should respond with 200 (action: labeled)', async () => {
bvGetPrIsTrustedSpy. bvGetPrIsTrustedSpy.and.returnValues(Promise.resolve(true), Promise.resolve(false));
withArgs(2).and.resolveTo(false).
withArgs(4).and.resolveTo(true);
const reqs = [4, 2].map(num => createRequest(num, 'labeled').expect(200, http.STATUS_CODES[200])); const reqs = [4, 2].map(num => createRequest(num, 'labeled').expect(200, http.STATUS_CODES[200]));
await Promise.all(reqs); await Promise.all(reqs);
@ -653,9 +650,7 @@ describe('PreviewServerFactory', () => {
it('should respond with 200 (action: unlabeled)', async () => { it('should respond with 200 (action: unlabeled)', async () => {
bvGetPrIsTrustedSpy. bvGetPrIsTrustedSpy.and.returnValues(Promise.resolve(true), Promise.resolve(false));
withArgs(2).and.resolveTo(false).
withArgs(4).and.resolveTo(true);
const reqs = [4, 2].map(num => createRequest(num, 'unlabeled').expect(200, http.STATUS_CODES[200])); const reqs = [4, 2].map(num => createRequest(num, 'unlabeled').expect(200, http.STATUS_CODES[200]));
await Promise.all(reqs); await Promise.all(reqs);

View File

@ -39,7 +39,7 @@ describe('preview-server/utils', () => {
throwRequestError(505, 'ERROR MESSAGE', request); throwRequestError(505, 'ERROR MESSAGE', request);
} catch (error) { } catch (error) {
caught = true; caught = true;
expect(error).toBeInstanceOf(PreviewServerError); expect(error).toEqual(jasmine.any(PreviewServerError));
expect(error.status).toEqual(505); expect(error.status).toEqual(505);
expect(error.message).toEqual(`ERROR MESSAGE in request: POST some.domain.com/path "The request body"`); expect(error.message).toEqual(`ERROR MESSAGE in request: POST some.domain.com/path "The request body"`);
} }

File diff suppressed because it is too large Load Diff

View File

@ -8,32 +8,10 @@ exitCode=0
# Helpers # Helpers
function checkCert {
local certPath=$1
if [[ ! -f "$certPath" ]]; then
echo "Certificate '$certPath' does not exist. Skipping expiration check..."
return
fi
openssl x509 -checkend 0 -in "$certPath" -noout > /dev/null
reportStatus "Certificate '$certPath'"
if [[ $? -ne 0 ]]; then
echo " [WARN]"
echo " If you did not provide the certificate explicitly, try running the"
echo " 'docker build' command again with the '--no-cache' option to generate"
echo " a new self-signed certificate."
fi
}
function reportStatus { function reportStatus {
local lastExitCode=$? local lastExitCode=$?
echo "$1: $([[ $lastExitCode -eq 0 ]] && echo OK || echo NOT OK)" echo "$1: $([[ $lastExitCode -eq 0 ]] && echo OK || echo NOT OK)"
[[ $lastExitCode -eq 0 ]] || exitCode=1 [[ $lastExitCode -eq 0 ]] || exitCode=1
return $lastExitCode
} }
@ -50,16 +28,6 @@ for s in ${services[@]}; do
done done
# Check SSL/TLS certificates expiration
certs=(
"$AIO_LOCALCERTS_DIR/$AIO_DOMAIN_NAME.crt"
"$TEST_AIO_LOCALCERTS_DIR/$TEST_AIO_DOMAIN_NAME.crt"
)
for c in ${certs[@]}; do
checkCert $c
done
# Check servers # Check servers
origins=( origins=(
http://$AIO_PREVIEW_SERVER_HOSTNAME:$AIO_PREVIEW_SERVER_PORT http://$AIO_PREVIEW_SERVER_HOSTNAME:$AIO_PREVIEW_SERVER_PORT

View File

@ -3,7 +3,7 @@
## Create `aio-builds` persistent disk (if not already exists) ## Create `aio-builds` persistent disk (if not already exists)
- Follow instructions [here](https://cloud.google.com/compute/docs/disks/add-persistent-disk#create_disk). - Follow instructions [here](https://cloud.google.com/compute/docs/disks/add-persistent-disk#create_disk).
- `sudo mkfs.ext4 -m 0 -E lazy_itable_init=0,lazy_journal_init=0,discard /dev/disk/by-id/google-aio-builds` - `sudo mkfs.ext4 -F -E lazy_itable_init=0,lazy_journal_init=0,discard /dev/disk/by-id/google-aio-builds`
## Mount disk ## Mount disk
@ -14,7 +14,7 @@
## Mount disk on boot ## Mount disk on boot
- Run: - Run:
```sh ```
echo UUID=`sudo blkid -s UUID -o value /dev/disk/by-id/google-aio-builds` \ echo UUID=`sudo blkid -s UUID -o value /dev/disk/by-id/google-aio-builds` \
/mnt/disks/aio-builds ext4 defaults,discard,nofail 0 2 | sudo tee -a /etc/fstab /mnt/disks/aio-builds ext4 discard,defaults,nofail 0 2 | sudo tee -a /etc/fstab
``` ```

View File

@ -1,11 +1,10 @@
# VM setup - Create docker image # VM setup - Create docker image
## Install git, Node.js and yarn ## Install node and yarn
- `sudo apt-get update` - Install [nvm](https://github.com/creationix/nvm#installation).
- `sudo apt-get install -y git` - Install node.js: `nvm install 8`
- Install the latest stable version of [Node.js](https://nodejs.org/en/download). - Install yarn: `npm -g install yarn`
- Install the latest stable version of [yarn](https://classic.yarnpkg.com/en/docs/install).
## Checkout repository ## Checkout repository
@ -17,11 +16,7 @@
- You can overwrite the default environment variables inside the image, by passing new values using - You can overwrite the default environment variables inside the image, by passing new values using
`--build-arg`. `--build-arg`.
**Note 1:** The script has to execute docker commands with `sudo`. **Note:** The script has to execute docker commands with `sudo`.
**Note 2:**
The script has to execute `yarn` commands, so make sure `yarn` is on the `PATH` when invoking the
script.
## Example ## Example
@ -31,7 +26,7 @@ The following commands would create a docker image from GitHub repo `foo/bar` to
- `git clone https://github.com/foo/bar.git foobar` - `git clone https://github.com/foo/bar.git foobar`
- Run: - Run:
```sh ```
./foobar/aio-builds-setup/scripts/create-image.sh foobar-builds \ ./foobar/aio-builds-setup/scripts/create-image.sh foobar-builds \
--build-arg AIO_REPO_SLUG=foo/bar \ --build-arg AIO_REPO_SLUG=foo/bar \
--build-arg AIO_DOMAIN_NAME=foobar-builds.io \ --build-arg AIO_DOMAIN_NAME=foobar-builds.io \

View File

@ -3,17 +3,24 @@
## Install docker ## Install docker
Official installation instructions: https://docs.docker.com/engine/install _Debian (jessie):_
Example: - `sudo apt-get update`
- `sudo apt-get install -y apt-transport-https ca-certificates curl git software-properties-common`
- `curl -fsSL https://apt.dockerproject.org/gpg | sudo apt-key add -`
- `apt-key fingerprint 58118E89F3A912897C070ADBF76221572C52609D`
- `sudo add-apt-repository "deb https://apt.dockerproject.org/repo/ debian-$(lsb_release -cs) main"`
- `sudo apt-get update`
- `sudo apt-get -y install docker-engine`
_Debian (buster):_ _Ubuntu (16.04):_
- `sudo apt-get update` - `sudo apt-get update`
- `sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common` - `sudo apt-get install -y curl git linux-image-extra-$(uname -r) linux-image-extra-virtual`
- `curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -` - `sudo apt-get install -y apt-transport-https ca-certificates`
- `sudo apt-key fingerprint 0EBFCD88` - `curl -fsSL https://yum.dockerproject.org/gpg | sudo apt-key add -`
- `sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"` - `apt-key fingerprint 58118E89F3A912897C070ADBF76221572C52609D`
- `sudo add-apt-repository "deb https://apt.dockerproject.org/repo/ ubuntu-$(lsb_release -cs) main"`
- `sudo apt-get update` - `sudo apt-get update`
- `sudo apt-get -y install docker-ce docker-ce-cli containerd.io` - `sudo apt-get -y install docker-engine`
## Start the docker ## Start the docker

View File

@ -8,16 +8,16 @@ VM host to update the preview server based on changes in the source code.
The script will pull the latest changes from the origin's master branch and examine if there have The script will pull the latest changes from the origin's master branch and examine if there have
been any changes in files inside the preview server source code directory (see below). If there are, been any changes in files inside the preview server source code directory (see below). If there are,
it will create a new image and verify that it works as expected. Finally, it will stop and remove it will create a new image and verify that is works as expected. Finally, it will stop and remove
the old docker container and image, create a new container based on the new image and start it. the old docker container and image, create a new container based on the new image and start it.
The script assumes that the preview server source code is in the repository's The script assumes that the preview server source code is in the repository's
`aio/aio-builds-setup/` directory and expects the following inputs: `aio/aio-builds-setup/` directory and expects the following inputs:
- **$1**: `HOST_REPO_DIR` - **$1**: `HOST_REPO_DIR`
- **$2**: `HOST_SECRETS_DIR` - **$2**: `HOST_LOCALCERTS_DIR`
- **$3**: `HOST_BUILDS_DIR` - **$3**: `HOST_SECRETS_DIR`
- **$4**: `HOST_LOCALCERTS_DIR` - **$4**: `HOST_BUILDS_DIR`
- **$5**: `HOST_LOGS_DIR` - **$5**: `HOST_LOGS_DIR`
See [here](vm-setup--create-host-dirs-and-files.md) for more info on what each input directory is See [here](vm-setup--create-host-dirs-and-files.md) for more info on what each input directory is
@ -25,38 +25,28 @@ used for.
**Note 1:** The script has to execute docker commands with `sudo`. **Note 1:** The script has to execute docker commands with `sudo`.
**Note 2:** **Note 2:** Make sure the user that executes the script has access to update the repository
The script has to execute `yarn` commands, so make sure `yarn` is on the `PATH` when invoking the
script.
**Note 3:** Make sure the user that executes the script has access to update the repository.
## Run the script manually ## Run the script manually
You may choose to manually run the script, when necessary. Example: You may choose to manually run the script, when necessary. Example:
```sh ```
update-preview-server.sh \ update-preview-server.sh \
/path/to/repo \ /path/to/repo \
/path/to/localcerts \
/path/to/secrets \ /path/to/secrets \
/path/to/builds \ /path/to/builds \
/path/to/localcerts \
/path/to/logs /path/to/logs
``` ```
## Run the script automatically ## Run the script automatically
You may choose to automatically trigger the script, e.g. using a cronjob. For example, the following You may choose to automatically trigger the script, e.g. using a cronjob. For example, the following
cronjob entry would run the script every 30 minutes, update the preview server (if necessary) and cronjob entry would run the script every hour and update the preview server (assuming the user has
log its output to `update-preview-server.log` (assuming the user has the necessary permissions): the necessary permissions):
``` ```
# Periodically check for changes and update the preview server (if necessary) # Periodically check for changes and update the preview server (if necessary)
*/30 * * * * /path/to/update-preview-server.sh /path/to/repo /path/to/secrets /path/to/builds /path/to/localcerts /path/to/logs >> /path/to/update-preview-server.log 2>&1 */30 * * * * /path/to/update-preview-server.sh /path/to/repo /path/to/localcerts /path/to/secrets /path/to/builds /path/to/logs
``` ```
**Note:**
Keep in mind that cron jobs run in non-interactive, non-login shells. This means that the execution
context might be different compared to when running the same commands from an interactive, login
shell. For example, `.bashrc` files are normally _not_ sourced automatically in cron jobs. See
[here](http://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html) for more info.

View File

@ -7,14 +7,13 @@ echo -e "\n\n[`date`] - Updating the preview server..."
# Input # Input
readonly HOST_REPO_DIR=$1 readonly HOST_REPO_DIR=$1
readonly HOST_SECRETS_DIR=$2 readonly HOST_LOCALCERTS_DIR=$2
readonly HOST_BUILDS_DIR=$3 readonly HOST_SECRETS_DIR=$3
readonly HOST_LOCALCERTS_DIR=$4 readonly HOST_BUILDS_DIR=$4
readonly HOST_LOGS_DIR=$5 readonly HOST_LOGS_DIR=$5
# Constants # Constants
readonly PROVISIONAL_TAG=provisional readonly PROVISIONAL_IMAGE_NAME=aio-builds:provisional
readonly PROVISIONAL_IMAGE_NAME=aio-builds:$PROVISIONAL_TAG
readonly LATEST_IMAGE_NAME=aio-builds:latest readonly LATEST_IMAGE_NAME=aio-builds:latest
readonly CONTAINER_NAME=aio readonly CONTAINER_NAME=aio
@ -31,7 +30,7 @@ readonly CONTAINER_NAME=aio
# Do not update the server unless files inside `aio-builds-setup/` have changed # Do not update the server unless files inside `aio-builds-setup/` have changed
# or the last attempt failed (identified by the provisional image still being around). # or the last attempt failed (identified by the provisional image still being around).
readonly relevantChangedFilesCount=$(git diff --name-only $lastDeployedCommit...HEAD | grep -P "^aio/aio-builds-setup/" | wc -l) readonly relevantChangedFilesCount=$(git diff --name-only $lastDeployedCommit...HEAD | grep -P "^aio/aio-builds-setup/" | wc -l)
readonly lastAttemptFailed=$(sudo docker image ls | grep "$PROVISIONAL_TAG" >> /dev/fd/3 && echo "true" || echo "false") readonly lastAttemptFailed=$(sudo docker rmi "$PROVISIONAL_IMAGE_NAME" >> /dev/fd/3 && echo "true" || echo "false")
if [[ $relevantChangedFilesCount -eq 0 ]] && [[ "$lastAttemptFailed" != "true" ]]; then if [[ $relevantChangedFilesCount -eq 0 ]] && [[ "$lastAttemptFailed" != "true" ]]; then
echo "Skipping update because no relevant files have been touched." echo "Skipping update because no relevant files have been touched."
exit 0 exit 0
@ -61,9 +60,9 @@ readonly CONTAINER_NAME=aio
--publish 80:80 \ --publish 80:80 \
--publish 443:443 \ --publish 443:443 \
--restart unless-stopped \ --restart unless-stopped \
--volume $HOST_LOCALCERTS_DIR:/etc/ssl/localcerts:ro \
--volume $HOST_SECRETS_DIR:/aio-secrets:ro \ --volume $HOST_SECRETS_DIR:/aio-secrets:ro \
--volume $HOST_BUILDS_DIR:/var/www/aio-builds \ --volume $HOST_BUILDS_DIR:/var/www/aio-builds \
--volume $HOST_LOCALCERTS_DIR:/etc/ssl/localcerts:ro \
--volume $HOST_LOGS_DIR:/var/log/aio \ --volume $HOST_LOGS_DIR:/var/log/aio \
"$LATEST_IMAGE_NAME" "$LATEST_IMAGE_NAME"

View File

@ -1,12 +1,11 @@
{ {
"$schema": "./node_modules/@angular/cli/lib/config/schema.json", "$schema": "./node_modules/@angular-devkit/core/src/workspace/workspace-schema.json",
"version": 1, "version": 1,
"cli": { "cli": {
"packageManager": "yarn", "packageManager": "yarn",
"warnings": { "warnings": {
"typescriptMismatch": false "typescriptMismatch": false
}, }
"analytics": false
}, },
"newProjectRoot": "projects", "newProjectRoot": "projects",
"projects": { "projects": {
@ -14,13 +13,6 @@
"root": "", "root": "",
"sourceRoot": "src", "sourceRoot": "src",
"projectType": "application", "projectType": "application",
"prefix": "aio",
"schematics": {
"@schematics/angular:component": {
"inlineStyle": true,
"style": "scss"
}
},
"architect": { "architect": {
"build": { "build": {
"builder": "@angular-devkit/build-angular:browser", "builder": "@angular-devkit/build-angular:browser",
@ -28,9 +20,7 @@
"outputPath": "dist", "outputPath": "dist",
"index": "src/index.html", "index": "src/index.html",
"main": "src/main.ts", "main": "src/main.ts",
"polyfills": "src/polyfills.ts", "tsConfig": "src/tsconfig.app.json",
"tsConfig": "tsconfig.app.json",
"webWorkerTsConfig": "tsconfig.worker.json",
"aot": true, "aot": true,
"optimization": true, "optimization": true,
"buildOptimizer": true, "buildOptimizer": true,
@ -41,9 +31,11 @@
"extractLicenses": true, "extractLicenses": true,
"namedChunks": true, "namedChunks": true,
"vendorChunk": false, "vendorChunk": false,
"polyfills": "src/polyfills.ts",
"assets": [ "assets": [
"src/assets", "src/assets",
"src/generated", "src/generated",
"src/app/search/search-worker.js",
"src/pwa-manifest.json", "src/pwa-manifest.json",
"src/google385281288605d160.html", "src/google385281288605d160.html",
{ {
@ -58,15 +50,9 @@
} }
], ],
"styles": [ "styles": [
"src/styles/main.scss" "src/styles.scss"
], ],
"scripts": [], "scripts": []
"budgets": [
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
]
}, },
"configurations": { "configurations": {
"fast": { "fast": {
@ -75,8 +61,8 @@
"next": { "next": {
"fileReplacements": [ "fileReplacements": [
{ {
"replace": "src/environments/environment.ts", "src": "src/environments/environment.ts",
"with": "src/environments/environment.next.ts" "replaceWith": "src/environments/environment.next.ts"
} }
], ],
"serviceWorker": true "serviceWorker": true
@ -84,8 +70,8 @@
"stable": { "stable": {
"fileReplacements": [ "fileReplacements": [
{ {
"replace": "src/environments/environment.ts", "src": "src/environments/environment.ts",
"with": "src/environments/environment.stable.ts" "replaceWith": "src/environments/environment.stable.ts"
} }
], ],
"serviceWorker": true "serviceWorker": true
@ -93,14 +79,11 @@
"archive": { "archive": {
"fileReplacements": [ "fileReplacements": [
{ {
"replace": "src/environments/environment.ts", "src": "src/environments/environment.ts",
"with": "src/environments/environment.archive.ts" "replaceWith": "src/environments/environment.archive.ts"
} }
], ],
"serviceWorker": true "serviceWorker": true
},
"ci": {
"progress": false
} }
} }
}, },
@ -123,7 +106,7 @@
"browserTarget": "site:build:archive" "browserTarget": "site:build:archive"
}, },
"ci": { "ci": {
"browserTarget": "site:build:ci" "progress": false
} }
} }
}, },
@ -137,13 +120,17 @@
"builder": "@angular-devkit/build-angular:karma", "builder": "@angular-devkit/build-angular:karma",
"options": { "options": {
"main": "src/test.ts", "main": "src/test.ts",
"karmaConfig": "src/karma.conf.js",
"polyfills": "src/polyfills.ts", "polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json", "tsConfig": "src/tsconfig.spec.json",
"webWorkerTsConfig": "tsconfig.worker.json", "scripts": [],
"karmaConfig": "karma.conf.js", "styles": [
"src/styles.scss"
],
"assets": [ "assets": [
"src/assets", "src/assets",
"src/generated", "src/generated",
"src/app/search/search-worker.js",
"src/pwa-manifest.json", "src/pwa-manifest.json",
"src/google385281288605d160.html", "src/google385281288605d160.html",
{ {
@ -156,27 +143,27 @@
"input": "node_modules/@webcomponents/custom-elements/src", "input": "node_modules/@webcomponents/custom-elements/src",
"output": "/assets/js" "output": "/assets/js"
} }
], ]
"styles": [
"src/styles/main.scss"
],
"scripts": []
} }
}, },
"lint": { "lint": {
"builder": "@angular-devkit/build-angular:tslint", "builder": "@angular-devkit/build-angular:tslint",
"options": { "options": {
"tsConfig": [ "tsConfig": [
"tsconfig.app.json", "src/tsconfig.app.json",
"tsconfig.spec.json", "src/tsconfig.spec.json"
"tsconfig.worker.json",
"tests/e2e/tsconfig.json"
], ],
"exclude": [ "exclude": []
"**/node_modules/**"
]
} }
}, }
}
},
"site-e2e": {
"root": "",
"projectType": "application",
"cli": {},
"schematics": {},
"architect": {
"e2e": { "e2e": {
"builder": "@angular-devkit/build-angular:protractor", "builder": "@angular-devkit/build-angular:protractor",
"options": { "options": {
@ -188,9 +175,27 @@
"devServerTarget": "site:serve:ci" "devServerTarget": "site:serve:ci"
} }
} }
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tests/e2e/tsconfig.e2e.json"
],
"exclude": []
}
} }
} }
} }
}, },
"defaultProject": "site" "schematics": {
"@schematics/angular:component": {
"inlineStyle": true,
"prefix": "aio",
"styleext": "scss"
},
"@schematics/angular:directive": {
"prefix": "aio"
}
}
} }

View File

@ -1,13 +1,13 @@
# CLI Overview and Command Reference <h1 class="no-toc">CLI Command Reference</h1>
The Angular CLI is a command-line interface tool that you use to initialize, develop, scaffold, and maintain Angular applications directly from a command shell. The Angular CLI is a command-line interface tool that you use to initialize, develop, scaffold, and maintain Angular applications. You can use the tool directly in a command shell, or indirectly through an interactive UI such as [Angular Console](https://angularconsole.com).
## Installing Angular CLI ## Installing Angular CLI
Major versions of Angular CLI follow the supported major version of Angular, but minor versions can be released separately. Major versions of Angular CLI follow the supported major version of Angular, but minor versions can be released separately.
Install the CLI using the `npm` package manager: Install the CLI using the `npm` package manager:
<code-example language="bash"> <code-example format="." language="bash">
npm install -g @angular/cli npm install -g @angular/cli
</code-example> </code-example>
@ -20,14 +20,14 @@ Invoke the tool on the command line through the `ng` executable.
Online help is available on the command line. Online help is available on the command line.
Enter the following to list commands or options for a given command (such as [generate](cli/generate)) with a short description. Enter the following to list commands or options for a given command (such as [generate](cli/generate)) with a short description.
<code-example language="bash"> <code-example format="." language="bash">
ng help ng help
ng generate --help ng generate --help
</code-example> </code-example>
To create, build, and serve a new, basic Angular project on a development server, go to the parent directory of your new workspace use the following commands: To create, build, and serve a new, basic Angular project on a development server, go to the parent directory of your new workspace use the following commands:
<code-example language="bash"> <code-example format="." language="bash">
ng new my-first-project ng new my-first-project
cd my-first-project cd my-first-project
ng serve ng serve
@ -36,14 +36,6 @@ ng serve
In your browser, open http://localhost:4200/ to see the new app run. In your browser, open http://localhost:4200/ to see the new app run.
When you use the [ng serve](cli/serve) command to build an app and serve it locally, the server automatically rebuilds the app and reloads the page when you change any of the source files. When you use the [ng serve](cli/serve) command to build an app and serve it locally, the server automatically rebuilds the app and reloads the page when you change any of the source files.
<div class="alert is-helpful">
When you run `ng new my-first-project` a new folder, named `my-first-project`, will be created in the current working directory. Since you want to be able to create files inside that folder, make sure you have sufficient rights in the current working directory before running the command.
If the current working directory is not the right place for your project, you can change to a more appropriate directory by running `cd <path-to-other-directory>` first.
</div>
## Workspaces and project files ## Workspaces and project files
The [ng new](cli/new) command creates an *Angular workspace* folder and generates a new app skeleton. The [ng new](cli/new) command creates an *Angular workspace* folder and generates a new app skeleton.
@ -82,8 +74,8 @@ Command syntax is shown as follows:
* Option names are prefixed with a double dash (--). * Option names are prefixed with a double dash (--).
Option aliases are prefixed with a single dash (-). Option aliases are prefixed with a single dash (-).
Arguments are not prefixed. Arguments are not prefixed.
For example: For example:
<code-example language="bash"> <code-example format="." language="bash">
ng build my-app -c production ng build my-app -c production
</code-example> </code-example>

View File

@ -1,48 +0,0 @@
# Gathering and Viewing Usage Analytics
Users can opt in to share their Angular CLI usage data with [Google Analytics](https://support.google.com/analytics/answer/1008015?hl=en), using the [`ng analytics` CLI command](analytics).
The data is also shared with the Angular team, and used to improve the CLI.
The gathering of CLI analytics data is disabled by default, and must be enabled at the project level by individual users.
It cannot be enabled at the project level for all users.
Data gathered in this way can be viewed on the Google Analytics site, but is not automatically visible on your own organization's Analytics site.
As an administrator for an Angular development group, you can configure your instance of Angular CLI to be able to see analytics data for your own team's usage of the Angular CLI.
This configuration option is separate from and in addition to other usage analytics that your users may be sharing with Google.
## Enable access to CLI usage data
To configure access to your own users' CLI usage data, use the `ng config` command to add a key to your global [`angular.json` workspace configuration file](guide/workspace-config).
The key goes under `cli.analyticsSharing` at the top level of the file, outside the `projects` sections.
The value of the key is your organization's tracking ID, as assigned by Google Analytics.
This ID is a string that looks like `UA-123456-12`.
You can choose to use a descriptive string as the key value, or be assigned a random key when you run the CLI command.
For example, the following command adds a configuration key named "tracking".
<code-example language="sh" class="code-shell">
ng config --global cli.analyticsSharing.tracking UA-123456-12
</code-example>
To turn off this feature, run the following command:
<code-example language="sh" class="code-shell">
ng config --global --remove cli.analyticsSharing
</code-example>
## Per user tracking
You can add a custom user ID to the global configuration, in order to identify unique usage of commands and flags.
If that user enables CLI analytics for their own project, your analytics display tracks and labels their individual usage.
<code-example language="sh" class="code-shell">
ng config --global cli.analyticsSharing.user SOME_USER_NAME
</code-example>
To generate a new random user ID, run the following command:
<code-example language="sh" class="code-shell">
ng config --global cli.analyticsSharing.user ""
</code-example>

View File

@ -18,15 +18,11 @@
**/src/karma.conf.js **/src/karma.conf.js
**/.angular-cli.json **/.angular-cli.json
**/.editorconfig **/.editorconfig
**/.gitignore
**/angular.json **/angular.json
**/tsconfig.json **/tsconfig.json
**/bs-config.e2e.json **/bs-config.e2e.json
**/bs-config.json **/bs-config.json
**/package.json **/package.json
**/tsconfig.json
**/tsconfig.app.json
**/tsconfig.spec.json
**/tslint.json **/tslint.json
**/karma-test-shim.js **/karma-test-shim.js
**/browser-test-shim.js **/browser-test-shim.js
@ -83,6 +79,9 @@ upgrade-phonecat-2-hybrid/aot/**/*
# styleguide # styleguide
!styleguide/src/systemjs.custom.js !styleguide/src/systemjs.custom.js
# universal
!universal/webpack.server.config.js
# stackblitz # stackblitz
*stackblitz.no-link.html *stackblitz.no-link.html
@ -93,6 +92,3 @@ upgrade-phonecat-3-final/tsconfig-aot.json
upgrade-phonecat-3-final/rollup-config.js upgrade-phonecat-3-final/rollup-config.js
!upgrade-phonecat-*/**/karma.conf.js !upgrade-phonecat-*/**/karma.conf.js
!upgrade-phonecat-*/**/karma-test-shim.js !upgrade-phonecat-*/**/karma-test-shim.js
# schematics
!schematics-for-libraries/projects/my-lib/package.json

View File

@ -1,19 +0,0 @@
import { browser, element, by } from 'protractor';
describe('Accessibility example e2e tests', () => {
beforeEach(() => {
browser.get('');
});
it('should display Accessibility Example', () => {
expect(element(by.css('h1')).getText()).toEqual('Accessibility Example');
});
it('should take a number and change progressbar width', () => {
element(by.css('input')).sendKeys('16');
expect(element(by.css('input')).getAttribute('value')).toEqual('016');
expect(element(by.css('app-example-progressbar div')).getCssValue('width')).toBe('48px');
});
});

View File

@ -1,13 +0,0 @@
<h1>Accessibility Example</h1>
<!-- #docregion template -->
<label>
Enter an example progress value
<input type="number" min="0" max="100"
[value]="progress" (input)="progress = $event.target.value">
</label>
<!-- The user of the progressbar sets an aria-label to communicate what the progress means. -->
<app-example-progressbar [value]="progress" aria-label="Example of a progress bar">
</app-example-progressbar>
<!-- #enddocregion template -->

Some files were not shown because too many files have changed in this diff Show More