This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export interface TimestampBuilderSchema { | |
| format: string; | |
| path: string; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {Builder, BuilderConfiguration, BuilderContext, BuildEvent} from '@angular-devkit/architect'; | |
| import {Observable} from 'rxjs'; | |
| import {TimestampBuilderSchema} from './schema'; | |
| export default class TimestampBuilder implements Builder<TimestampBuilderSchema> { | |
| constructor(private context: BuilderContext) { | |
| } | |
| run(builderConfig: BuilderConfiguration<Partial<TimestampBuilderSchema>>): Observable<BuildEvent> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export interface BuildEvent { | |
| success: boolean; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {Builder, BuilderConfiguration, BuilderContext, BuildEvent} from '@angular-devkit/architect'; | |
| import {bindNodeCallback, Observable, of} from 'rxjs'; | |
| import {catchError, map, tap} from 'rxjs/operators'; | |
| import {TimestampBuilderSchema} from './schema'; | |
| import {getSystemPath} from '@angular-devkit/core'; | |
| import {writeFile} from 'fs'; | |
| import * as dateFormat from 'dateformat'; | |
| export default class TimestampBuilder implements Builder<TimestampBuilderSchema> { | |
| constructor(private context: BuilderContext) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export interface Builder<OptionsT> { | |
| run(builderConfig: BuilderConfiguration<Partial<OptionsT>>): Observable<BuildEvent>; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { SchemaObject as TimestampBuilderSchema } from './schema'; | |
| import { BuilderContext, BuilderOutput, createBuilder } from '@angular-devkit/architect'; | |
| import { Observable } from 'rxjs'; | |
| import { json } from '@angular-devkit/core'; | |
| export function createTimestamp( | |
| { path, format }: TimestampBuilderSchema, | |
| { workspaceRoot, logger }: BuilderContext, | |
| ): Observable<BuilderOutput> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * A builder handler function. The function signature passed to `createBuilder()`. | |
| */ | |
| export interface BuilderHandlerFn<A> { | |
| /** | |
| * Builders are defined by users to perform any kind of task, like building, testing or linting, | |
| * and should use this interface. | |
| * @param input The options (a JsonObject), validated by the schema and received by the | |
| * builder. This can include resolved options from the CLI or the workspace. | |
| * @param context A context that can be used to interact with the Architect framework. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export interface Schema { | |
| error?: string; | |
| info?: { | |
| [key: string]: any; | |
| }; | |
| success: boolean; | |
| target?: Target; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function createBuilder<OptT = json.JsonObject, OutT extends BuilderOutput = BuilderOutput>( | |
| fn: BuilderHandlerFn<OptT>, | |
| ): Builder<OptT & json.JsonObject> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { SchemaObject as TimestampBuilderSchema } from './schema'; | |
| import { BuilderContext, BuilderOutput, createBuilder } from '@angular-devkit/architect'; | |
| import { Observable, bindNodeCallback, of } from 'rxjs'; | |
| import { catchError, map, tap } from 'rxjs/operators'; | |
| import { getSystemPath, normalize, json } from '@angular-devkit/core'; | |
| import { writeFile } from 'fs'; | |
| import * as dateFormat from 'dateformat'; | |
| export function createTimestamp( | |
| { path, format }: TimestampBuilderSchema, |
OlderNewer