()
| 32 | |
| 33 | // Main deployment function |
| 34 | function deploy() { |
| 35 | console.log('🚀 Starting deployment...'); |
| 36 | |
| 37 | // Check if build directory exists |
| 38 | if (!fs.existsSync(buildDir)) { |
| 39 | console.error('❌ build directory not found. Please run npm run build first.'); |
| 40 | process.exit(1); |
| 41 | } |
| 42 | |
| 43 | // Remove existing plugin directory |
| 44 | if (fs.existsSync(pluginDir)) { |
| 45 | console.log('🧹 Cleaning existing plugin directory...'); |
| 46 | fs.rmSync(pluginDir, { recursive: true, force: true }); |
| 47 | } |
| 48 | |
| 49 | // Create plugin directory and dist subdirectory |
| 50 | console.log('📁 Creating plugin directory structure...'); |
| 51 | fs.mkdirSync(pluginDistDir, { recursive: true }); |
| 52 | |
| 53 | // Copy build folder contents to plugin/dist |
| 54 | console.log('📦 Copying build folder to dist...'); |
| 55 | copyRecursive(buildDir, pluginDistDir); |
| 56 | |
| 57 | // Copy src folder contents to plugin/dist |
| 58 | console.log('📂 Copying src folder to dist...'); |
| 59 | if (fs.existsSync(srcDir)) { |
| 60 | copyRecursive(srcDir, pluginDistDir); |
| 61 | } |
| 62 | |
| 63 | // Copy package.json |
| 64 | console.log('📄 Copying package.json...'); |
| 65 | fs.copyFileSync(packageJsonPath, path.join(pluginDir, 'package.json')); |
| 66 | |
| 67 | // Copy README.md if it exists |
| 68 | if (fs.existsSync(readmePath)) { |
| 69 | console.log('📄 Copying README.md...'); |
| 70 | fs.copyFileSync(readmePath, path.join(pluginDir, 'README.md')); |
| 71 | } |
| 72 | |
| 73 | // Copy CHANGELOG.md if it exists |
| 74 | if (fs.existsSync(changelogPath)) { |
| 75 | console.log('📄 Copying CHANGELOG.md...'); |
| 76 | fs.copyFileSync(changelogPath, path.join(pluginDir, 'CHANGELOG.md')); |
| 77 | } |
| 78 | |
| 79 | console.log('✅ Deployment completed successfully!'); |
| 80 | console.log(`📍 Plugin installed at: ${pluginDir}`); |
| 81 | console.log(''); |
| 82 | console.log('🔄 Please restart Tabby to load the plugin.'); |
| 83 | } |
| 84 | |
| 85 | // Run deployment |
| 86 | deploy(); |
no test coverage detected