MCPcopy
hub / github.com/reflex-dev/reflex / initialize_web_directory

Function initialize_web_directory

reflex/utils/frontend_skeleton.py:408–442  ·  view source on GitHub ↗

Initialize the web directory on reflex init.

()

Source from the content-addressed store, hash-verified

406
407
408def 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
445def update_entry_client():

Callers 1

Calls 10

get_project_hashFunction · 0.90
get_web_dirFunction · 0.90
initialize_package_jsonFunction · 0.85
initialize_bun_configFunction · 0.85
initialize_npmrcFunction · 0.85
initialize_vite_configFunction · 0.85
init_reflex_jsonFunction · 0.85

Tested by

no test coverage detected