31 Commits

Author SHA1 Message Date
Charles Lyding
0d104c0aba feat(@angular-devkit/architect): support accessing project metadata 2019-09-24 13:18:33 -07:00
Alan Agius
a6fbee6865 style: add no-invalid-await and prefer-promise-shorthand lint rules (#15450)
Add these two lint rules for a better code quality and readability
2019-08-27 10:24:58 -07:00
Pavel Březina
51622bdeaf fix(@angular-devkit/architect): add target to ScheduleOptions to allow its use in context.scheduleBuilder
A custom builder can call `context.scheduleBuilder` to call another builder.
However, the following call will fail with `Must either have a target from
the context or a default project.` exception because `scheduleBuilder` does
not pass `target` to the called builder.

```typescript
import { JsonObject } from '@angular-devkit/core'
import { BuilderContext, BuilderOutput, BuilderRun, createBuilder } from '@angular-devkit/architect';
import { Observable, from } from 'rxjs';
import { concatMap, map } from 'rxjs/operators';

export default createBuilder(_customBuilder);

function _customBuilder(options: JsonObject, context: BuilderContext): Observable<BuilderOutput> {
    const builder = '@angular-devkit/build-angular:browser';

    return from(context.scheduleBuilder(builder, options)).pipe(
        concatMap(run => run.result)
    );
}
```

Resolves:
https://github.com/angular/angular-cli/issues/15053
2019-07-31 13:22:11 -07:00
vikerman
77d4dd9733 fix(@angular-devkit/architect): fix for newest version of rxjs 2019-07-01 16:36:43 -07:00
Alan Agius
53d027837e fix(@angular-devkit/architect): error out when invalid configurations are provided
Fixes #14654
2019-06-10 13:43:39 -07:00
Charles Lyding
19ed795cb1 fix(@angular-devkit/architect): support all observable types as build results
Fixes #14579
2019-05-30 13:33:51 -07:00
Filipe Silva
d546b83e04 fix(@angular-devkit/architect): error run on input schema error (#14315)
Fix #14269
2019-05-07 12:37:56 -06:00
Alan Agius
968204fa2a refactor(@angular-devkit/architect): remove _registry from being a private (#14182) 2019-05-07 12:31:45 -06:00
Charles Lyding
5f248204ec fix(@angular-devkit/architect): propagate option validation errors
By using the `SchemaValidationException` object, the underlying JSON schema validation errors will be propagated to the consuming code.  This allows for more detailed error reporting of malformed or incorrectly provided options.

Partially addresses #14269
2019-04-26 10:26:47 -07:00
Alan Agius
260dacfb41 test: add new architect api to golden files 2019-04-15 11:08:46 -07:00
Charles Lyding
0a59307c19 fix(@angular-devkit/architect): fix incorrect relative core import 2019-04-12 15:40:51 -07:00
Charles Lyding
588d61e608 refactor(@angular-devkit/architect): remove temporary index2 entrypoint 2019-04-04 19:49:56 -07:00
Charles Lyding
db14292b52 fix(@angular-devkit/architect): remove experimental API 2019-04-02 10:31:24 -07:00
Hans Larsen
d25fb89078 feat(@angular-devkit/architect): add analytics to builder context
It should be NoopAnalytics if no analytics are supported.
2019-03-28 13:28:41 -07:00
Charles Lyding
4a8022ea00 fix(@angular-devkit/architect): ensure workspaceRoot is actually set to workspaceRoot 2019-03-27 16:33:39 -07:00
Hans Larsen
deeea03650 test: fix invalid architect tests
See fe229faf78
2019-03-15 16:07:06 -07:00
Alex Eagle
fe229faf78 test: comment out broken assertion 2019-03-13 14:28:25 -07:00
Hans Larsen
31e1ae9d17 feat(@angular-devkit/architect): add new context methods
getBuilderNameForTarget() allows someone to get the builder name string for a specific
target (or return a rejected promise if it fails).

validateOptions() allows a builder to validate options against the same mechanics that
are used when scheduling builders.

These two methods allow builders to get options from a workspace (or build some option
object), change it, validate it, and execute scheduleBuilder() if they want to schedule
directly (or want a parallel run).
2019-03-13 13:51:22 -07:00
Hans Larsen
3ac1cc30a7 feat(@angular-devkit/architect): add scheduleTargetAndForget function
It came up with Nrwl that this is a common pattern; someone wants to schedule a
target but does not want to manage the run himself. This function cancels the
run when the Observable is unsubscribed from (which is not the case for a
traditional run).

Because stop logic can be asynchronous, we need to add a teardown logic
handler to the context, which turns out to be useful for other cases as
well.
2019-03-11 13:48:01 -07:00
Hans Larsen
15312e8ef0 feat(@angular-devkit/architect): add targetFromTargetString() function
Useful for reading options. This uses the reverse logic from
targetStringFromTarget().

Also add tests for both functions.
2019-03-11 13:48:01 -07:00
Hans Larsen
f06493cb8a feat(@angular-devkit/architect): QoL changes for builders
Add a scheduling options to scheduleTarget and Builder on the context so
builders can schedule sub-builds and override the logger.

Add a getTargetOptions() for builders to get access to options from the
host for a specific target. This allows builders to get options, override
some, then scheduleBuilder with those new options, for example.
2019-03-06 10:05:31 -08:00
Hans Larsen
02943eaf49 fix(@angular-devkit/architect): properly subscribe to error handlers
If an error is reported but ANY subscription have an undefined error handler, RxJS
reports the error to the "host platform" (it setTimeout(() => throw error)). Since
we properly handle errors in some places, but should ignore them in others (e.g.
we handle errors on the outboundBus, so the output subscription should ignore it),
we still need to subscribe to error, just ignore it.
2019-03-05 11:14:59 -08:00
Hans Larsen
f0adbc41fd fix(@angular-devkit/architect): properly report errors thrown by builder
When they are thrown by the builder itself.
2019-03-05 11:14:59 -08:00
Hans Larsen
2ffaf0c11c feat(@angular-devkit/architect): allow for a different output type
There is no schema validation of output and we are not planning any
for now, but the attributes should be retained.
2019-02-27 10:11:22 -08:00
Hans Larsen
1aa1b47f90 feat(@angular-devkit/core): remove Log messages from Job API
If a system wants to have logging it should multiplex it itself on a channel.

Also changed the previous Architect commits to remove usage of Logs and move
to a "log" channel.
2019-02-19 13:51:29 -08:00
Hans Larsen
68220f13e4 feat(@angular-devkit/architect): New Architect API first draft
The new API has been described in this design doc:
https://docs.google.com/document/d/1SpN_2XEooI9_CPjqspAcNEBjVY874OWPZqOenjuF0qo/view

This first drafts add support for the API (given some deep imports). It is
still in draft mode but is committed to make it available to people to
start testing and moving their own builders.

This API rebuilds (not backward compatible) the Architect API package. To
use it people will need to import "@angular-devkit/architect/src/index2"
to start using it. A reference builder will be added in the next commit.

There are 2 pieces missing from this commit that will be added in the
same PR; 1) the architect-host and CLI to test, and 2) a reference
builder moved from the old API to the new one. These will be part of
the same PR.

Finally, there are missing tests in this package, but everything tested
manually and automatically works so far. Test coverage will be added
before the package is considered finished.

Due to a desire to keep architect, our tests and the scope of this PR
limited and keep the two APIs separated, every clashing files will
have a "2" suffix added to it. Once all builders have been moved and
we are sure everything works, all those files will be moved to their
final destination and the old API will be removed, in one PR.
2019-02-19 13:51:29 -08:00
Hans Larsen
32e230d252 feat(@angular-devkit/architect): deprecate the current architect API
This is done in short notice since it was always considered
experimental. Most developers already know that the API is going to
change.
2019-01-10 10:43:27 -08:00
Alan Agius
73a35071a0 feat(@angular-devkit/architect): add result property to BuildEvent 2019-01-08 13:42:45 -08:00
Alan Agius
45b6df511f fix(@angular-devkit/build-angular): lint non human readable formatters produces invalid output
fixes #12674
2018-12-06 11:24:27 -08:00
Filipe Silva
97f53b36d5 refactor(@angular-devkit/architect): use updated workspace api 2018-07-25 20:17:33 +01:00
Hans Larsen
44086c60ff build: move devkit repo back to angular-cli 2018-06-05 18:50:06 -07:00