build(mp-harmony): 添加components_diy和页面模块的构建配置
同时新增清理华为IDE内置node路径的脚本,以及空的权限检查文件
This commit is contained in:
62
remove-huawei-node-from-path.ps1
Normal file
62
remove-huawei-node-from-path.ps1
Normal file
@@ -0,0 +1,62 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$target = 'C:\Program Files\Huawei QuickApp IDE\resources\app\extensions\deveco-debug\lib\toolkit\nodeTool'
|
||||
|
||||
$before = [Environment]::GetEnvironmentVariable('Path', 'Machine')
|
||||
|
||||
Write-Host '=== Before: target entries in Machine PATH ==='
|
||||
$before -split ';' | ForEach-Object {
|
||||
if ($_.Trim() -ieq $target) {
|
||||
Write-Host (" [" + $_ + "]")
|
||||
}
|
||||
}
|
||||
|
||||
$entries = $before -split ';'
|
||||
$kept = New-Object System.Collections.Generic.List[string]
|
||||
$removed = New-Object System.Collections.Generic.List[string]
|
||||
foreach ($e in $entries) {
|
||||
$t = $e.Trim()
|
||||
if ($t -ieq $target) {
|
||||
$removed.Add($e)
|
||||
} elseif ($t -ne '') {
|
||||
$kept.Add($e)
|
||||
}
|
||||
}
|
||||
$after = [string]::Join(';', $kept.ToArray())
|
||||
|
||||
if ($removed.Count -eq 0) {
|
||||
Write-Host 'Target entry not found, nothing to do.'
|
||||
exit 0
|
||||
}
|
||||
|
||||
try {
|
||||
[Environment]::SetEnvironmentVariable('Path', $after, 'Machine')
|
||||
Write-Host ''
|
||||
Write-Host '=== Result ==='
|
||||
Write-Host (" Removed entries: " + $removed.Count)
|
||||
foreach ($r in $removed) { Write-Host (" - " + $r) }
|
||||
Write-Host (" Remaining entries: " + $kept.Count)
|
||||
Write-Host ' Write OK.'
|
||||
} catch {
|
||||
Write-Host ''
|
||||
Write-Host (' Write FAILED (admin required?): ' + $_.Exception.Message)
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host ''
|
||||
Write-Host '=== Verify after write ==='
|
||||
$verify = [Environment]::GetEnvironmentVariable('Path', 'Machine')
|
||||
$stillThere = 0
|
||||
foreach ($e in ($verify -split ';')) {
|
||||
if ($e.Trim() -ieq $target) { $stillThere++ }
|
||||
}
|
||||
if ($stillThere -gt 0) {
|
||||
Write-Host ' FAIL: target still present.'
|
||||
exit 1
|
||||
} else {
|
||||
Write-Host ' OK: target no longer in Machine PATH.'
|
||||
}
|
||||
|
||||
Write-Host ''
|
||||
Write-Host 'Note: env var change does NOT affect already-running processes.'
|
||||
Write-Host 'Reopen cmd / Git Bash / HBuilderX to see updated where node.'
|
||||
Reference in New Issue
Block a user