remove and cleanup unused code (#4074)
This commit is contained in:
@@ -1,49 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
// Paths
|
||||
const platformWinDir = path.join(__dirname, '..', 'src', 'platform', 'windows', 'bin');
|
||||
const outDir = path.join(__dirname, '..', 'out', 'Goose-win32-x64', 'resources', 'bin');
|
||||
const srcBinDir = path.join(__dirname, '..', 'src', 'bin');
|
||||
|
||||
// Helper function to copy files
|
||||
function copyFiles(sourceDir, targetDir) {
|
||||
// Ensure target directory exists
|
||||
if (!fs.existsSync(targetDir)) {
|
||||
fs.mkdirSync(targetDir, { recursive: true });
|
||||
}
|
||||
|
||||
// Copy all files from source to target directory
|
||||
console.log(`Copying files to ${targetDir}...`);
|
||||
fs.readdirSync(sourceDir).forEach(file => {
|
||||
const srcPath = path.join(sourceDir, file);
|
||||
const destPath = path.join(targetDir, file);
|
||||
|
||||
// Skip .gitignore and README.md
|
||||
if (file === '.gitignore' || file === 'README.md') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle directories (like goose-npm)
|
||||
if (fs.statSync(srcPath).isDirectory()) {
|
||||
fs.cpSync(srcPath, destPath, { recursive: true, force: true });
|
||||
console.log(`Copied directory: ${file}`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Copy individual file
|
||||
fs.copyFileSync(srcPath, destPath);
|
||||
console.log(`Copied: ${file}`);
|
||||
});
|
||||
}
|
||||
|
||||
// Copy to both directories
|
||||
console.log('Copying Windows-specific files...');
|
||||
|
||||
// Copy to src/bin for development
|
||||
copyFiles(platformWinDir, srcBinDir);
|
||||
|
||||
// Copy to output directory for distribution
|
||||
copyFiles(platformWinDir, outDir);
|
||||
|
||||
console.log('Windows-specific files copied successfully');
|
||||
@@ -1,53 +0,0 @@
|
||||
const { createCanvas, loadImage } = require('canvas');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
async function generateUpdateIcon() {
|
||||
// Load the original icon
|
||||
const iconPath = path.join(__dirname, '../src/images/iconTemplate.png');
|
||||
const icon = await loadImage(iconPath);
|
||||
|
||||
// Create canvas
|
||||
const canvas = createCanvas(22, 22);
|
||||
const ctx = canvas.getContext('2d');
|
||||
|
||||
// Draw the original icon
|
||||
ctx.drawImage(icon, 0, 0);
|
||||
|
||||
// Add red dot in top-right corner
|
||||
ctx.fillStyle = '#FF0000';
|
||||
ctx.beginPath();
|
||||
ctx.arc(18, 4, 3, 0, 2 * Math.PI);
|
||||
ctx.fill();
|
||||
|
||||
// Save the new icon
|
||||
const outputPath = path.join(__dirname, '../src/images/iconTemplateUpdate.png');
|
||||
const buffer = canvas.toBuffer('image/png');
|
||||
fs.writeFileSync(outputPath, buffer);
|
||||
|
||||
console.log('Generated update icon at:', outputPath);
|
||||
|
||||
// Also generate @2x version
|
||||
const canvas2x = createCanvas(44, 44);
|
||||
const ctx2x = canvas2x.getContext('2d');
|
||||
|
||||
// Load and draw @2x version
|
||||
const icon2xPath = path.join(__dirname, '../src/images/iconTemplate@2x.png');
|
||||
const icon2x = await loadImage(icon2xPath);
|
||||
ctx2x.drawImage(icon2x, 0, 0);
|
||||
|
||||
// Add red dot in top-right corner (scaled)
|
||||
ctx2x.fillStyle = '#FF0000';
|
||||
ctx2x.beginPath();
|
||||
ctx2x.arc(36, 8, 6, 0, 2 * Math.PI);
|
||||
ctx2x.fill();
|
||||
|
||||
// Save the @2x version
|
||||
const output2xPath = path.join(__dirname, '../src/images/iconTemplateUpdate@2x.png');
|
||||
const buffer2x = canvas2x.toBuffer('image/png');
|
||||
fs.writeFileSync(output2xPath, buffer2x);
|
||||
|
||||
console.log('Generated @2x update icon at:', output2xPath);
|
||||
}
|
||||
|
||||
generateUpdateIcon().catch(console.error);
|
||||
@@ -1,16 +0,0 @@
|
||||
const { execSync } = require('child_process');
|
||||
const path = require('path');
|
||||
|
||||
try {
|
||||
if (process.platform === 'win32') {
|
||||
execSync(path.join(__dirname, 'prepare-windows-npm.bat'), { stdio: 'inherit' });
|
||||
} else {
|
||||
execSync(path.join(__dirname, 'prepare-windows-npm.sh'), {
|
||||
stdio: 'inherit',
|
||||
shell: '/bin/bash'
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error preparing platform:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user