Skip to content

Commit be245df

Browse files
committed
♻️ Refactor build scripts into packages/dev
Consolidated scattered build scripts into the packages/dev package structure: - Moved deploy-signalrgb.js to packages/dev/scripts/ with enhanced WSL support - Removed scripts/build.js, scripts/glsl-lint.js, and scripts/deploy-signalrgb.js - Added WSL detection and Windows home directory resolution via $W env var - Enhanced deploy script with better platform support for Windows/legacy paths This reorganization centralizes development tooling within the monorepo structure and improves cross-platform compatibility.
1 parent db5a034 commit be245df

File tree

4 files changed

+32
-632
lines changed

4 files changed

+32
-632
lines changed

packages/dev/scripts/deploy-signalrgb.js

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env node
22

3-
import { copyFileSync, existsSync, mkdirSync, readdirSync } from 'node:fs'
3+
import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync } from 'node:fs'
44
import os from 'node:os'
55
import { join, resolve } from 'node:path'
66

@@ -13,18 +13,45 @@ const pink = NEON('255,97,216')
1313
const yellow = NEON('255,240,0')
1414
const red = '\x1b[31m'
1515

16+
function isWSL() {
17+
if (os.platform() !== 'linux') return false
18+
try {
19+
const release = readFileSync('/proc/version', 'utf8').toLowerCase()
20+
return release.includes('microsoft') || release.includes('wsl')
21+
} catch {
22+
return false
23+
}
24+
}
25+
1626
function getSignalRGBEffectsDir() {
1727
const platform = os.platform()
1828
const home = os.homedir()
19-
// macOS default location
20-
const macPath = join(home, 'Documents', 'SignalRGB', 'Effects')
21-
// Legacy/Windows path for reference (user can set SIGRGB_DIR to override)
22-
const winPath = join(home, 'Documents', 'WhirlwindFX', 'Effects')
2329

2430
const override = process.env.SIGRGB_DIR
2531
if (override) return resolve(override)
2632

33+
// WSL: use Windows home directory from $W env var
34+
if (isWSL()) {
35+
const winHome = process.env.W
36+
if (winHome) {
37+
const winPath = join(winHome, 'Documents', 'SignalRGB', 'Effects')
38+
const legacyWinPath = join(winHome, 'Documents', 'WhirlwindFX', 'Effects')
39+
if (existsSync(legacyWinPath)) return legacyWinPath
40+
return winPath
41+
}
42+
console.log(`${yellow}[!]${RESET} WSL detected but $W not set. Set $W to your Windows home dir or use SIGRGB_DIR.`)
43+
}
44+
45+
// macOS default location
46+
const macPath = join(home, 'Documents', 'SignalRGB', 'Effects')
47+
// Legacy/Windows path
48+
const winPath = join(home, 'Documents', 'WhirlwindFX', 'Effects')
49+
2750
if (platform === 'darwin') return macPath
51+
if (platform === 'win32') {
52+
if (existsSync(winPath)) return winPath
53+
return join(home, 'Documents', 'SignalRGB', 'Effects')
54+
}
2855
// Fallback
2956
if (existsSync(winPath)) return winPath
3057
return macPath

scripts/build.js

Lines changed: 0 additions & 172 deletions
This file was deleted.

scripts/deploy-signalrgb.js

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)