first commit

This commit is contained in:
Alessandro Seravalli 2025-07-17 18:30:44 +02:00
commit 5444871039
36 changed files with 2933 additions and 0 deletions

46
README.md Normal file
View File

@ -0,0 +1,46 @@
# pdca0-dev-hub
**pdca0-dev-hub** è un ambiente di sviluppo e gestione per moduli e componenti della piattaforma PDCA0, pensato per facilitare la configurazione, il build, il testing e il rilascio di moduli backend e frontend, con particolare attenzione all'integrazione di moduli XDCE.
## Struttura del progetto
- `cmd/`: Script batch e PowerShell per operazioni di build, configurazione, gestione branch e rilascio.
- `src/darwin/`: Script e strumenti per la gestione di moduli frontend e backend, setup ambienti, configurazione e aggiornamento dipendenze npm.
- `frontend/`: Script per gestione e aggiornamento pacchetti npm frontend.
- `backend/`: Script per gestione moduli backend (es. installazione con Maven).
- `setup-conf/`: Script per configurazione interattiva dei moduli e generazione file di configurazione.
- `setup-env/`: Script per setup ambiente di sviluppo (es. controlli versioni Node.js, git, ecc).
- `src/general/`: Script generici di utilità, come selezione cartelle progetto.
- `resources/`: File di configurazione JSON condivisi tra gli script.
- `releaser/`: Configurazioni e strumenti per il rilascio e la gestione dei moduli attivi.
## Principali funzionalità
- **Configurazione interattiva**: Script PowerShell con interfaccia grafica per selezionare, configurare e salvare i moduli attivi.
- **Gestione dipendenze**: Script per installazione/aggiornamento dipendenze npm e Maven.
- **Gestione branch**: Script per la creazione e gestione di branch Git nei progetti.
- **Build e rilascio**: Script per build automatizzato, watch dei moduli e rilascio dei pacchetti.
## Requisiti
- **Windows** (testato su Windows 10/11)
- **PowerShell**
- **Node.js v10.24.1**
- **Git**
- (Per backend) **Maven**
## Setup rapido
1. Clona il repository:
```sh
git clone <url-repo>
```
2. Configura i moduli tramite gli script in `cmd/` o `src/darwin/setup-conf/`.
3. Per avviare il frontend o il backend, utilizza gli script batch/ps1 dedicati (es. `pdca0-fe.bat`, `pdca0-be.ps1`).
4. Segui le istruzioni a schermo per installare le dipendenze e configurare l'ambiente.
## File di configurazione
- `resources/pdca0-config.json`: Elenco moduli attivi e mapping tra moduli backend/frontend/core/deploy.
- `cmd/pdc-xdce-setup.conf`: Moduli XDCE da monitorare.
- `releaser/pdca0.conf`: Moduli attivi per la fase di rilascio.

7
cmd/build-commit.bat Normal file
View File

@ -0,0 +1,7 @@
@echo off
call git commit --allow-empty -m "build"
if "%~1" neq "false" (
call git push
)

654
cmd/pdc-xdce-setup.bat Normal file
View File

