Skip to content

Commit

Permalink
24th Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Shyam-Chen committed May 31, 2024
1 parent 902028b commit c60806c
Show file tree
Hide file tree
Showing 4 changed files with 318 additions and 446 deletions.
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@vitest/coverage-v8": "^1.4.0",
"@vue/test-utils": "^2.4.5",
"happy-dom": "^14.7.0",
"internal-ip": "^8.0.0",
"private-ip-address": "^1.0.0",
"process-envify": "^2.0.0",
"rimraf": "^5.0.5",
"sass": "^1.74.1",
Expand Down
16 changes: 4 additions & 12 deletions app/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { resolve } from 'node:path';
import { networkInterfaces } from 'node:os';
import vue from '@vitejs/plugin-vue';
import { internalIpV4 } from 'internal-ip';
import { internalIPv4 } from 'private-ip-address';
import { defineConfig } from 'vite';
import vueRoutes from 'vite-plugin-vue-routes';
import tailwindColors from 'tailwindcss/colors';
Expand All @@ -11,16 +10,9 @@ import envify from 'process-envify';

const mobile = !!/android|ios/.exec(process.env.TAURI_ENV_PLATFORM!);

const ipv4Address = Object.values(networkInterfaces())
.flatMap((nInterface) => nInterface ?? [])
.filter(
(detail) =>
detail && detail.address && detail.family === 'IPv4' && detail.address !== '127.0.0.1',
)[0].address;

export default defineConfig(async () => ({
define: envify({
API_URL: mobile ? `http://${ipv4Address}:3000` : process.env.API_URL || '',
API_URL: mobile ? `http://${internalIPv4()}:3000` : process.env.API_URL || '',
}),
plugins: [
vue(),
Expand Down Expand Up @@ -58,8 +50,8 @@ export default defineConfig(async () => ({
},
port: 1420,
strictPort: true,
host: mobile ? '0.0.0.0' : false,
hmr: mobile ? { protocol: 'ws', host: await internalIpV4(), port: 1421 } : undefined,
host: mobile ? internalIPv4() : false,
hmr: mobile ? { protocol: 'ws', host: internalIPv4(), port: 1421 } : undefined,
watch: {
ignored: ['**/src-tauri/**'],
},
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
"e2e": "pnpm -C e2e e2e"
},
"devDependencies": {
"@biomejs/biome": "^1.6.4",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-typescript": "^13.0.0",
"eslint": "^9.0.0",
"eslint-plugin-vue": "^9.24.0",
"prettier": "^3.2.5"
"@biomejs/biome": "1.7.3",
"@vue/eslint-config-prettier": "9.0.0",
"@vue/eslint-config-typescript": "13.0.0",
"eslint": "8.57.0",
"eslint-plugin-vue": "9.26.0",
"prettier": "3.2.5"
}
}
Loading

0 comments on commit c60806c

Please sign in to comment.