GSI - Employe Self Service Mobile
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.

25 lines
1016 B

2 months ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.detectProjectRoot = void 0;
  4. const fsutils_1 = require("./fsutils");
  5. const error_1 = require("./error");
  6. const path_1 = require("path");
  7. function detectProjectRoot(options) {
  8. let projectRootDir = options.cwd || process.cwd();
  9. if (options.configPath) {
  10. const fullPath = (0, path_1.resolve)(projectRootDir, options.configPath);
  11. if (!(0, fsutils_1.fileExistsSync)(fullPath)) {
  12. throw new error_1.FirebaseError(`Could not load config file ${options.configPath}.`, { exit: 1 });
  13. }
  14. return (0, path_1.dirname)(fullPath);
  15. }
  16. while (!(0, fsutils_1.fileExistsSync)((0, path_1.resolve)(projectRootDir, "./firebase.json"))) {
  17. const parentDir = (0, path_1.dirname)(projectRootDir);
  18. if (parentDir === projectRootDir) {
  19. return null;
  20. }
  21. projectRootDir = parentDir;
  22. }
  23. return projectRootDir;
  24. }
  25. exports.detectProjectRoot = detectProjectRoot;