UNPKG

firebase-tools

Version:
38 lines (37 loc) 1.79 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"); exports.command = new command_1.Command("functions:kits:install") .description("install a function kit into your project") .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("|")})`) .action(async (options) => { experiments.assertEnabled("kits", "install a function kit"); 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, project: options.project, projectId: options.projectId, rc: options.rc, }); });