UNPKG

firebase-tools

Version:
48 lines (47 loc) • 2.17 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.command = void 0; const command_1 = require("../command"); const error_1 = require("../error"); const experiments = require("../experiments"); const install_1 = require("../functions/kits/install"); const requireAuth_1 = require("../requireAuth"); const requireConfig_1 = require("../requireConfig"); exports.command = new command_1.Command("functions:kits:install") .description("install a function kit into your project") .before(() => { experiments.assertEnabled("kits", "install a function kit"); }) .before(requireConfig_1.requireConfig) .before(requireAuth_1.requireAuth) .withForce() .option("--package <package>", "NPM package name or specifier to install as a function kit") .option("--directory <directory>", "path to a local functions codebase directory to install as a function kit") .option(`--template <template>`, `template to use for the kit index file (${Object.keys(install_1.TEMPLATES).join("|")})`) .option("--no-configure", "skip parameter prompting and configuration during installation") .action(async (options) => { if (!options.config) { throw new error_1.FirebaseError("Not in a Firebase project directory (firebase.json not found)."); } if (options.package && options.directory) { throw new error_1.FirebaseError("Cannot specify both --package and --directory. Please choose one."); } if (!options.package && !options.directory) { throw new error_1.FirebaseError("Must specify either --package or --directory."); } if (options.directory && options.template) { throw new error_1.FirebaseError("Cannot specify --template with --directory."); } await (0, install_1.installKitOrInstance)({ config: options.config, package: options.package, directory: options.directory, template: options.template, nonInteractive: options.nonInteractive, force: options.force, configure: options.configure, project: options.project, projectId: options.projectId, rc: options.rc, }); });