Skip to content

Commit

Permalink
feat(@angular-devkit/core): add handling for defaultConfiguration t…
Browse files Browse the repository at this point in the history
…arget definition property
  • Loading branch information
alan-agius4 authored and filipesilva committed Mar 8, 2021
1 parent 1da359a commit 8e981d0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions etc/api/angular_devkit/core/src/_golden-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@ export declare class SynchronousDelegateExpectedException extends BaseException
export interface TargetDefinition {
builder: string;
configurations?: Record<string, Record<string, JsonValue | undefined> | undefined>;
defaultConfiguration?: string;
options?: Record<string, JsonValue | undefined>;
}

Expand Down
3 changes: 2 additions & 1 deletion packages/angular_devkit/core/src/workspace/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface ProjectDefinition {
export interface TargetDefinition {
options?: Record<string, JsonValue | undefined>;
configurations?: Record<string, Record<string, JsonValue | undefined> | undefined>;

defaultConfiguration?: string;
builder: string;
}

Expand Down Expand Up @@ -234,6 +234,7 @@ export class TargetDefinitionCollection extends DefinitionCollection<TargetDefin
builder: definition.builder,
options: definition.options,
configurations: definition.configurations,
defaultConfiguration: definition.defaultConfiguration,
};

super.set(definition.name, target);
Expand Down
2 changes: 1 addition & 1 deletion packages/angular_devkit/core/src/workspace/json/reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ function parseTargetsObject(
const name = key.value;
if (context.trackChanges) {
targets[name] = createVirtualAstObject<TargetDefinition>(value, {
include: [ 'builder', 'options', 'configurations' ],
include: [ 'builder', 'options', 'configurations', 'defaultConfiguration' ],
listener(op, path, node, value) {
jsonMetadata.addChange(
op,
Expand Down
3 changes: 3 additions & 0 deletions packages/angular_devkit/core/src/workspace/json/writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ function convertJsonTarget(target: TargetDefinition): JsonObject {
...(isEmpty(target.configurations)
? {}
: { configurations: target.configurations as JsonObject }),
...(target.defaultConfiguration === undefined
? {}
: { defaultConfiguration: target.defaultConfiguration }),
};
}

Expand Down

0 comments on commit 8e981d0

Please sign in to comment.