This commit is contained in:
pakintada@gmail.com 2024-01-15 11:49:09 +07:00
commit d4478222eb
4 changed files with 32 additions and 12 deletions

View file

@ -30,11 +30,19 @@ We have some environment variables to control app behavior. The environment vari
> note: All the environment variables can access through `import.meta.env.{VARIABLE_NAME}`.
> note: In development mode, you can create a `.env.development.local` file in the root directory of the project to set environment variables.
> note: In development, you can create a `.env.local` file in the root directory of the project to set environment variables.
## Environment Mode
In this Client project, we have two environment modes: `electron` and `web`. Business logic will be different in these two modes. you wrap the code in `if (import.meta.env.MODE === 'electron')` to run the code in electron mode. You can also use `if (import.meta.env.MODE === 'web')` to run the code in web mode.
The reason why we have two environment modes is that in electron we have to use native modules for example `deeplink` to handle login callback. But in web, we have to use `window.location.href` to handle login callback.
> In Development, the default if to run cmd `npm run dev` is will run in both electron and web mode. If you want to run in electron or web mode, you can run `npm run dev:electron` or `npm run dev:web`.
## Environment Variables List
In this section, we will list all the environment variables. That app will use the default value if you don't set the environment variables.
In this section, we will list all the environment variables. That app will use in both environment mode the default value if you don't set the environment variables.
> dev: if you add new environment variables, please add it to this section.

View file

@ -5,7 +5,7 @@
"scripts": {
"dev": "concurrently \"npm run dev:electron\" \"npm run dev:web\"",
"dev:electron": "vite -c vite.config.electron.ts",
"dev:web": "vite -c vite.config.web.ts",
"dev:web": "vite -c vite.config.web.ts --open",
"build": "concurrently \"npm run build:electron\" \"npm run build:web\"",
"build:electron": "tsc && vite build -c vite.config.electron.ts --mode=production && electron-builder",
"build:web": "tsc && vite build -c vite.config.web.ts --mode=production",

View file

@ -2,10 +2,13 @@
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"lib": [
"ES2020",
"DOM",
"DOM.Iterable"
],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
@ -13,13 +16,19 @@
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src", "electron"],
"references": [{ "path": "./tsconfig.node.json" }]
"include": [
"src",
"electron"
],
"references": [
{
"path": "./tsconfig.node.json"
}
]
}

View file

@ -19,6 +19,9 @@
"database": "${workspaceFolder:server}/data/database.db"
}
],
"sqltools.useNodeRuntime": true
"sqltools.useNodeRuntime": true,
"cSpell.words": [
"TAOBIN"
]
}
}