installer.py 2.5 KB

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