@ -0,0 +1,654 @@
@echo off
setlocal enableDelayedExpansion
set "current_dir=%~dp0"
set "is_test=false"
if "%~1" == "test" (
set "is_test=true"
set "current_dir=%~dp0target\"
if not exist "!current_dir!" (
mkdir "!current_dir!"
)
set "USERPROFILE=!current_dir!\user"
if not exist "!USERPROFILE!" (
mkdir "!USERPROFILE!"
)
)
set "default_modules="
set "config_file=!current_dir!pdc-xdce-setup.conf"
set "module_name_key=installed_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%> "!current_dir!pdc-xdce-setup.conf"
echo I moduli da installare sono: %modules%
:: Controllo della versione di Node.js
for /f "tokens=*" %%v in ('node -v 2^>nul') do set "node_version=%%v"
if not defined node_version (
echo Node.js non e' installato.
exit /b 1
)
if not "%node_version%"=="v10.24.1" (
echo Versione di Node.js non compatibile. Richiesta: v10.24.1, trovata: %node_version%
exit /b 1
)
:: Check if git is installed
where git >nul 2>nul
if %errorlevel% neq 0 (
echo Git could not be found. Please install Git.
endlocal
pause
exit /b
)
if not exist "!current_dir!package.json" (
(
echo {
echo "name": "package-json-master",
echo "version": "0.1.0",
echo "scripts": ^{
echo "ng": "ng"
echo ^},
echo "repository": ^{
echo "type": "git",
echo "url": "example.com"
echo ^},
echo "author": ^{
echo "name": "ARCH",
echo "email": "arch@isp.com"
echo ^},
echo "keywords": ^[
echo "angular"
echo ^],
echo "license": "MIT",
echo "bugs": ^{
echo "url": "example.com/issues"
echo ^},
echo "engines": ^{
echo "node": ">=6.0.0"
echo ^},
echo "dependencies": ^{
echo "@angular-devkit/architect": "0.11.0",
echo "@angular-devkit/build-angular": "0.11.0",
echo "@angular-devkit/build-optimizer": "0.11.0",
echo "@angular-devkit/core": "7.1.0",
echo "@angular-devkit/schematics": "7.1.0",
echo "@angular-devkit/schematics-cli": "0.11.0",
echo "@angular/cli": "7.1.0",
echo "@isp/xdce-build-utils": "1",
echo "@isp/xdce-schematics": "1",
echo "@schematics/angular": "7.1.0",
echo "@schematics/update": "0.11.0",
echo "node-sass": "^4.9.3",
echo "node-sass-tilde-importer": "1.0.1"
echo ^}
echo ^}
) > "!current_dir!package.json"
)
:: Create .angular.json file
if not exist "!current_dir!.angular.json" (
(
echo ^{
echo "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
echo "version": 1,
echo "newProjectRoot": "projects",
echo "projects": ^{
echo "showcase-webapp": ^{
echo "root": "",
echo "sourceRoot": "src",
echo "projectType": "application",
echo "architect": ^{
echo "build": ^{
echo "builder": "@angular-devkit/build-angular:browser",
echo "options": ^{
echo "outputPath": "target/app",
echo "index": "src/index.html",
echo "main": "src/main.ts",
echo "tsConfig": "src/tsconfig.app.json",
echo "polyfills": "src/polyfills.ts",
echo "extractCss":true,
echo "assets": ^[
echo "src/assets",
echo "src/nginx-cfg",
echo "src/nginx-default-cfg",
echo "src/favicon.ico",
echo "src/login",
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-module-tutorial/e2e",
echo "output": "/e2e/xdce-module-tutorial"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-module-tutorial/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-module-docs/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/showcase-arch-pluggable-impl/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-arch-core-base/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-arch-core/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-module-tutorial/docs",
echo "output": "/docs"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/showcase-ui/docs",
echo "output": "/docs"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/showcase-arch-pluggable-impl/docs",
echo "output": "/docs"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-arch-core/docs",
echo "output": "/docs"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-arch-core-base/docs",
echo "output": "/docs"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-module-widgetdemo/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-module-common-docs/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/showcase-ui/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-widget/docs",
echo "output": "/docs"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-widget/assets",
echo "output": "/assets"
echo ^}
echo ^],
echo "styles": ^[
echo ^{
echo "input": "node_modules/@isp/xdce-arch-core/bootstrap/bootstrap.min.css",
echo "bundleName": "bootstrap.css"
echo ^},
echo ^{
echo "input": "node_modules/@isp/xdce-arch-core-base/style/xdce-arch-core-base.css",
echo "bundleName": "xdce-arch-core-base.css"
echo ^},
echo ^{
echo "input": "node_modules/@isp/xdce-arch-core/style/xdce-arch-core.css",
echo "bundleName": "xdce-arch-core.css"
echo ^},
echo ^{
echo "input": "node_modules/@isp/showcase-ui/style/showcase-ui.css",
echo "bundleName": "showcase-ui.css"
echo ^},
echo ^{
echo "input": "src/theme-colors.green.scss",
echo "lazy": true,
echo "bundleName": "theme-colors.green.css"
echo ^},
echo ^{
echo "input": "src/theme-colors.blue.scss",
echo "lazy": true,
echo "bundleName": "theme-colors.blue.css"
echo ^},
echo ^{
echo "input": "src/theme-colors.ipo.scss",
echo "lazy": true,
echo "bundleName": "theme-colors.ipo.css"
echo ^},
echo ^{
echo "input": "src/widget-colors.green.scss",
echo "lazy": true,
echo "bundleName": "widget-colors.green.css"
echo ^},
echo ^{
echo "input": "src/widget-colors.blue.scss",
echo "lazy": true,
echo "bundleName": "widget-colors.blue.css"
echo ^},
echo ^{
echo "input": "src/widget-colors.ipo.scss",
echo "lazy": true,
echo "bundleName": "widget-colors.ipo.css"
echo ^},
echo "src/styles.scss"
echo ^],
echo "scripts": ^[
echo ^{
echo "input": "node_modules/prismjs/prism.js"
echo ^},
echo ^{
echo "input": "node_modules/prismjs/components/prism-typescript.js"
echo ^},
echo ^{
echo "input": "node_modules/prismjs/components/prism-sass.js"
echo ^},
echo ^{
echo "input": "node_modules/prismjs/components/prism-javascript.js"
echo ^},
echo ^{
echo "input": "node_modules/prismjs/components/prism-json.js"
echo ^}
echo ^]
echo ^},
echo "configurations": ^{
echo "production": ^{
echo "optimization": true,
echo "outputHashing": "all",
echo "sourceMap": false,
echo "extractCss": true,
echo "namedChunks": false,
echo "aot": true,
echo "extractLicenses": true,
echo "vendorChunk": false,
echo "buildOptimizer": true,
echo "fileReplacements": ^[
echo ^{
echo "replace": "src/environments/environment.ts",
echo "with": "src/environments/environment.prod.ts"
echo ^}
echo ^]
echo ^}
echo ^}
echo ^},
echo "serve": ^{
echo "builder": "@angular-devkit/build-angular:dev-server",
echo "options": ^{
echo "browserTarget": "showcase-webapp:build",
echo "proxyConfig": "proxy.conf.json"
echo ^},
echo "configurations": ^{
echo "production": ^{
echo "extractCss": true,
echo "browserTarget": "showcase-webapp:build:production"
echo ^}
echo ^}
echo ^},
echo "extract-i18n": ^{
echo "builder": "@angular-devkit/build-angular:extract-i18n",
echo "options": ^{
echo "browserTarget": "showcase-webapp:build"
echo ^}
echo ^},
echo "test": ^{
echo "builder": "@angular-devkit/build-angular:karma",
echo "options": ^{
echo "main": "src/test.ts",
echo "karmaConfig": "./karma.conf.js",
echo "polyfills": "src/polyfills.ts",
echo "tsConfig": "src/tsconfig.spec.json",
echo "scripts": ^[
echo ^{
echo "input": "node_modules/prismjs/prism.js"
echo ^},
echo ^{
echo "input": "node_modules/prismjs/components/prism-typescript.js"
echo ^},
echo ^{
echo "input": "node_modules/prismjs/components/prism-sass.js"
echo ^},
echo ^{
echo "input": "node_modules/prismjs/components/prism-javascript.js"
echo ^},
echo ^{
echo "input": "node_modules/prismjs/components/prism-json.js"
echo ^}
echo ^],
echo "styles": ^[
echo ^{
echo "input": "node_modules/@isp/xdce-arch-core/bootstrap/bootstrap.min.css",
echo "bundleName": "bootstrap.css"
echo ^},
echo ^{
echo "input": "node_modules/@isp/xdce-arch-core/style/xdce-arch-core.css",
echo "bundleName": "xdce-arch-core.css"
echo ^},
echo ^{
echo "input": "node_modules/@isp/showcase-ui/style/showcase-ui.css",
echo "bundleName": "showcase-ui.css"
echo ^},
echo ^{
echo "input": "src/theme-colors.green.scss",
echo "lazy": true,
echo "bundleName": "theme-colors.green.css"
echo ^},
echo ^{
echo "input": "src/theme-colors.blue.scss",
echo "lazy": true,
echo "bundleName": "theme-colors.blue.css"
echo ^},
echo ^{
echo "input": "src/theme-colors.ipo.scss",
echo "lazy": true,
echo "bundleName": "theme-colors.ipo.css"
echo ^},
echo ^{
echo "input": "src/widget-colors.green.scss",
echo "lazy": true,
echo "bundleName": "widget-colors.green.css"
echo ^},
echo ^{
echo "input": "src/widget-colors.blue.scss",
echo "lazy": true,
echo "bundleName": "widget-colors.blue.css"
echo ^},
echo ^{
echo "input": "src/widget-colors.ipo.scss",
echo "lazy": true,
echo "bundleName": "widget-colors.ipo.css"
echo ^},
echo "src/styles.scss"
echo ^],
echo "assets": ^[
echo "src/assets",
echo "src/favicon.ico",
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-module-tutorial/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-module-docs/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-module-bear-docs/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/showcase-arch-pluggable-impl/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-arch-core/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-module-tutorial/docs",
echo "output": "/docs"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/showcase-ui/docs",
echo "output": "/docs"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/showcase-arch-pluggable-impl/docs",
echo "output": "/docs"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-arch-core/docs",
echo "output": "/docs"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-module-widgetdemo/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-module-common-docs/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-widget/assets",
echo "output": "/assets"
echo ^}
echo ^]
echo ^}
echo ^},
echo "lint": ^{
echo "builder": "@angular-devkit/build-angular:tslint",
echo "options": ^{
echo "tsConfig": ^[
echo "src/tsconfig.app.json",
echo "src/tsconfig.spec.json"
echo ^],
echo "exclude": ^[
echo "**/node_modules/**"
echo ^]
echo ^}
echo ^}
echo ^}
echo ^},
echo "showcase-webapp-e2e": ^{
echo "root": "",
echo "sourceRoot": "",
echo "projectType": "application",
echo "architect": ^{
echo "e2e": ^{
echo "builder": "@angular-devkit/build-angular:protractor",
echo "options": ^{
echo "protractorConfig": "./protractor.conf.js",
echo "devServerTarget": "showcase-webapp:serve"
echo ^}
echo ^},
echo "lint": ^{
echo "builder": "@angular-devkit/build-angular:tslint",
echo "options": ^{
echo "tsConfig": ^[
echo "e2e/tsconfig.e2e.json"
echo ^],
echo "exclude": ^[
echo "**/node_modules/**"
echo ^]
echo ^}
echo ^}
echo ^}
echo ^}
echo ^},
echo "defaultProject": "showcase-webapp",
echo "schematics": ^{
echo "@schematics/angular:component": ^{
echo "prefix": "app",
echo "styleext": "scss"
echo ^},
echo "@schematics/angular:directive": ^{
echo "prefix": "app"
echo ^}
echo ^}
echo ^}
) > "!current_dir!.angular.json"
)
call :set_npmrc
@REM call :npm_install
call :set_sass_binary_file
for %%a in (!modules!) do (
echo %%a
set "module=%%a"
call :check_repo_exists !module!
if %errorlevel% neq 0 (
echo Repository does not exist or is not accessible.
endlocal
pause
exit /b
)
call :install_module !module!
)
echo Setup complete.
endlocal
exit /b
:: #region Functions
:: Funzione per settare il corretto .npmrc
:set_npmrc
set "npmrc_path=!USERPROFILE!\.npmrc"
if exist "!npmrc_path!" (
echo Il file .npmrc esiste.
:: Controlla se contiene la stringa "arti0-artifactory.sede.corp.sanpaoloimi.com"
findstr /C:"arti0-artifactory.sede.corp.sanpaoloimi.com" "!npmrc_path!" >nul
if errorlevel 1 (
echo La stringa "arti0-artifactory.sede.corp.sanpaoloimi.com" non e' presente.
:: Rinomina il file esistente
ren "!npmrc_path!" ".npmrc_old"
echo Creazione di un nuovo file .npmrc con informazioni predefinite.
(
echo registry=https://arti0-artifactory.sede.corp.sanpaoloimi.com/artifactory/api/npm/npm-repos
echo strict-ssl=false
echo insecure=true
echo rejectUnauthorized=false
echo always-auth=true
echo email=cm.dipartimentale@intesasanpaolo.com
echo //arti0-artifactory.sede.corp.sanpaoloimi.com/artifactory/api/npm/:_auth="bnBtLXNuYXBzaG90LWRlcGxveWVyOkFQOTQ0SGd4YlR2ZFZkY1RmenVySkpFZ1c0ag=="
) > "!npmrc_path!"
) else (
echo La stringa "arti0-artifactory.sede.corp.sanpaoloimi.com" e' presente.
)
) else (
echo Il file .npmrc non esiste. Creazione del file con informazioni predefinite.
(
echo registry=https://arti0-artifactory.sede.corp.sanpaoloimi.com/artifactory/api/npm/npm-repos
echo strict-ssl=false
echo insecure=true
echo rejectUnauthorized=false
echo always-auth=true
echo email=cm.dipartimentale@intesasanpaolo.com
echo //arti0-artifactory.sede.corp.sanpaoloimi.com/artifactory/api/npm/:_auth="bnBtLXNuYXBzaG90LWRlcGxveWVyOkFQOTQ0SGd4YlR2ZFZkY1RmenVySkpFZ1c0ag=="
) > "!npmrc_path!"
)
exit /b
:: Funzione che setta il sass_binary_file
:set_sass_binary_file
set "npmrc_path=!USERPROFILE!\.npmrc"
:: Controlla se contiene la stringa "sass_binary_path"
findstr /C:"sass_binary_path" "!npmrc_path!" >nul
if errorlevel 1 (
echo La stringa "sass_binary_path" non e' presente. Aggiungo il path al "binding.node".
echo sass_binary_path=!current_dir!node_modules\node-sass\vendor\win32-x64-64\binding.node >> "!npmrc_path!"
for /d %%d in ("!current_dir!*") do (
if exist "%%d\node_modules\node-sass" (
echo Trovata cartella node-sass in "%%d". Cancello...
rmdir /s /q "%%d\node_modules\node-sass"
rmdir /s /q "%%d\node_modules\node-sass-tilde-importer"
echo Eseguo npm install in "%%d"...
pushd "%%d"
npm install
popd
)
)
) else (
echo La stringa "sass_binary_path" e' presente.
)
exit /b
:: Install dependencies if either node_modules or package-lock.json does not exist
:npm_install
set "folder_name="
if "%~1" neq "" (
set "folder_name=%~1\"
)
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
:: Check if the repository exists
:check_repo_exists
set "module_name=%~1"
git ls-remote "https://bitbucket.intesasanpaolo.com/scm/pdca0/!module_name!.git" >nul 2>nul
exit /b
:: Clone the repository if it does not exist
:clone_repo
set "module_name=%~1"
echo !current_dir!!module_name!
if not exist "!current_dir!!module_name!" (
cd "!current_dir!"
git clone "https://bitbucket.intesasanpaolo.com/scm/pdca0/!module_name!.git" "!module_name!"
cd "!current_dir!!module_name!"
git checkout env/svil
git pull
cd "!current_dir!"
)
exit /b
:: Install the module
:install_module
set "module_name=%~1"
call :clone_repo !module_name!
@REM call :npm_install !module_name!
exit /b
:: #endregion

1
cmd/pdc-xdce-setup.conf Normal file
View File

@ -0,0 +1 @@
watched_modules=xdce-module-arc-v1,xdce-module-widget-fideuram-v1,pdca0-ui

10
cmd/pdca0-be.ps1 Normal file
View File

@ -0,0 +1,10 @@
# Avvia la UI dei tool backend PDCA0
$scriptPath = Resolve-Path (Join-Path $PSScriptRoot '../src/darwin/backend/ui.ps1')
if (Test-Path $scriptPath) {
& $scriptPath
} else {
Write-Host "File non trovato: $scriptPath" -ForegroundColor Red
exit 1
}

10
cmd/pdca0-conf.ps1 Normal file
View File

@ -0,0 +1,10 @@
# Avvia la UI di configurazione PDCA0
$scriptPath = Resolve-Path (Join-Path $PSScriptRoot '../src/darwin/setup-conf/setup-conf.ps1')
if (Test-Path $scriptPath) {
& $scriptPath
} else {
Write-Host "File non trovato: $scriptPath" -ForegroundColor Red
exit 1
}

164
cmd/pdca0-fe.bat Normal file
View File

@ -0,0 +1,164 @@
@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

168
cmd/pdca0-newbranch.ps1 Normal file
View File

