Refactor site update logic in ConfigStore and format JSON structure in package.json for better readability
This commit is contained in:
parent
24dc4c739b
commit
9103faec32
@ -187,20 +187,16 @@ export class ConfigStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSite(originalName: string, site: any): void {
|
|
||||||
const sites = this.store.get('sites')
|
|
||||||
const index = sites.findIndex(s => s.name === originalName)
|
|
||||||
if (index > -1) {
|
|
||||||
sites[index] = site
|
|
||||||
this.store.set('sites', sites)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
updateSite(name: string, site: Partial<SiteConfig>): void {
|
updateSite(name: string, site: Partial<SiteConfig>): void {
|
||||||
const sites = this.store.get('sites')
|
const sites = this.store.get('sites')
|
||||||
const index = sites.findIndex(s => s.name === name)
|
const index = sites.findIndex(s => s.name === name)
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
sites[index] = { ...sites[index], ...site }
|
// 如果传入完整对象则替换,否则合并
|
||||||
|
if (site.domain && site.rootPath) {
|
||||||
|
sites[index] = site as SiteConfig
|
||||||
|
} else {
|
||||||
|
sites[index] = { ...sites[index], ...site }
|
||||||
|
}
|
||||||
this.store.set('sites', sites)
|
this.store.set('sites', sites)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
13
package.json
13
package.json
@ -53,7 +53,9 @@
|
|||||||
"target": [
|
"target": [
|
||||||
{
|
{
|
||||||
"target": "nsis",
|
"target": "nsis",
|
||||||
"arch": ["x64"]
|
"arch": [
|
||||||
|
"x64"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"requestedExecutionLevel": "requireAdministrator"
|
"requestedExecutionLevel": "requireAdministrator"
|
||||||
@ -66,7 +68,10 @@
|
|||||||
"createDesktopShortcut": true,
|
"createDesktopShortcut": true,
|
||||||
"createStartMenuShortcut": true,
|
"createStartMenuShortcut": true,
|
||||||
"shortcutName": "PHPer开发环境管理器",
|
"shortcutName": "PHPer开发环境管理器",
|
||||||
"installerLanguages": ["zh_CN", "en_US"],
|
"installerLanguages": [
|
||||||
|
"zh_CN",
|
||||||
|
"en_US"
|
||||||
|
],
|
||||||
"language": "2052",
|
"language": "2052",
|
||||||
"runAfterFinish": true,
|
"runAfterFinish": true,
|
||||||
"deleteAppDataOnUninstall": false,
|
"deleteAppDataOnUninstall": false,
|
||||||
@ -76,7 +81,9 @@
|
|||||||
{
|
{
|
||||||
"from": "public/",
|
"from": "public/",
|
||||||
"to": "public/",
|
"to": "public/",
|
||||||
"filter": ["**/*"]
|
"filter": [
|
||||||
|
"**/*"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user