fix: aggressively run fix-htaccess.js in all build lifecycles and add comment bypass to trick hostinger

This commit is contained in:
xadyz1 2026-07-26 22:47:19 +01:00
parent 13ffb16952
commit 10f2863aa4
3 changed files with 9 additions and 3 deletions

View file

@ -5,7 +5,7 @@
"description": "Cross-cutting tooling for ScreenTinker shared assets (transition shader library, etc.)",
"license": "MIT",
"scripts": {
"build": "npm install --prefix server",
"build": "npm install --prefix server && node scripts/fix-htaccess.js",
"postinstall": "node scripts/fix-htaccess.js",
"build:manifest": "node shared/Transitions/generate-manifest.js",
"test:shaders": "node shared/Transitions/compile-test.js"

View file

@ -22,7 +22,12 @@ for (const htaccessPath of possiblePaths) {
// Remove the offending line completely
content = content.replace(/^.*SetEnv NODE_OPTIONS.*$/gm, '');
fs.writeFileSync(htaccessPath, content.trim() + '\n', 'utf8');
// Add a commented-out version to trick Hostinger's auto-injector into thinking it's already there
if (!content.includes('# SetEnv NODE_OPTIONS --use-openssl-ca')) {
content = content.trim() + '\n# SetEnv NODE_OPTIONS --use-openssl-ca\n';
}
fs.writeFileSync(htaccessPath, content, 'utf8');
console.log(`[fix-htaccess] Successfully removed SetEnv NODE_OPTIONS!`);
fixed = true;
}

View file

@ -6,7 +6,8 @@
"scripts": {
"start": "node --env-file-if-exists=.env server.js",
"dev": "node --watch --env-file-if-exists=.env server.js",
"test": "node --test --test-concurrency=2"
"test": "node --test --test-concurrency=2",
"postinstall": "node ../scripts/fix-htaccess.js || true"
},
"dependencies": {
"@azure/msal-node": "^5.2.1",