@ -0,0 +1,168 @@
<#
.SYNOPSIS
Script per creare un nuovo branch Git in un progetto selezionato.
.DESCRIPTION
Questo script permette di:
1) Selezionare una cartella di progetto
2) Se è un repository Git:
a) Stashare eventuali modifiche non committate
b) Passare al branch master (o altro branch base specificato)
c) Creare un nuovo branch
d) Passare al nuovo branch
3) Se non è un repository Git, ritorna un errore
.PARAMETER Name
Nome del nuovo branch da creare. Se non specificato, verrà richiesto durante l'esecuzione.
.PARAMETER Base
Branch di base da cui creare il nuovo branch (default: "master")
.EXAMPLE
.\Create-PDCA0-Branch.ps1 -Name "feature/nuova-funzionalita"
Crea un nuovo branch "feature/nuova-funzionalita" a partire dal branch master
.EXAMPLE
.\Create-PDCA0-Branch.ps1 -Name "bugfix/correzione" -Base "develop"
Crea un nuovo branch "bugfix/correzione" a partire dal branch develop
.EXAMPLE
.\Create-PDCA0-Branch.ps1
Chiede interattivamente il nome del branch e poi lo crea a partire dal branch master
.NOTES
Autore: Cascade
Data: 2025-07-04
#>
param(
[Parameter(Mandatory=$false, Position=0)]
[string]$Name,
[Parameter(Mandatory=$false)]
[string]$Base = "master"
)
function Test-GitRepository {
param (
[Parameter(Mandatory=$true)]
[string]$Path
)
$gitDir = Join-Path -Path $Path -ChildPath ".git"
return Test-Path -Path $gitDir -PathType Container
}
function Invoke-GitCommand {
param (
[Parameter(Mandatory=$true)]
[string]$Command,
[Parameter(Mandatory=$true)]
[string]$WorkingDirectory,
[Parameter(Mandatory=$false)]
[string]$ErrorMessage
)
try {
$output = & git -C $WorkingDirectory $Command.Split(" ") 2>&1
if ($LASTEXITCODE -ne 0) {
Write-Host "Errore nell'esecuzione del comando Git: $Command" -ForegroundColor Red
Write-Host $output -ForegroundColor Red
if ($ErrorMessage) {
Write-Host $ErrorMessage -ForegroundColor Red
}
return $false
}
return $true
}
catch {
Write-Host "Eccezione nell'esecuzione del comando Git: $Command" -ForegroundColor Red
Write-Host $_.Exception.Message -ForegroundColor Red
if ($ErrorMessage) {
Write-Host $ErrorMessage -ForegroundColor Red
}
return $false
}
}
function Main {
# Verifica che lo script Select-PDCA0-Folders.ps1 esista
$selectFoldersPath = Join-Path $PSScriptRoot '../src/general/select-pdca0-folders.ps1'
if (-not (Test-Path -Path $selectFoldersPath -PathType Leaf)) {
Write-Host "Errore: Lo script Select-PDCA0-Folders.ps1 non è stato trovato nella directory corrente." -ForegroundColor Red
return 1
}
# Se il nome del branch non è stato specificato, chiedi all'utente
if ([string]::IsNullOrEmpty($Name)) {
$Name = Read-Host "Inserisci il nome del nuovo branch"
if ([string]::IsNullOrEmpty($Name)) {
Write-Host "Errore: È necessario specificare un nome per il branch." -ForegroundColor Red
return 1
}
}
# Seleziona una cartella con Select-PDCA0-Folders.ps1
Write-Host "Seleziona un progetto Git..." -ForegroundColor Cyan
$selectedFolder = & $selectFoldersPath
if ($null -eq $selectedFolder) {
Write-Host "Nessuna cartella selezionata. Operazione annullata." -ForegroundColor Yellow
return 1
}
$folderPath = $selectedFolder.FullName
Write-Host "Cartella selezionata: $folderPath" -ForegroundColor Green
# Verifica se è un repository Git
if (-not (Test-GitRepository -Path $folderPath)) {
Write-Host "Errore: La cartella selezionata non è un repository Git." -ForegroundColor Red
return 1
}
Write-Host "Repository Git rilevato. Procedo con le operazioni..." -ForegroundColor Green
# 1. Stasha eventuali modifiche non committate
Write-Host "Verifico se ci sono modifiche da stashare..." -ForegroundColor Cyan
$hasChanges = & git -C $folderPath status --porcelain
if ($hasChanges) {
Write-Host "Modifiche rilevate. Procedo con lo stash..." -ForegroundColor Yellow
$stashName = "Auto-stash prima di creare il branch $Name"
$stashSuccess = Invoke-GitCommand -Command "stash push -m `"$stashName`"" -WorkingDirectory $folderPath -ErrorMessage "Impossibile eseguire lo stash delle modifiche."
if (-not $stashSuccess) {
return 1
}
Write-Host "Modifiche salvate nello stash." -ForegroundColor Green
} else {
Write-Host "Nessuna modifica da stashare." -ForegroundColor Green
}
# 2. Passa al branch base (default: master)
Write-Host "Passo al branch base '$Base'..." -ForegroundColor Cyan
$checkoutSuccess = Invoke-GitCommand -Command "checkout $Base" -WorkingDirectory $folderPath -ErrorMessage "Impossibile passare al branch $Base. Assicurati che esista."
if (-not $checkoutSuccess) {
return 1
}
Write-Host "Ora sei sul branch '$Base'." -ForegroundColor Green
# 3. Aggiorna il branch base
Write-Host "Aggiorno il branch '$Base'..." -ForegroundColor Cyan
$pullSuccess = Invoke-GitCommand -Command "pull" -WorkingDirectory $folderPath -ErrorMessage "Impossibile aggiornare il branch $Base."
if (-not $pullSuccess) {
Write-Host "Avviso: Impossibile aggiornare il branch $Base. Continuo comunque." -ForegroundColor Yellow
} else {
Write-Host "Branch '$Base' aggiornato." -ForegroundColor Green
}
# 4. Crea un nuovo branch
Write-Host "Creo il nuovo branch '$Name'..." -ForegroundColor Cyan
$createSuccess = Invoke-GitCommand -Command "checkout -b $Name" -WorkingDirectory $folderPath -ErrorMessage "Impossibile creare il branch $Name."
if (-not $createSuccess) {
return 1
}
Write-Host "Branch '$Name' creato con successo." -ForegroundColor Green
Write-Host "Operazione completata con successo!" -ForegroundColor Green
Write-Host "Ora sei sul branch '$Name' nel repository $folderPath" -ForegroundColor Green
return 0
}
# Esegui lo script
$exitCode = Main
exit $exitCode

10
cmd/pdca0-update-npm.ps1 Normal file
View File

@ -0,0 +1,10 @@
# Avvia la UI di configurazione PDCA0
$scriptPath = Resolve-Path (Join-Path $PSScriptRoot '../src/darwin/frontend/ui-update-npm-versions.ps1')
if (Test-Path $scriptPath) {
& $scriptPath
} else {
Write-Host "File non trovato: $scriptPath" -ForegroundColor Red
exit 1
}

7
cmd/release-commit.bat Normal file
View File

@ -0,0 +1,7 @@
@echo off
call git commit --allow-empty -m "RELEASE"
if "%~1" neq "false" (
call git push
)

112
cmd/set-git-config.ps1 Normal file
View File

@ -0,0 +1,112 @@
<#
.SYNOPSIS
Script per impostare username e email Git su tutti i repository nella cartella di progetto
.DESCRIPTION
Questo script cerca tutti i repository Git nella directory radice del progetto
e imposta il nome utente e l'email specificati per ciascuno di essi.
.PARAMETER Username
Il nome utente Git da impostare
.PARAMETER Email
L'indirizzo email Git da impostare
.PARAMETER RootDir
La directory radice in cui cercare i repository Git
.EXAMPLE
.\set-git-config-new.ps1 -Username "Mario Rossi" -Email "mario.rossi@intesasanpaolo.com" -RootDir "C:\Users\MarioRossi\progetti"
#>
param (
[Parameter(Mandatory=$true)]
[string]$Username,
[Parameter(Mandatory=$true)]
[string]$Email,
[Parameter(Mandatory=$true)]
[string]$RootDir
)
# Funzione per verificare se una directory è un repository Git
function Is-GitRepository {
param ([string]$Directory)
return (Test-Path -Path "$Directory\.git" -PathType Container)
}
# Funzione per impostare la configurazione Git in un repository
function Set-GitConfig {
param (
[string]$RepoPath,
[string]$Username,
[string]$Email
)
try {
Push-Location $RepoPath
Write-Host "Configurazione di $RepoPath" -ForegroundColor Cyan
# Imposta nome utente e email
git config user.name "$Username"
git config user.email "$Email"
# Verifica che le impostazioni siano state applicate correttamente
$configName = git config user.name
$configEmail = git config user.email
if ($configName -eq $Username -and $configEmail -eq $Email) {
Write-Host "Configurazione completata con successo" -ForegroundColor Green
} else {
Write-Host "Errore nella configurazione" -ForegroundColor Red
}
}
catch {
Write-Host "Errore durante la configurazione: $_" -ForegroundColor Red
}
finally {
Pop-Location
}
}
# Verifica se la directory radice esiste
if (-not (Test-Path -Path $RootDir)) {
Write-Host "La directory $RootDir non esiste!" -ForegroundColor Red
exit 1
}
# Trova tutte le directory di primo livello nella directory radice
$directories = Get-ChildItem -Path $RootDir -Directory
# Contatori per statistiche
$totalRepos = 0
$successfulRepos = 0
Write-Host "Ricerca dei repository Git in $RootDir..." -ForegroundColor Yellow
# Itera su tutte le directory di primo livello
foreach ($dir in $directories) {
$dirPath = $dir.FullName
# Verifica se la directory è un repository Git
if (Is-GitRepository -Directory $dirPath) {
$totalRepos++
Write-Host "Repository trovato: $dirPath" -ForegroundColor Blue
# Imposta la configurazione Git
Set-GitConfig -RepoPath $dirPath -Username $Username -Email $Email
$successfulRepos++
}
}
Write-Host ""
Write-Host "====== Riepilogo ======" -ForegroundColor Magenta
Write-Host "Repository trovati: $totalRepos" -ForegroundColor White
Write-Host "Repository configurati: $successfulRepos" -ForegroundColor White
if ($totalRepos -eq 0) {
Write-Host "Nessun repository Git trovato nella directory $RootDir" -ForegroundColor Yellow
}
elseif ($totalRepos -eq $successfulRepos) {
Write-Host "Tutti i repository sono stati configurati correttamente!" -ForegroundColor Green
}
else {
Write-Host "Alcuni repository non sono stati configurati correttamente." -ForegroundColor Red
}

View File

@ -0,0 +1,112 @@
@echo off
setlocal enabledelayedexpansion
:: Parametri: modulo, tipo di versione (DEV, TEST)
set MODULE=%1
set VERSION_TYPE=%2
if "%MODULE%"=="" (
echo Errore: Specificare il modulo come primo parametro
exit /b 1
)
if "%VERSION_TYPE%"=="" (
echo Errore: Specificare il tipo di versione (DEV, TEST) come secondo parametro
exit /b 1
)
echo Generazione changelog per %MODULE% (%VERSION_TYPE%)...
:: Determina il numero di versione
if "%VERSION_TYPE%"=="TEST" (
:: Per TEST, usa la versione corrente
for /f "tokens=*" %%v in ('git describe --abbrev=0 --tags') do set VERSION=%%v
:: Rimuovi eventuali prefissi dal tag
set VERSION=!VERSION:v=!
set VERSION=!VERSION:%MODULE%-=!
) else if "%VERSION_TYPE%"=="DEV" (
:: Per DEV, calcola la prossima versione
for /f "tokens=*" %%v in ('git describe --abbrev=0 --tags') do set LAST_TAG=%%v
:: Estrai il numero di versione e incrementa la parte minore
set LAST_VERSION=!LAST_TAG:v=!
set LAST_VERSION=!LAST_VERSION:%MODULE%-=!
for /f "tokens=1,2,3 delims=." %%a in ("!LAST_VERSION!") do (
set MAJOR=%%a
set MINOR=%%b
set PATCH=%%c
set /a MINOR=!MINOR!+1
set VERSION=!MAJOR!.!MINOR!.0
)
) else (
echo Errore: Tipo di versione non valido. Usare DEV o TEST.
exit /b 1
)
echo Versione: %VERSION%
:: Trova l'ultimo tag
for /f "tokens=*" %%t in ('git describe --abbrev=0 --tags') do set LAST_TAG=%%t
:: Crea un file temporaneo per il changelog
set TEMP_CHANGELOG=%TEMP%\changelog_temp.md
echo ## %VERSION% > %TEMP_CHANGELOG%
:: Ottieni tutti i merge commit dall'ultimo tag
git log %LAST_TAG%..HEAD --merges --pretty=format:"%%H" > %TEMP%\merge_commits.txt
:: Per ogni merge commit, estrai il branch di origine e i commit messages
for /f "tokens=*" %%c in (%TEMP%\merge_commits.txt) do (
:: Ottieni il nome del branch di origine
for /f "tokens=*" %%b in ('git log -1 --pretty=format:"%%s" %%c ^| findstr /r "Merge branch"') do (
set MERGE_MSG=%%b
set BRANCH_NAME=!MERGE_MSG:Merge branch '=!
set BRANCH_NAME=!BRANCH_NAME:'=!
set BRANCH_NAME=!BRANCH_NAME: into =!
:: Rimuovi il prefisso feature/ se presente
set CLEAN_BRANCH=!BRANCH_NAME:feature/=!
:: Ottieni i commit messages di questo branch
set COMMIT_MSGS=
for /f "tokens=*" %%m in ('git log %%c^~ --pretty=format:"%%s" --no-merges ^| findstr /v "Merge"') do (
if "!COMMIT_MSGS!"=="" (
set COMMIT_MSGS=%%m
) else (
set COMMIT_MSGS=!COMMIT_MSGS!, %%m
)
)
:: Aggiungi al changelog
echo - !CLEAN_BRANCH!: !COMMIT_MSGS! >> %TEMP_CHANGELOG%
)
)
:: Aggiorna il README.md
set README_PATH=..\README.md
set TEMP_README=%TEMP%\readme_temp.md
if "%VERSION_TYPE%"=="TEST" (
:: Per TEST, sostituisci la sezione "Next Release" con la nuova versione
type %README_PATH% | findstr /v /c:"## Next Release" > %TEMP_README%
type %TEMP_CHANGELOG% >> %TEMP_README%
) else (
:: Per DEV, aggiungi sotto "Next Release"
findstr /v /c:"## Next Release" %README_PATH% > %TEMP_README%
echo ## Next Release > %TEMP%\next_release.md
type %TEMP%\next_release.md %TEMP_CHANGELOG% >> %TEMP_README%
)
:: Sostituisci il README originale
copy /y %TEMP_README% %README_PATH% > nul
echo Changelog generato con successo per la versione %VERSION%
echo Aggiornato %README_PATH%
:: Pulizia file temporanei
del %TEMP_CHANGELOG% 2>nul
del %TEMP%\merge_commits.txt 2>nul
del %TEMP_README% 2>nul
del %TEMP%\next_release.md 2>nul
endlocal

View File

View File

@ -0,0 +1 @@
:: recuperare informazioni pollando jenkins

1
releaser/pdca0.conf Normal file
View File

@ -0,0 +1 @@
active_modules=xdce-module-widget-fideuram-v1,xdce-module-arc-v1,pdca0-ui

6
releaser/start-build.bat Normal file
View File

@ -0,0 +1,6 @@
:: Inserire i parametri necessari per avviare il build
:: modulo da buildare
:: tipo di versione (DEV, TEST)
:: controllare che l'ultimo commit del branch master sia incluso in env/svil
:: se TEST, utilizzare il messaggio "RELEASE" sul commit

View File

@ -0,0 +1,13 @@
{
"xdce_modules": [
"pdca0-ui",
"xdce-module-arc-v1",
"xdce-module-widget-fideuram-v1"
],
"backend_modules": [
"pdca0-arc-v1",
"pdca0-sessionmanager-v1"
],
"core_module": "core-arc-v1",
"deploy_module": "pdca0-deploy-arch"
}

View File

@ -0,0 +1,28 @@
@echo off
setlocal enabledelayedexpansion
set "module_name=%~1"
set MVN_INSTALL_CMD=mvn -V clean install -U dependency:resolve -DskipTests -Dversion=1.0.0-DEV
set TIMES=1
call :install_module
:install_module
call echo Installo %module_name%... && cd %module_name% && echo call %MVN_INSTALL_CMD% && call %MVN_INSTALL_CMD%
if !errorlevel! neq 0 (
if !TIMES! geq 3 (
echo Installazione fallita, controlla i log.
endlocal
pause
exit /b
)
set /a TIMES+=1
echo Tentativo !TIMES! fallito, riprovo.
cd ..
call :install_module
exit /b
)
:: Se qui ci arrivi, l'installazione è andata bene: chiudi il terminale
exit
endlocal

View File

@ -0,0 +1,6 @@
@echo off
set module_name=%~1
set MVN_RUN_CMD=call mvn -V spring-boot:run -Dspring-boot.run.profiles=local -Dversion=1.0.0-DEV -DskipTests
call echo Avvio %module_name%... && cd %module_name% && echo call %MVN_RUN_CMD% && call %MVN_RUN_CMD%

View File

@ -0,0 +1,6 @@
@echo off
set module_name=%~1
set MVN_RUN_CMD=mvn -V spring-boot:run -Dversion=1.0.0-DEV -Dspring-boot.run.profiles=local,cache "-Dspring-boot.run.jvmArguments=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5006"
call echo Avvio %module_name%... && cd %module_name% && echo call %MVN_RUN_CMD% && call %MVN_RUN_CMD%

194
src/darwin/backend/ui.ps1 Normal file
View File

@ -0,0 +1,194 @@
#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.backend_modules) { $modules += $json.backend_modules }
if ($json.core_module) { $modules += $json.core_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 Backend 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
$coreModules = @()
$backendModules = @()
if ($json.core_module) { $coreModules += $json.core_module }
if ($json.backend_modules) { $backendModules += $json.backend_modules }
$coreModules = $coreModules | Sort-Object -Unique
$backendModules = $backendModules | Sort-Object -Unique
$checkboxes = @()
$y = 10
# Label core_module
$coreLabel = New-Object System.Windows.Forms.Label
$coreLabel.Text = "core_module"
$coreLabel.Font = New-Object System.Drawing.Font('Segoe UI', 9, [System.Drawing.FontStyle]::Regular)
$coreLabel.Location = New-Object System.Drawing.Point(10, $y)
$coreLabel.Size = New-Object System.Drawing.Size(200, 20)
$dictPanel.Controls.Add($coreLabel)
$y += 22
# Checkbox core
foreach ($mod in $coreModules) {
$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 backend_modules
$modulesLabel = New-Object System.Windows.Forms.Label
$modulesLabel.Text = "backend_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 $backendModules) {
$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"
$cmd = "cd /d $ScriptDir && install.bat `"" + $modPath + "`""
$pos = $positions[$index]
powershell -ExecutionPolicy Bypass -File $startCmdPosScript -CommandLine $cmd -X $pos.X -Y $pos.Y -Width $pos.Width -Height $pos.Height
}
[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
foreach ($mod in $selected) {
$index = [Array]::IndexOf($modules, $mod)
if ($index -lt 0) { continue }
$isCore = $coreModules -contains $mod
if ($isCore) {
$batName = "start_core.bat"
} else {
$batName = "start.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"
$cmd = "cd /d $ScriptDir && $batName `"" + $modPath + "`""
$pos = $positions[$index]
powershell -ExecutionPolicy Bypass -File $startCmdPosScript -CommandLine $cmd -X $pos.X -Y $pos.Y -Width $pos.Width -Height $pos.Height
}
[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()

View File

@ -0,0 +1,31 @@
@echo off
setlocal enableDelayedExpansion
:: Install dependencies if either node_modules or package-lock.json does not exist
set "current_dir=%~1"
set "folder_name=%~2"
if "%~2" neq "" (
set "folder_name=%~2\"
)
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

View File

@ -0,0 +1,168 @@
# Script PowerShell: setup-conf.ps1
# 1. Recupera i nomi delle cartelle
# 2. Riorganizza secondo le regole
# 3. Legge e aggiorna il JSON con una UI interattiva
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
$basePath = Resolve-Path (Join-Path $ScriptDir '../../../../pdca0')
# 1. Recupera i nomi delle cartelle
$dirs = Get-ChildItem -Path $basePath -Directory | Select-Object -ExpandProperty Name
# 2. Riorganizza gli input
$projects = $dirs | Where-Object { $_ -like 'xdce-module*' -or $_ -like '*-ui' -or $_ -like '*deploy*' -or $_ -like '*arch-impl*' }
$packages = $dirs | Where-Object { $_ -like 'xdce-module*' -or $_ -like '*-ui' -or $_ -like '*arch-impl*' }
# Funzione per creare la UI dinamica
function Show-UpdateForm {
param (
[Parameter(Mandatory)] $projects,
[Parameter(Mandatory)] $packages
)
$form = New-Object Windows.Forms.Form
$form.Text = "Update npm versions"
$form.Size = New-Object Drawing.Size(600, 500)
$form.StartPosition = "CenterScreen"
$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)
$selectionPanel = New-Object System.Windows.Forms.TableLayoutPanel
$selectionPanel.Dock = [System.Windows.Forms.DockStyle]::Fill
$selectionPanel.BorderStyle = 'Fixed3D'
$selectionPanel.BackColor = 'White'
$selectionPanel.RowCount = 2
$selectionPanel.ColumnCount = 1
$selectionPanel.RowStyles.Add((New-Object System.Windows.Forms.RowStyle([System.Windows.Forms.SizeType]::Absolute, 85)))
$selectionPanel.RowStyles.Add((New-Object System.Windows.Forms.RowStyle([System.Windows.Forms.SizeType]::Percent, 100)))
$mainPanel.Controls.Add($selectionPanel, 0, 0)
$selectProjectPanel = New-Object System.Windows.Forms.Panel
$selectProjectPanel.Dock = [System.Windows.Forms.DockStyle]::Fill
$selectProjectPanel.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Left -bor [System.Windows.Forms.AnchorStyles]::Right
$selectionPanel.Controls.Add($selectProjectPanel, 0, 0)
$y = 10
$labelProgetto = New-Object Windows.Forms.Label
$labelProgetto.Text = "Seleziona progetto:"
$labelProgetto.Location = New-Object Drawing.Point(10, $y)
$labelProgetto.Size = New-Object Drawing.Size(200, 20)
$selectProjectPanel.Controls.Add($labelProgetto)
$y += 20
# ComboBox progetti
$cmbProgetti = New-Object Windows.Forms.ComboBox
$cmbProgetti.Location = New-Object Drawing.Point(10, $y)
$cmbProgetti.Size = New-Object Drawing.Size(340, 30)
$cmbProgetti.DropDownStyle = 'DropDownList'
$cmbProgetti.Items.AddRange($projects)
$selectProjectPanel.Controls.Add($cmbProgetti)
$y += 35
$labelPacchetti = New-Object Windows.Forms.Label
$labelPacchetti.Text = "Seleziona i pacchetti da aggiornare:"
$labelPacchetti.Location = New-Object Drawing.Point(10, $y)
$labelPacchetti.Size = New-Object Drawing.Size(200, 20)
$selectProjectPanel.Controls.Add($labelPacchetti)
$y = 10
# Panel per i checkbox pacchetti
$pnlPackages = New-Object Windows.Forms.Panel
$pnlPackages.AutoScroll = $true
$pnlPackages.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Left -bor [System.Windows.Forms.AnchorStyles]::Right
$selectionPanel.Controls.Add($pnlPackages, 0, 1)
function Update-PackageCheckboxes($projectName) {
$pnlPackages.Controls.Clear()
$script:chkboxes = @()
if (-not $projectName) { return }
$pkgJsonPath = Join-Path -Path $PSScriptRoot -ChildPath "..\..\..\..\pdca0\$projectName\package.json"
$pkgJsonPath = [System.IO.Path]::GetFullPath($pkgJsonPath)
if (-not (Test-Path $pkgJsonPath)) { return }
try {
$pkgContent = Get-Content $pkgJsonPath -Raw | ConvertFrom-Json
$allDeps = @()
if ($pkgContent.dependencies) { $allDeps += $pkgContent.dependencies.PSObject.Properties.Name }
if ($pkgContent.devDependencies) { $allDeps += $pkgContent.devDependencies.PSObject.Properties.Name }
$yChk = 0
foreach ($dep in ($allDeps | Sort-Object -Unique)) {
$chk = New-Object Windows.Forms.CheckBox
$chk.Text = $dep
$chk.Location = New-Object Drawing.Point(20, $yChk)
$chk.Size = New-Object Drawing.Size(250, 20)
$pnlPackages.Controls.Add($chk)
$script:chkboxes += $chk
$yChk += 22
}
} catch {}
}
# Aggiorna i checkbox quando cambia il progetto selezionato
$cmbProgetti.Add_SelectedIndexChanged({
$selected = $cmbProgetti.SelectedItem
Update-PackageCheckboxes $selected
})
# Inizializza lista pacchetti vuota
$script:chkboxes = @()
Update-PackageCheckboxes $null
$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 = 35
$mainPanel.Controls.Add($buttonPanel, 0, 1)
# Pulsante aggiorna
$btnAggiorna = New-Object Windows.Forms.Button
$btnAggiorna.Text = "Aggiorna"
$btnAggiorna.Location = New-Object Drawing.Point(490, 0)
$btnAggiorna.Size = New-Object Drawing.Size(80, 25)
$btnAggiorna.Anchor = [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Right
$buttonPanel.Controls.Add($btnAggiorna)
# Gestione click
$btnAggiorna.Add_Click({
$selectedProject = $cmbProgetti.SelectedItem
$selectedPackages = $chkboxes | Where-Object { $_.Checked } | ForEach-Object { $_.Text }
if (-not $selectedProject) {
[System.Windows.Forms.MessageBox]::Show("Seleziona un progetto!", "Errore", [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Error)
return
}
if (-not $selectedPackages -or $selectedPackages.Count -eq 0) {
[System.Windows.Forms.MessageBox]::Show("Seleziona almeno un pacchetto!", "Errore", [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Error)
return
}
# Lancia lo script update-npm-versions.ps1
$scriptPath = Join-Path $ScriptDir 'update-npm-versions.ps1'
$allArgs = @(
'-NoProfile',
'-ExecutionPolicy', 'Bypass',
'-File', $scriptPath,
'-ProjectFolder', $selectedProject,
'-Packages'
) + ($selectedPackages -join ',')
Start-Process powershell -ArgumentList $allArgs -Wait
[System.Windows.Forms.MessageBox]::Show("Aggiornamento completato!", "Fatto", [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Information)
})
$buttonPanel.Controls.Add($btnAggiorna)
$form.ShowDialog()
}
Show-UpdateForm -projects $projects -packages $packages

View File

@ -0,0 +1,72 @@
param(
[Parameter(Mandatory = $true, Position = 0)]
[string]$ProjectFolder,
[Parameter(Mandatory = $true, Position = 1)]
[string[]]$Packages
)
$PackagesArray = $Packages -split ','
Write-Host "Aggiornamento pacchetti specifici all'ultima versione beta..." -ForegroundColor Cyan
if (-not $ProjectFolder) {
Write-Error "Errore: Specificare il folder su cui eseguire l'aggiornamento dei pacchetti."
Write-Host "Utilizzo: .\\update-lib.ps1 nome-folder-progetto nome-pacchetto1 nome-pacchetto2 ..."
exit 1
}
if (-not $Packages -or $PackagesArray.Count -eq 0) {
Write-Error "Errore: Specificare almeno un pacchetto da aggiornare."
Write-Host "Utilizzo: .\\update-lib.ps1 nome-folder-progetto nome-pacchetto1 nome-pacchetto2 ..."
exit 1
}
$module = Join-Path $PSScriptRoot "..\..\..\..\pdca0\$ProjectFolder"
Write-Host "Aggiorno $module" -ForegroundColor Yellow
Set-Location $module
if (-not (Test-Path "package.json")) {
Write-Error "Errore: package.json non trovato nella directory corrente."
exit 1
}
# Crea lo script Node.js temporaneo
$nodeScript = @'
const fs = require('fs');
const { execSync } = require('child_process');
const pkg = require('./package.json');
const packages = process.argv.slice(2);
async function updatePackages() {
for (const packageName of packages) {
try {
console.log(`Aggiornamento di ${packageName} all'ultima versione beta...`);
const versionsOutput = execSync(`npm view ${packageName} versions --json`, {encoding: 'utf8'});
const versions = JSON.parse(versionsOutput);
let latestVersion = versions[versions.length-1];
const caret = !latestVersion.includes('snapshot') ? '' : '^';
if (pkg.dependencies && pkg.dependencies[packageName]) {
pkg.dependencies[packageName] = `${caret}${latestVersion}`;
} else if (pkg.devDependencies && pkg.devDependencies[packageName]) {
pkg.devDependencies[packageName] = `${caret}${latestVersion}`;
}
console.log(`Pacchetto ${packageName} aggiornato alla versione ${latestVersion}`);
} catch (error) {
console.error(`Errore nell'aggiornamento di ${packageName}: ${error.message}`);
}
}
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
}
updatePackages();
'@
$jsFile = "update-npm-lib.js"
Set-Content -Path $jsFile -Value $nodeScript -Encoding UTF8
# Esegue lo script Node.js
node $jsFile @PackagesArray
# Rimuove il file temporaneo
Remove-Item $jsFile
Write-Host "Aggiornamento completato." -ForegroundColor Green
exit 0

View File

@ -0,0 +1,166 @@
# Script PowerShell: setup-conf.ps1
# 1. Recupera i nomi delle cartelle
# 2. Riorganizza secondo le regole
# 3. Legge e aggiorna il JSON con una UI interattiva
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
$basePath = Resolve-Path (Join-Path $ScriptDir '../../../../pdca0')
$configPath = Resolve-Path (Join-Path $ScriptDir '../../../resources/pdca0-config.json')
# 1. Recupera i nomi delle cartelle
$dirs = Get-ChildItem -Path $basePath -Directory | Select-Object -ExpandProperty Name
# 2. Riorganizza gli input
$backend_modules = $dirs | Where-Object { $_ -like 'pdca0*' -and $_ -like '*v1' -and $_ -notlike '*deploy*' }
$core_module = $dirs | Where-Object { $_ -like 'core*' }
$xdce_modules = $dirs | Where-Object { $_ -like 'xdce-module*' -or $_ -like '*-ui' }
$deploy_module = $dirs | Where-Object { $_ -like '*deploy*' }
# 3. Leggi il file JSON
$json = Get-Content $configPath -Raw | ConvertFrom-Json
# Funzione per creare la UI dinamica
function Show-ConfigForm {
param (
[Parameter(Mandatory)] $json,
[Parameter(Mandatory)] $modulesDict
)
$form = New-Object Windows.Forms.Form
$form.Text = "Setup Darwin PDCA0 environments"
$form.Size = New-Object Drawing.Size(600, 500)
$form.StartPosition = "CenterScreen"
$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)
$controls = @{}
$y = 10
$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)
foreach ($key in $modulesDict.Keys) {
$label = New-Object Windows.Forms.Label
$label.Text = $key
$label.Location = New-Object Drawing.Point(10, $y)
$label.Size = New-Object Drawing.Size(200, 20)
$dictPanel.Controls.Add($label)
$y += 20
$values = $modulesDict[$key]
$current = $json.PSObject.Properties[$key].Value
if ($null -ne $current -and $current.GetType().IsArray) {
# Array: Checkboxes
$chkboxes = @()
foreach ($val in $values) {
$chk = New-Object Windows.Forms.CheckBox
$chk.Text = $val
$chk.Location = New-Object Drawing.Point(30, $y)
$chk.Size = New-Object Drawing.Size(200, 20)
if ($current -contains $val) { $chk.Checked = $true }
$dictPanel.Controls.Add($chk)
$chkboxes += $chk
$y += 22
}
$controls[$key] = $chkboxes
} elseif ($null -ne $current -and $current -is [string]) {
# String: Radio in Panel
$panel = New-Object Windows.Forms.Panel
$panel.Location = New-Object Drawing.Point(25, $y)
$panel.Size = New-Object Drawing.Size(250, ($values.Count * 24 + 8))
$panel.BorderStyle = 'None'
$radios = @()
$panelY = 4
foreach ($val in $values) {
$rad = New-Object Windows.Forms.RadioButton
$rad.Text = $val
$rad.Location = New-Object Drawing.Point(4, $panelY)
$rad.Size = New-Object Drawing.Size(200, 20)
if ($current -eq $val) { $rad.Checked = $true }
$panel.Controls.Add($rad)
$radios += $rad
$panelY += 22
}
$dictPanel.Controls.Add($panel)
$controls[$key] = $radios
$y += $panel.Height
} else {
# Default fallback: radio in Panel
$panel = New-Object Windows.Forms.Panel
$panel.Location = New-Object Drawing.Point(25, $y)
$panel.Size = New-Object Drawing.Size(250, ($values.Count * 24 + 8))
$panel.BorderStyle = 'None'
$radios = @()
$panelY = 4
foreach ($val in $values) {
$rad = New-Object Windows.Forms.RadioButton
$rad.Text = $val
$rad.Location = New-Object Drawing.Point(4, $panelY)
$rad.Size = New-Object Drawing.Size(200, 20)
$panel.Controls.Add($rad)
$radios += $rad
$panelY += 22
}
$dictPanel.Controls.Add($panel)
$controls[$key] = $radios
$y += $panel.Height
}
$y += 10
}
$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 = 35
$mainPanel.Controls.Add($buttonPanel, 0, 1)
$btnSave = New-Object Windows.Forms.Button
$btnSave.Text = "Salva"
$btnSave.Location = New-Object Drawing.Point(490, 0)
$btnSave.Size = New-Object Drawing.Size(80, 25)
$btnSave.Anchor = [System.Windows.Forms.AnchorStyles]::Bottom -bor [System.Windows.Forms.AnchorStyles]::Right
$btnSave.Add_Click({
foreach ($key in $modulesDict.Keys) {
$controlsForKey = $controls[$key]
if ($controlsForKey[0] -is [Windows.Forms.CheckBox]) {
$selected = @($controlsForKey | Where-Object { $_.Checked } | ForEach-Object { $_.Text })
$json | Add-Member -MemberType NoteProperty -Name $key -Value $selected -Force
} else {
$selected = $controlsForKey | Where-Object { $_.Checked } | Select-Object -First 1
if ($selected) {
$json | Add-Member -MemberType NoteProperty -Name $key -Value $selected.Text -Force
}
}
}
$json | ConvertTo-Json -Depth 10 | Set-Content $configPath
[System.Windows.Forms.MessageBox]::Show("Configurazione salvata!", "Salvato", [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Information)
$form.Close()
})
$buttonPanel.Controls.Add($btnSave)
$form.ShowDialog()
}
$modulesDict = @{
backend_modules = $backend_modules
core_module = $core_module
xdce_modules = $xdce_modules
deploy_module = $deploy_module
}
Show-ConfigForm -json $json -modulesDict $modulesDict

