forked from cambecc/earth
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsync-wallpaper.js
More file actions
75 lines (62 loc) · 2.02 KB
/
sync-wallpaper.js
File metadata and controls
75 lines (62 loc) · 2.02 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/**
* Sync script to copy updated files from public/ to wallpaper-engine/
* Run this after making changes to core earth.js code to keep versions in sync
*
* Usage: node sync-wallpaper.js
*/
var fs = require('fs');
var path = require('path');
var filesToSync = [
// Core earth library files
'libs/earth/1.0.0/earth.js',
'libs/earth/1.0.0/globes.js',
'libs/earth/1.0.0/micro.js',
'libs/earth/1.0.0/products.js',
// Data files (optional - only if structure changed)
// 'data/earth-topo.json',
// 'data/earth-topo-mobile.json',
// Styles (only if modified)
// 'styles/styles.css',
];
var publicDir = path.join(__dirname, 'public');
var wallpaperDir = path.join(__dirname, 'wallpaper-engine');
console.log('Syncing files from public/ to wallpaper-engine/...');
console.log('');
var synced = 0;
var skipped = 0;
var errors = 0;
filesToSync.forEach(function (relativePath) {
var sourcePath = path.join(publicDir, relativePath);
var destPath = path.join(wallpaperDir, relativePath);
var destDir = path.dirname(destPath);
try {
// Check if source exists
if (!fs.existsSync(sourcePath)) {
console.log('SKIP: ' + relativePath + ' (source not found)');
skipped++;
return;
}
// Create destination directory if needed
if (!fs.existsSync(destDir)) {
fs.mkdirSync(destDir, { recursive: true });
}
// Copy file
fs.copyFileSync(sourcePath, destPath);
console.log('SYNC: ' + relativePath);
synced++;
} catch (error) {
console.error('ERROR: ' + relativePath + ' - ' + error.message);
errors++;
}
});
console.log('');
console.log('Sync complete:');
console.log(' Synced: ' + synced);
console.log(' Skipped: ' + skipped);
console.log(' Errors: ' + errors);
if (errors === 0) {
console.log('');
console.log('Next steps:');
console.log(' 1. Test wallpaper in Wallpaper Engine editor');
console.log(' 2. If working, update on Steam Workshop');
}