sitecheckultra 0.0.0-stage β 2.0.2
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/LICENSE +21 -0
- package/README.md +161 -2
- package/bin/sitecheckultra.js +360 -0
- package/lib/analyzer.js +729 -0
- package/lib/branding.js +31 -0
- package/lib/crawler.js +961 -0
- package/lib/exporter.js +533 -0
- package/lib/http-client.js +62 -0
- package/lib/parse-worker.js +13 -0
- package/lib/renderer.js +114 -0
- package/lib/scorer.js +520 -0
- package/lib/sitemap.js +244 -0
- package/lib/store.js +110 -0
- package/lib/trackers-db.json +1 -0
- package/lib/trackers.js +343 -0
- package/lib/worker-pool.js +124 -0
- package/package.json +52 -4
- package/public/app.js +3615 -0
- package/public/brand/site-check-ultra.png +0 -0
- package/public/index.html +658 -0
- package/public/styles.css +3734 -0
- package/public/trackers/bing.svg +1 -0
- package/public/trackers/cloudflare.svg +1 -0
- package/public/trackers/cookiebot.svg +1 -0
- package/public/trackers/crisp.svg +1 -0
- package/public/trackers/googleads.svg +1 -0
- package/public/trackers/googleanalytics.svg +1 -0
- package/public/trackers/googletagmanager.svg +1 -0
- package/public/trackers/hotjar.svg +1 -0
- package/public/trackers/hubspot.svg +1 -0
- package/public/trackers/intercom.svg +1 -0
- package/public/trackers/linkedin.svg +1 -0
- package/public/trackers/matomo.svg +1 -0
- package/public/trackers/meta.svg +1 -0
- package/public/trackers/microsoftclarify.svg +1 -0
- package/public/trackers/pinterest.svg +1 -0
- package/public/trackers/plausibleanalytics.svg +1 -0
- package/public/trackers/quantcast.svg +1 -0
- package/public/trackers/snapchat.svg +1 -0
- package/public/trackers/tiktok.svg +1 -0
- package/public/trackers/usercentrics.svg +1 -0
- package/public/trackers/x.svg +1 -0
- package/public/trackers/zendesk.svg +1 -0
- package/server.js +421 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Site Check Ultra
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,162 @@
|
|
|
1
|
-
#
|
|
1
|
+
# π Site Check Ultra
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Der schnelle Website-Audit fΓΌr SEO, Speed, Mobile & WCAG**
|
|
4
|
+
|
|
5
|
+
Ein lokales Tool zum Crawlen und Analysieren von Websites. PrΓΌft Indexierung, Canonicals, Redirects, H-Baum, Schema, Tracking, Links, Geschwindigkeit, Mobile-Optimierung und Barrierefreiheit.
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+