View File

@ -0,0 +1,26 @@
@echo off
:: Controllo della versione di Node.js
for /f "tokens=*" %%v in ('node -v 2^>nul') do set "node_version=%%v"
if not defined node_version (
echo Node.js non e' installato.
exit /b 1
endlocal
)
if not "%node_version%"=="v10.24.1" (
echo Versione di Node.js non compatibile. Richiesta: v10.24.1, trovata: %node_version%
exit /b 1
endlocal
)
:: Check if git is installed
where git >nul 2>nul
if %errorlevel% neq 0 (
echo Git could not be found. Please install Git.
pause
exit /b 1
endlocal
)
endlocal

View File

@ -0,0 +1,459 @@
@echo off
set directory=%~1
if not exist "%directory%package.json" (
(
echo {
echo "name": "package-json-master",
echo "version": "0.1.0",
echo "scripts": ^{
echo "ng": "ng"
echo ^},
echo "repository": ^{
echo "type": "git",
echo "url": "example.com"
echo ^},
echo "author": ^{
echo "name": "ARCH",
echo "email": "arch@isp.com"
echo ^},
echo "keywords": ^[
echo "angular"
echo ^],
echo "license": "MIT",
echo "bugs": ^{
echo "url": "example.com/issues"
echo ^},
echo "engines": ^{
echo "node": ">=6.0.0"
echo ^},
echo "dependencies": ^{
echo "@angular-devkit/architect": "0.11.0",
echo "@angular-devkit/build-angular": "0.11.0",
echo "@angular-devkit/build-optimizer": "0.11.0",
echo "@angular-devkit/core": "7.1.0",
echo "@angular-devkit/schematics": "7.1.0",
echo "@angular-devkit/schematics-cli": "0.11.0",
echo "@angular/cli": "7.1.0",
echo "@isp/xdce-build-utils": "1",
echo "@isp/xdce-schematics": "1",
echo "@schematics/angular": "7.1.0",
echo "@schematics/update": "0.11.0",
echo "node-sass": "^4.9.3",
echo "node-sass-tilde-importer": "1.0.1"
echo ^}
echo ^}
) > "%directory%package.json"
echo Added %directory%package.json
)
:: Create .angular.json file
if not exist "%directory%.angular.json" (
(
echo ^{
echo "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
echo "version": 1,
echo "newProjectRoot": "projects",
echo "projects": ^{
echo "showcase-webapp": ^{
echo "root": "",
echo "sourceRoot": "src",
echo "projectType": "application",
echo "architect": ^{
echo "build": ^{
echo "builder": "@angular-devkit/build-angular:browser",
echo "options": ^{
echo "outputPath": "target/app",
echo "index": "src/index.html",
echo "main": "src/main.ts",
echo "tsConfig": "src/tsconfig.app.json",
echo "polyfills": "src/polyfills.ts",
echo "extractCss":true,
echo "assets": ^[
echo "src/assets",
echo "src/nginx-cfg",
echo "src/nginx-default-cfg",
echo "src/favicon.ico",
echo "src/login",
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-module-tutorial/e2e",
echo "output": "/e2e/xdce-module-tutorial"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-module-tutorial/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-module-docs/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/showcase-arch-pluggable-impl/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-arch-core-base/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-arch-core/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-module-tutorial/docs",
echo "output": "/docs"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/showcase-ui/docs",
echo "output": "/docs"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/showcase-arch-pluggable-impl/docs",
echo "output": "/docs"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-arch-core/docs",
echo "output": "/docs"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-arch-core-base/docs",
echo "output": "/docs"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-module-widgetdemo/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-module-common-docs/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/showcase-ui/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-widget/docs",
echo "output": "/docs"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-widget/assets",
echo "output": "/assets"
echo ^}
echo ^],
echo "styles": ^[
echo ^{
echo "input": "node_modules/@isp/xdce-arch-core/bootstrap/bootstrap.min.css",
echo "bundleName": "bootstrap.css"
echo ^},
echo ^{
echo "input": "node_modules/@isp/xdce-arch-core-base/style/xdce-arch-core-base.css",
echo "bundleName": "xdce-arch-core-base.css"
echo ^},
echo ^{
echo "input": "node_modules/@isp/xdce-arch-core/style/xdce-arch-core.css",
echo "bundleName": "xdce-arch-core.css"
echo ^},
echo ^{
echo "input": "node_modules/@isp/showcase-ui/style/showcase-ui.css",
echo "bundleName": "showcase-ui.css"
echo ^},
echo ^{
echo "input": "src/theme-colors.green.scss",
echo "lazy": true,
echo "bundleName": "theme-colors.green.css"
echo ^},
echo ^{
echo "input": "src/theme-colors.blue.scss",
echo "lazy": true,
echo "bundleName": "theme-colors.blue.css"
echo ^},
echo ^{
echo "input": "src/theme-colors.ipo.scss",
echo "lazy": true,
echo "bundleName": "theme-colors.ipo.css"
echo ^},
echo ^{
echo "input": "src/widget-colors.green.scss",
echo "lazy": true,
echo "bundleName": "widget-colors.green.css"
echo ^},
echo ^{
echo "input": "src/widget-colors.blue.scss",
echo "lazy": true,
echo "bundleName": "widget-colors.blue.css"
echo ^},
echo ^{
echo "input": "src/widget-colors.ipo.scss",
echo "lazy": true,
echo "bundleName": "widget-colors.ipo.css"
echo ^},
echo "src/styles.scss"
echo ^],
echo "scripts": ^[
echo ^{
echo "input": "node_modules/prismjs/prism.js"
echo ^},
echo ^{
echo "input": "node_modules/prismjs/components/prism-typescript.js"
echo ^},
echo ^{
echo "input": "node_modules/prismjs/components/prism-sass.js"
echo ^},
echo ^{
echo "input": "node_modules/prismjs/components/prism-javascript.js"
echo ^},
echo ^{
echo "input": "node_modules/prismjs/components/prism-json.js"
echo ^}
echo ^]
echo ^},
echo "configurations": ^{
echo "production": ^{
echo "optimization": true,
echo "outputHashing": "all",
echo "sourceMap": false,
echo "extractCss": true,
echo "namedChunks": false,
echo "aot": true,
echo "extractLicenses": true,
echo "vendorChunk": false,
echo "buildOptimizer": true,
echo "fileReplacements": ^[
echo ^{
echo "replace": "src/environments/environment.ts",
echo "with": "src/environments/environment.prod.ts"
echo ^}
echo ^]
echo ^}
echo ^}
echo ^},
echo "serve": ^{
echo "builder": "@angular-devkit/build-angular:dev-server",
echo "options": ^{
echo "browserTarget": "showcase-webapp:build",
echo "proxyConfig": "proxy.conf.json"
echo ^},
echo "configurations": ^{
echo "production": ^{
echo "extractCss": true,
echo "browserTarget": "showcase-webapp:build:production"
echo ^}
echo ^}
echo ^},
echo "extract-i18n": ^{
echo "builder": "@angular-devkit/build-angular:extract-i18n",
echo "options": ^{
echo "browserTarget": "showcase-webapp:build"
echo ^}
echo ^},
echo "test": ^{
echo "builder": "@angular-devkit/build-angular:karma",
echo "options": ^{
echo "main": "src/test.ts",
echo "karmaConfig": "./karma.conf.js",
echo "polyfills": "src/polyfills.ts",
echo "tsConfig": "src/tsconfig.spec.json",
echo "scripts": ^[
echo ^{
echo "input": "node_modules/prismjs/prism.js"
echo ^},
echo ^{
echo "input": "node_modules/prismjs/components/prism-typescript.js"
echo ^},
echo ^{
echo "input": "node_modules/prismjs/components/prism-sass.js"
echo ^},
echo ^{
echo "input": "node_modules/prismjs/components/prism-javascript.js"
echo ^},
echo ^{
echo "input": "node_modules/prismjs/components/prism-json.js"
echo ^}
echo ^],
echo "styles": ^[
echo ^{
echo "input": "node_modules/@isp/xdce-arch-core/bootstrap/bootstrap.min.css",
echo "bundleName": "bootstrap.css"
echo ^},
echo ^{
echo "input": "node_modules/@isp/xdce-arch-core/style/xdce-arch-core.css",
echo "bundleName": "xdce-arch-core.css"
echo ^},
echo ^{
echo "input": "node_modules/@isp/showcase-ui/style/showcase-ui.css",
echo "bundleName": "showcase-ui.css"
echo ^},
echo ^{
echo "input": "src/theme-colors.green.scss",
echo "lazy": true,
echo "bundleName": "theme-colors.green.css"
echo ^},
echo ^{
echo "input": "src/theme-colors.blue.scss",
echo "lazy": true,
echo "bundleName": "theme-colors.blue.css"
echo ^},
echo ^{
echo "input": "src/theme-colors.ipo.scss",
echo "lazy": true,
echo "bundleName": "theme-colors.ipo.css"
echo ^},
echo ^{
echo "input": "src/widget-colors.green.scss",
echo "lazy": true,
echo "bundleName": "widget-colors.green.css"
echo ^},
echo ^{
echo "input": "src/widget-colors.blue.scss",
echo "lazy": true,
echo "bundleName": "widget-colors.blue.css"
echo ^},
echo ^{
echo "input": "src/widget-colors.ipo.scss",
echo "lazy": true,
echo "bundleName": "widget-colors.ipo.css"
echo ^},
echo "src/styles.scss"
echo ^],
echo "assets": ^[
echo "src/assets",
echo "src/favicon.ico",
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-module-tutorial/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-module-docs/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-module-bear-docs/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/showcase-arch-pluggable-impl/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-arch-core/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-module-tutorial/docs",
echo "output": "/docs"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/showcase-ui/docs",
echo "output": "/docs"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/showcase-arch-pluggable-impl/docs",
echo "output": "/docs"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-arch-core/docs",
echo "output": "/docs"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-module-widgetdemo/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-module-common-docs/assets",
echo "output": "/assets"
echo ^},
echo ^{
echo "glob": "**/*",
echo "input": "node_modules/@isp/xdce-widget/assets",
echo "output": "/assets"
echo ^}
echo ^]
echo ^}
echo ^},
echo "lint": ^{
echo "builder": "@angular-devkit/build-angular:tslint",
echo "options": ^{
echo "tsConfig": ^[
echo "src/tsconfig.app.json",
echo "src/tsconfig.spec.json"
echo ^],
echo "exclude": ^[
echo "**/node_modules/**"
echo ^]
echo ^}
echo ^}
echo ^}
echo ^},
echo "showcase-webapp-e2e": ^{
echo "root": "",
echo "sourceRoot": "",
echo "projectType": "application",
echo "architect": ^{
echo "e2e": ^{
echo "builder": "@angular-devkit/build-angular:protractor",
echo "options": ^{
echo "protractorConfig": "./protractor.conf.js",
echo "devServerTarget": "showcase-webapp:serve"
echo ^}
echo ^},
echo "lint": ^{
echo "builder": "@angular-devkit/build-angular:tslint",
echo "options": ^{
echo "tsConfig": ^[
echo "e2e/tsconfig.e2e.json"
echo ^],
echo "exclude": ^[
echo "**/node_modules/**"
echo ^]
echo ^}
echo ^}
echo ^}
echo ^}
echo ^},
echo "defaultProject": "showcase-webapp",
echo "schematics": ^{
echo "@schematics/angular:component": ^{
echo "prefix": "app",
echo "styleext": "scss"
echo ^},
echo "@schematics/angular:directive": ^{
echo "prefix": "app"
echo ^}
echo ^}
echo ^}
) > "%directory%.angular.json"
echo Added %directory%.angular.json
)
endlocal

