Skip to content

Commit e5a440f

Browse files
authored
Refactor build:extension command (#822)
* Refactor build:extenstions command * Enable parallel build extension * build extension on windows, set job name similar to folder name * windows build extension write logs to console for debugging --------- Co-authored-by: Hien To <[email protected]> Co-authored-by: Hien To <[email protected]>
1 parent a6b4438 commit e5a440f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@
3232
"build:web": "yarn workspace jan-web build && cpx \"web/out/**\" \"electron/renderer/\"",
3333
"build:electron": "cpx \"models/**\" \"electron/models/\" && yarn workspace jan build",
3434
"build:electron:test": "yarn workspace jan build:test",
35-
"build:extensions": "rimraf ./electron/pre-install/*.tgz && concurrently --kill-others-on-fail \"cd ./extensions/conversational-extension && npm install && npm run build:publish\" \"cd ./extensions/inference-extension && npm install && npm run build:publish\" \"cd ./extensions/model-extension && npm install && npm run build:publish\" \"cd ./extensions/monitoring-extension && npm install && npm run build:publish\" \"cd ./extensions/assistant-extension && npm install && npm run build:publish\"",
35+
"build:extensions:windows": "rimraf ./electron/pre-install/*.tgz && powershell -command \"$jobs = Get-ChildItem -Path './extensions' -Directory | ForEach-Object { Start-Job -Name ($_.Name) -ScriptBlock { param($_dir); try { Set-Location $_dir; npm install; npm run build:publish; Write-Output 'Build successful in ' + $_dir } catch { Write-Error 'Error in ' + $_dir; throw } } -ArgumentList $_.FullName }; $jobs | Wait-Job; $jobs | ForEach-Object { Receive-Job -Job $_ -Keep } | ForEach-Object { Write-Host $_ }; $failed = $jobs | Where-Object { $_.State -ne 'Completed' -or $_.ChildJobs[0].JobStateInfo.State -ne 'Completed' }; if ($failed) { Exit 1 }\"",
36+
"build:extensions:linux": "rimraf ./electron/pre-install/*.tgz && find ./extensions -mindepth 1 -maxdepth 1 -type d -print0 | xargs -0 -n 1 -P 4 -I {} sh -c 'cd {} && npm install && npm run build:publish'",
37+
"build:extensions:darwin": "rimraf ./electron/pre-install/*.tgz && find ./extensions -mindepth 1 -maxdepth 1 -type d -print0 | xargs -0 -n 1 -P 4 -I {} sh -c 'cd {} && npm install && npm run build:publish'",
38+
"build:extensions": "run-script-os",
3639
"build:test": "yarn build:web && yarn workspace jan build:test",
3740
"build": "yarn build:web && yarn build:electron",
3841
"build:publish": "yarn build:web && yarn workspace jan build:publish"

0 commit comments

Comments
 (0)