feat: restore enhanced build system and integrate parallel build script

This PR combines two improvements to the build system:

1. **Restore Enhanced Build System** (reverts PR #6811)
   - Restores commit SHA versioning for VS Code extensions
   - Brings back reusable GitHub Actions workflows
   - Re-enables monorepo build system with local file dependencies
   - Restores enhanced oneper utility with commit SHA support

2. **Integrate Parallel Build Script** (integrates PR #6821)
   - Replaces shell/PowerShell build scripts with JavaScript version
   - Implements parallel package building for 40% faster builds (20s → 12s)
   - Cross-platform compatibility using Node.js instead of platform-specific scripts
   - Enhanced error reporting and build status visibility

## Key Changes
-  Reusable GitHub Actions workflow for VS Code extension builds
-  Commit SHA versioning restored in extension package.json
-  Enhanced oneper utility with full commit SHA support
-  New `scripts/build-packages.js` with parallel execution
-  Removed platform-specific `build-packages.sh` and `build-packages.ps1`
-  Updated all workflows and tasks to use the new build script

## Performance Impact
Build time improvement: **20s → 12s** (40% faster) due to parallel execution

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Patrick Erichsen 2025-07-28 14:22:11 -07:00
parent 81dd2c3112
commit 0f582f2002
10 changed files with 123 additions and 117 deletions

View File

@ -106,13 +106,8 @@ jobs:
key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }}
# Build all packages using the authoritative build script
- name: Build packages (Windows)
run: ./scripts/build-packages.ps1
if: matrix.os == 'windows-latest'
- name: Build packages (Linux/macOS)
run: ./scripts/build-packages.sh
if: matrix.os != 'windows-latest'
- name: Build packages
run: node ./scripts/build-packages.js
- name: Install extension Dependencies
run: |

View File

@ -167,7 +167,7 @@ jobs:
key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }}
- name: Build packages (Unix)
run: cd ../.. && ./scripts/build-packages.sh
run: cd ../.. && node ./scripts/build-packages.js
# npm install core
- name: Install core node_modules

View File

@ -59,7 +59,7 @@ jobs:
node-version-file: ".nvmrc"
- name: Build packages (Unix)
run: ./scripts/build-packages.sh
run: node ./scripts/build-packages.js
config-yaml-checks:
needs: build-packages
@ -78,7 +78,7 @@ jobs:
- name: Build packages and check config-yaml
run: |
./scripts/build-packages.sh
node ./scripts/build-packages.js
cd packages/config-yaml
npx tsc --noEmit
# Tests are currently failing, commenting out for now
@ -137,7 +137,7 @@ jobs:
- name: Build packages and install core dependencies
run: |
./scripts/build-packages.sh
node ./scripts/build-packages.js
cd core
npm ci
@ -177,7 +177,7 @@ jobs:
- name: Build packages and install dependencies
run: |
./scripts/build-packages.sh
node ./scripts/build-packages.js
if [ "${{ steps.gui-cache.outputs.cache-hit }}" != "true" ]; then
cd core
npm ci
@ -211,7 +211,7 @@ jobs:
- name: Build packages and install dependencies
run: |
./scripts/build-packages.sh
node ./scripts/build-packages.js
cd core
npm ci
cd ../gui
@ -251,7 +251,7 @@ jobs:
- name: Build packages and install dependencies
run: |
./scripts/build-packages.sh
node ./scripts/build-packages.js
if [ "${{ steps.binary-cache.outputs.cache-hit }}" != "true" ]; then
cd core
npm ci
@ -295,7 +295,7 @@ jobs:
- name: Build packages and install dependencies
run: |
./scripts/build-packages.sh
node ./scripts/build-packages.js
if [ "${{ steps.vscode-cache.outputs.cache-hit }}" != "true" ]; then
cd core
npm ci
@ -333,7 +333,7 @@ jobs:
- name: Build packages and install dependencies
run: |
./scripts/build-packages.sh
node ./scripts/build-packages.js
cd core
npm ci
cd ../extensions/vscode
@ -370,7 +370,7 @@ jobs:
- name: Build packages and install core dependencies
run: |
./scripts/build-packages.sh
node ./scripts/build-packages.js
cd core
npm ci
@ -401,7 +401,7 @@ jobs:
- name: Build packages and run tests
run: |
./scripts/build-packages.sh
node ./scripts/build-packages.js
cd packages/config-yaml
npm test
@ -421,7 +421,7 @@ jobs:
- name: Build packages and run tests
run: |
./scripts/build-packages.sh
node ./scripts/build-packages.js
cd packages/openai-adapters
npm test
env:
@ -453,7 +453,7 @@ jobs:
- name: Build packages and get test files
id: vscode-get-test-file-matrix
run: |
./scripts/build-packages.sh
node ./scripts/build-packages.js
cd core
npm ci
cd ../extensions/vscode
@ -525,7 +525,7 @@ jobs:
- name: Build packages and download e2e dependencies
run: |
./scripts/build-packages.sh
node ./scripts/build-packages.js
if [ "${{ steps.storage-cache.outputs.cache-hit }}" != "true" ]; then
cd core
npm ci
@ -590,7 +590,7 @@ jobs:
- name: Build packages and install core dependencies
run: |
./scripts/build-packages.sh
node ./scripts/build-packages.js
cd core
npm ci
@ -678,7 +678,7 @@ jobs:
- name: Build packages and install dependencies
run: |
./scripts/build-packages.sh
node ./scripts/build-packages.js
cd core
npm ci
cd ../gui
@ -703,7 +703,7 @@ jobs:
- name: Build packages and install core dependencies
run: |
./scripts/build-packages.sh
node ./scripts/build-packages.js
cd core
npm ci

