Files
spark/mod.ts
Juergen Kunz 526b4f46dd
All checks were successful
CI / Type Check & Lint (push) Successful in 13s
CI / Build Test (Current Platform) (push) Successful in 19s
CI / Build All Platforms (push) Successful in 1m48s
feat(migration): Migrate from Node.js to Deno runtime
Major migration to Deno runtime following the nupst project pattern:

Core Changes:
- Created deno.json configuration with tasks, imports, and settings
- Created mod.ts as main entry point with Deno permissions
- Updated all TypeScript imports from .js to .ts extensions
- Replaced Node.js APIs (process.exit) with Deno equivalents (Deno.exit)
- Updated path imports to use @std/path from JSR

Dependencies:
- Migrated all npm dependencies to use npm: prefix in import map
- Added Deno standard library imports (@std/path, @std/assert)
- Configured import aliases for all @push.rocks and @serve.zone packages

Build & Distribution:
- Created install.sh for downloading pre-compiled binaries
- Created uninstall.sh for clean system removal
- Created scripts/compile-all.sh for multi-platform compilation
- Supports Linux (x64, ARM64), macOS (x64, ARM64), Windows (x64)

Testing:
- Migrated tests to Deno test framework using @std/assert
- Created test.simple.ts for basic verification
- Updated test structure to use Deno.test instead of tap

CI/CD:
- Created .gitea/workflows/ci.yml for type checking, linting, and builds
- Created .gitea/workflows/release.yml for automated releases
- Created .gitea/release-template.md for release documentation

Cleanup:
- Removed package.json, pnpm-lock.yaml, tsconfig.json
- Removed Node.js CLI files (cli.js, cli.child.ts, cli.ts.js)
- Removed dist_ts/ compiled output directory
- Removed npmextra.json configuration

This migration enables standalone binary distribution without Node.js
runtime dependency while maintaining all existing functionality.
2025-10-23 23:22:16 +00:00

46 lines
1.3 KiB
TypeScript

#!/usr/bin/env -S deno run --allow-all
/**
* Spark - Server Configuration and Management Tool
*
* A comprehensive tool for maintaining and configuring servers, integrating
* with Docker and supporting advanced task scheduling, targeted at the Servezone
* infrastructure and used by @serve.zone/cloudly as a cluster node server system manager.
*
* Required Permissions:
* - --allow-net: API communication, Docker access
* - --allow-read: Configuration files, project files
* - --allow-write: Logs, configuration updates
* - --allow-run: systemctl, Docker commands
* - --allow-env: Environment variables
* - --allow-sys: System information
*
* @module
*/
import * as cli from './ts/spark.cli.ts';
/**
* Main entry point for the Spark application
* Sets up the CLI environment and executes the requested command
*/
async function main(): Promise<void> {
// Set environment variable to indicate CLI call
Deno.env.set('CLI_CALL', 'true');
// Execute the CLI
await cli.runCli();
}
// Execute main and handle errors
if (import.meta.main) {
try {
await main();
} catch (error) {
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
Deno.exit(1);
}
}
// Export for library usage
export * from './ts/spark.classes.spark.ts';