diff --git a/cortex-js/package.json b/cortex-js/package.json index 65344fea3..56357d24b 100644 --- a/cortex-js/package.json +++ b/cortex-js/package.json @@ -9,9 +9,12 @@ }, "scripts": { "dev": "nest dev", - "build": "yarn build:extensions && nest build && cp -r cpuinfo/bin ./dist/", + "build": "yarn build:extensions && nest build && cpx \"cpuinfo/bin/**\" dist/bin", "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", - "build:extensions": "for dir in ./src/extensions/*/; do (cd \"$dir\" && yarn && yarn build); done", + "build:extensions": "run-script-os", + "build:extensions:windows": "powershell -command \"$jobs = Get-ChildItem -Path './src/extensions' -Directory | ForEach-Object { Start-Job -Name ($_.Name) -ScriptBlock { param($_dir); try { Set-Location $_dir; yarn; yarn build; 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 }\"", + "build:extensions:linux": "for dir in ./src/extensions/*/; do (cd \"$dir\" && yarn && yarn build); done", + "build:extensions:macos": "for dir in ./src/extensions/*/; do (cd \"$dir\" && yarn && yarn build); done", "start": "nest start", "start:dev": "nest start --watch", "start:debug": "nest start --debug --watch", @@ -53,6 +56,7 @@ "uuid": "^9.0.1" }, "devDependencies": { + "cpx": "^1.5.0", "@nestjs/cli": "^10.0.0", "@nestjs/schematics": "^10.0.0", "@nestjs/testing": "^10.0.0", @@ -76,7 +80,8 @@ "ts-jest": "^29.1.0", "ts-loader": "^9.4.3", "tsconfig-paths": "^4.2.0", - "typescript": "^5.1.3" + "typescript": "^5.1.3", + "run-script-os": "^1.1.6" }, "files": [ "dist"