

Kod: Tümünü seç
Microsoft Windows [Version 10.0.26100.7019]
(c) Microsoft Corporation. Tüm hakları saklıdır.
C:\Users\TRWE_2012\Masaüstü\develop-word-like-markdown-editor>npm install
added 104 packages, and audited 105 packages in 18s
14 packages are looking for funding
run `npm fund` for details
2 vulnerabilities (1 low, 1 high)
To address issues that do not require attention, run:
npm audit fix
To address all issues, run:
npm audit fix --force
Run `npm audit` for details.
npm warn install-scripts 1 package has install scripts not yet covered by allowScripts:
npm warn install-scripts esbuild@0.27.7 (postinstall: node install.js)
npm warn install-scripts
npm warn install-scripts Run `npm install-scripts ls` to review, or `npm install-scripts approve <pkg>` to allow.
npm notice
npm notice New major version of npm available! 11.19.0 -> 12.0.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v12.0.2
npm notice To update run: npm install -g npm@12.0.2
npm notice
C:\Users\TRWE_2012\Masaüstü\develop-word-like-markdown-editor>npm run build
> react-vite-tailwind@0.0.0 build
> vite build
vite v7.3.2 building client environment for production...
✓ 1877 modules transformed.
[plugin vite:singlefile]
[plugin vite:singlefile] Inlining: index-Dz5Z7WC1.js
[plugin vite:singlefile] Inlining: style-DsOmVCoJ.css
dist/index.html 362.74 kB │ gzip: 112.24 kB
✓ built in 2.40s
C:\Users\TRWE_2012\Masaüstü\develop-word-like-markdown-editor>
Türkçe mesajlı (Build-WebApp-TR.ps1, UTF-8 BOM ile Türkçe karakterler doğru görünür) ve İngilizce mesajlı (Build-WebApp-EN.ps1, taşınabilirlik için tamamen İngilizce) sürümler. İkisi de aynı mantığı çalıştırır. Kendi kullanımınız için Türkçe olanı çalıştırmanız yeterlidir.
Betiğin akışı:
1.Arşiv dosyasının (.zip, .rar, .7z) tam yolunu kullanıcısından ister.
2.Masaüstünde arşivle aynı isimde bir klasöre çıkartır (zaten varsa üzerine yazmak isteyip istemediğini sorar).
3.İçindeki package.json dosyasını otomatik bulur, o klasöre geçer, npm install ve npm run build komutlarını kendisi çalıştırır.
4.Derleme bitince dist klasöründeki HTML dosyasını bulur, kullanıcısından yeni bir isim ister, o isimle Masaüstüne kopyalar.
5.Dosyayı varsayılan tarayıcında açıp açmak istemediğinizi sorar, onaylarsanız açar.
Önemli notlar:
1..zip dosyaları için PowerShell'in kendi yerleşik aracı kullanılıyor, ek bir program gerekmiyor.
2..rar veya .7z için sistemde 7-Zip kurulu olması gerekiyor (yoksa betik sizi uyarıp indirme linkini gösteriyor ve duruyor , kendisi bir şey indirip, kurmaya çalışmıyor).
3.Node.js kurulu değilse betik hata verip duruyor, sessizce bir şey yapmaya çalışmıyor.
4.Masaüstünde aynı isimde klasör varsa senden onay almadan silmiyor.
Üstteki 6 komutluk elle yaptığın işlemi tek seferde otomatik yapıyor betik....
KOD İÇERİKLERİ :
Build-WebApp-TR.ps1
Kod: Tümünü seç
# ============================================================
# Automated Web App Build Script (Turkish version)
# Extracts a downloaded archive (.zip / .rar / .7z), installs
# npm dependencies, builds the project with Vite, and deploys
# the resulting HTML file to the Desktop. User-facing messages
# are in Turkish; code identifiers and comments remain English
# for portability.
# ============================================================
$OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
chcp 65001 > $null
$ErrorActionPreference = "Stop"
function Find-SevenZip {
$candidates = @(
"C:\Program Files\7-Zip\7z.exe",
"C:\Program Files (x86)\7-Zip\7z.exe"
)
foreach ($path in $candidates) {
if (Test-Path $path) { return $path }
}
$cmd = Get-Command "7z.exe" -ErrorAction SilentlyContinue
if ($cmd) { return $cmd.Source }
return $null
}
function Find-ProjectRoot {
param([string]$SearchPath)
$packageJson = Get-ChildItem -Path $SearchPath -Filter "package.json" -Recurse -File -ErrorAction SilentlyContinue |
Select-Object -First 1
if ($packageJson) { return $packageJson.DirectoryName }
return $null
}
function Find-BuiltHtml {
param([string]$ProjectRoot)
$distIndex = Join-Path $ProjectRoot "dist\index.html"
if (Test-Path $distIndex) { return $distIndex }
$distFolder = Join-Path $ProjectRoot "dist"
if (Test-Path $distFolder) {
$anyHtml = Get-ChildItem -Path $distFolder -Filter "*.html" -Recurse -File -ErrorAction SilentlyContinue |
Select-Object -First 1
if ($anyHtml) { return $anyHtml.FullName }
}
return $null
}
Write-Host "===================================================="
Write-Host " Otomatik Web Uygulaması Derleme Betiği"
Write-Host "===================================================="
Write-Host ""
# Step 1: Ask the user for the full path of the archive
$archivePath = Read-Host "Arşiv dosyasının tam yolunu girin (.zip, .rar, .7z)"
$archivePath = $archivePath.Trim('"').Trim()
if (-not (Test-Path -LiteralPath $archivePath)) {
Write-Host "HATA: Belirtilen dosya bulunamadı: $archivePath"
Read-Host "`nÇıkmak için ENTER tuşuna basın."
exit 1
}
$extension = [System.IO.Path]::GetExtension($archivePath).ToLower()
if ($extension -notin @(".zip", ".rar", ".7z")) {
Write-Host "HATA: Desteklenmeyen dosya türü. Yalnızca .zip, .rar, .7z desteklenir."
Read-Host "`nÇıkmak için ENTER tuşuna basın."
exit 1
}
$baseName = [System.IO.Path]::GetFileNameWithoutExtension($archivePath)
$desktop = [Environment]::GetFolderPath("Desktop")
$destinationFolder = Join-Path $desktop $baseName
# Step 2: Extract the archive into a same-named folder on the Desktop
if (Test-Path -LiteralPath $destinationFolder) {
$overwrite = Read-Host "'$destinationFolder' klasörü zaten var. Üzerine yazılsın mı? (E/H)"
if ($overwrite -match '^[EeYy]') {
Remove-Item -LiteralPath $destinationFolder -Recurse -Force
} else {
Write-Host "İşlem kullanıcı tarafından iptal edildi."
Read-Host "`nÇıkmak için ENTER tuşuna basın."
exit 0
}
}
Write-Host ""
Write-Host "Arşiv şuraya çıkartılıyor: $destinationFolder"
try {
if ($extension -eq ".zip") {
Expand-Archive -LiteralPath $archivePath -DestinationPath $destinationFolder -Force
} else {
$sevenZip = Find-SevenZip
if (-not $sevenZip) {
Write-Host "HATA: Bu sistemde 7-Zip bulunamadı."
Write-Host ".rar veya .7z dosyalarını açabilmek için https://www.7-zip.org/ adresinden 7-Zip kurun."
Read-Host "`nÇıkmak için ENTER tuşuna basın."
exit 1
}
New-Item -ItemType Directory -Path $destinationFolder -Force | Out-Null
& $sevenZip x $archivePath "-o$destinationFolder" -y | Out-Null
if ($LASTEXITCODE -ne 0) {
throw "7-Zip çıkartma işlemi $LASTEXITCODE hata koduyla başarısız oldu."
}
}
} catch {
Write-Host "HATA: Çıkartma işlemi başarısız oldu. $($_.Exception.Message)"
Read-Host "`nÇıkmak için ENTER tuşuna basın."
exit 1
}
Write-Host "Çıkartma işlemi tamamlandı."
# Step 3: Locate the project root (folder containing package.json) and build it
$projectRoot = Find-ProjectRoot -SearchPath $destinationFolder
if (-not $projectRoot) {
Write-Host "HATA: Çıkartılan arşivin içinde package.json dosyası bulunamadı."
Read-Host "`nÇıkmak için ENTER tuşuna basın."
exit 1
}
Write-Host "Proje klasörü bulundu: $projectRoot"
Set-Location -LiteralPath $projectRoot
if (-not (Get-Command "node" -ErrorAction SilentlyContinue)) {
Write-Host "HATA: Bu sistemde Node.js kurulu değil."
Write-Host "Bu betiği çalıştırmadan önce https://nodejs.org/ adresinden Node.js kurun."
Read-Host "`nÇıkmak için ENTER tuşuna basın."
exit 1
}
Write-Host ""
Write-Host "Bağımlılıklar kuruluyor (npm install)..."
& npm install
if ($LASTEXITCODE -ne 0) {
Write-Host "HATA: npm install başarısız oldu."
Read-Host "`nÇıkmak için ENTER tuşuna basın."
exit 1
}
Write-Host ""
Write-Host "Proje derleniyor (npm run build)..."
& npm run build
if ($LASTEXITCODE -ne 0) {
Write-Host "HATA: npm run build başarısız oldu."
Read-Host "`nÇıkmak için ENTER tuşuna basın."
exit 1
}
Write-Host "Derleme başarıyla tamamlandı."
# Step 4: Ask for an output name and copy the built HTML file to the Desktop
$builtHtml = Find-BuiltHtml -ProjectRoot $projectRoot
if (-not $builtHtml) {
Write-Host "HATA: Derleme sonrasında 'dist' klasöründe HTML dosyası bulunamadı."
Read-Host "`nÇıkmak için ENTER tuşuna basın."
exit 1
}
Write-Host ""
$outputName = Read-Host "Son HTML dosyası için bir isim girin (uzantısız)"
$outputName = $outputName.Trim()
if ([string]::IsNullOrWhiteSpace($outputName)) {
$outputName = $baseName
}
$invalidChars = [System.IO.Path]::GetInvalidFileNameChars()
foreach ($char in $invalidChars) {
$outputName = $outputName.Replace($char, '_')
}
if (-not $outputName.ToLower().EndsWith(".html")) {
$outputName = "$outputName.html"
}
$finalPath = Join-Path $desktop $outputName
Copy-Item -LiteralPath $builtHtml -Destination $finalPath -Force
Write-Host "Dosya şuraya kopyalandı: $finalPath"
# Step 5: Ask for confirmation and open the file in the default browser
Write-Host ""
$openConfirm = Read-Host "Dosya şimdi varsayılan tarayıcınızda açılsın mı? (E/H)"
if ($openConfirm -match '^[EeYy]') {
Start-Process -FilePath $finalPath
} else {
Write-Host "Dosyayı daha sonra şuradan manuel olarak açabilirsiniz: $finalPath"
}
Write-Host ""
Write-Host "===================================================="
Write-Host " İşlem tamamlandı."
Write-Host "===================================================="
Read-Host "`nÇıkmak için ENTER tuşuna basın."
Kod: Tümünü seç
# ============================================================
# Automated Web App Build Script (English version)
# Extracts a downloaded archive (.zip / .rar / .7z), installs
# npm dependencies, builds the project with Vite, and deploys
# the resulting HTML file to the Desktop.
# ============================================================
$ErrorActionPreference = "Stop"
function Find-SevenZip {
$candidates = @(
"C:\Program Files\7-Zip\7z.exe",
"C:\Program Files (x86)\7-Zip\7z.exe"
)
foreach ($path in $candidates) {
if (Test-Path $path) { return $path }
}
$cmd = Get-Command "7z.exe" -ErrorAction SilentlyContinue
if ($cmd) { return $cmd.Source }
return $null
}
function Find-ProjectRoot {
param([string]$SearchPath)
$packageJson = Get-ChildItem -Path $SearchPath -Filter "package.json" -Recurse -File -ErrorAction SilentlyContinue |
Select-Object -First 1
if ($packageJson) { return $packageJson.DirectoryName }
return $null
}
function Find-BuiltHtml {
param([string]$ProjectRoot)
$distIndex = Join-Path $ProjectRoot "dist\index.html"
if (Test-Path $distIndex) { return $distIndex }
$distFolder = Join-Path $ProjectRoot "dist"
if (Test-Path $distFolder) {
$anyHtml = Get-ChildItem -Path $distFolder -Filter "*.html" -Recurse -File -ErrorAction SilentlyContinue |
Select-Object -First 1
if ($anyHtml) { return $anyHtml.FullName }
}
return $null
}
Write-Host "===================================================="
Write-Host " Automated Web App Build Script"
Write-Host "===================================================="
Write-Host ""
# Step 1: Ask the user for the full path of the archive
$archivePath = Read-Host "Enter the full path of the archive file (.zip, .rar, .7z)"
$archivePath = $archivePath.Trim('"').Trim()
if (-not (Test-Path -LiteralPath $archivePath)) {
Write-Host "ERROR: The specified file was not found: $archivePath"
Read-Host "`nPress ENTER to exit."
exit 1
}
$extension = [System.IO.Path]::GetExtension($archivePath).ToLower()
if ($extension -notin @(".zip", ".rar", ".7z")) {
Write-Host "ERROR: Unsupported file type. Only .zip, .rar, .7z are supported."
Read-Host "`nPress ENTER to exit."
exit 1
}
$baseName = [System.IO.Path]::GetFileNameWithoutExtension($archivePath)
$desktop = [Environment]::GetFolderPath("Desktop")
$destinationFolder = Join-Path $desktop $baseName
# Step 2: Extract the archive into a same-named folder on the Desktop
if (Test-Path -LiteralPath $destinationFolder) {
$overwrite = Read-Host "Folder '$destinationFolder' already exists. Overwrite it? (Y/N)"
if ($overwrite -match '^[Yy]') {
Remove-Item -LiteralPath $destinationFolder -Recurse -Force
} else {
Write-Host "Operation cancelled by user."
Read-Host "`nPress ENTER to exit."
exit 0
}
}
Write-Host ""
Write-Host "Extracting archive to: $destinationFolder"
try {
if ($extension -eq ".zip") {
Expand-Archive -LiteralPath $archivePath -DestinationPath $destinationFolder -Force
} else {
$sevenZip = Find-SevenZip
if (-not $sevenZip) {
Write-Host "ERROR: 7-Zip was not found on this system."
Write-Host "Install 7-Zip from https://www.7-zip.org/ to extract .rar or .7z files."
Read-Host "`nPress ENTER to exit."
exit 1
}
New-Item -ItemType Directory -Path $destinationFolder -Force | Out-Null
& $sevenZip x $archivePath "-o$destinationFolder" -y | Out-Null
if ($LASTEXITCODE -ne 0) {
throw "7-Zip extraction failed with exit code $LASTEXITCODE."
}
}
} catch {
Write-Host "ERROR: Extraction failed. $($_.Exception.Message)"
Read-Host "`nPress ENTER to exit."
exit 1
}
Write-Host "Extraction completed."
# Step 3: Locate the project root (folder containing package.json) and build it
$projectRoot = Find-ProjectRoot -SearchPath $destinationFolder
if (-not $projectRoot) {
Write-Host "ERROR: No package.json file was found inside the extracted archive."
Read-Host "`nPress ENTER to exit."
exit 1
}
Write-Host "Project folder found: $projectRoot"
Set-Location -LiteralPath $projectRoot
if (-not (Get-Command "node" -ErrorAction SilentlyContinue)) {
Write-Host "ERROR: Node.js is not installed on this system."
Write-Host "Install it from https://nodejs.org/ before running this script."
Read-Host "`nPress ENTER to exit."
exit 1
}
Write-Host ""
Write-Host "Installing dependencies (npm install)..."
& npm install
if ($LASTEXITCODE -ne 0) {
Write-Host "ERROR: npm install failed."
Read-Host "`nPress ENTER to exit."
exit 1
}
Write-Host ""
Write-Host "Building the project (npm run build)..."
& npm run build
if ($LASTEXITCODE -ne 0) {
Write-Host "ERROR: npm run build failed."
Read-Host "`nPress ENTER to exit."
exit 1
}
Write-Host "Build completed successfully."
# Step 4: Ask for an output name and copy the built HTML file to the Desktop
$builtHtml = Find-BuiltHtml -ProjectRoot $projectRoot
if (-not $builtHtml) {
Write-Host "ERROR: No HTML file was found in the 'dist' folder after the build."
Read-Host "`nPress ENTER to exit."
exit 1
}
Write-Host ""
$outputName = Read-Host "Enter a name for the final HTML file (without extension)"
$outputName = $outputName.Trim()
if ([string]::IsNullOrWhiteSpace($outputName)) {
$outputName = $baseName
}
$invalidChars = [System.IO.Path]::GetInvalidFileNameChars()
foreach ($char in $invalidChars) {
$outputName = $outputName.Replace($char, '_')
}
if (-not $outputName.ToLower().EndsWith(".html")) {
$outputName = "$outputName.html"
}
$finalPath = Join-Path $desktop $outputName
Copy-Item -LiteralPath $builtHtml -Destination $finalPath -Force
Write-Host "File copied to: $finalPath"
# Step 5: Ask for confirmation and open the file in the default browser
Write-Host ""
$openConfirm = Read-Host "Open the file in your default browser now? (Y/N)"
if ($openConfirm -match '^[Yy]') {
Start-Process -FilePath $finalPath
} else {
Write-Host "You can open the file manually later from: $finalPath"
}
Write-Host ""
Write-Host "===================================================="
Write-Host " Process completed."
Write-Host "===================================================="
Read-Host "`nPress ENTER to exit."





