UNPKG

ctrlshiftleft

Version:

AI-powered toolkit for embedding QA and security testing into development workflows

77 lines (64 loc) 2.05 kB
#!/usr/bin/env node /** * ctrl.shift.left Extension Packager * * This script packages the VS Code extension for distribution */ const fs = require('fs'); const path = require('path'); const { execSync } = require('child_process'); // Configuration const EXTENSION_DIR = __dirname; const PACKAGE_DIR = path.join(EXTENSION_DIR, 'dist'); const VERSION = require('./package.json').version; /** * Creates the distribution directory if it doesn't exist */ function ensureDistDirectory() { if (!fs.existsSync(PACKAGE_DIR)) { fs.mkdirSync(PACKAGE_DIR, { recursive: true }); console.log(`Created distribution directory: ${PACKAGE_DIR}`); } } /** * Packages the extension as a VSIX file */ function packageExtension() { try { console.log('Packaging VS Code extension...'); // Check if vsce is installed try { execSync('vsce --version', { stdio: 'ignore' }); } catch (error) { console.log('Installing vsce package manager...'); execSync('npm install -g @vscode/vsce', { stdio: 'inherit' }); } // Package the extension const vsixPath = path.join(PACKAGE_DIR, `ctrlshiftleft-${VERSION}.vsix`); execSync(`vsce package -o "${vsixPath}"`, { cwd: EXTENSION_DIR, stdio: 'inherit' }); console.log(`\nExtension packaged successfully: ${vsixPath}`); console.log('\nInstallation Instructions:'); console.log('1. Open VS Code'); console.log('2. Go to Extensions view (Ctrl+Shift+X)'); console.log('3. Click the "..." in the top-right corner'); console.log('4. Select "Install from VSIX..."'); console.log(`5. Choose the generated file: ctrlshiftleft-${VERSION}.vsix`); } catch (error) { console.error(`\nError packaging extension: ${error.message}`); process.exit(1); } } /** * Main function */ function main() { console.log('ctrl.shift.left VS Code Extension Packager'); console.log('=========================================='); ensureDistDirectory(); packageExtension(); } // Run the packager main();