View File

@ -0,0 +1,48 @@
@echo off
setlocal enableDelayedExpansion
:: Funzione per settare il corretto .npmrc
if "%~1" neq "" (
set "USERPROFILE=%~1"
)
set "npmrc_path=!USERPROFILE!\.npmrc"
if exist "!npmrc_path!" (
echo Il file .npmrc esiste.
:: Controlla se contiene la stringa "arti0-artifactory.sede.corp.sanpaoloimi.com"
findstr /C:"arti0-artifactory.sede.corp.sanpaoloimi.com" "!npmrc_path!" >nul
if errorlevel 1 (
echo La stringa "arti0-artifactory.sede.corp.sanpaoloimi.com" non e' presente.
:: Rinomina il file esistente
ren "!npmrc_path!" ".npmrc_old"
echo Creazione di un nuovo file .npmrc con informazioni predefinite.
(
echo registry=https://arti0-artifactory.sede.corp.sanpaoloimi.com/artifactory/api/npm/npm-repos
echo strict-ssl=false
echo insecure=true
echo rejectUnauthorized=false
echo always-auth=true
echo email=cm.dipartimentale@intesasanpaolo.com
echo //arti0-artifactory.sede.corp.sanpaoloimi.com/artifactory/api/npm/:_auth="bnBtLXNuYXBzaG90LWRlcGxveWVyOkFQOTQ0SGd4YlR2ZFZkY1RmenVySkpFZ1c0ag=="
) > "!npmrc_path!"
) else (
echo La stringa "arti0-artifactory.sede.corp.sanpaoloimi.com" e' presente.
)
) else (
echo Il file .npmrc non esiste. Creazione del file con informazioni predefinite.
(
echo registry=https://arti0-artifactory.sede.corp.sanpaoloimi.com/artifactory/api/npm/npm-repos
echo strict-ssl=false
echo insecure=true
echo rejectUnauthorized=false
echo always-auth=true
echo email=cm.dipartimentale@intesasanpaolo.com
echo //arti0-artifactory.sede.corp.sanpaoloimi.com/artifactory/api/npm/:_auth="bnBtLXNuYXBzaG90LWRlcGxveWVyOkFQOTQ0SGd4YlR2ZFZkY1RmenVySkpFZ1c0ag=="
) > "!npmrc_path!"
)
exit /b
endlocal

