"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CodiacApiScaffolding = void 0;
const tslib_1 = require("tslib");
const codiac_common_1 = require("@codiac.io/codiac-common");
const codiac_relay_contracts_1 = require("@codiac.io/codiac-relay-contracts");
const inversify_1 = require("inversify");
const __1 = require("..");
/** Initializes a project for the Codiac Api platform.
 */
let CodiacApiScaffolding = class CodiacApiScaffolding extends __1.TypescriptScaffolding {
    constructor(logger) {
        super(logger);
        this.name = "api";
        this.npmDependencies = [
            "reflect-metadata",
            "@codiac.io/codiac-api-base",
            "@codiac.io/codiac-auth-contracts",
            "@codiac.io/codiac-common",
            "@codiac.io/plugins-auth-sdk",
            "@codiac.io/plugins-mongo-repo"
        ];
        this.npmDevDependencies = [
            "mocha",
            "chai",
            "nyc",
            "@types/mocha",
            "@types/chai",
            "@types/node",
            "ts-node",
            "typescript@4.0.5",
            'reflect-metadata'
        ];
        this.scaffoldFolders = [".vscode", "src"];
        this.scaffoldFiles = [
            `.gitignore${__1.ProjectInitializer.SCAFFOLDING_SUFFIX}`,
            "src/app-config.json",
            `src/index.ts${__1.ProjectInitializer.SCAFFOLDING_SUFFIX}`,
            `src/myApiDef.ts${__1.ProjectInitializer.SCAFFOLDING_SUFFIX}`,
            ".vscode/settings.json",
            ".vscode/tasks.json",
            ".vscode/launch.json"
        ];
        this.sccIgnoreFile = `.gitignore${__1.ProjectInitializer.SCAFFOLDING_SUFFIX}`;
        this.afterInitHandler = (projectRoot, config, localOps) => tslib_1.__awaiter(this, void 0, void 0, function* () {
            // await super.afterInitHandler!(projectRoot, config, localOps);
            // OR
            yield this.initTypescript(projectRoot, true);
            yield this.initNpm(projectRoot, config, this, localOps);
            config.buildDef = ["tsc"];
            // Declare the api image
            let target = new codiac_relay_contracts_1.RegistryTarget("default", __1.ProjectInitializer.DEFAULT_REGISTRY_URL);
            localOps.declareImageExport(config, config.name, target, "Dockerfile", undefined);
            config.buildIncludes = ["src/app-config.json"];
        });
    }
};
CodiacApiScaffolding = tslib_1.__decorate([
    (0, inversify_1.injectable)(),
    tslib_1.__param(0, (0, inversify_1.inject)(codiac_common_1.INTERFACES.IBetterLogger)),
    tslib_1.__metadata("design:paramtypes", [Object])
], CodiacApiScaffolding);
exports.CodiacApiScaffolding = CodiacApiScaffolding;
//# sourceMappingURL=codiac-api-scaffolding.js.map