From b02b93b6848d147b05d95af7373a28b138c0f5ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diana=20L=C3=B3pez=20Alvas?= Date: Thu, 25 Apr 2024 19:54:59 -0300 Subject: [PATCH] vite prefix --- package-lock.json | 14 +++----------- .../ActionButtons/ShareChallenge/ShareButton.tsx | 2 +- src/components/footer/Footer.tsx | 4 ++-- src/index.tsx | 4 ++-- src/pbApi.ts | 3 +-- src/pbSession.ts | 2 +- src/test/shareByUrl.test.tsx | 4 ++-- 7 files changed, 12 insertions(+), 21 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8c90ea51..596190a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4143,7 +4143,6 @@ }, "node_modules/@nsis/language-data": { "version": "0.9.0", - "dev": true, "license": "Zlib" }, "node_modules/@octokit/auth-token": { @@ -17985,7 +17984,6 @@ "version": "2.0.8", "resolved": "https://registry.npmjs.org/makensis/-/makensis-2.0.8.tgz", "integrity": "sha512-DEwR7EHnRAQEx5cgvLzHiIjwH471wEfJasa2mTMLuW6byYgY6F+87TiSj8n8C5OYtBCQwA8Fd6S7N0I5ayTvKQ==", - "dev": true, "dependencies": { "@nsis/language-data": "^0.9.0", "dotenv": "^16.3.1", @@ -17997,7 +17995,6 @@ }, "node_modules/makensis/node_modules/dotenv": { "version": "16.3.1", - "dev": true, "license": "BSD-2-Clause", "engines": { "node": ">=12" @@ -18008,7 +18005,6 @@ }, "node_modules/makensis/node_modules/dotenv-expand": { "version": "10.0.0", - "dev": true, "license": "BSD-2-Clause", "engines": { "node": ">=12" @@ -30329,8 +30325,7 @@ } }, "@nsis/language-data": { - "version": "0.9.0", - "dev": true + "version": "0.9.0" }, "@octokit/auth-token": { "version": "3.0.3", @@ -39407,7 +39402,6 @@ "version": "2.0.8", "resolved": "https://registry.npmjs.org/makensis/-/makensis-2.0.8.tgz", "integrity": "sha512-DEwR7EHnRAQEx5cgvLzHiIjwH471wEfJasa2mTMLuW6byYgY6F+87TiSj8n8C5OYtBCQwA8Fd6S7N0I5ayTvKQ==", - "dev": true, "requires": { "@nsis/language-data": "^0.9.0", "dotenv": "^16.3.1", @@ -39415,12 +39409,10 @@ }, "dependencies": { "dotenv": { - "version": "16.3.1", - "dev": true + "version": "16.3.1" }, "dotenv-expand": { - "version": "10.0.0", - "dev": true + "version": "10.0.0" } } }, diff --git a/src/components/creator/Editor/ActionButtons/ShareChallenge/ShareButton.tsx b/src/components/creator/Editor/ActionButtons/ShareChallenge/ShareButton.tsx index ad705088..e49884dd 100644 --- a/src/components/creator/Editor/ActionButtons/ShareChallenge/ShareButton.tsx +++ b/src/components/creator/Editor/ActionButtons/ShareChallenge/ShareButton.tsx @@ -34,7 +34,7 @@ const ShareDialog = ({ open, setDialogOpen }: { open: boolean, setDialogOpen: (o export const ShareModal = () => { const { sharedId } = useContext(CreatorContext) - const sharedLink = process.env.PB_APP_URL + `/#/desafio/guardado/${sharedId}` + const sharedLink = process.env.VITE_PB_APP_URL + `/#/desafio/guardado/${sharedId}` return {sharedId ? diff --git a/src/components/footer/Footer.tsx b/src/components/footer/Footer.tsx index 26c71e3c..c0762ab4 100644 --- a/src/components/footer/Footer.tsx +++ b/src/components/footer/Footer.tsx @@ -17,10 +17,10 @@ export const PBLink = (props: LinkProps & PBLinkProps) => { - if(!process.env.APP_VERSION) throw new Error("Missing Pilas Bloques version. ENV not set") + if(!process.env.VITE_APP_VERSION) throw new Error("Missing Pilas Bloques version. ENV not set") const {t} = useTranslation("footer") - const appVersion = process.env.APP_VERSION + const appVersion = process.env.VITE_APP_VERSION const newsUrl = new URL(`/novedades`, siteUrl).toString() const lastCommitHash = process.env.VITE_GIT_SHORT_COMMIT_HASH const repoUrl = `https://github.com/Program-AR/pilas-bloques-app/tree/${process.env.VITE_GIT_COMMIT_HASH}` diff --git a/src/index.tsx b/src/index.tsx index a392dbec..3d3944fa 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -9,8 +9,8 @@ import { ThemeContextProvider } from './theme/ThemeContext'; import { PBProgress } from "./components/PBProgress"; -if (process.env.GOOGLE_ANALYTICS_KEY) { - ReactGA.initialize(process.env.GOOGLE_ANALYTICS_KEY); +if (process.env.VITE_GOOGLE_ANALYTICS_KEY) { + ReactGA.initialize(process.env.VITE_GOOGLE_ANALYTICS_KEY); } const root = ReactDOM.createRoot( diff --git a/src/pbApi.ts b/src/pbApi.ts index d48e8d53..33dc1128 100644 --- a/src/pbApi.ts +++ b/src/pbApi.ts @@ -96,7 +96,7 @@ export namespace PilasBloquesApi{ return isValid } - export const baseURL = window.PBRuntime?.apiURL || process.env.API_URL + export const baseURL = window.PBRuntime?.apiURL || process.env.VITE_API_URL async function bodyWithContext(body?: T) { return body ? { @@ -115,7 +115,6 @@ export namespace PilasBloquesApi{ if(user) headers.append('Authorization', `Bearer ${user.token}`) console.log(url) - console.log(body) return _doFetch(url, { method, diff --git a/src/pbSession.ts b/src/pbSession.ts index be598649..469a0514 100644 --- a/src/pbSession.ts +++ b/src/pbSession.ts @@ -27,7 +27,7 @@ export namespace PBSession { online: online(), browserId: null, userId: LocalStorage.getUser(), - version: process.env.APP_VERSION, + version: process.env.VITE_APP_VERSION, experimentGroup: 'off', url: window.location.href, ip: await userIp(), diff --git a/src/test/shareByUrl.test.tsx b/src/test/shareByUrl.test.tsx index bc011142..481f12c1 100644 --- a/src/test/shareByUrl.test.tsx +++ b/src/test/shareByUrl.test.tsx @@ -102,7 +102,7 @@ describe("Share by url", () => { await shareChallenge() const urlText = await screen.findByRole('textbox') - expect(urlText.getAttribute('value')).toBe(`${process.env.PB_APP_URL}/#/desafio/guardado/shared`) + expect(urlText.getAttribute('value')).toBe(`${process.env.VITE_PB_APP_URL}/#/desafio/guardado/shared`) }) test("Should change to save button on challenge share", async () => { @@ -130,7 +130,7 @@ describe("Share by url", () => { const urlText = await screen.findByRole('textbox') //The url text is not changing in the text - expect(urlText.getAttribute('value')).toBe(`${process.env.PB_APP_URL}/#/desafio/guardado/newShared`) + expect(urlText.getAttribute('value')).toBe(`${process.env.VITE_PB_APP_URL}/#/desafio/guardado/newShared`) }) })