|
@@ -598,6 +598,8 @@ def initialize_web_directory():
|
|
|
|
|
|
initialize_package_json()
|
|
|
|
|
|
+ initialize_bun_config()
|
|
|
+
|
|
|
path_ops.mkdir(get_web_dir() / constants.Dirs.PUBLIC)
|
|
|
|
|
|
update_next_config()
|
|
@@ -622,17 +624,21 @@ def _compile_package_json():
|
|
|
def initialize_package_json():
|
|
|
"""Render and write in .web the package.json file."""
|
|
|
output_path = get_web_dir() / constants.PackageJson.PATH
|
|
|
- code = _compile_package_json()
|
|
|
- output_path.write_text(code)
|
|
|
+ output_path.write_text(_compile_package_json())
|
|
|
+
|
|
|
|
|
|
- best_registry = _get_npm_registry()
|
|
|
+def initialize_bun_config():
|
|
|
+ """Initialize the bun config file."""
|
|
|
bun_config_path = get_web_dir() / constants.Bun.CONFIG_PATH
|
|
|
- bun_config_path.write_text(
|
|
|
- f"""
|
|
|
-[install]
|
|
|
-registry = "{best_registry}"
|
|
|
-"""
|
|
|
- )
|
|
|
+
|
|
|
+ if (custom_bunfig := Path(constants.Bun.CONFIG_PATH)).exists():
|
|
|
+ bunfig_content = custom_bunfig.read_text()
|
|
|
+ console.info(f"Copying custom bunfig.toml inside {get_web_dir()} folder")
|
|
|
+ else:
|
|
|
+ best_registry = _get_npm_registry()
|
|
|
+ bunfig_content = constants.Bun.DEFAULT_CONFIG.format(registry=best_registry)
|
|
|
+
|
|
|
+ bun_config_path.write_text(bunfig_content)
|
|
|
|
|
|
|
|
|
def init_reflex_json(project_hash: int | None):
|