-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathbuild.js
More file actions
60 lines (50 loc) · 1.86 KB
/
build.js
File metadata and controls
60 lines (50 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
const { execSync } = require('child_process');
const fs = require('fs-extra');
const path = require('path');
// Configuration
const pluginName = 'CustomLogoPlugin';
const pluginVersion = '1.0.0';
const targetFramework = 'net6.0'; // Jellyfin 10.8.0+ uses .NET 6.0
// Ensure output directories exist
const outputDir = path.join(__dirname, 'dist');
const buildDir = path.join(outputDir, 'build');
console.log('Cleaning previous build files...');
fs.removeSync(outputDir);
fs.ensureDirSync(buildDir);
// Copy source files to build directory
console.log('Copying source files...');
fs.copySync('./CustomLogoPlugin-1.0.0', buildDir, {
filter: (src) => {
// Exclude any temp or system files
return !src.includes('obj') && !src.includes('bin');
}
});
// Detect if dotnet is available
try {
console.log('Checking .NET SDK...');
execSync('dotnet --version', { stdio: 'pipe' });
// If dotnet is available, build the plugin
console.log('Building plugin...');
execSync(`dotnet publish "${path.join(buildDir, 'CustomLogoPlugin.csproj')}" -c Release -f ${targetFramework} --output "${path.join(outputDir, 'bin')}"`, {
stdio: 'inherit'
});
console.log('Build completed successfully!');
} catch (error) {
console.error('Error: .NET SDK not found or build failed.');
console.error('To build this plugin, you need to install the .NET SDK version 6.0 or higher.');
console.error('Download from: https://dotnet.microsoft.com/download');
console.error('');
console.error('Detailed error:', error.message);
process.exit(1);
}
// Copy additional files needed for Jellyfin
console.log('Copying metadata files...');
fs.copySync(
path.join(buildDir, 'manifest.json'),
path.join(outputDir, 'bin', 'manifest.json')
);
fs.copySync(
path.join(buildDir, 'static'),
path.join(outputDir, 'bin', 'static')
);
console.log(`Plugin built successfully: ${outputDir}/bin`);