View File

@ -0,0 +1,37 @@
@echo off
setlocal enableDelayedExpansion
:: Funzione che setta il sass_binary_file
set "current_dir=%~1"
if "%~2" neq "" (
set "USERPROFILE=%~2"
)
set "npmrc_path=!USERPROFILE!\.npmrc"
:: Controlla se contiene la stringa "sass_binary_path"
findstr /C:"sass_binary_path" "!npmrc_path!" >nul
if errorlevel 1 (
echo La stringa "sass_binary_path" non e' presente. Aggiungo il path al "binding.node".
echo sass_binary_path=%current_dir%node_modules\node-sass\vendor\win32-x64-64\binding.node >> "!npmrc_path!"
for /d %%d in ("%current_dir%*") do (
if exist "%%d\node_modules\node-sass" (
echo Trovata cartella node-sass in "%%d". Cancello...
rmdir /s /q "%%d\node_modules\node-sass"
rmdir /s /q "%%d\node_modules\node-sass-tilde-importer"
echo Eseguo npm install in "%%d"...
pushd "%%d"
npm install
popd
)
)
) else (
echo La stringa "sass_binary_path" e' presente.
)
endlocal
exit /b

View File

@ -0,0 +1,24 @@
function Get-TerminalPositions {
param(
[int]$count
)
$max = 6
$screen = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds
$cols = 2
$rows = [Math]::Ceiling($max / 2)
$width = [Math]::Floor($screen.Width / $cols)
$height = [Math]::Floor($screen.Height / [Math]::Min($rows,3))
$basePositions = @()
for ($i = 0; $i -lt $max; $i++) {
$col = $i % 2
$row = [Math]::Floor($i / 2)
$x = $col * $width
$y = $row * $height
$basePositions += @{ X = $x; Y = $y; Width = $width; Height = $height }
}
$positions = @()
for ($i = 0; $i -lt $count; $i++) {
$positions += $basePositions[$i % $max]
}
return $positions
}

