check_initialized: skip REFLEX_DIR check for backend only (#1478)

This commit is contained in:
Masen Furer 2023-08-02 06:33:56 -07:00 committed by GitHub
parent deef553e82
commit 919f239168
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 24 deletions

View File

@ -59,10 +59,21 @@ jobs:
working-directory: ./reflex-examples/counter working-directory: ./reflex-examples/counter
run: | run: |
poetry run pip install -r requirements.txt poetry run pip install -r requirements.txt
- name: Check export --backend-only before init for counter example
working-directory: ./reflex-examples/counter
run: |
poetry run reflex export --backend-only
- name: Check run --backend-only before init for counter example
run: |
poetry run bash scripts/integration.sh ./reflex-examples/counter dev 8001 --backend-only --backend-port 8001
- name: Init Website for counter example - name: Init Website for counter example
working-directory: ./reflex-examples/counter working-directory: ./reflex-examples/counter
run: | run: |
poetry run reflex init --loglevel debug poetry run reflex init --loglevel debug
- name: Check export for counter example
working-directory: ./reflex-examples/counter
run: |
poetry run reflex export
- name: Run Website and Check for errors - name: Run Website and Check for errors
run: | run: |
# Check that npm is home # Check that npm is home

View File

@ -11,4 +11,4 @@ echo "Installing reflex from local repo code"
cd /reflex-repo cd /reflex-repo
poetry install poetry install
echo "Running reflex init in test project dir" echo "Running reflex init in test project dir"
poetry run /bin/bash -c "cd ~/hello && reflex init" poetry run /bin/bash -c "cd ~/hello && reflex init && rm -rf ~/.reflex .web && reflex export --backend-only"

View File

@ -108,6 +108,7 @@ def export(
generate_sitemap_config(deploy_url) generate_sitemap_config(deploy_url)
command = "export-sitemap" command = "export-sitemap"
if frontend:
checkpoints = [ checkpoints = [
"Linting and checking ", "Linting and checking ",
"Compiled successfully", "Compiled successfully",
@ -119,7 +120,6 @@ def export(
"Finalizing page optimization", "Finalizing page optimization",
"Export successful", "Export successful",
] ]
# Start the subprocess with the progress bar. # Start the subprocess with the progress bar.
process = processes.new_process( process = processes.new_process(
[prerequisites.get_package_manager(), "run", command], [prerequisites.get_package_manager(), "run", command],

View File

@ -398,7 +398,7 @@ def check_initialized(frontend: bool = True):
Exit: If the app is not initialized. Exit: If the app is not initialized.
""" """
has_config = os.path.exists(constants.CONFIG_FILE) has_config = os.path.exists(constants.CONFIG_FILE)
has_reflex_dir = IS_WINDOWS or os.path.exists(constants.REFLEX_DIR) has_reflex_dir = not frontend or IS_WINDOWS or os.path.exists(constants.REFLEX_DIR)
has_web_dir = not frontend or os.path.exists(constants.WEB_DIR) has_web_dir = not frontend or os.path.exists(constants.WEB_DIR)
# Check if the app is initialized. # Check if the app is initialized.

View File

@ -1,14 +1,21 @@
#!/bin/bash #!/bin/bash
# Change directory to the first argument passed to the script # Change directory to the first argument passed to the script
pushd "$1" || exit 1 project_dir=$1
echo "Changed directory to $1" shift
pushd "$project_dir" || exit 1
echo "Changed directory to $project_dir"
# So we get stdout / stderr from Python ASAP. Without this, delays can be very long (e.g. on Windows, Github Actions) # So we get stdout / stderr from Python ASAP. Without this, delays can be very long (e.g. on Windows, Github Actions)
export PYTHONUNBUFFERED=1 export PYTHONUNBUFFERED=1
env_mode=$1
shift
check_ports=${1:-3000 8000}
shift
# Start the server in the background # Start the server in the background
reflex run --loglevel debug --env "$2" & pid=$! reflex run --loglevel debug --env "$env_mode" "$@" & pid=$!
# Within the context of this bash, $pid_in_bash is what we need to pass to "kill" on exit # Within the context of this bash, $pid_in_bash is what we need to pass to "kill" on exit
# This is true on all platforms. # This is true on all platforms.