Compare commits

...

3 Commits

Author SHA1 Message Date
MasterGordon 92d233a191 bump version 2025-10-26 01:20:20 +02:00
MasterGordon 1121a7b290 bump version with --start 2025-10-26 01:19:24 +02:00
MasterGordon efaf30a863 minor improvements 2025-10-26 00:52:56 +02:00
2 changed files with 15 additions and 4 deletions

View File

@ -79,7 +79,7 @@ async function isProcessRunning(pid: number): Promise<boolean> {
async function isServerResponsive(port: number): Promise<boolean> {
try {
const response = await fetch(`http://localhost:${port}/`, {
signal: AbortSignal.timeout(2000),
signal: AbortSignal.timeout(50),
});
return response.ok || response.status === 404; // Server is up if it responds at all
} catch {
@ -109,8 +109,8 @@ async function startServer(): Promise<number> {
const proc = Bun.spawn(
["dotnet", "csharpier", "server", "--server-port", String(SERVER_PORT)],
{
stdout: "inherit",
stderr: "inherit",
stdout: null,
stderr: null,
},
);
@ -244,6 +244,7 @@ function showHelp(): void {
Usage:
csharpierd <filename> < input.cs Format C# code from stdin
csharpierd --start Start and prewarm the server
csharpierd --status Show server status
csharpierd --stop Stop the background server
csharpierd --help Show this help message
@ -254,6 +255,9 @@ Description:
automatically shuts down after 1 hour of inactivity.
Examples:
# Start and prewarm the server
csharpierd --start
# Format a C# file
csharpierd Program.cs < Program.cs
@ -379,6 +383,13 @@ async function main() {
process.exit(0);
}
// Handle --start flag
if (arg === "--start") {
await ensureServer();
console.error("CSharpier server is ready");
process.exit(0);
}
// Normal formatting mode
const fileName = arg;
if (!fileName) {

View File

@ -1,6 +1,6 @@
{
"name": "csharpierd",
"version": "1.0.2",
"version": "1.0.5",
"description": "A persistent CSharpier formatting daemon with automatic server management and idle timeout",
"module": "index.ts",
"type": "module",