@boostercloud/cli
Version:
CLI of the Booster Framework, the next level of abstraction for cloud-native applications
44 lines (43 loc) • 2 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@oclif/core");
const base_command_1 = require("../../common/base-command");
const script_1 = require("../../common/script");
const brand_1 = require("../../common/brand");
const stub_publisher_1 = require("../../services/stub-publisher");
const project_checker_1 = require("../../services/project-checker");
const user_prompt_1 = require("../../services/user-prompt");
class Publish extends base_command_1.default {
async run() {
const { flags } = await this.parse(Publish);
const stubFolderExists = (0, stub_publisher_1.checkStubsFolderExists)();
if (!stubFolderExists) {
(0, stub_publisher_1.createStubsFolder)();
}
if (stubFolderExists && !flags.force) {
await user_prompt_1.default.confirmPrompt({
message: brand_1.default.dangerize('Stubs folder already exists. Do you want to overwrite it?'),
}).then((confirm) => {
if (!confirm) {
throw new Error(brand_1.default.dangerize('Stubs folder already exists. Use --force option to overwrite files in it'));
}
});
}
await run();
}
}
Publish.description = 'publish all resource template stubs that are available for customization';
Publish.usage = 'boost stub:publish --force';
Publish.examples = ['$ boost stub:publish --force', '$ boost stub:publish'];
Publish.flags = {
force: core_1.Flags.boolean({
char: 'f',
description: 'Overwrite any existing stub files',
}),
};
exports.default = Publish;
const run = async () => script_1.Script.init(`boost ${brand_1.default.energize('stub:publish')} 🗄`, Promise.resolve(process.cwd()))
.step('Verifying project', project_checker_1.checkCurrentDirIsABoosterProject)
.step('Publishing stubs', stub_publisher_1.publishStubFiles)
.info('Resource template stubs published!')
.done();