installer.py 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. """File for constants related to the installation process. (Bun/Node)."""
  2. from __future__ import annotations
  3. from types import SimpleNamespace
  4. from .base import IS_WINDOWS
  5. from .utils import classproperty
  6. # Bun config.
  7. class Bun(SimpleNamespace):
  8. """Bun constants."""
  9. # The Bun version.
  10. VERSION = "1.2.4"
  11. # Min Bun Version
  12. MIN_VERSION = "1.2.4"
  13. # URL to bun install script.
  14. INSTALL_URL = "https://raw.githubusercontent.com/reflex-dev/reflex/main/scripts/bun_install.sh"
  15. # URL to windows install script.
  16. WINDOWS_INSTALL_URL = (
  17. "https://raw.githubusercontent.com/reflex-dev/reflex/main/scripts/install.ps1"
  18. )
  19. # Path of the bunfig file
  20. CONFIG_PATH = "bunfig.toml"
  21. @classproperty
  22. @classmethod
  23. def ROOT_PATH(cls):
  24. """The directory to store the bun.
  25. Returns:
  26. The directory to store the bun.
  27. """
  28. from reflex.config import environment
  29. return environment.REFLEX_DIR.get() / "bun"
  30. @classproperty
  31. @classmethod
  32. def DEFAULT_PATH(cls):
  33. """Default bun path.
  34. Returns:
  35. The default bun path.
  36. """
  37. return cls.ROOT_PATH / "bin" / ("bun" if not IS_WINDOWS else "bun.exe")
  38. DEFAULT_CONFIG = """
  39. [install]
  40. registry = "{registry}"
  41. """
  42. # Node / NPM config
  43. class Node(SimpleNamespace):
  44. """Node/ NPM constants."""
  45. # The Node version.
  46. VERSION = "22.11.0"
  47. # The minimum required node version.
  48. MIN_VERSION = "18.18.0"
  49. class PackageJson(SimpleNamespace):
  50. """Constants used to build the package.json file."""
  51. class Commands(SimpleNamespace):
  52. """The commands to define in package.json."""
  53. DEV = "next dev"
  54. EXPORT = "next build"
  55. EXPORT_SITEMAP = "next build && next-sitemap"
  56. PROD = "next start"
  57. PATH = "package.json"
  58. DEPENDENCIES = {
  59. "@emotion/react": "11.14.0",
  60. "axios": "1.7.9",
  61. "json5": "2.2.3",
  62. "next": "15.1.7",
  63. "next-sitemap": "4.2.3",
  64. "next-themes": "0.4.4",
  65. "react": "19.0.0",
  66. "react-dom": "19.0.0",
  67. "react-focus-lock": "2.13.6",
  68. "socket.io-client": "4.8.1",
  69. "fast-json-patch": "3.1.1",
  70. "universal-cookie": "7.2.2",
  71. }
  72. DEV_DEPENDENCIES = {
  73. "autoprefixer": "10.4.20",
  74. "postcss": "8.5.1",
  75. "postcss-import": "16.1.0",
  76. }
  77. OVERRIDES = {
  78. # This should always match the `react` version in DEPENDENCIES for recharts compatibility.
  79. "react-is": "19.0.0"
  80. }