Refactor batch scripts and cleanup
- Refactored `cmd/build-commit.bat` and `cmd/release-commit.bat` to improve commit message handling and force push logic. - Deleted obsolete `cmd/pdca0-fe.bat`. - Added new command: `cmd/pdca0-fe.ps1`, that uses the new script implementation of the old `cmd/pdca0-fe.bat` using the `src/darwin/frontend` scripts folder. - Removed unused or obsolete files.
This commit is contained in:
parent
08b2e3ac1a
commit
983291082c
@ -1,7 +1,13 @@
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
call git commit --allow-empty -m "build"
|
||||
set "commit_message=build"
|
||||
if "%~1" neq "" (
|
||||
set "commit_message=build %~1"
|
||||
)
|
||||
|
||||
if "%~1" neq "false" (
|
||||
call git push
|
||||
call git commit --allow-empty -m "!commit_message!"
|
||||
|
||||
if "%~2" neq "false" (
|
||||
call git push -f
|
||||
)
|
164
cmd/pdca0-fe.bat
164
cmd/pdca0-fe.bat
@ -1,164 +0,0 @@
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
set "current_dir=%~dp0..\..\pdca0\"
|
||||
set "is_test=false"
|
||||
if "%~1" == "test" (
|
||||
set "is_test=true"
|
||||
|
||||
set "current_dir=%~dp0..\..\target\"
|
||||
if not exist "!current_dir!" (
|
||||
mkdir "!current_dir!"
|
||||
)
|
||||
)
|
||||
|
||||
set "default_modules="
|
||||
set "config_file=%~dp0pdc-xdce-setup.conf"
|
||||
set "module_name_key=watched_modules"
|
||||
|
||||
if exist %config_file% (
|
||||
for /f "tokens=1,2 delims==" %%A in ('findstr /R "^%module_name_key%=.*" %config_file%') do (
|
||||
set "default_modules=%%B"
|
||||
)
|
||||
)
|
||||
|
||||
:: Prompt for the module to watch
|
||||
set /p modules="Enter the module or modules (separated with coma) to watch [!default_modules!]: "
|
||||
|
||||
if "!modules!"=="" set "modules=!default_modules!"
|
||||
|
||||
:: Scrivi il valore nel file pdc-xdce-setup.conf
|
||||
echo %module_name_key%=%modules%> "%~dp0pdc-xdce-setup.conf"
|
||||
|
||||
echo Watched module/s: %modules%
|
||||
|
||||
:: Sostituisce le virgole con spazi
|
||||
set "modules=!modules:,= !"
|
||||
echo !modules!
|
||||
|
||||
:: Itera sulla stringa modificata
|
||||
for %%a in (!modules!) do (
|
||||
echo %%a
|
||||
set "module=%%a"
|
||||
set "module_dir=!current_dir!!module!"
|
||||
|
||||
cd /d !module_dir!
|
||||
|
||||
echo Eseguo controlli su !cd!
|
||||
|
||||
:: Controlla se local-gulpfile.js esiste
|
||||
if not exist "!cd!\local-gulpfile.js" (
|
||||
(
|
||||
echo var gulp = require('gulp'^);
|
||||
echo var path = require('path'^);
|
||||
echo var fileSystem = require('fs'^);
|
||||
echo.
|
||||
echo function emptyFolder(directoryPath^) ^{
|
||||
echo if (fileSystem.existsSync(directoryPath^)^) ^{
|
||||
echo fileSystem.readdirSync(directoryPath^).forEach(function (file^) ^{
|
||||
echo var curPath = path.join(directoryPath, file^);
|
||||
echo if (fileSystem.lstatSync(curPath^).isDirectory(^)^) ^{
|
||||
echo emptyFolder(curPath^);
|
||||
echo fileSystem.rmdirSync(curPath^);
|
||||
echo ^} else ^{
|
||||
echo fileSystem.unlinkSync(curPath^);
|
||||
echo ^}
|
||||
echo ^}^);
|
||||
echo ^}
|
||||
echo ^}
|
||||
echo.
|
||||
echo gulp.task('custom:after-all', function (^)^{
|
||||
echo var mainTask = process.argv.slice(2^)^[0^];
|
||||
echo if (mainTask === 'build:watch_local'^) ^{
|
||||
echo var dest = path.join(process.cwd(^), '..', 'pdca0-deploy-arch', 'node_modules', '@isp', '!module!'^);
|
||||
echo if (!fileSystem.existsSync(dest^)^)^{
|
||||
echo emptyFolder(dest^);
|
||||
echo ^}
|
||||
echo return gulp.src(^`${configuration.distFolder}/**^`^)
|
||||
echo .pipe(gulp.dest(dest^)^);
|
||||
echo ^}
|
||||
echo ^}^);
|
||||
) > "!cd!\local-gulpfile.js"
|
||||
) else (
|
||||
findstr /C:"require('gulp')" "!cd!\local-gulpfile.js" >nul || (
|
||||
echo.
|
||||
echo var gulp = require('gulp'^);
|
||||
echo.
|
||||
) >> "!cd!\local-gulpfile.js"
|
||||
findstr /C:"require('path')" "!cd!\local-gulpfile.js" >nul || (
|
||||
echo.
|
||||
echo var path = require('path'^);
|
||||
echo.
|
||||
) >> "!cd!\local-gulpfile.js"
|
||||
|
||||
findstr /C:"require('path')" "!cd!\local-gulpfile.js" >nul || (
|
||||
echo.
|
||||
echo var path = require('path'^);
|
||||
echo.
|
||||
) >> "!cd!\local-gulpfile.js"
|
||||
|
||||
|
||||
|
||||
findstr /C:"custom:after-all" "!cd!\local-gulpfile.js" >nul || (
|
||||
echo.
|
||||
echo var fileSystem = require('fs'^);
|
||||
echo.
|
||||
echo function emptyFolder(directoryPath^) ^{
|
||||
echo if (fileSystem.existsSync(directoryPath^)^) ^{
|
||||
echo fileSystem.readdirSync(directoryPath^).forEach(function (file^) ^{
|
||||
echo var curPath = path.join(directoryPath, file^);
|
||||
echo if (fileSystem.lstatSync(curPath^).isDirectory(^)^) ^{
|
||||
echo emptyFolder(curPath^);
|
||||
echo fileSystem.rmdirSync(curPath^);
|
||||
echo ^} else ^{
|
||||
echo fileSystem.unlinkSync(curPath^);
|
||||
echo ^}
|
||||
echo ^}^);
|
||||
echo ^}
|
||||
echo ^}
|
||||
echo.
|
||||
echo gulp.task('custom:after-all', function (^)^{
|
||||
echo var mainTask = process.argv.slice(2^)^[0^];
|
||||
echo if (mainTask === 'build:watch_local'^) ^{
|
||||
echo var dest = path.join(process.cwd(^), '..', 'pdca0-deploy-arch', 'node_modules', '@isp', '!module!'^);
|
||||
echo if (!fileSystem.existsSync(dest^)^)^{
|
||||
echo emptyFolder(dest^);
|
||||
echo ^}
|
||||
echo return gulp.src(^`${configuration.distFolder}/**^`^)
|
||||
echo .pipe(gulp.dest(dest^)^);
|
||||
echo ^}
|
||||
echo ^}^);
|
||||
) >> "!cd!\local-gulpfile.js"
|
||||
)
|
||||
|
||||
:: Controllo esistenza node_modules e package-lock.json
|
||||
if not exist "!cd!\node_modules" (
|
||||
echo node_modules non esiste, eseguo npm install...
|
||||
npm install
|
||||
) else if not exist "!cd!\package-lock.json" (
|
||||
echo package-lock.json non esiste, eseguo npm install...
|
||||
npm install
|
||||
)
|
||||
|
||||
echo Avvio e !module!
|
||||
:: Esegue npm run build:watch_local
|
||||
start cmd /k "npm run build:watch_local"
|
||||
)
|
||||
|
||||
|
||||
netstat -ano | findstr :4200 >nul
|
||||
if errorlevel 1 (
|
||||
set "deploy_name=pdca0-deploy-arch"
|
||||
echo Attendi 15 secondi prima di avviare !deploy_name!...
|
||||
|
||||
:: Attendi 15 secondi
|
||||
timeout /t 15 /nobreak
|
||||
|
||||
set "deploy_dir=!current_dir!!deploy_name!"
|
||||
cd /d !deploy_dir!
|
||||
echo Avvio !deploy_name!
|
||||
start cmd /k "npm start"
|
||||
)
|
||||
|
||||
endlocal
|
||||
exit
|
10
cmd/pdca0-fe.ps1
Normal file
10
cmd/pdca0-fe.ps1
Normal file
@ -0,0 +1,10 @@
|
||||
# Avvia la UI dei tool backend PDCA0
|
||||
|
||||
$scriptPath = Resolve-Path (Join-Path $PSScriptRoot '../src/darwin/frontend/ui.ps1')
|
||||
|
||||
if (Test-Path $scriptPath) {
|
||||
& $scriptPath
|
||||
} else {
|
||||
Write-Host "File non trovato: $scriptPath" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
@ -1,7 +1,13 @@
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
call git commit --allow-empty -m "RELEASE"
|
||||
set "commit_message=RELEASE"
|
||||
if "%~1" neq "" (
|
||||
set "commit_message=RELEASE %~1"
|
||||
)
|
||||
|
||||
if "%~1" neq "false" (
|
||||
call git push
|
||||
call git commit --allow-empty -m "!commit_message!"
|
||||
|
||||
if "%~2" neq "false" (
|
||||
call git push -f
|
||||
)
|
@ -2,30 +2,13 @@
|
||||
|
||||
setlocal enableDelayedExpansion
|
||||
|
||||
:: Install dependencies if either node_modules or package-lock.json does not exist
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
set "current_dir=%~1"
|
||||
set "module_name=%~1"
|
||||
|
||||
set "folder_name=%~2"
|
||||
if "%~2" neq "" (
|
||||
set "folder_name=%~2\"
|
||||
call echo Installo %module_name%... && cd %module_name% && call npm install
|
||||
if !errorlevel! neq 0 (
|
||||
exit /b
|
||||
)
|
||||
|
||||
set "is_test=false"
|
||||
if "%~3" neq "" (
|
||||
set "is_test=%~3"
|
||||
)
|
||||
|
||||
if "!is_test!" == "false" (
|
||||
if not exist "%current_dir%!folder_name!node_modules" (
|
||||
cd "%current_dir%!folder_name!"
|
||||
npm install
|
||||
cd "%current_dir%"
|
||||
)
|
||||
if not exist "%current_dir%!folder_name!package-lock.json" (
|
||||
cd "%current_dir%!folder_name!"
|
||||
npm install
|
||||
cd "%current_dir%"
|
||||
)
|
||||
)
|
||||
exit /b
|
||||
exit
|
25
src/darwin/frontend/start_deploy.bat
Normal file
25
src/darwin/frontend/start_deploy.bat
Normal file
@ -0,0 +1,25 @@
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
set deploy_path=%~1
|
||||
for %%f in ("%deploy_path%") do set "deploy_name=%%~nxf"
|
||||
|
||||
cd /d %deploy_path%
|
||||
netstat -ano | findstr :4200 >nul
|
||||
if errorlevel 1 (
|
||||
echo Attendi 15 secondi prima di avviare %deploy_name%...
|
||||
|
||||
:: Attendi 15 secondi
|
||||
timeout /t 15 /nobreak
|
||||
|
||||
echo Avvio %deploy_name%
|
||||
call npm start
|
||||
|
||||
endlocal
|
||||
exit
|
||||
)
|
||||
|
||||
echo %deploy_name% gia' in esecuzione.
|
||||
|
||||
endlocal
|
||||
exit /b
|
198
src/darwin/frontend/ui.ps1
Normal file
198
src/darwin/frontend/ui.ps1
Normal file
@ -0,0 +1,198 @@
|
||||
#requires -Version 5.1
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
|
||||
# Percorso file config
|
||||
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
||||
$jsonPath = Resolve-Path (Join-Path $ScriptDir "..\..\..\resources\pdca0-config.json")
|
||||
if (!(Test-Path $jsonPath)) {
|
||||
[System.Windows.Forms.MessageBox]::Show("File di configurazione non trovato: $jsonPath", "Errore", [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Error)
|
||||
exit 1
|
||||
}
|
||||
|
||||
. "$ScriptDir\..\..\general\get-terminal-positions.ps1"
|
||||
|
||||
$pdca0Path = Join-Path $ScriptDir "..\..\..\..\pdca0"
|
||||
|
||||
|
||||
# Lettura moduli dal file JSON
|
||||
$json = Get-Content $jsonPath -Raw | ConvertFrom-Json
|
||||
$modules = @()
|
||||
if ($json.xdce_modules) { $modules += $json.xdce_modules }
|
||||
if ($json.deploy_module) { $modules += $json.deploy_module }
|
||||
$modules = $modules | Sort-Object -Unique
|
||||
|
||||
if ($modules.Count -eq 0) {
|
||||
[System.Windows.Forms.MessageBox]::Show("Nessun modulo trovato nel file di configurazione.", "Errore", [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Error)
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Crea form in stile setup-conf.ps1
|
||||
$form = New-Object System.Windows.Forms.Form
|
||||
$form.Text = "Darwin PDCA0 Frontend Util"
|
||||
$form.Size = New-Object System.Drawing.Size(600, 500)
|
||||
$form.StartPosition = "CenterScreen"
|
||||
|
||||
# TableLayoutPanel principale
|
||||
$mainPanel = New-Object System.Windows.Forms.TableLayoutPanel
|
||||
$mainPanel.Dock = [System.Windows.Forms.DockStyle]::Fill
|
||||
$mainPanel.RowCount = 2
|
||||
$mainPanel.ColumnCount = 1
|
||||
$mainPanel.RowStyles.Add((New-Object System.Windows.Forms.RowStyle([System.Windows.Forms.SizeType]::Percent, 100)))
|
||||
$mainPanel.RowStyles.Add((New-Object System.Windows.Forms.RowStyle([System.Windows.Forms.SizeType]::Absolute, 35)))
|
||||
$form.Controls.Add($mainPanel)
|
||||
|
||||
# Pannello bianco con bordo per i checkbox
|
||||
$dictPanel = New-Object System.Windows.Forms.Panel
|
||||
$dictPanel.Dock = [System.Windows.Forms.DockStyle]::Fill
|
||||
$dictPanel.BorderStyle = 'Fixed3D'
|
||||
$dictPanel.BackColor = 'White'
|
||||
$dictPanel.AutoScroll = $true
|
||||
$dictPanel.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Left -bor [System.Windows.Forms.AnchorStyles]::Right
|
||||
$mainPanel.Controls.Add($dictPanel, 0, 0)
|
||||
|
||||
# Suddividi moduli in core e modules
|
||||
$deployModule = @()
|
||||
$xdceModules = @()
|
||||
if ($json.deploy_module) { $deployModule += $json.deploy_module }
|
||||
if ($json.xdce_modules) { $xdceModules += $json.xdce_modules }
|
||||
$deployModule = $deployModule | Sort-Object -Unique
|
||||
$xdceModules = $xdceModules | Sort-Object -Unique
|
||||
|
||||
$checkboxes = @()
|
||||
$y = 10
|
||||
# Label deploy_module
|
||||
$deployLabel = New-Object System.Windows.Forms.Label
|
||||
$deployLabel.Text = "deploy_module"
|
||||
$deployLabel.Font = New-Object System.Drawing.Font('Segoe UI', 9, [System.Drawing.FontStyle]::Regular)
|
||||
$deployLabel.Location = New-Object System.Drawing.Point(10, $y)
|
||||
$deployLabel.Size = New-Object System.Drawing.Size(200, 20)
|
||||
$dictPanel.Controls.Add($deployLabel)
|
||||
$y += 22
|
||||
# Checkbox core
|
||||
foreach ($mod in $deployModule) {
|
||||
$cb = New-Object System.Windows.Forms.CheckBox
|
||||
$cb.Text = $mod
|
||||
$cb.Font = New-Object System.Drawing.Font('Segoe UI', 9, [System.Drawing.FontStyle]::Regular)
|
||||
$cb.Location = New-Object System.Drawing.Point(30, $y)
|
||||
$cb.Size = New-Object System.Drawing.Size(510, 22)
|
||||
$cb.Checked = $true
|
||||
$dictPanel.Controls.Add($cb)
|
||||
$checkboxes += $cb
|
||||
$y += 24
|
||||
}
|
||||
$y += 10
|
||||
# Label xdce_modules
|
||||
$modulesLabel = New-Object System.Windows.Forms.Label
|
||||
$modulesLabel.Text = "frontend_modules"
|
||||
$modulesLabel.Font = New-Object System.Drawing.Font('Segoe UI', 9, [System.Drawing.FontStyle]::Regular)
|
||||
$modulesLabel.Location = New-Object System.Drawing.Point(10, $y)
|
||||
$modulesLabel.Size = New-Object System.Drawing.Size(200, 20)
|
||||
$dictPanel.Controls.Add($modulesLabel)
|
||||
$y += 22
|
||||
# Checkbox modules
|
||||
foreach ($mod in $xdceModules) {
|
||||
$cb = New-Object System.Windows.Forms.CheckBox
|
||||
$cb.Text = $mod
|
||||
$cb.Font = New-Object System.Drawing.Font('Segoe UI', 9, [System.Drawing.FontStyle]::Regular)
|
||||
$cb.Location = New-Object System.Drawing.Point(30, $y)
|
||||
$cb.Size = New-Object System.Drawing.Size(510, 22)
|
||||
$cb.Checked = $true
|
||||
$dictPanel.Controls.Add($cb)
|
||||
$checkboxes += $cb
|
||||
$y += 24
|
||||
}
|
||||
|
||||
# Pannello per il bottone in basso
|
||||
$buttonPanel = New-Object System.Windows.Forms.Panel
|
||||
$buttonPanel.Dock = [System.Windows.Forms.DockStyle]::Fill
|
||||
$buttonPanel.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Left -bor [System.Windows.Forms.AnchorStyles]::Right
|
||||
$buttonPanel.Height = 45
|
||||
$mainPanel.Controls.Add($buttonPanel, 0, 1)
|
||||
|
||||
# Bottone installa
|
||||
$btnInstall = New-Object System.Windows.Forms.Button
|
||||
$btnInstall.Text = "Installa selezionati"
|
||||
$btnInstall.Size = New-Object System.Drawing.Size(120, 25)
|
||||
$btnInstall.Font = New-Object System.Drawing.Font('Segoe UI', 9, [System.Drawing.FontStyle]::Regular)
|
||||
$btnInstall.Anchor = [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Right
|
||||
$btnInstall.Location = New-Object System.Drawing.Point(320, 0)
|
||||
$buttonPanel.Controls.Add($btnInstall)
|
||||
|
||||
# Bottone avvia
|
||||
$btnStart = New-Object System.Windows.Forms.Button
|
||||
$btnStart.Text = "Avvia selezionati"
|
||||
$btnStart.Size = New-Object System.Drawing.Size(120, 25)
|
||||
$btnStart.Font = New-Object System.Drawing.Font('Segoe UI', 9, [System.Drawing.FontStyle]::Regular)
|
||||
$btnStart.Anchor = [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Right
|
||||
$btnStart.Location = New-Object System.Drawing.Point(450, 0)
|
||||
$buttonPanel.Controls.Add($btnStart)
|
||||
|
||||
# Azione installazione
|
||||
$btnInstall.Add_Click({
|
||||
$selected = $checkboxes | Where-Object { $_.Checked } | ForEach-Object { $_.Text }
|
||||
if ($selected.Count -eq 0) {
|
||||
[System.Windows.Forms.MessageBox]::Show("Seleziona almeno un modulo.", "Attenzione", [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Warning)
|
||||
return
|
||||
}
|
||||
$form.Enabled = $false
|
||||
# $positions = Get-TerminalPositions $modules.Count
|
||||
foreach ($mod in $selected) {
|
||||
$index = [Array]::IndexOf($modules, $mod)
|
||||
if ($index -lt 0) { continue }
|
||||
$modPathRaw = Join-Path $pdca0Path $mod
|
||||
try {
|
||||
$modPath = Resolve-Path $modPathRaw -ErrorAction Stop | Select-Object -ExpandProperty Path
|
||||
} catch {
|
||||
[System.Windows.Forms.MessageBox]::Show("Modulo non trovato: $modPathRaw", "Errore", [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Error)
|
||||
continue
|
||||
}
|
||||
#$startCmdPosScript = Join-Path $ScriptDir "..\..\general\start-cmd-pos.ps1"
|
||||
$startCmdScript = Join-Path $ScriptDir "..\..\general\start-cmd.ps1"
|
||||
$cmd = "cd /d $ScriptDir && install.bat `"" + $modPath + "`""
|
||||
# $pos = $positions[$index]
|
||||
# powershell -ExecutionPolicy Bypass -File $startCmdScript -Name "install $mod" -CommandLine $cmd -X $pos.X -Y $pos.Y -Width $pos.Width -Height $pos.Height
|
||||
powershell -ExecutionPolicy Bypass -File $startCmdScript -Name "install $mod" -CommandLine $cmd
|
||||
}
|
||||
[System.Windows.Forms.MessageBox]::Show("Installazione avviata in nuove finestre terminale.", "Info", [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Information)
|
||||
$form.Enabled = $true
|
||||
})
|
||||
|
||||
# Azione avvio
|
||||
$btnStart.Add_Click({
|
||||
$selected = $checkboxes | Where-Object { $_.Checked } | ForEach-Object { $_.Text }
|
||||
if ($selected.Count -eq 0) {
|
||||
[System.Windows.Forms.MessageBox]::Show("Seleziona almeno un modulo.", "Attenzione", [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Warning)
|
||||
return
|
||||
}
|
||||
$form.Enabled = $false
|
||||
# $positions = Get-TerminalPositions $modules.Count FIX-ME: non funziona
|
||||
foreach ($mod in $selected) {
|
||||
$index = [Array]::IndexOf($modules, $mod)
|
||||
if ($index -lt 0) { continue }
|
||||
$isCore = $deployModule -contains $mod
|
||||
if ($isCore) {
|
||||
$batName = "start_deploy.bat"
|
||||
} else {
|
||||
$batName = "watch_module.bat"
|
||||
}
|
||||
$modPathRaw = Join-Path $pdca0Path $mod
|
||||
try {
|
||||
$modPath = Resolve-Path $modPathRaw -ErrorAction Stop | Select-Object -ExpandProperty Path
|
||||
} catch {
|
||||
[System.Windows.Forms.MessageBox]::Show("Modulo non trovato: $modPathRaw", "Errore", [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Error)
|
||||
continue
|
||||
}
|
||||
#$startCmdPosScript = Join-Path $ScriptDir "..\..\general\start-cmd-pos.ps1"
|
||||
$startCmdScript = Join-Path $ScriptDir "..\..\general\start-cmd.ps1"
|
||||
$cmd = "cd /d $ScriptDir && $batName `"" + $modPath + "`""
|
||||
# $pos = $positions[$index]
|
||||
# powershell -ExecutionPolicy Bypass -File $startCmdPosScript -Name "start $mod" -CommandLine $cmd -X $pos.X -Y $pos.Y -Width $pos.Width -Height $pos.Height
|
||||
powershell -ExecutionPolicy Bypass -File $startCmdScript -Name "start $mod" -CommandLine $cmd
|
||||
}
|
||||
[System.Windows.Forms.MessageBox]::Show("Avvio progetti in nuove finestre terminale.", "Info", [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Information)
|
||||
$form.Enabled = $true
|
||||
})
|
||||
|
||||
# Avvia la UI
|
||||
[void]$form.ShowDialog()
|
102
src/darwin/frontend/watch_module.bat
Normal file
102
src/darwin/frontend/watch_module.bat
Normal file
@ -0,0 +1,102 @@
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
set module_path=%~1
|
||||
for %%f in ("%module_path%") do set "module_name=%%~nxf"
|
||||
|
||||
cd /d %module_path%
|
||||
|
||||
echo Eseguo controlli su !cd!
|
||||
|
||||
:: Controlla se local-gulpfile.js esiste
|
||||
if not exist "!cd!\local-gulpfile.js" (
|
||||
(
|
||||
echo var gulp = require('gulp'^);
|
||||
echo var path = require('path'^);
|
||||
echo var fileSystem = require('fs'^);
|
||||
echo.
|
||||
echo function emptyFolder(directoryPath^) ^{
|
||||
echo if (fileSystem.existsSync(directoryPath^)^) ^{
|
||||
echo fileSystem.readdirSync(directoryPath^).forEach(function (file^) ^{
|
||||
echo var curPath = path.join(directoryPath, file^);
|
||||
echo if (fileSystem.lstatSync(curPath^).isDirectory(^)^) ^{
|
||||
echo emptyFolder(curPath^);
|
||||
echo fileSystem.rmdirSync(curPath^);
|
||||
echo ^} else ^{
|
||||
echo fileSystem.unlinkSync(curPath^);
|
||||
echo ^}
|
||||
echo ^}^);
|
||||
echo ^}
|
||||
echo ^}
|
||||
echo.
|
||||
echo gulp.task('custom:after-all', function (^)^{
|
||||
echo var mainTask = process.argv.slice(2^)^[0^];
|
||||
echo if (mainTask === 'build:watch_local'^) ^{
|
||||
echo var dest = path.join(process.cwd(^), '..', 'pdca0-deploy-arch', 'node_modules', '@isp', '%module_name%'^);
|
||||
echo if (!fileSystem.existsSync(dest^)^)^{
|
||||
echo emptyFolder(dest^);
|
||||
echo ^}
|
||||
echo return gulp.src(^`${configuration.distFolder}/**^`^)
|
||||
echo .pipe(gulp.dest(dest^)^);
|
||||
echo ^}
|
||||
echo ^}^);
|
||||
) > "!cd!\local-gulpfile.js"
|
||||
) else (
|
||||
findstr /C:"require('gulp')" "!cd!\local-gulpfile.js" >nul || (
|
||||
echo.
|
||||
echo var gulp = require('gulp'^);
|
||||
echo.
|
||||
) >> "!cd!\local-gulpfile.js"
|
||||
findstr /C:"require('path')" "!cd!\local-gulpfile.js" >nul || (
|
||||
echo.
|
||||
echo var path = require('path'^);
|
||||
echo.
|
||||
) >> "!cd!\local-gulpfile.js"
|
||||
|
||||
findstr /C:"require('path')" "!cd!\local-gulpfile.js" >nul || (
|
||||
echo.
|
||||
echo var path = require('path'^);
|
||||
echo.
|
||||
) >> "!cd!\local-gulpfile.js"
|
||||
|
||||
|
||||
|
||||
findstr /C:"custom:after-all" "!cd!\local-gulpfile.js" >nul || (
|
||||
echo.
|
||||
echo var fileSystem = require('fs'^);
|
||||
echo.
|
||||
echo function emptyFolder(directoryPath^) ^{
|
||||
echo if (fileSystem.existsSync(directoryPath^)^) ^{
|
||||
echo fileSystem.readdirSync(directoryPath^).forEach(function (file^) ^{
|
||||
echo var curPath = path.join(directoryPath, file^);
|
||||
echo if (fileSystem.lstatSync(curPath^).isDirectory(^)^) ^{
|
||||
echo emptyFolder(curPath^);
|
||||
echo fileSystem.rmdirSync(curPath^);
|
||||
echo ^} else ^{
|
||||
echo fileSystem.unlinkSync(curPath^);
|
||||
echo ^}
|
||||
echo ^}^);
|
||||
echo ^}
|
||||
echo ^}
|
||||
echo.
|
||||
echo gulp.task('custom:after-all', function (^)^{
|
||||
echo var mainTask = process.argv.slice(2^)^[0^];
|
||||
echo if (mainTask === 'build:watch_local'^) ^{
|
||||
echo var dest = path.join(process.cwd(^), '..', 'pdca0-deploy-arch', 'node_modules', '@isp', '%module_name%'^);
|
||||
echo if (!fileSystem.existsSync(dest^)^)^{
|
||||
echo emptyFolder(dest^);
|
||||
echo ^}
|
||||
echo return gulp.src(^`${configuration.distFolder}/**^`^)
|
||||
echo .pipe(gulp.dest(dest^)^);
|
||||
echo ^}
|
||||
echo ^}^);
|
||||
) >> "!cd!\local-gulpfile.js"
|
||||
)
|
||||
|
||||
echo Avvio %module_name%
|
||||
|
||||
:: Esegue npm run build:watch_local
|
||||
call npm run build:watch_local
|
||||
|
||||
endlocal
|
||||
exit
|
Loading…
x
Reference in New Issue
Block a user