diff --git a/.github/workflows/build-host.yml b/.github/workflows/build-host.yml index eb99f65146..7ebe755c7d 100644 --- a/.github/workflows/build-host.yml +++ b/.github/workflows/build-host.yml @@ -25,13 +25,11 @@ jobs: INPUT_ENVIRONMENT: ${{ inputs.environment }} run: | if [ "$INPUT_ENVIRONMENT" = "production" ]; then - echo "OWN_REALM_URL=https://app.boxel.ai/experiments/" >> $GITHUB_ENV echo "RESOLVED_BASE_REALM_URL=https://app.boxel.ai/base/" >> $GITHUB_ENV echo "MATRIX_URL=https://matrix.boxel.ai" >> $GITHUB_ENV echo "MATRIX_SERVER_NAME=boxel.ai" >> $GITHUB_ENV echo "EXPERIMENTAL_AI_ENABLED=true" >> $GITHUB_ENV elif [ "$INPUT_ENVIRONMENT" = "staging" ]; then - echo "OWN_REALM_URL=https://realms-staging.stack.cards/experiments/" >> $GITHUB_ENV echo "RESOLVED_BASE_REALM_URL=https://realms-staging.stack.cards/base/" >> $GITHUB_ENV echo "MATRIX_URL=https://matrix-staging.stack.cards" >> $GITHUB_ENV echo "MATRIX_SERVER_NAME=stack.cards" >> $GITHUB_ENV diff --git a/.github/workflows/pr-boxel-host.yml b/.github/workflows/pr-boxel-host.yml index 6929080e8b..3682ae213c 100644 --- a/.github/workflows/pr-boxel-host.yml +++ b/.github/workflows/pr-boxel-host.yml @@ -56,7 +56,6 @@ jobs: - name: Deploy boxel-host preview uses: ./.github/actions/deploy-ember-preview env: - OWN_REALM_URL: https://realms-staging.stack.cards/experiments/ RESOLVED_BASE_REALM_URL: https://realms-staging.stack.cards/base/ MATRIX_URL: https://matrix-staging.stack.cards MATRIX_SERVER_NAME: stack.cards @@ -87,7 +86,6 @@ jobs: - name: Deploy boxel-host preview uses: ./.github/actions/deploy-ember-preview env: - OWN_REALM_URL: https://app.boxel.ai/experiments/ RESOLVED_BASE_REALM_URL: https://app.boxel.ai/base/ MATRIX_URL: https://matrix.boxel.ai MATRIX_SERVER_NAME: boxel.ai diff --git a/README.md b/README.md index 1bddceb8d6..5def205cf8 100644 --- a/README.md +++ b/README.md @@ -47,12 +47,10 @@ In order to run the ember-cli hosted app: 1. `pnpm build` in the boxel-ui/addon workspace to build the boxel-ui addon. 2. `pnpm build` in the boxel-motion/addon workspace to build the boxel-motion addon. -3. `pnpm start` in the host/ workspace to serve the ember app. Note that this script includes the environment variable `OWN_REALM_URL=http://localhost:4201/experiments/` which configures the host to point to the experiments realm's cards realm by default. +3. `pnpm start` in the host/ workspace to serve the ember app. 4. `pnpm start:all` in the realm-server/ to serve the base and experiments realms -- this will also allow you to switch between the app and the tests without having to restart servers). This expects the Ember application to be running at `http://localhost:4200`, if you’re running it elsewhere you can specify it with `HOST_URL=http://localhost:5200 pnpm start:all`. -The app is available at http://localhost:4200. It will serve the experiments realm (configurable with OWN_REALM_URL, as mentioned above). You can open the base and experiments cards workspace directly by entering http://localhost:4201/base or http://localhost:4201/experiments in the browser. - -If you want to use operator mode, you need to register an account on Matrix. To make it easier, you can execute `pnpm register-test-user` in `packages/matrix/`. Now you can sign in with the test user using the credentials `username: user`, `password: password`. +The app is available at http://localhost:4200. You will be prompted to register an account. To make it easier, you can execute `pnpm register-test-user` in `packages/matrix/`. Now you can sign in with the test user using the credentials `username: user`, `password: password`. When you are done running the app you can stop the synapse server by running the following from the `packages/matrix` workspace: diff --git a/packages/boxel-ui/addon/bin/conditional-build.sh b/packages/boxel-ui/addon/bin/conditional-build.sh new file mode 100755 index 0000000000..e489b8edad --- /dev/null +++ b/packages/boxel-ui/addon/bin/conditional-build.sh @@ -0,0 +1,25 @@ +#! /bin/sh + +CURRENT_DIR="$(pwd)" +SCRIPTS_DIR="$(cd "$(dirname "$0")" && pwd)" + +SRC_DIR="${SCRIPTS_DIR}/../src" +DIST_DIR="${SCRIPTS_DIR}/../dist" + +if [ ! -d "$DIST_DIR" ]; then + echo "boxel-ui/addon dist dir does not exist. Building in ${SRC_DIR}/.." + cd "${SRC_DIR}/.." + pnpm run build + exit 0 +fi + +mod_time_src=$(find "$SRC_DIR" -type f -exec stat -f %m {} + | sort -nr | head -n1) +mod_time_dist=$(find "$DIST_DIR" -type f -exec stat -f %m {} + | sort -nr | head -n1) + +if [ "$mod_time_src" -gt "$mod_time_dist" ]; then + echo "boxel-ui/addon dist dir is out of date. Building in ${SRC_DIR}/.." + cd "${SRC_DIR}/.." + pnpm run build +else + echo "✔️ boxel-ui/addon dist dir is up to date" +fi diff --git a/packages/host/package.json b/packages/host/package.json index 117d1c1a40..16706a64ff 100644 --- a/packages/host/package.json +++ b/packages/host/package.json @@ -21,7 +21,8 @@ "lint:js": "eslint . --cache", "lint:js:fix": "eslint . --fix", "lint:glint": "glint", - "start": "NODE_OPTIONS='--max-old-space-size=8192' FASTBOOT_DISABLED=true OWN_REALM_URL=http://localhost:4201/experiments/ ember serve", + "ensure-boxel-ui": "../boxel-ui/addon/bin/conditional-build.sh", + "start": "pnpm ensure-boxel-ui && NODE_OPTIONS='--max-old-space-size=8192' FASTBOOT_DISABLED=true ember serve", "start:build": "NODE_OPTIONS='--max-old-space-size=8192' FASTBOOT_DISABLED=true ember build --watch", "test": "concurrently \"pnpm:lint\" \"pnpm:test:*\" --names \"lint,test:\"", "test-with-percy": "percy exec --parallel -- pnpm test:wait-for-servers",