@coze-arch/cli 0.1.4-alpha.4711a7 → 0.1.4-alpha.e6e18e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__templates__/expo/.cozeproj/scripts/dev_build.ps1 +1 -1
- package/lib/__templates__/expo/.cozeproj/scripts/dev_run.ps1 +2 -2
- package/lib/__templates__/vite/scripts/build.ps1 +1 -4
- package/lib/__templates__/vite/scripts/dev.ps1 +23 -7
- package/lib/__templates__/vite/scripts/ensure-deps.ps1 +33 -0
- package/lib/__templates__/vite/scripts/prepare.ps1 +1 -6
- package/lib/cli.js +1 -1
- package/package.json +1 -1
|
@@ -64,11 +64,11 @@ $expo = Start-LoggedProcess (Join-Path $workspace "client") $clientLog @("exec",
|
|
|
64
64
|
|
|
65
65
|
Start-Sleep -Seconds 8
|
|
66
66
|
if ((Test-Path $clientLog) -and (Select-String -Path $clientLog -Pattern "TypeError: fetch failed" -Quiet)) {
|
|
67
|
-
Write-Host "Expo
|
|
67
|
+
Write-Host "Expo startup detected a network error; retrying in offline mode."
|
|
68
68
|
Stop-ProcessTree $expo.Id
|
|
69
69
|
$expoEnvironment.EXPO_OFFLINE = "1"
|
|
70
70
|
$expo = Start-LoggedProcess (Join-Path $workspace "client") $clientLog @("exec", "expo", "start", "--web", "--clear", "--port", "$expoPort") $expoEnvironment
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
Write-Host "
|
|
73
|
+
Write-Host "Services started. Server PID: $($server.Id), Expo PID: $($expo.Id)"
|
|
74
74
|
Write-Host "EXPO_PUBLIC_BACKEND_BASE_URL=$webUrl"
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
$ErrorActionPreference = "Stop"
|
|
2
2
|
|
|
3
3
|
$workspace = if ($env:COZE_WORKSPACE_PATH) { $env:COZE_WORKSPACE_PATH } else { (Get-Location).Path }
|
|
4
|
+
& "$PSScriptRoot/ensure-deps.ps1"
|
|
4
5
|
Set-Location $workspace
|
|
5
6
|
|
|
6
|
-
Write-Host "Installing dependencies..."
|
|
7
|
-
& pnpm install --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
|
|
8
|
-
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
9
|
-
|
|
10
7
|
Write-Host "Building frontend with Vite..."
|
|
11
8
|
& pnpm vite build
|
|
12
9
|
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
@@ -51,13 +51,29 @@ try {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
$process.Id | Set-Content $pidFile
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
|
|
55
|
+
$startupTimeoutSeconds = 30
|
|
56
|
+
$startupDeadline = (Get-Date).AddSeconds($startupTimeoutSeconds)
|
|
57
|
+
while ((Get-Date) -lt $startupDeadline) {
|
|
58
|
+
if ($process.HasExited) {
|
|
59
|
+
Write-Error "Dev server exited before listening on port $port."
|
|
60
|
+
Get-Content $errorLogFile -Tail 20 -ErrorAction SilentlyContinue
|
|
61
|
+
Remove-Item $pidFile -Force -ErrorAction SilentlyContinue
|
|
62
|
+
exit 1
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (Get-NetTCPConnection -LocalPort $port -State Listen -ErrorAction SilentlyContinue) {
|
|
66
|
+
Write-Host "Dev server is listening on port $port (PID: $($process.Id))."
|
|
67
|
+
Write-Host "Log file: $logFile"
|
|
68
|
+
exit 0
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
Start-Sleep -Milliseconds 200
|
|
59
72
|
}
|
|
60
73
|
|
|
61
|
-
Write-
|
|
62
|
-
|
|
74
|
+
Write-Error "Dev server did not listen on port $port within $startupTimeoutSeconds seconds."
|
|
75
|
+
Stop-ProcessTree $process.Id
|
|
76
|
+
Get-Content $errorLogFile -Tail 20 -ErrorAction SilentlyContinue
|
|
77
|
+
Remove-Item $pidFile -Force -ErrorAction SilentlyContinue
|
|
78
|
+
exit 1
|
|
63
79
|
<% } %>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
$ErrorActionPreference = "Stop"
|
|
2
|
+
|
|
3
|
+
$workspace = if ($env:COZE_WORKSPACE_PATH) { $env:COZE_WORKSPACE_PATH } else { (Get-Location).Path }
|
|
4
|
+
Set-Location $workspace
|
|
5
|
+
|
|
6
|
+
$lockfile = Join-Path $workspace "pnpm-lock.yaml"
|
|
7
|
+
$modulesDirectory = Join-Path $workspace "node_modules"
|
|
8
|
+
$modulesManifest = Join-Path $modulesDirectory ".modules.yaml"
|
|
9
|
+
$lockHashFile = Join-Path $modulesDirectory ".coze-lockfile-sha256"
|
|
10
|
+
|
|
11
|
+
if (-not (Test-Path $lockfile)) {
|
|
12
|
+
throw "pnpm-lock.yaml is required to install dependencies."
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
$lockHash = (Get-FileHash -LiteralPath $lockfile -Algorithm SHA256).Hash
|
|
16
|
+
$cachedLockHash = if (Test-Path $lockHashFile) {
|
|
17
|
+
(Get-Content -LiteralPath $lockHashFile -Raw).Trim()
|
|
18
|
+
} else {
|
|
19
|
+
""
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if ((Test-Path $modulesManifest) -and $cachedLockHash -eq $lockHash) {
|
|
23
|
+
Write-Host "Dependencies already match pnpm-lock.yaml; skipping install."
|
|
24
|
+
return
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
Write-Host "Installing dependencies..."
|
|
28
|
+
& pnpm install --frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
|
|
29
|
+
if ($LASTEXITCODE -ne 0) {
|
|
30
|
+
throw "pnpm install failed with exit code $LASTEXITCODE."
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
Set-Content -LiteralPath $lockHashFile -Value $lockHash -NoNewline
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
$ErrorActionPreference = "Stop"
|
|
2
2
|
|
|
3
3
|
$workspace = if ($env:COZE_WORKSPACE_PATH) { $env:COZE_WORKSPACE_PATH } else { (Get-Location).Path }
|
|
4
|
+
& "$PSScriptRoot/ensure-deps.ps1"
|
|
4
5
|
Set-Location $workspace
|
|
5
6
|
|
|
6
|
-
Write-Host "Installing dependencies..."
|
|
7
|
-
& pnpm install --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
|
|
8
|
-
if ($LASTEXITCODE -ne 0) {
|
|
9
|
-
exit $LASTEXITCODE
|
|
10
|
-
}
|
|
11
|
-
|
|
12
7
|
if (Get-Command coze-dev -ErrorAction SilentlyContinue) {
|
|
13
8
|
& coze-dev check-bins --help *> $null
|
|
14
9
|
if ($LASTEXITCODE -eq 0) {
|
package/lib/cli.js
CHANGED
|
@@ -2114,7 +2114,7 @@ const EventBuilder = {
|
|
|
2114
2114
|
};
|
|
2115
2115
|
|
|
2116
2116
|
var name = "@coze-arch/cli";
|
|
2117
|
-
var version = "0.1.4-alpha.
|
|
2117
|
+
var version = "0.1.4-alpha.e6e18e";
|
|
2118
2118
|
var description = "coze coding devtools cli";
|
|
2119
2119
|
var license = "MIT";
|
|
2120
2120
|
var author = "fanwenjie.fe@bytedance.com";
|