Skip to content

Commit

Permalink
chore(env): base url
Browse files Browse the repository at this point in the history
  • Loading branch information
Novout committed Mar 17, 2022
1 parent 4262ae1 commit 6f1fed6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions packages/better-write-app/.env.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ VITE_EMPTY_LINE=__EMPTY_LINE__
VITE_LINE_BREAK=__LINE_BREAK__
VITE_PAGE_BREAK=__PAGE_BREAK__
VITE_INITIAL_LOAD=__INITIAL_LOAD__
VITE_BASE_URL=https://better-write.vercel.app/

// Google Fonts API
VITE_GOOGLE_FONTS_KEY=
Expand Down
1 change: 1 addition & 0 deletions packages/better-write-app/src/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface ImportMetaEnv {
readonly VITE_LINE_BREAK: string
readonly VITE_PAGE_BREAK: string
readonly VITE_INITIAL_LOAD: string
readonly VITE_BASE_URL: string

readonly VITE_GOOGLE_FONTS_KEY: string
readonly VITE_GOOGLE_FONTS_MAX_FONTS: number
Expand Down
16 changes: 8 additions & 8 deletions packages/better-write-app/src/use/env.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
export const useEnv = () => {
const getCorrectLocalUrl = () => {
return import.meta.env.PROD
? 'https://better-write.vercel.app'
? import.meta.env.VITE_BASE_URL
: 'http://localhost:3000'
}

const projectEmpty = (): string => {
return import.meta.env.VITE_PROJECT_EMPTY as string
return import.meta.env.VITE_PROJECT_EMPTY
}

const projectLocalStorage = () => {
return import.meta.env.VITE_LOCAL_STORAGE as string
return import.meta.env.VITE_LOCAL_STORAGE
}

const isEmptyProject = (name: string) => {
return name === useEnv().projectEmpty()
}

const dropboxKey = () => {
return import.meta.env.VITE_DROPBOX_APP_KEY as string
return import.meta.env.VITE_DROPBOX_APP_KEY
}

const maxFonts = () => {
Expand All @@ -30,19 +30,19 @@ export const useEnv = () => {
}

const emptyLine = () => {
return import.meta.env.VITE_EMPTY_LINE as string
return import.meta.env.VITE_EMPTY_LINE
}

const lineBreak = () => {
return import.meta.env.VITE_LINE_BREAK as string
return import.meta.env.VITE_LINE_BREAK
}

const pageBreak = () => {
return import.meta.env.VITE_PAGE_BREAK as string
return import.meta.env.VITE_PAGE_BREAK
}

const initialLoad = () => {
return import.meta.env.VITE_INITIAL_LOAD as string
return import.meta.env.VITE_INITIAL_LOAD
}

const packageVersion = () => {
Expand Down
1 change: 1 addition & 0 deletions packages/better-write-app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default defineConfig({
define: {
__VUE_I18N_FULL_INSTALL__: true,
__VUE_I18N_LEGACY_API__: false,
__VUE_I18N_PROD_DEVTOOLS__: false,
__INTLIFY_PROD_DEVTOOLS__: false,
},
plugins: [
Expand Down

0 comments on commit 6f1fed6

Please sign in to comment.