scripts update
This commit is contained in:
parent
d559d9c18d
commit
afca1215bb
5
.gitignore
vendored
5
.gitignore
vendored
@ -44,3 +44,8 @@ logs/
|
|||||||
|
|
||||||
# macOS
|
# macOS
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
# OTHER
|
||||||
|
.just/
|
||||||
|
journalapp.exe
|
||||||
|
Journal.App/node_modules.old/@rollup/.rollup-win32-x64-msvc-IjiZshxL/rollup.win32-x64-msvc.node
|
||||||
|
|||||||
7
Journal.App/package-lock.json
generated
7
Journal.App/package-lock.json
generated
@ -906,6 +906,7 @@
|
|||||||
"integrity": "sha512-NXsZLvalgI3HrHG6ogoEVzjyV7bSFQNqQeekfU7nNufQFrRyV3EBDfQKEwxx50peu7spZR42JuC1PFhwxuvBrg==",
|
"integrity": "sha512-NXsZLvalgI3HrHG6ogoEVzjyV7bSFQNqQeekfU7nNufQFrRyV3EBDfQKEwxx50peu7spZR42JuC1PFhwxuvBrg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@standard-schema/spec": "^1.0.0",
|
"@standard-schema/spec": "^1.0.0",
|
||||||
"@sveltejs/acorn-typescript": "^1.0.5",
|
"@sveltejs/acorn-typescript": "^1.0.5",
|
||||||
@ -948,6 +949,7 @@
|
|||||||
"integrity": "sha512-Y1Cs7hhTc+a5E9Va/xwKlAJoariQyHY+5zBgCZg4PFWNYQ1nMN9sjK1zhw1gK69DuqVP++sht/1GZg1aRwmAXQ==",
|
"integrity": "sha512-Y1Cs7hhTc+a5E9Va/xwKlAJoariQyHY+5zBgCZg4PFWNYQ1nMN9sjK1zhw1gK69DuqVP++sht/1GZg1aRwmAXQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sveltejs/vite-plugin-svelte-inspector": "^4.0.1",
|
"@sveltejs/vite-plugin-svelte-inspector": "^4.0.1",
|
||||||
"debug": "^4.4.1",
|
"debug": "^4.4.1",
|
||||||
@ -1254,6 +1256,7 @@
|
|||||||
"integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==",
|
"integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"acorn": "bin/acorn"
|
"acorn": "bin/acorn"
|
||||||
},
|
},
|
||||||
@ -1540,6 +1543,7 @@
|
|||||||
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
},
|
},
|
||||||
@ -1686,6 +1690,7 @@
|
|||||||
"integrity": "sha512-pRUBr6j6uQDgBi208gHnGRMykw0Rf2Yr1HmLyRucsvcaYgIUxswJkT93WZJflsmezu5s8Lq+q78EoyLv2yaFCg==",
|
"integrity": "sha512-pRUBr6j6uQDgBi208gHnGRMykw0Rf2Yr1HmLyRucsvcaYgIUxswJkT93WZJflsmezu5s8Lq+q78EoyLv2yaFCg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jridgewell/remapping": "^2.3.4",
|
"@jridgewell/remapping": "^2.3.4",
|
||||||
"@jridgewell/sourcemap-codec": "^1.5.0",
|
"@jridgewell/sourcemap-codec": "^1.5.0",
|
||||||
@ -1765,6 +1770,7 @@
|
|||||||
"integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==",
|
"integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
"tsserver": "bin/tsserver"
|
"tsserver": "bin/tsserver"
|
||||||
@ -1779,6 +1785,7 @@
|
|||||||
"integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==",
|
"integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"esbuild": "^0.25.0",
|
"esbuild": "^0.25.0",
|
||||||
"fdir": "^6.4.4",
|
"fdir": "^6.4.4",
|
||||||
|
|||||||
19
devtool.json
19
devtool.json
@ -245,6 +245,23 @@
|
|||||||
"workingDir": ".",
|
"workingDir": ".",
|
||||||
"dependsOn": []
|
"dependsOn": []
|
||||||
}
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
"id": "npm-clean",
|
||||||
|
"label": "Clean Node Modules",
|
||||||
|
"description": "Remove Journal.App node_modules (kills node/tauri first)",
|
||||||
|
"group": "System",
|
||||||
|
"command": "pwsh",
|
||||||
|
"args": [
|
||||||
|
"-NoProfile",
|
||||||
|
"-ExecutionPolicy",
|
||||||
|
"Bypass",
|
||||||
|
"-File",
|
||||||
|
"scripts/npm-clean.ps1"
|
||||||
|
],
|
||||||
|
"workingDir": ".",
|
||||||
|
"dependsOn": []
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"env": [
|
"env": [
|
||||||
{
|
{
|
||||||
@ -298,4 +315,4 @@
|
|||||||
"options": []
|
"options": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
6
package-lock.json
generated
Normal file
6
package-lock.json
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"name": "journal",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {}
|
||||||
|
}
|
||||||
62
scripts/npm-clean.ps1
Normal file
62
scripts/npm-clean.ps1
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
param(
|
||||||
|
[switch]$RemoveLockfile,
|
||||||
|
[switch]$Force
|
||||||
|
)
|
||||||
|
|
||||||
|
$commonScript = Join-Path $PSScriptRoot "script-common.ps1"
|
||||||
|
if (-not (Test-Path $commonScript)) {
|
||||||
|
throw "Missing helper script: $commonScript"
|
||||||
|
}
|
||||||
|
. $commonScript
|
||||||
|
|
||||||
|
$repoRoot = Resolve-JournalRepoRoot -StartPath $PSScriptRoot
|
||||||
|
$appRoot = Resolve-JournalAppRoot -RepoRoot $repoRoot
|
||||||
|
|
||||||
|
Write-Host "Cleaning npm artifacts for Journal.App" -ForegroundColor Cyan
|
||||||
|
Write-Host "Using app root: $appRoot" -ForegroundColor DarkGray
|
||||||
|
|
||||||
|
$processNames = @("node", "journalapp", "tauri")
|
||||||
|
Get-Process -ErrorAction SilentlyContinue |
|
||||||
|
Where-Object { $processNames -contains $_.ProcessName } |
|
||||||
|
ForEach-Object {
|
||||||
|
try {
|
||||||
|
Stop-Process -Id $_.Id -Force -ErrorAction Stop
|
||||||
|
Write-Host "Stopped process: $($_.ProcessName) ($($_.Id))" -ForegroundColor DarkGray
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Warning "Failed to stop process $($_.ProcessName) ($($_.Id)): $($_.Exception.Message)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Push-Location $appRoot
|
||||||
|
try {
|
||||||
|
$nodeModulesPath = Join-Path $appRoot "node_modules"
|
||||||
|
$lockfilePath = Join-Path $appRoot "package-lock.json"
|
||||||
|
|
||||||
|
if (Test-Path $nodeModulesPath) {
|
||||||
|
if (-not $Force) {
|
||||||
|
Write-Host "Removing node_modules (use -Force to suppress prompt)..." -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
Remove-Item -Recurse -Force $nodeModulesPath
|
||||||
|
Write-Host "Removed node_modules." -ForegroundColor Green
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "node_modules not found; nothing to remove." -ForegroundColor DarkGray
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($RemoveLockfile) {
|
||||||
|
if (Test-Path $lockfilePath) {
|
||||||
|
Remove-Item -Force $lockfilePath
|
||||||
|
Write-Host "Removed package-lock.json." -ForegroundColor Green
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "package-lock.json not found; nothing to remove." -ForegroundColor DarkGray
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "Keeping package-lock.json (pass -RemoveLockfile to delete)." -ForegroundColor DarkGray
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
Pop-Location
|
||||||
|
}
|
||||||
@ -40,10 +40,59 @@ if (-not (Get-Command npm -ErrorAction SilentlyContinue)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$nodeModulesPath = Join-Path $appRoot "node_modules"
|
$nodeModulesPath = Join-Path $appRoot "node_modules"
|
||||||
|
$packageJsonPath = Join-Path $appRoot "package.json"
|
||||||
$packageLockPath = Join-Path $appRoot "package-lock.json"
|
$packageLockPath = Join-Path $appRoot "package-lock.json"
|
||||||
|
$depsHashPath = Join-Path $appRoot "node_modules\.journal-deps.sha256"
|
||||||
|
|
||||||
|
function Get-JournalNodeDepsHash {
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string[]]$Paths
|
||||||
|
)
|
||||||
|
|
||||||
|
$hashLines = foreach ($path in $Paths) {
|
||||||
|
if (-not (Test-Path $path)) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
(Get-FileHash -Algorithm SHA256 -Path $path).Hash
|
||||||
|
}
|
||||||
|
return ($hashLines -join "`n").Trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
$hashInputs = @()
|
||||||
|
if (Test-Path $packageJsonPath) {
|
||||||
|
$hashInputs += $packageJsonPath
|
||||||
|
}
|
||||||
|
if (Test-Path $packageLockPath) {
|
||||||
|
$hashInputs += $packageLockPath
|
||||||
|
}
|
||||||
|
if ($hashInputs.Count -eq 0) {
|
||||||
|
throw "package.json not found under $appRoot."
|
||||||
|
}
|
||||||
|
|
||||||
|
$expectedDepsHash = Get-JournalNodeDepsHash -Paths $hashInputs
|
||||||
$shouldInstall = $InstallDeps -or (-not (Test-Path $nodeModulesPath))
|
$shouldInstall = $InstallDeps -or (-not (Test-Path $nodeModulesPath))
|
||||||
|
$installReason = $null
|
||||||
|
|
||||||
|
if (-not $shouldInstall -and -not $SkipInstall) {
|
||||||
|
if (-not (Test-Path $depsHashPath)) {
|
||||||
|
$shouldInstall = $true
|
||||||
|
$installReason = "dependency hash missing"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$currentDepsHash = (Get-Content $depsHashPath -Raw).Trim()
|
||||||
|
if ($currentDepsHash -ne $expectedDepsHash) {
|
||||||
|
$shouldInstall = $true
|
||||||
|
$installReason = "package.json/lockfile changed"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($SkipInstall) {
|
if ($SkipInstall) {
|
||||||
$shouldInstall = $false
|
$shouldInstall = $false
|
||||||
|
if ($installReason) {
|
||||||
|
Write-Host "SkipInstall set; dependencies may be stale ($installReason)." -ForegroundColor Yellow
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "Building Journal.App target '$Target' ($Configuration)..." -ForegroundColor Cyan
|
Write-Host "Building Journal.App target '$Target' ($Configuration)..." -ForegroundColor Cyan
|
||||||
@ -59,16 +108,26 @@ try {
|
|||||||
@("install", "--no-audit", "--fund=false")
|
@("install", "--no-audit", "--fund=false")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($installReason) {
|
||||||
|
Write-Host "Dependencies changed ($installReason). Installing..." -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
|
||||||
Write-Host "> npm $($installArgs -join ' ')" -ForegroundColor DarkGray
|
Write-Host "> npm $($installArgs -join ' ')" -ForegroundColor DarkGray
|
||||||
if (-not $DryRun) {
|
if (-not $DryRun) {
|
||||||
& npm @installArgs
|
& npm @installArgs
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
throw "Dependency install failed with exit code $LASTEXITCODE."
|
throw "Dependency install failed with exit code $LASTEXITCODE."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$depsDir = Split-Path $depsHashPath -Parent
|
||||||
|
if (-not (Test-Path $depsDir)) {
|
||||||
|
New-Item -ItemType Directory -Force -Path $depsDir | Out-Null
|
||||||
|
}
|
||||||
|
$expectedDepsHash | Set-Content -Path $depsHashPath -NoNewline
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Write-Host "Skipping dependency install (node_modules already present)." -ForegroundColor DarkGray
|
Write-Host "Skipping dependency install (node_modules present and deps unchanged)." -ForegroundColor DarkGray
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($Target -eq "web") {
|
if ($Target -eq "web") {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user