diff --git a/.env b/.env index 7de816505..e10a70f1c 100644 --- a/.env +++ b/.env @@ -1,2 +1,3 @@ VITE_VERSION=$npm_package_version VITE_NAME=$npm_package_name +VITE_FULL_URL=/ diff --git a/.gitignore b/.gitignore index be4846622..dbbfdf145 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. +.env + # dependencies /node_modules /.pnp diff --git a/bin/print-ci-env-public-url.cjs b/bin/print-ci-env-public-url.cjs index d629a2650..7384a5c9f 100644 --- a/bin/print-ci-env-public-url.cjs +++ b/bin/print-ci-env-public-url.cjs @@ -1,12 +1,16 @@ #!/usr/bin/env node -let url; +let baseUrl; if (process.env.GITHUB_REPOSITORY_OWNER === "microbit-foundation") { // STAGE must be defined before this is imported const { bucketPrefix } = require("../deployment.cjs"); - url = `/${bucketPrefix}/`; + baseUrl = `/${bucketPrefix}/`; } else { - url = "/"; + baseUrl = "/"; } +const fullUrl = `https://${bucketName}${baseUrl}`; + // Two env vars as PUBLIC_URL seems to be blank when running jest even if we set it. -console.log(`PUBLIC_URL=${url}`); -console.log(`E2E_PUBLIC_URL=${url}`); +console.log(`PUBLIC_URL=${baseUrl}`); +console.log(`E2E_PUBLIC_URL=${baseUrl}`); +// This is used for og:url and similar. Not quite right for review domain but we don't really care. +console.log(`VITE_FULL_URL=${fullUrl}`);