|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## β‘ Schnellstart
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx sitecheckultra
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Das war's! Der Server startet automatisch und ΓΆffnet deinen Browser.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## π Features
|
|
24
|
+
|
|
25
|
+
### π **Umfassende Analyse**
|
|
26
|
+
- **SEO (25%)** β Title, Meta, Canonicals, Indexierung
|
|
27
|
+
- **AEO / KI (15%)** β Schema.org, Open Graph, JSON-LD
|
|
28
|
+
- **Hygiene (15%)** β Redirects, Broken Links, Tracking
|
|
29
|
+
- **Speed (15%)** β TTFB, Payload-GrΓΆΓe, External Scripts
|
|
30
|
+
- **Mobile (15%)** β Viewport, Responsive Images, Touch Icons
|
|
31
|
+
- **WCAG (15%)** β Alt-Texte, Γberschriften, Link-Texte
|
|
32
|
+
|
|
33
|
+
### π― **Multi-Core Crawler**
|
|
34
|
+
- Sitemap-Erkennung
|
|
35
|
+
- Interne Links folgen
|
|
36
|
+
- Parallel-Requests (konfigurierbar)
|
|
37
|
+
- JavaScript-Rendering (optional mit Playwright)
|
|
38
|
+
- Basic Auth / Staging-Support
|
|
39
|
+
|
|
40
|
+
### π **Export & Reporting**
|
|
41
|
+
- Excel (Multi-Sheet mit 6-Kategorie-Audit)
|
|
42
|
+
- CSV (UTF-8 BOM fΓΌr Excel)
|
|
43
|
+
- HTML-Report (druckbar)
|
|
44
|
+
- JSON-Export
|
|
45
|
+
|
|
46
|
+
### π¨ **Visualisierung**
|
|
47
|
+
- H-Baum (Γberschriften-Hierarchie)
|
|
48
|
+
- Link-Graph
|
|
49
|
+
- Redirect-Chain-Visualisierung
|
|
50
|
+
- Score-Dashboard
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## π οΈ Installation
|
|
55
|
+
|
|
56
|
+
### Voraussetzungen
|
|
57
|
+
- **Node.js 18+** ([Download](https://nodejs.org/))
|
|
58
|
+
|
|
59
|
+
### Global installieren (empfohlen)
|
|
60
|
+
```bash
|
|
61
|
+
npm install -g sitecheckultra
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Dann starten mit:
|
|
65
|
+
```bash
|
|
66
|
+
sitecheckultra
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Ohne Installation (npx)
|
|
70
|
+
```bash
|
|
71
|
+
npx sitecheckultra
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## π Verwendung
|
|
77
|
+
|
|
78
|
+
### 1. Server starten
|
|
79
|
+
```bash
|
|
80
|
+
npx sitecheckultra
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Der Server lΓ€uft auf `http://localhost:3456` (oder nΓ€chster freier Port).
|
|
84
|
+
|
|
85
|
+
### 2. URL eingeben
|
|
86
|
+
Gib die URL deiner Website ein (z.B. `https://example.com`) und klicke auf **"Seite scannen"**.
|
|
87
|
+
|
|
88
|
+
### 3. Optionen konfigurieren
|
|
89
|
+
- **Crawl-Modus**: Ganze Website oder nur eine URL
|
|
90
|
+
- **Rendering**: Auto (schnell), Nur HTML, oder Browser-Rendering
|
|
91
|
+
- **Max. Seiten**: Limit fΓΌr die Anzahl der zu crawlenden Seiten
|
|
92
|
+
- **Geschwindigkeit**: Anzahl paralleler Requests
|
|
93
|
+
|
|
94
|
+
### 4. Ergebnisse analysieren
|
|
95
|
+
- **Tabelle**: Alle Seiten mit Status, Title, Meta, H1-H6, Score
|
|
96
|
+
- **H-Baum**: Γberschriften-Hierarchie visualisiert
|
|
97
|
+
- **Links**: Interne/externe Links, Broken Links
|
|
98
|
+
- **Redirects**: Redirect-Chains und Status-Codes
|
|
99
|
+
- **Export**: Excel, CSV, HTML-Report
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## π§ Erweiterte Optionen
|
|
104
|
+
|
|
105
|
+
### Port Γ€ndern
|
|
106
|
+
```bash
|
|
107
|
+
PORT=8080 npx sitecheckultra
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Basic Auth fΓΌr Staging-Umgebungen
|
|
111
|
+
Klicke auf **"Staging / Passwortschutz"** und gib Benutzername/Passwort ein.
|
|
112
|
+
|
|
113
|
+
### JavaScript-Rendering
|
|
114
|
+
FΓΌr SPAs (Single Page Applications) aktiviere **"Browser-Rendering (Chrome)"**.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## π¦ Update
|
|
119
|
+
|
|
120
|
+
Das Tool prΓΌft automatisch bei jedem Start auf Updates.
|
|
121
|
+
|
|
122
|
+
Manuell aktualisieren:
|
|
123
|
+
```bash
|
|
124
|
+
npm update -g sitecheckultra
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## π Probleme?
|
|
130
|
+
|
|
131
|
+
### Port bereits belegt
|
|
132
|
+
Das Tool findet automatisch einen freien Port. Falls Probleme auftreten:
|
|
133
|
+
```bash
|
|
134
|
+
PORT=3000 npx sitecheckultra
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Node.js Version zu alt
|
|
138
|
+
Aktualisiere Node.js auf Version 18 oder hΓΆher: https://nodejs.org/
|
|
139
|
+
|
|
140
|
+
### Playwright-Fehler (Browser-Rendering)
|
|
141
|
+
Installiere Playwright-Browser:
|
|
142
|
+
```bash
|
|
143
|
+
npx playwright install chromium
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## π Lizenz
|
|
149
|
+
|
|
150
|
+
MIT Β© Site Check Ultra
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## π Links
|
|
155
|
+
|
|
156
|
+
- **GitHub**: https://github.com/yourusername/site-check-ultra
|
|
157
|
+
- **Issues**: https://github.com/yourusername/site-check-ultra/issues
|
|
158
|
+
- **npm**: https://www.npmjs.com/package/sitecheckultra
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
**Made with β€οΈ for better websites**
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Site Check Ultra CLI Entry Point
|
|
5
|
+
*
|
|
6
|
+
* Startet den lokalen Server und ΓΆffnet den Browser.
|
|
7
|
+
* PrΓΌft auf Updates und installiert Node.js falls nΓΆtig.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { spawn, execSync } from 'node:child_process';
|
|
11
|
+
import { createRequire } from 'node:module';
|
|
12
|
+
import { fileURLToPath } from 'node:url';
|
|
13
|
+
import { dirname, join, sep } from 'node:path';
|
|
14
|
+
import { existsSync } from 'node:fs';
|
|
15
|
+
import https from 'node:https';
|
|
16
|
+
|
|
17
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
18
|
+
const __dirname = dirname(__filename);
|
|
19
|
+
const require = createRequire(import.meta.url);
|
|
20
|
+
|
|
21
|
+
// Konfiguration
|
|
22
|
+
const PACKAGE_NAME = 'sitecheckultra';
|
|
23
|
+
const DEFAULT_PORT = 3456;
|
|
24
|
+
|
|
25
|
+
// Farben fΓΌr Console-Output
|
|
26
|
+
const colors = {
|
|
27
|
+
reset: '\x1b[0m',
|
|
28
|
+
bright: '\x1b[1m',
|
|
29
|
+
dim: '\x1b[2m',
|
|
30
|
+
red: '\x1b[31m',
|
|
31
|
+
green: '\x1b[32m',
|
|
32
|
+
yellow: '\x1b[33m',
|
|
33
|
+
blue: '\x1b[34m',
|
|
34
|
+
cyan: '\x1b[36m',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/* Aktuelle Version direkt aus package.json (keine Hardcoding-Fallen bei Releases) */
|
|
38
|
+
function currentVersion() {
|
|
39
|
+
try {
|
|
40
|
+
return require('../package.json').version;
|
|
41
|
+
} catch {
|
|
42
|
+
return '?';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function log(message, color = colors.reset) {
|
|
47
|
+
console.log(`${color}${message}${colors.reset}`);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function logBanner() {
|
|
51
|
+
const v = currentVersion();
|
|
52
|
+
log('');
|
|
53
|
+
log(' βββββββββββββββββββββββββββββββββββββββββ', colors.cyan);
|
|
54
|
+
log(` β π Site Check Ultra v${`${v}`.padEnd(16)}β`, colors.bright + colors.cyan);
|
|
55
|
+
log(' β Website Audit Tool β', colors.cyan);
|
|
56
|
+
log(' βββββββββββββββββββββββββββββββββββββββββ', colors.cyan);
|
|
57
|
+
log('');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* PrΓΌft ob Node.js installiert ist und die Version ausreichend ist
|
|
62
|
+
*/
|
|
63
|
+
function checkNodeVersion() {
|
|
64
|
+
try {
|
|
65
|
+
const version = process.version;
|
|
66
|
+
const major = parseInt(version.slice(1).split('.')[0], 10);
|
|
67
|
+
|
|
68
|
+
if (major < 18) {
|
|
69
|
+
log(`β οΈ Node.js ${version} gefunden, aber Version 18+ wird benΓΆtigt.`, colors.yellow);
|
|
70
|
+
log(' Bitte aktualisiere Node.js: https://nodejs.org/', colors.dim);
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
log(`β Node.js ${version}`, colors.green);
|
|
75
|
+
return true;
|
|
76
|
+
} catch (err) {
|
|
77
|
+
log('β Node.js ist nicht installiert!', colors.red);
|
|
78
|
+
log(' Installiere Node.js von: https://nodejs.org/', colors.dim);
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* PrΓΌft auf Updates ΓΌber die npm Registry (bei jedem Start, non-blocking).
|
|
85
|
+
* LΓ€uft via npx scu / npx sitecheckultra, wird zusΓ€tzlich eine 1-Klick-
|
|
86
|
+
* Selbstaktualisierung angeboten (npm install -g + Neustart).
|
|
87
|
+
*/
|
|
88
|
+
function checkForUpdates() {
|
|
89
|
+
return new Promise((resolve) => {
|
|
90
|
+
const options = {
|
|
91
|
+
hostname: 'registry.npmjs.org',
|
|
92
|
+
path: `/${PACKAGE_NAME}/latest`,
|
|
93
|
+
method: 'GET',
|
|
94
|
+
timeout: 5000,
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const req = https.request(options, (res) => {
|
|
98
|
+
let data = '';
|
|
99
|
+
|
|
100
|
+
res.on('data', (chunk) => {
|
|
101
|
+
data += chunk;
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
res.on('end', () => {
|
|
105
|
+
try {
|
|
106
|
+
const latest = JSON.parse(data);
|
|
107
|
+
const current = currentVersion();
|
|
108
|
+
|
|
109
|
+
if (latest.version && latest.version !== current) {
|
|
110
|
+
const updateCmd = 'npm install -g sitecheckultra@latest';
|
|
111
|
+
log('');
|
|
112
|
+
log('ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ', colors.yellow);
|
|
113
|
+
log('β π Neue Version verfΓΌgbar! β', colors.yellow);
|
|
114
|
+
log(`β Aktuell: ${current.padEnd(10)} β Neu: ${latest.version.padEnd(10)} β`, colors.yellow);
|
|
115
|
+
log('β β', colors.yellow);
|
|
116
|
+
log(`β Update mit: ${updateCmd.padEnd(41)}β`, colors.bright + colors.yellow);
|
|
117
|
+
log('ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ', colors.yellow);
|
|
118
|
+
log('');
|
|
119
|
+
|
|
120
|
+
// npx-Lauf (npx scu / npx sitecheckultra): automatisch auf die
|
|
121
|
+
// neue Version heben und danach die GLOBALE Installation starten
|
|
122
|
+
// (npm install -g ersetzt die Dateien; der npx-Cache-Code bleibt alt).
|
|
123
|
+
const runningViaNpx = String(process.argv[1] || '').includes(`${sep}_npx${sep}`);
|
|
124
|
+
if (runningViaNpx) {
|
|
125
|
+
log('βΉ npx-Lauf erkannt β starte Update auf die neueste Versionβ¦', colors.cyan);
|
|
126
|
+
try {
|
|
127
|
+
execSync(updateCmd, { stdio: 'inherit' });
|
|
128
|
+
log('β Update installiert β starte neue Versionβ¦', colors.green);
|
|
129
|
+
const globalPrefix = execSync('npm prefix -g', { encoding: 'utf8' }).trim();
|
|
130
|
+
const globalBin = process.platform === 'win32'
|
|
131
|
+
? join(globalPrefix, 'sitecheckultra.cmd')
|
|
132
|
+
: join(globalPrefix, 'bin', 'sitecheckultra');
|
|
133
|
+
const child = spawn(process.execPath, [globalBin], {
|
|
134
|
+
env: { ...process.env, SITECHECK_UPDATED: String(latest.version) },
|
|
135
|
+
stdio: 'inherit'
|
|
136
|
+
});
|
|
137
|
+
child.on('exit', (code) => process.exit(code || 0));
|
|
138
|
+
process.on('SIGINT', () => { child.kill('SIGINT'); process.exit(0); });
|
|
139
|
+
process.on('SIGTERM', () => { child.kill('SIGTERM'); process.exit(0); });
|
|
140
|
+
resolve(true);
|
|
141
|
+
return;
|
|
142
|
+
} catch (err) {
|
|
143
|
+
log(`β Auto-Update fehlgeschlagen: ${err.message}`, colors.yellow);
|
|
144
|
+
log(` Manuell: ${updateCmd}`, colors.dim);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
resolve(true);
|
|
149
|
+
} catch (err) {
|
|
150
|
+
// Silent fail - Updates sind optional
|
|
151
|
+
resolve(false);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
req.on('error', () => {
|
|
157
|
+
// Silent fail - keine Internetverbindung oder npm nicht erreichbar
|
|
158
|
+
resolve(false);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
req.on('timeout', () => {
|
|
162
|
+
req.destroy();
|
|
163
|
+
resolve(false);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
req.end();
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Findet einen freien Port (verbessert mit async/await)
|
|
172
|
+
* Wichtig: Testet auf 127.0.0.1 β exakt der Host, auf den server.js bindet.
|
|
173
|
+
* Ein Wildcard-Test (ohne Host) meldet auf macOS belegte 127.0.0.1-Ports
|
|
174
|
+
* fΓ€lschlich als frei β EADDRINUSE-Crash beim Start.
|
|
175
|
+
*/
|
|
176
|
+
async function findFreePort(startPort = DEFAULT_PORT) {
|
|
177
|
+
const net = await import('node:net');
|
|
178
|
+
const HOST = '127.0.0.1';
|
|
179
|
+
|
|
180
|
+
// Wenn PORT env gesetzt ist, nutze diesen
|
|
181
|
+
const envPort = process.env.PORT ? parseInt(process.env.PORT, 10) : null;
|
|
182
|
+
if (envPort) {
|
|
183
|
+
return new Promise((resolve, reject) => {
|
|
184
|
+
const server = net.createServer();
|
|
185
|
+
server.listen(envPort, HOST, () => {
|
|
186
|
+
const foundPort = server.address().port;
|
|
187
|
+
server.close(() => resolve(foundPort));
|
|
188
|
+
});
|
|
189
|
+
server.on('error', () => {
|
|
190
|
+
log(`β Port ${envPort} ist bereits belegt!`, colors.red);
|
|
191
|
+
process.exit(1);
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Suche freien Port ab startPort
|
|
197
|
+
for (let port = startPort; port < startPort + 100; port++) {
|
|
198
|
+
const isFree = await new Promise((resolve) => {
|
|
199
|
+
const server = net.createServer();
|
|
200
|
+
server.listen(port, HOST, () => {
|
|
201
|
+
server.close(() => resolve(true));
|
|
202
|
+
});
|
|
203
|
+
server.on('error', () => resolve(false));
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
if (isFree) return port;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
throw new Error('Kein freier Port gefunden!');
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Γffnet den Browser
|
|
214
|
+
*/
|
|
215
|
+
function openBrowser(url) {
|
|
216
|
+
const platform = process.platform;
|
|
217
|
+
let command;
|
|
218
|
+
|
|
219
|
+
switch (platform) {
|
|
220
|
+
case 'darwin':
|
|
221
|
+
command = `open "${url}"`;
|
|
222
|
+
break;
|
|
223
|
+
case 'win32':
|
|
224
|
+
command = `start "${url}"`;
|
|
225
|
+
break;
|
|
226
|
+
default:
|
|
227
|
+
command = `xdg-open "${url}"`;
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
try {
|
|
232
|
+
execSync(command, { stdio: 'ignore' });
|
|
233
|
+
log(`β Browser geΓΆffnet: ${url}`, colors.green);
|
|
234
|
+
} catch (err) {
|
|
235
|
+
log(`βΉ Γffne manuell: ${url}`, colors.cyan);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Startet den Express-Server
|
|
241
|
+
*/
|
|
242
|
+
async function startServer() {
|
|
243
|
+
const port = await findFreePort();
|
|
244
|
+
const url = `http://localhost:${port}`;
|
|
245
|
+
|
|
246
|
+
log('');
|
|
247
|
+
log('π Starte Server...', colors.cyan);
|
|
248
|
+
log('');
|
|
249
|
+
|
|
250
|
+
// Server-Pfad relativ zum bin-Verzeichnis
|
|
251
|
+
const serverPath = join(__dirname, '..', 'server.js');
|
|
252
|
+
|
|
253
|
+
if (!existsSync(serverPath)) {
|
|
254
|
+
log('β server.js nicht gefunden!', colors.red);
|
|
255
|
+
log(` Erwartet: ${serverPath}`, colors.dim);
|
|
256
|
+
process.exit(1);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// Umgebungsvariablen fΓΌr den Server
|
|
260
|
+
const env = {
|
|
261
|
+
...process.env,
|
|
262
|
+
PORT: port.toString(),
|
|
263
|
+
NODE_ENV: 'production',
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
// Server als Child-Process starten
|
|
267
|
+
const server = spawn('node', [serverPath], {
|
|
268
|
+
env,
|
|
269
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
let serverReady = false;
|
|
273
|
+
|
|
274
|
+
server.stdout.on('data', (data) => {
|
|
275
|
+
const output = data.toString();
|
|
276
|
+
|
|
277
|
+
// Server ist bereit wenn er die URL ausgibt
|
|
278
|
+
if (!serverReady && output.includes('localhost')) {
|
|
279
|
+
serverReady = true;
|
|
280
|
+
log('');
|
|
281
|
+
log('ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ', colors.green);
|
|
282
|
+
log('β β Site Check Ultra lΓ€uft! β', colors.green);
|
|
283
|
+
log(`β URL: ${url.padEnd(50)}β`, colors.bright + colors.green);
|
|
284
|
+
log('β β', colors.green);
|
|
285
|
+
log('β Beenden mit: Ctrl+C β', colors.dim + colors.green);
|
|
286
|
+
log('ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ', colors.green);
|
|
287
|
+
log('');
|
|
288
|
+
|
|
289
|
+
// Browser ΓΆffnen nach kurzer VerzΓΆgerung
|
|
290
|
+
setTimeout(() => openBrowser(url), 1000);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// Server-Output weiterleiten (nur wichtige Meldungen)
|
|
294
|
+
if (output.includes('Error') || output.includes('error')) {
|
|
295
|
+
process.stdout.write(output);
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
server.stderr.on('data', (data) => {
|
|
300
|
+
process.stderr.write(data);
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
server.on('error', (err) => {
|
|
304
|
+
log(`β Server-Fehler: ${err.message}`, colors.red);
|
|
305
|
+
process.exit(1);
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
server.on('exit', (code) => {
|
|
309
|
+
if (code !== 0 && code !== null) {
|
|
310
|
+
log(`β Server beendet mit Code ${code}`, colors.red);
|
|
311
|
+
process.exit(code);
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
// Graceful Shutdown
|
|
316
|
+
process.on('SIGINT', () => {
|
|
317
|
+
log('');
|
|
318
|
+
log('π Beende Site Check Ultra...', colors.cyan);
|
|
319
|
+
server.kill('SIGINT');
|
|
320
|
+
setTimeout(() => process.exit(0), 500);
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
process.on('SIGTERM', () => {
|
|
324
|
+
server.kill('SIGTERM');
|
|
325
|
+
process.exit(0);
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Hauptfunktion
|
|
331
|
+
*/
|
|
332
|
+
async function main() {
|
|
333
|
+
logBanner();
|
|
334
|
+
|
|
335
|
+
// 1. Node.js Version prΓΌfen
|
|
336
|
+
checkNodeVersion();
|
|
337
|
+
|
|
338
|
+
// 2. Auf Updates prΓΌfen (asynchron, blockiert nicht)
|
|
339
|
+
checkForUpdates();
|
|
340
|
+
|
|
341
|
+
// 3. Server starten
|
|
342
|
+
await startServer();
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// Fehlerbehandlung
|
|
346
|
+
process.on('uncaughtException', (err) => {
|
|
347
|
+
log(`β Unerwarteter Fehler: ${err.message}`, colors.red);
|
|
348
|
+
process.exit(1);
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
process.on('unhandledRejection', (err) => {
|
|
352
|
+
log(`β Unbehandelte Promise-Ablehnung: ${err.message}`, colors.red);
|
|
353
|
+
process.exit(1);
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
// CLI starten
|
|
357
|
+
main().catch((err) => {
|
|
358
|
+
log(`β Fehler beim Start: ${err.message}`, colors.red);
|
|
359
|
+
process.exit(1);
|
|
360
|
+
});
|