3
.vscode/tasks.json vendored
View File

@ -227,8 +227,7 @@
{
"label": "build-packages",
"type": "shell",
"windows": { "command": "./scripts/build-packages.ps1" },
"command": "./scripts/build-packages.sh",
"command": "node ./scripts/build-packages.js",
"problemMatcher": [],
"presentation": {
"reveal": "silent",

View File

@ -80,7 +80,7 @@
},
"../fetch": {
"name": "@continuedev/fetch",
"version": "1.0.15",
"version": "1.0.16",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/config-types": "file:../config-types",

100
scripts/build-packages.js Normal file
View File

@ -0,0 +1,100 @@
const { spawn } = require("child_process");
const path = require("path");
const fs = require("fs");
const fsPromises = require("fs/promises");
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);
});
});
}
// Helper function to build a package (install + build)
async function buildPackage(packageName, cleanNodeModules = false) {
const packagePath = path.join(__dirname, "..", "packages", packageName);
if (!fs.existsSync(packagePath)) {
throw new Error(`Package directory not found: ${packagePath}`);
}
if (cleanNodeModules) {
const nodeModulesPath = path.join(packagePath, "node_modules");
if (fs.existsSync(nodeModulesPath)) {
console.log(`🧹 Cleaning node_modules for ${packageName}`);
await fsPromises.rm(nodeModulesPath, { recursive: true, force: true });
}
}
await runCommand(npmInstallCmd, packagePath, `${packageName} (install)`);
return runCommand("npm run build", packagePath, `${packageName} (build)`);
}
async function buildPackagesInParallel(packages, cleanNodeModules = false) {
const buildPromises = packages.map((pkg) =>
buildPackage(pkg, cleanNodeModules),
);
return Promise.all(buildPromises);
}
async function main() {
try {
console.log("🚀 Starting package builds...\n");
// Phase 1: Build config-types (foundation - no dependencies)
await buildPackagesInParallel(["config-types"]);
// Phase 2: Build packages that depend on config-types
await buildPackagesInParallel(["fetch", "config-yaml", "llm-info"]);
// Phase 3: Build packages that depend on other local packages
await buildPackagesInParallel(["openai-adapters", "continue-sdk"], true);
console.log("🎉 All packages built successfully!");
} catch (error) {
console.error("💥 Build failed:", error.message);
process.exit(1);
}
}
if (require.main === module) {
main();
}

View File

@ -1,43 +0,0 @@
# Use npm ci in CI, npm install in development
if ($env:CI -eq "true") {
$npmInstallCmd = "npm ci"
} else {
$npmInstallCmd = "npm install"
}
Push-Location packages
# Phase 1: Build config-types (foundation - no dependencies)
Push-Location "config-types"
& cmd /c $npmInstallCmd
npm run build
Pop-Location
# Phase 2: Build packages that depend on config-types
Push-Location "fetch"
& cmd /c $npmInstallCmd
npm run build
Pop-Location
Push-Location "config-yaml"
& cmd /c $npmInstallCmd
npm run build
Pop-Location
Push-Location "llm-info"
& cmd /c $npmInstallCmd
npm run build
Pop-Location
# Phase 3: Build packages that depend on other local packages
Push-Location "openai-adapters"
& cmd /c $npmInstallCmd
npm run build
Pop-Location
Push-Location "continue-sdk"
& cmd /c $npmInstallCmd
npm run build
Pop-Location
Pop-Location

View File

@ -1,45 +0,0 @@
# Build @continuedev packages for monorepo style linking
# Use npm ci in CI, npm install in development
if [ "$CI" = "true" ]; then
NPM_INSTALL_CMD="npm ci"
else
NPM_INSTALL_CMD="npm install"
fi
cd packages
# Phase 1: Build config-types (foundation - no dependencies)
cd config-types
$NPM_INSTALL_CMD
npm run build
cd ..
# Phase 2: Build packages that depend on config-types
cd fetch
$NPM_INSTALL_CMD
npm run build
cd ..
cd config-yaml
$NPM_INSTALL_CMD
npm run build
cd ..
cd llm-info
$NPM_INSTALL_CMD
npm run build
cd ..
# Phase 3: Build packages that depend on other local packages
cd openai-adapters
rm -rf node_modules
$NPM_INSTALL_CMD
npm run build
cd ..
cd continue-sdk
rm -rf node_modules
$NPM_INSTALL_CMD
npm run build
cd ..

View File

@ -77,7 +77,7 @@ Write-Host "`nInstalling root-level dependencies..." -ForegroundColor White
npm install
Write-Host "`nBuilding packages (fetch, openai-adapters, config-yaml)..." -ForegroundColor White
& .\scripts\build-packages.ps1
node ./scripts/build-packages.js
Write-Host "`nInstalling Core extension dependencies..." -ForegroundColor White
Push-Location core

View File

@ -31,7 +31,7 @@ echo "Installing root-level dependencies..."
npm install
echo "Building packages (fetch, openai-adapters, config-yaml)..."
./scripts/build-packages.sh
node ./scripts/build-packages.js
echo "Installing Core extension dependencies..."
pushd core