Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/jetbrains-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ jobs:
path: gui/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }}

- name: Build packages (Unix)
run: cd ../.. && ./scripts/build-packages.sh
- name: Build packages
run: cd ../.. && node ./scripts/build-packages.js

# npm install core
- name: Install core node_modules
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,8 @@ jobs:
path: gui/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }}

- name: Build packages (Windows)
run: ./scripts/build-packages.ps1
if: matrix.os == 'windows-latest'

- name: Build packages (Unix)
run: ./scripts/build-packages.sh
if: matrix.os != 'windows-latest'
- name: Build packages
run: node ./scripts/build-packages.js

- name: Install extension Dependencies
run: |
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,8 @@ jobs:
path: gui/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }}

- name: Build packages (Windows)
run: ./scripts/build-packages.ps1
if: matrix.os == 'windows-latest'

- name: Build packages (Unix)
run: ./scripts/build-packages.sh
if: matrix.os != 'windows-latest'
- name: Build packages
run: node ./scripts/build-packages.js

- name: Install extension Dependencies
run: |
Expand Down
79 changes: 79 additions & 0 deletions scripts/build-packages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
const { spawn } = require("child_process");
const path = require("path");
const fs = require("fs");

const npmInstallCmd = process.env.CI === "true" ? "npm ci" : "npm install";

function runCommand(command, cwd, packageName) {
return new Promise((resolve, reject) => {
console.log(`Starting ${packageName}: ${command}`);

const [cmd, ...args] = command.split(" ");
const child = spawn(cmd, args, {
cwd,
stdio: "pipe",
shell: true,
});

let stdout = "";
let stderr = "";

child.stdout.on("data", (data) => {
stdout += data.toString();
});

child.stderr.on("data", (data) => {
stderr += data.toString();
});

child.on("close", (code) => {
if (code === 0) {
console.log(`✅ ${packageName}: ${command} completed successfully`);
resolve({ packageName, command, stdout, stderr });
} else {
console.error(`❌ ${packageName}: ${command} failed with code ${code}`);
console.error(`stderr: ${stderr}`);
reject(
new Error(`${packageName} failed: ${command} (exit code ${code})`),
);
}
});

child.on("error", (error) => {
console.error(`❌ ${packageName}: Failed to start ${command}:`, error);
reject(error);
});
});
}

async function buildPackage(packageName) {
const packagePath = path.join(__dirname, "..", "packages", packageName);

if (!fs.existsSync(packagePath)) {
throw new Error(`Package directory not found: ${packagePath}`);
}

await runCommand(npmInstallCmd, packagePath, `${packageName} (install)`);

return runCommand("npm run build", packagePath, `${packageName} (build)`);
}

async function main() {
try {
console.log("🚀 Starting package builds...");

await Promise.all([
buildPackage("openai-adapters"),
buildPackage("config-yaml"),
]);

console.log("🎉 All packages built successfully!");
} catch (error) {
console.error("💥 Build failed:", error.message);
process.exit(1);
}
}

if (require.main === module) {
main();
}
13 changes: 0 additions & 13 deletions scripts/build-packages.ps1

This file was deleted.

13 changes: 0 additions & 13 deletions scripts/build-packages.sh

This file was deleted.

Loading