Initialize the web directory on reflex init.
()
| 406 | |
| 407 | |
| 408 | def initialize_web_directory(): |
| 409 | """Initialize the web directory on reflex init.""" |
| 410 | console.log("Initializing the web directory.") |
| 411 | |
| 412 | # Reuse the hash if one is already created, so we don't over-write it when running reflex init |
| 413 | project_hash = get_project_hash() |
| 414 | |
| 415 | console.debug(f"Copying {constants.Templates.Dirs.WEB_TEMPLATE} to {get_web_dir()}") |
| 416 | path_ops.copy_tree(constants.Templates.Dirs.WEB_TEMPLATE, str(get_web_dir())) |
| 417 | |
| 418 | console.debug("Restoring lockfiles.") |
| 419 | sync_root_lockfiles_to_web() |
| 420 | |
| 421 | console.debug("Initializing the web directory.") |
| 422 | initialize_package_json() |
| 423 | sync_web_lockfiles_to_root() |
| 424 | |
| 425 | console.debug("Initializing the bun config file.") |
| 426 | initialize_bun_config() |
| 427 | |
| 428 | console.debug("Initializing the .npmrc file.") |
| 429 | initialize_npmrc() |
| 430 | |
| 431 | console.debug("Initializing the public directory.") |
| 432 | path_ops.mkdir(get_web_dir() / constants.Dirs.PUBLIC) |
| 433 | |
| 434 | console.debug("Initializing the react-router.config.js file.") |
| 435 | update_react_router_config() |
| 436 | |
| 437 | console.debug("Initializing the vite.config.js file.") |
| 438 | initialize_vite_config() |
| 439 | |
| 440 | console.debug("Initializing the reflex.json file.") |
| 441 | # Initialize the reflex json file. |
| 442 | init_reflex_json(project_hash=project_hash) |
| 443 | |
| 444 | |
| 445 | def update_entry_client(): |
no test coverage detected