Skip to content

Commit

Permalink
perf: move env files
Browse files Browse the repository at this point in the history
  • Loading branch information
kaivanwong committed Dec 5, 2023
1 parent 858e114 commit dabfef9
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 38 deletions.
Empty file removed .vite/constants.ts
Empty file.
2 changes: 2 additions & 0 deletions .vite/env/.env.development → env/.env.development
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
VITE_ENV_MODE = development
VITE_BASE_URL = /

APP_NAME = "Opuntia"
2 changes: 2 additions & 0 deletions .vite/env/.env.production → env/.env.production
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
VITE_ENV_MODE = production
VITE_BASE_URL = /

APP_NAME = "Opuntia"
2 changes: 2 additions & 0 deletions .vite/env/.env.staging → env/.env.staging
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
VITE_ENV_MODE = staging
VITE_BASE_URL = /

APP_NAME = "Opuntia"
23 changes: 13 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.svg">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Opuntia</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>

<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.svg">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Opuntia</title>
</head>

<body>
<div id="app" />
<script type="module" src="/src/main.ts"></script>
</body>

</html>
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"dev": "vite",
"build": "run-p type-check build-only",
"preview": "vite preview",
"test": "vitest",
"test:unit": "vitest",
"test:e2e": "start-server-and-test preview http://localhost:4173 'cypress run --e2e'",
"test:e2e:dev": "start-server-and-test 'vite dev --port 4173' http://localhost:4173 'cypress open --e2e'",
"test:e2e": "cypress open",
"build-only": "vite build",
"type-check": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false"
"type-check": "vue-tsc --noEmit"
},
"dependencies": {
"pinia": "^2.1.7",
Expand Down
15 changes: 5 additions & 10 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"extends": "@vue/tsconfig/tsconfig.json",
"extends": "@vue/tsconfig/tsconfig.dom.json",
"compilerOptions": {
"composite": true,
"lib": ["DOM", "ESNext"],
"baseUrl": ".",
"paths": {
"@/*": [
"./src/*"
"src/*"
]
},
"types": [
Expand All @@ -18,14 +16,11 @@
"noUnusedLocals": true
},
"include": [
"env.d.ts",
"mock/**/*",
"src/**/*",
"src/**/*.vue",
"types/**/*",
"vite.config.*",
"vitest.config.*",
"cypress.config.*",
"nightwatch.conf.*",
"playwright.config.*"
"cypress.config.*"
],
"exclude": [
"node_modules",
Expand Down
9 changes: 9 additions & 0 deletions types/env.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
/// <reference types="vite/client" />

interface ImportMetaEnv {
readonly VITE_ENV_MODE: string
readonly VITE_BASE_URL: string
}

interface ImportMeta {
readonly env: ImportMetaEnv
}
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import vueJsx from '@vitejs/plugin-vue-jsx'
export default (options: ConfigEnv) => {
const { mode } = options

const envDir = '.vite/env/'
const envDir = 'env/'

const env = loadEnv(mode, envDir, ['VITE_', 'APP_', 'AXIOS_'])

Expand Down
14 changes: 0 additions & 14 deletions vitest.config.ts

This file was deleted.

0 comments on commit dabfef9

Please sign in to comment.