feat: 添加环境配置文件,更新.gitignore以排除dist-test目录,新增构建和预览测试脚本
This commit is contained in:
3
.env.test
Normal file
3
.env.test
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
VITE_API_URL=http://192.168.1.7:9527
|
||||||
|
VITE_TRADINGVIEW_LIBRARY_URL=https://dev.riwsan1.com
|
||||||
|
# VITE_TRADINGVIEW_DATA_API_URL=https://demo-feed-data.tradingview.com
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -26,6 +26,7 @@ npm-debug.log*
|
|||||||
!/.vscode/extensions.json
|
!/.vscode/extensions.json
|
||||||
/coverage
|
/coverage
|
||||||
/dist
|
/dist
|
||||||
|
/dist-test
|
||||||
/dev-dist
|
/dev-dist
|
||||||
/node_modules
|
/node_modules
|
||||||
/platforms
|
/platforms
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
"deploy:cloudflare": "wrangler pages deploy dist --project-name=riwa --branch=main",
|
"deploy:cloudflare": "wrangler pages deploy dist --project-name=riwa --branch=main",
|
||||||
"test:e2e": "cypress run",
|
"test:e2e": "cypress run",
|
||||||
"test:unit": "vitest",
|
"test:unit": "vitest",
|
||||||
|
"test:build": "vite build -m test --outDir dist-test",
|
||||||
|
"test:preview": "vite preview --port 6173 -m test --outDir dist-test",
|
||||||
"lint": "eslint",
|
"lint": "eslint",
|
||||||
"lint:fix": "eslint --fix"
|
"lint:fix": "eslint --fix"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -15,13 +15,14 @@ import { defineConfig } from "vite";
|
|||||||
import { VitePWA } from "vite-plugin-pwa";
|
import { VitePWA } from "vite-plugin-pwa";
|
||||||
import { generateVersion } from "./scripts/build";
|
import { generateVersion } from "./scripts/build";
|
||||||
|
|
||||||
dotenv.config({ path: `.env.${process.env.NODE_ENV}` });
|
|
||||||
|
|
||||||
const packageJson = JSON.parse(fs.readFileSync("./package.json", "utf-8"));
|
const packageJson = JSON.parse(fs.readFileSync("./package.json", "utf-8"));
|
||||||
const appVersion = packageJson.version;
|
const appVersion = packageJson.version;
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig(({ mode }) => {
|
||||||
|
dotenv.config({ path: `.env.${mode}` });
|
||||||
|
|
||||||
|
return {
|
||||||
plugins: [
|
plugins: [
|
||||||
vue(),
|
vue(),
|
||||||
jsx(),
|
jsx(),
|
||||||
@@ -102,4 +103,5 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user