No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

npm-dependencies.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.askInstallDependencies = void 0;
  4. const spawn = require("cross-spawn");
  5. const logger_1 = require("../../../logger");
  6. const prompt_1 = require("../../../prompt");
  7. function askInstallDependencies(setup, config) {
  8. return (0, prompt_1.prompt)(setup, [
  9. {
  10. name: "npm",
  11. type: "confirm",
  12. message: "Do you want to install dependencies with npm now?",
  13. default: true,
  14. },
  15. ]).then(() => {
  16. if (setup.npm) {
  17. return new Promise((resolve) => {
  18. const installer = spawn("npm", ["install"], {
  19. cwd: config.projectDir + `/${setup.source}`,
  20. stdio: "inherit",
  21. });
  22. installer.on("error", (err) => {
  23. logger_1.logger.debug(err.stack);
  24. });
  25. installer.on("close", (code) => {
  26. if (code === 0) {
  27. return resolve();
  28. }
  29. logger_1.logger.info();
  30. logger_1.logger.error("NPM install failed, continuing with Firebase initialization...");
  31. return resolve();
  32. });
  33. });
  34. }
  35. });
  36. }
  37. exports.askInstallDependencies = askInstallDependencies;