UNPKG

@rockset/cli

Version:
47 lines (46 loc) 1.8 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DEFAULT_SOURCE_ROOT = void 0; const core_1 = require("@oclif/core"); const prompts = require("prompts"); const core_2 = require("@rockset/core"); const base_command_1 = require("../../base-command"); const chalk = require("chalk"); exports.DEFAULT_SOURCE_ROOT = 'src'; let InitializeProject = /** @class */ (() => { class InitializeProject extends base_command_1.RockCommand { async run() { const { flags } = await this.parse(InitializeProject); const writeRootConfig = async (source_root = exports.DEFAULT_SOURCE_ROOT) => { await core_2.fileutil.writeRootConfig({ source_root, }); this.log(chalk `Created root config at {green ${core_2.types.ROOT_CONFIG}}`); await core_2.fileutil.ensureSrcDir(); }; if (flags.yes) { return writeRootConfig(); } // Ask the user to choose the root path const { root } = (await prompts({ type: 'text', name: 'root', message: 'Enter the root path for your Query Lambdas', initial: exports.DEFAULT_SOURCE_ROOT, })); if (root) { await writeRootConfig(root); } else { this.log('Did not write config file'); } } } InitializeProject.flags = { help: core_1.Flags.help({ char: 'h' }), yes: core_1.Flags.boolean({ char: 'y' }), }; InitializeProject.description = `initialize your project with a ${core_2.types.ROOT_CONFIG} file.`; return InitializeProject; })(); exports.default = InitializeProject;