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.

24 lines
1.3 KiB

2 months ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.warnIfCustomBuildScript = exports.readJSON = exports.isUrl = void 0;
  4. const fs_extra_1 = require("fs-extra");
  5. const path_1 = require("path");
  6. const promises_1 = require("fs/promises");
  7. function isUrl(url) {
  8. return /^https?:\/\//.test(url);
  9. }
  10. exports.isUrl = isUrl;
  11. function readJSON(file, options) {
  12. return (0, fs_extra_1.readJSON)(file, options);
  13. }
  14. exports.readJSON = readJSON;
  15. async function warnIfCustomBuildScript(dir, framework, defaultBuildScripts) {
  16. var _a;
  17. const packageJsonBuffer = await (0, promises_1.readFile)((0, path_1.join)(dir, "package.json"));
  18. const packageJson = JSON.parse(packageJsonBuffer.toString());
  19. const buildScript = (_a = packageJson.scripts) === null || _a === void 0 ? void 0 : _a.build;
  20. if (buildScript && !defaultBuildScripts.includes(buildScript)) {
  21. console.warn(`\nWARNING: Your package.json contains a custom build that is being ignored. Only the ${framework} default build script (e.g, "${defaultBuildScripts[0]}") is respected. If you have a more advanced build process you should build a custom integration https://firebase.google.com/docs/hosting/express\n`);
  22. }
  23. }
  24. exports.warnIfCustomBuildScript = warnIfCustomBuildScript;