@angular-devkit/architect 0.800.0 → 0.800.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -67,8 +67,9 @@ class WorkspaceNodeModulesArchitectHost {
67
67
  if (targetSpec === undefined) {
68
68
  return null;
69
69
  }
70
- if (target.configuration && !targetSpec['configurations']) {
71
- throw new Error('Configuration not set in the workspace.');
70
+ if (target.configuration
71
+ && !(targetSpec['configurations'] && targetSpec['configurations'][target.configuration])) {
72
+ throw new Error(`Configuration '${target.configuration}' is not set in the workspace.`);
72
73
  }
73
74
  return {
74
75
  ...targetSpec['options'],
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@angular-devkit/architect",
3
- "version": "0.800.0",
3
+ "version": "0.800.4",
4
4
  "description": "Angular Build Facade",
5
5
  "experimental": true,
6
6
  "main": "src/index.js",
7
7
  "typings": "src/index.d.ts",
8
8
  "dependencies": {
9
- "@angular-devkit/core": "8.0.0",
9
+ "@angular-devkit/core": "8.0.4",
10
10
  "rxjs": "6.4.0"
11
11
  },
12
12
  "builders": "./builders/builders.json",
package/src/api.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
8
  import { analytics, experimental, json, logging } from '@angular-devkit/core';
9
- import { Observable } from 'rxjs';
9
+ import { Observable, SubscribableOrPromise } from 'rxjs';
10
10
  import { Schema as RealBuilderInput, Target as RealTarget } from './input-schema';
11
11
  import { Schema as RealBuilderOutput } from './output-schema';
12
12
  import { Schema as RealBuilderProgress, State as BuilderProgressState } from './progress-schema';
@@ -211,7 +211,8 @@ export interface BuilderContext {
211
211
  /**
212
212
  * An accepted return value from a builder. Can be either an Observable, a Promise or a vector.
213
213
  */
214
- export declare type BuilderOutputLike = Observable<BuilderOutput> | Promise<BuilderOutput> | BuilderOutput;
214
+ export declare type BuilderOutputLike = SubscribableOrPromise<BuilderOutput> | BuilderOutput;
215
+ export declare function isBuilderOutput(obj: any): obj is BuilderOutput;
215
216
  /**
216
217
  * A builder handler function. The function signature passed to `createBuilder()`.
217
218
  */
package/src/api.js CHANGED
@@ -4,6 +4,14 @@ const rxjs_1 = require("rxjs");
4
4
  const operators_1 = require("rxjs/operators");
5
5
  const progress_schema_1 = require("./progress-schema");
6
6
  exports.BuilderProgressState = progress_schema_1.State;
7
+ // tslint:disable-next-line:no-any
8
+ function isBuilderOutput(obj) {
9
+ if (!obj || typeof obj.then === 'function' || typeof obj.subscribe === 'function') {
10
+ return false;
11
+ }
12
+ return typeof obj.success === 'boolean';
13
+ }
14
+ exports.isBuilderOutput = isBuilderOutput;
7
15
  /**
8
16
  * Returns a string of "project:target[:configuration]" for the target object.
9
17
  */
package/src/architect.js CHANGED
@@ -239,7 +239,8 @@ class Architect {
239
239
  return this._scheduler.has(name);
240
240
  }
241
241
  scheduleBuilder(name, options, scheduleOptions = {}) {
242
- if (!/^[^:]+:[^:]+$/.test(name)) {
242
+ // The below will match 'project:target:configuration'
243
+ if (!/^[^:]+:[^:]+(:[^:]+)?$/.test(name)) {
243
244
  throw new Error('Invalid builder name: ' + JSON.stringify(name));
244
245
  }
245
246
  return schedule_by_name_1.scheduleByName(name, options, {
@@ -143,16 +143,16 @@ function createBuilder(fn) {
143
143
  let result;
144
144
  try {
145
145
  result = fn(i.options, context);
146
+ if (api_1.isBuilderOutput(result)) {
147
+ result = rxjs_1.of(result);
148
+ }
149
+ else {
150
+ result = rxjs_1.from(result);
151
+ }
146
152
  }
147
153
  catch (e) {
148
154
  result = rxjs_1.throwError(e);
149
155
  }
150
- if (core_1.isPromise(result)) {
151
- result = rxjs_1.from(result);
152
- }
153
- else if (!rxjs_1.isObservable(result)) {
154
- result = rxjs_1.of(result);
155
- }
156
156
  // Manage some state automatically.
157
157
  progress({ state: api_1.BuilderProgressState.Running, current: 0, total: 1 }, context);
158
158
  subscriptions.push(result.pipe(operators_1.tap(() => {