View File

@ -0,0 +1,203 @@
<#
.SYNOPSIS
Script per selezionare una o più cartelle nella directory due livelli sopra rispetto alla posizione dello script.
.DESCRIPTION
Questo script mostra le cartelle presenti nella directory corrente e permette di:
- Navigare tra le cartelle usando le frecce su/giù
- Selezionare/deselezionare più elementi usando Spazio
- Confermare la selezione con Invio
.NOTES
Autore: Cascade
Data: 2025-07-04
#>
function Show-FolderSelector {
[CmdletBinding()]
param(
[Parameter(Mandatory=$false)]
[switch]$MultiSelect = $false,
[Parameter(Mandatory=$false)]
[string]$DirectoryPath = $null
)
# Ottieni le cartelle nella directory specificata o corrente
if ($DirectoryPath) {
$folders = Get-ChildItem -Path $DirectoryPath -Directory
} else {
$folders = Get-ChildItem -Directory
}
if ($folders.Count -eq 0) {
Write-Host "Nessuna cartella trovata nella directory specificata." -ForegroundColor Yellow
return $null
}
# Inizializza variabili
$currentPosition = 0
$selectedFolders = @{}
$exit = $false
$height = $folders.Count
# Pulisci la console e nascondi il cursore
Clear-Host
[Console]::CursorVisible = $false
try {
# Loop principale
while (-not $exit) {
# Pulisci lo schermo e mostra l'intestazione
Clear-Host
if ($MultiSelect) {
Write-Host "Seleziona cartelle (usa frecce su/giù, Spazio per selezionare, Invio per confermare):" -ForegroundColor Cyan
} else {
Write-Host "Seleziona una cartella (usa frecce su/giù, Invio per confermare):" -ForegroundColor Cyan
}
Write-Host "----------------------------------------------------------------" -ForegroundColor Cyan
# Mostra la lista di cartelle
for ($i = 0; $i -lt $folders.Count; $i++) {
$folder = $folders[$i]
$prefix = " "
# Evidenzia la posizione corrente
if ($i -eq $currentPosition) {
$prefix = "> "
$foregroundColor = "Green"
} else {
$foregroundColor = "White"
}
# Mostra lo stato di selezione
if ($selectedFolders.ContainsKey($folder.Name)) {
$prefix += "[X] "
} else {
$prefix += "[ ] "
}
# Stampa la riga
Write-Host "$prefix$($folder.Name)" -ForegroundColor $foregroundColor
}
# Mostra il conteggio delle selezioni
Write-Host "----------------------------------------------------------------" -ForegroundColor Cyan
$selectionCount = $selectedFolders.Count
Write-Host "Elementi selezionati: $selectionCount" -ForegroundColor Yellow
# Leggi l'input dell'utente
$key = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
# Gestisci l'input
switch ($key.VirtualKeyCode) {
38 { # Freccia su
if ($currentPosition -gt 0) {
$currentPosition--
}
}
40 { # Freccia giù
if ($currentPosition -lt $folders.Count - 1) {
$currentPosition++
}
}
32 { # Spazio
if ($MultiSelect) {
$folderName = $folders[$currentPosition].Name
if ($selectedFolders.ContainsKey($folderName)) {
$selectedFolders.Remove($folderName)
} else {
$selectedFolders[$folderName] = $folders[$currentPosition]
}
}
}
13 { # Invio (conferma)
$exit = $true
}
27 { # Esc (annulla)
$selectedFolders = @{}
$exit = $true
}
}
}
# Restituisci i risultati
if ($selectedFolders.Count -gt 0) {
return $selectedFolders.Values
} else {
# Se non ci sono selezioni esplicite, restituisci la cartella corrente
return $folders[$currentPosition]
}
}
finally {
# Ripristina la visibilità del cursore
[Console]::CursorVisible = $true
Write-Host ""
}
}
# Funzione principale
function Main {
param(
[Parameter(Mandatory=$false)]
[switch]$MultiSelect = $false
)
# Determina il percorso dello script
$scriptPath = $PSScriptRoot
# Calcola il percorso ..\..\..\pdca0 rispetto alla posizione dello script
$targetPath = Join-Path $PSScriptRoot "..\..\..\pdca0" | Resolve-Path -ErrorAction SilentlyContinue
if (-not $targetPath) {
Write-Host "La cartella ..\..\..\pdca0 non esiste rispetto alla posizione dello script ($PSScriptRoot)." -ForegroundColor Red
return $null
}
# Mostra le cartelle disponibili e ottieni la selezione
Write-Host "Cartelle presenti nella directory: $targetPath" -ForegroundColor Cyan
Get-ChildItem -Path $targetPath -Directory | ForEach-Object { Write-Host "- $($_.Name)" }
Write-Host ""
# Avvia il selettore di cartelle
$selectedFolders = Show-FolderSelector -MultiSelect:$MultiSelect -DirectoryPath $targetPath
# Mostra i risultati
Write-Host ""
if ($selectedFolders -is [array]) {
Write-Host "Hai selezionato le seguenti cartelle:" -ForegroundColor Green
$selectedFolders | ForEach-Object { Write-Host "- $($_.Name)" }
# Restituisci l'array di cartelle selezionate
return $selectedFolders
}
elseif ($selectedFolders -ne $null) {
Write-Host "Hai selezionato la cartella: $($selectedFolders.Name)" -ForegroundColor Green
# Restituisci la singola cartella selezionata
return $selectedFolders
}
else {
Write-Host "Nessuna cartella selezionata." -ForegroundColor Yellow
return $null
}
}
<#
.SYNOPSIS
Seleziona una o più cartelle nella directory che si trova due livelli sopra rispetto alla posizione dello script.
.DESCRIPTION
Questo script permette di selezionare una o più cartelle nella directory che si trova due livelli sopra rispetto alla posizione dello script.
.PARAMETER MultiSelect
Abilita la selezione multipla di cartelle. Se non specificato, permette solo la selezione di una cartella.
.EXAMPLE
.\Select-Folders.ps1
Seleziona una singola cartella.
.EXAMPLE
.\Select-Folders.ps1 -MultiSelect
Permette di selezionare più cartelle.
#>
param(
[Parameter(Mandatory=$false)]
[switch]$MultiSelect = $false
)
# Esegui lo script
$result = Main -MultiSelect:$MultiSelect
return $result

