mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 11:07:06 +00:00
feat: 优化开发环境配置
This commit is contained in:
parent
7c21782ab5
commit
a8d2d6f13f
1
.github/workflows/publish.yml
vendored
1
.github/workflows/publish.yml
vendored
@ -4,7 +4,6 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "pro"
|
- "pro"
|
||||||
- "dev"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-version:
|
check-version:
|
||||||
|
|||||||
@ -61,6 +61,10 @@ class IndexController extends InvokeController
|
|||||||
$array = Base::json2array(file_get_contents($hotFile));
|
$array = Base::json2array(file_get_contents($hotFile));
|
||||||
$style = null;
|
$style = null;
|
||||||
$script = preg_replace("/^(\/\/(.*?))(:\d+)?\//i", "$1:" . $array['APP_DEV_PORT'] . "/", asset_main("resources/assets/js/app.js"));
|
$script = preg_replace("/^(\/\/(.*?))(:\d+)?\//i", "$1:" . $array['APP_DEV_PORT'] . "/", asset_main("resources/assets/js/app.js"));
|
||||||
|
$proxyUri = env('VSCODE_PROXY_URI');
|
||||||
|
if (is_string($proxyUri) && preg_match('/^https?:\/\//i', $proxyUri)) {
|
||||||
|
$script = preg_replace('/^(https?:\/\/|\/\/)[^\/]+/', rtrim($proxyUri, '/'), $script, 1);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$array = Base::json2array(file_get_contents($manifestFile));
|
$array = Base::json2array(file_get_contents($manifestFile));
|
||||||
$style = asset_main($array['resources/assets/js/app.js']['css'][0]);
|
$style = asset_main($array['resources/assets/js/app.js']['css'][0]);
|
||||||
|
|||||||
10
cmd
10
cmd
@ -175,7 +175,13 @@ web_build() {
|
|||||||
fi
|
fi
|
||||||
if [ "$type" = "dev" ]; then
|
if [ "$type" = "dev" ]; then
|
||||||
echo "<script>window.location.href=window.location.href.replace(/:\d+/, ':' + $(env_get APP_PORT))</script>" > ./index.html
|
echo "<script>window.location.href=window.location.href.replace(/:\d+/, ':' + $(env_get APP_PORT))</script>" > ./index.html
|
||||||
env_set APP_DEV_PORT $(rand 20001 30000)
|
if [[ -z "$(env_get APP_DEV_PORT)" ]] || [[ -z "${VSCODE_PROXY_URI:-}" ]]; then
|
||||||
|
env_set APP_DEV_PORT $(rand 20001 30000)
|
||||||
|
fi
|
||||||
|
if [ -n "${VSCODE_PROXY_URI:-}" ]; then
|
||||||
|
VSCODE_PROXY_URI=$(APP_DEV_PORT="$(env_get APP_DEV_PORT)" node -p "process.env.VSCODE_PROXY_URI.replace(/\{\{port\}\}/g, process.env.APP_DEV_PORT || '')")
|
||||||
|
fi
|
||||||
|
env_set VSCODE_PROXY_URI "${VSCODE_PROXY_URI:-}"
|
||||||
fi
|
fi
|
||||||
switch_debug "$type"
|
switch_debug "$type"
|
||||||
#
|
#
|
||||||
@ -479,7 +485,7 @@ handle_install() {
|
|||||||
for vol in "${volumes[@]}"; do
|
for vol in "${volumes[@]}"; do
|
||||||
tmp_path="${WORK_DIR}/${vol}"
|
tmp_path="${WORK_DIR}/${vol}"
|
||||||
mkdir -p "${tmp_path}"
|
mkdir -p "${tmp_path}"
|
||||||
chmod -R 775 "${tmp_path}"
|
find "${tmp_path}" -type d -exec chmod 775 {} \;
|
||||||
rm -f "${tmp_path}/dootask.lock"
|
rm -f "${tmp_path}/dootask.lock"
|
||||||
cmda="${cmda} -v ${tmp_path}:/usr/share/${vol}"
|
cmda="${cmda} -v ${tmp_path}:/usr/share/${vol}"
|
||||||
cmdb="${cmdb} touch /usr/share/${vol}/dootask.lock &&"
|
cmdb="${cmdb} touch /usr/share/${vol}/dootask.lock &&"
|
||||||
|
|||||||
2
resources/assets/js/app.js
vendored
2
resources/assets/js/app.js
vendored
@ -2,6 +2,8 @@ const isElectron = !!(window && window.process && window.process.type && window.
|
|||||||
const isEEUIApp = window && window.navigator && /eeui/i.test(window.navigator.userAgent);
|
const isEEUIApp = window && window.navigator && /eeui/i.test(window.navigator.userAgent);
|
||||||
const isSoftware = isElectron || isEEUIApp;
|
const isSoftware = isElectron || isEEUIApp;
|
||||||
|
|
||||||
|
document.getElementById("app")?.setAttribute("data-preload", "false");
|
||||||
|
|
||||||
import {languageName, switchLanguage as $L} from "./language";
|
import {languageName, switchLanguage as $L} from "./language";
|
||||||
import {isLocalHost} from "./components/Replace/utils";
|
import {isLocalHost} from "./components/Replace/utils";
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
<body>
|
<body>
|
||||||
|
|
||||||
@extends('ie')
|
@extends('ie')
|
||||||
<div id="app" data-preload="false">
|
<div id="app" data-preload="init">
|
||||||
<div class="app-view-loading no-dark-content">
|
<div class="app-view-loading no-dark-content">
|
||||||
<div>
|
<div>
|
||||||
<div>PAGE LOADING</div>
|
<div>PAGE LOADING</div>
|
||||||
|
|||||||
15
vite.config.js
vendored
15
vite.config.js
vendored
@ -22,6 +22,7 @@ export default defineConfig(({command, mode}) => {
|
|||||||
const env = loadEnv(mode, process.cwd(), '')
|
const env = loadEnv(mode, process.cwd(), '')
|
||||||
const host = "0.0.0.0"
|
const host = "0.0.0.0"
|
||||||
const port = parseInt(env['APP_DEV_PORT'])
|
const port = parseInt(env['APP_DEV_PORT'])
|
||||||
|
const proxy_uri = env['VSCODE_PROXY_URI']
|
||||||
|
|
||||||
if (command === 'serve') {
|
if (command === 'serve') {
|
||||||
const hotFile = path.resolve(__dirname, 'public/hot')
|
const hotFile = path.resolve(__dirname, 'public/hot')
|
||||||
@ -80,6 +81,17 @@ export default defineConfig(({command, mode}) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const serverHmr = {}
|
||||||
|
if (/^https?:\/\//i.test(proxy_uri)) {
|
||||||
|
const proxyUri = new URL(proxy_uri)
|
||||||
|
if (proxyUri) {
|
||||||
|
Object.assign(serverHmr, {
|
||||||
|
host: proxyUri.host,
|
||||||
|
clientPort: proxyUri.port || (/^https/.test(proxy_uri) ? 443 : 80)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
base: basePath,
|
base: basePath,
|
||||||
publicDir: publicPath,
|
publicDir: publicPath,
|
||||||
@ -98,7 +110,8 @@ export default defineConfig(({command, mode}) => {
|
|||||||
'**/language/**',
|
'**/language/**',
|
||||||
'**/electron/**',
|
'**/electron/**',
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
hmr: serverHmr
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user