"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var build_command_exports = {};
__export(build_command_exports, {
  BuildCommand: () => BuildCommand
});
module.exports = __toCommonJS(build_command_exports);
var import_bundle_command = require("./bundle-command");
var import_gen_command = require("./gen-command");
var import_project_command = require("./project-command");
class BuildCommand extends import_project_command.ProjectCommand {
  async run(buildContext) {
    const t0 = Date.now();
    const { projectType } = this.readProjectDefinitionFromFS();
    if (projectType === "interface") {
      this.logger.success("Interface projects have nothing to build.");
      return;
    }
    await this._runGenerate();
    await this._runBundle(buildContext);
    const dt = Date.now() - t0;
    this.logger.log(`Build completed in ${dt}ms`);
  }
  _runGenerate() {
    return new import_gen_command.GenerateCommand(this.api, this.prompt, this.logger, this.argv).setProjectContext(this.projectContext).run();
  }
  _runBundle(buildContext) {
    return new import_bundle_command.BundleCommand(this.api, this.prompt, this.logger, this.argv).setProjectContext(this.projectContext).run(buildContext);
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  BuildCommand
});
//# sourceMappingURL=build-command.js.map