View File

@ -0,0 +1,31 @@
param(
[Parameter(Mandatory=$true)]
[string]$CommandLine,
[int]$X = 100,
[int]$Y = 100,
[int]$Width = 900,
[int]$Height = 500
)
# Avvia il processo cmd
$proc = Start-Process -FilePath "cmd.exe" -ArgumentList "/k $CommandLine" -PassThru
# Attendi che la finestra sia pronta
Start-Sleep -Milliseconds 700
# Definisci Win32 API per spostare la finestra
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class Win32 {
[DllImport("user32.dll")]
public static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
}
"@
# Sposta la finestra
$hwnd = $proc.MainWindowHandle
Write-Host "[DEBUG] MoveWindow hwnd=$hwnd X=$X Y=$Y W=$Width H=$Height"
if ($hwnd -ne 0) {
[Win32]::MoveWindow($hwnd, $X, $Y, $Width, $Height, $true) | Out-Null
}

View File

@ -0,0 +1,21 @@
@echo off
REM Controlla se vfox è installato
where vfox >nul 2>&1
if errorlevel 1 (
echo ERRORE: vfox non trovato nel PATH. Installa vfox prima di eseguire questo script.
exit /b 1
)
REM Imposta le variabili di ambiente per Maven e altri tool
set "M2_HOME=%USERPROFILE%\.version-fox\cache\maven\current"
setx M2_HOME "%M2_HOME%"
setx M2 "%M2_HOME%\bin"
setx SYMLINK_HOME "%USERPROFILE%\_smlink_home\dist"
setx HTM_ENVIRONMENT "COLL"
echo Variabili di ambiente permanenti impostate (riavvia la sessione per applicarle):
echo M2_HOME=%USERPROFILE%\.version-fox\cache\maven\current
echo M2=%M2_HOME%\bin
echo SYMLINK_HOME=%USERPROFILE%\_smlink_home\dist
echo HTM_ENVIRONMENT=COLL

View File

@ -0,0 +1,68 @@
# Script di setup ambiente per smlink e htm_home
# NOTA: Alcune operazioni richiedono intervento manuale (vedi commenti)
# 1. Ottieni la home directory dell'utente
$home = [Environment]::GetFolderPath('UserProfile')
# 2. Crea la directory _symlink_home nella home
$symlinkHome = Join-Path $home "_symlink_home"
if (-not (Test-Path $symlinkHome)) {
New-Item -ItemType Directory -Path $symlinkHome | Out-Null
Write-Host "Creata directory: $symlinkHome"
} else {
Write-Host "Directory già esistente: $symlinkHome"
}
# 3. Crea il file smlink-settings.json con placeholder
$settingsPath = Join-Path $symlinkHome "smlink-settings.json"
$jsonContent = @'{
"credential-map": {
"bfasscm01t.fideuram.bancafideuram.it": {
"user": "VOSTRO_USERNAME",
"password": "VOSTRA_PASSWORD"
}
}
}
'@
Set-Content -Path $settingsPath -Value $jsonContent -Encoding UTF8
Write-Host "Creato file: $settingsPath"
# 4. Scompatta smlink.zip nella _symlink_home
# Modifica il percorso di $smlinkZip se necessario
$smlinkZip = "C:\PDC_INSTALL\software\smlink.zip"
if (Test-Path $smlinkZip) {
Expand-Archive -Path $smlinkZip -DestinationPath $symlinkHome -Force
Write-Host "smlink.zip spacchettato in $symlinkHome"
} else {
Write-Warning "File non trovato: $smlinkZip (modifica il percorso se necessario)"
}
# 5. Verifica permessi per la creazione di link simbolici
# Questo controllo verifica il gruppo Administrators, ma la policy può variare
$identity = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object System.Security.Principal.WindowsPrincipal($identity)
if ($principal.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Host "L'utente attuale ha privilegi di amministratore (può creare symlink se la policy lo consente)."
} else {
Write-Warning "L'utente attuale NON ha privilegi di amministratore. Potrebbero servire permessi aggiuntivi per creare symlink."
}
Write-Host "Verifica manualmente la policy: 'Criteri di sicurezza locali -> Criteri locali -> Assegnazione diritti utente -> Creazione di collegamenti simbolici'"
# 6. Crea la cartella _htm_home nella home dell'utente
$htmHome = Join-Path $home "_htm_home"
if (-not (Test-Path $htmHome)) {
New-Item -ItemType Directory -Path $htmHome | Out-Null
Write-Host "Creata directory: $htmHome"
} else {
Write-Host "Directory già esistente: $htmHome"
}
# 7. Istruzioni per lanciare smlink manualmente
Write-Host "\n*** ATTENZIONE: Passaggi manuali necessari ***"
Write-Host "1. Apri CMD come amministratore (NON PowerShell), spostati nella cartella PDC (es: cd %userprofile%\\Projects\\puc)"
Write-Host "2. Lancia il comando: smlink -ck I/CT/ct-master -n"
Write-Host " (verifica che il meno sia quello giusto, non un trattino lungo!)"
# 8. Istruzioni per copiare htm_home.zip
Write-Host "\nPer completare la configurazione, estrai la cartella 'hostname_NOMEMACCHINA' da htm_home.zip (in PDC_INSTALL/software) e copiala dentro $htmHome"
Write-Host "\nScript completato."

View File

@ -0,0 +1,23 @@
# update-path-if-needed.ps1
# Aggiunge riferimenti letterali a variabili d'ambiente nella PATH utente, solo se non già presenti
# Funziona SENZA limiti di lunghezza (al contrario di setx)
$toAdd = @('%JAVA_HOME%\bin', '%M2_HOME%', '%M2%', '%SYMLINK_HOME%')
# Recupera la PATH utente attuale
$userPath = [Environment]::GetEnvironmentVariable('PATH', 'User')
if (-not $userPath) { $userPath = '' }
foreach ($dir in $toAdd) {
$pattern = [regex]::Escape($dir)
if ($userPath -notmatch "(^|;)$pattern(;|$)") {
$userPath += ";$dir"
Write-Host "Aggiunto $dir alla PATH"
} else {ç
Write-Host "$dir già presente nella PATH"
}
}
[Environment]::SetEnvironmentVariable('PATH', $userPath, 'User')
Write-Host "PATH aggiornata (permanente, solo per l'utente)."
Write-Host "ATTENZIONE: la modifica sarà visibile solo nelle nuove sessioni di prompt/cmd/powershell."