@necrolab/dashboard 0.4.42 → 0.4.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/postinstall.js +15 -0
package/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -21,6 +21,7 @@ try {
|
|
|
21
21
|
// Only do file operations if we're in a nested structure
|
|
22
22
|
const distPath = path.resolve(path.join(__dirname, "../../../dashboard/dist/"));
|
|
23
23
|
const localDistPath = path.resolve("./dist/");
|
|
24
|
+
const publicPath = path.resolve("./public/");
|
|
24
25
|
|
|
25
26
|
if (fs.existsSync(localDistPath) && __dirname.includes("dashboard")) {
|
|
26
27
|
try {
|
|
@@ -29,6 +30,20 @@ if (fs.existsSync(localDistPath) && __dirname.includes("dashboard")) {
|
|
|
29
30
|
}
|
|
30
31
|
fs.renameSync(localDistPath, distPath);
|
|
31
32
|
console.log("📁 Moved dist folder");
|
|
33
|
+
|
|
34
|
+
// Copy service worker files from public to the same level as index.html
|
|
35
|
+
if (fs.existsSync(publicPath)) {
|
|
36
|
+
const swFiles = fs.readdirSync(publicPath).filter(file =>
|
|
37
|
+
file.endsWith('.js') && (file.startsWith('sw') || file.startsWith('workbox'))
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
for (const file of swFiles) {
|
|
41
|
+
const sourcePath = path.join(publicPath, file);
|
|
42
|
+
const destPath = path.join(distPath, file); // Same level as index.html
|
|
43
|
+
fs.copyFileSync(sourcePath, destPath);
|
|
44
|
+
console.log(`📄 Copied ${file} to dist root`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
32
47
|
} catch (error) {
|
|
33
48
|
console.log("⚠️ Could not move dist folder, but that's okay");
|
|
34
49
|
}
|