Skip to main content

BuildCommand

@webda/core


Function: BuildCommand()

BuildCommand(options?): (value, context) => any

Defined in: packages/core/src/services/command.ts:134

Sugar for @Command("build", { phase: "resolved", ...options }).

Marks a service method as a build-time hook. The method is invoked during webda build after Core.resolve() completes; service.init() is NOT called, so the method must not depend on DB/network connections.

The compiler (@webda/compiler) emits a build command entry into webda.module.json when it sees this decorator; webdac build then auto-invokes webda build if any configured service declares it.

Parameters​

options?​

Omit<CommandOptions, "phase"> = ...

Same options as @Command, minus phase (fixed to "resolved").

Returns​

A method decorator that registers the method as a build command with phase: "resolved".

(value, context) => any

Example​

class GrpcService extends Service {
@BuildCommand({ description: "Generate proto", requires: ["rest-domain"] })
async build() {
writeFileSync(this.parameters.protoFile, generateProto(...));
}
}