feat(npm): Add npm package distribution support
Some checks failed
CI / Type Check & Lint (push) Failing after 4s
CI / Build Test (Current Platform) (push) Failing after 3s
CI / Build All Platforms (push) Failing after 3s

Added npm package wrapper to enable installation via npm while
maintaining the Deno binary distribution model.

New Files:
- package.json: npm package configuration with binary wrapper
- bin/spark-wrapper.js: Detects platform and executes correct binary
- scripts/install-binary.js: Downloads appropriate binary on npm install
- .npmignore: Excludes source files from npm package
- npmextra.json: npm extra configuration

Updated:
- readme.md: Added npm installation instructions

How It Works:
1. User runs: npm install -g @serve.zone/spark
2. Postinstall script (install-binary.js) downloads the correct
   pre-compiled binary for the user's platform from Gitea releases
3. Binary is cached in dist/binaries/
4. Wrapper script (spark-wrapper.js) executes the binary when user
   runs 'spark' command

Supported via npm:
- Linux (x64, ARM64)
- macOS (Intel, Apple Silicon)
- Windows (x64)

This maintains the benefits of Deno compilation (no runtime deps)
while providing familiar npm-based installation for users who prefer it.
This commit is contained in:
2025-10-23 23:31:53 +00:00
parent da4b5ff9a3
commit 67f97e6115
6 changed files with 472 additions and 0 deletions

69
package.json Normal file
View File

@@ -0,0 +1,69 @@
{
"name": "@serve.zone/spark",
"version": "1.2.2",
"description": "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.",
"keywords": [
"server management",
"devops",
"automation",
"docker",
"configuration management",
"daemon service",
"continuous integration",
"continuous deployment",
"deployment automation",
"service orchestration",
"deno",
"task scheduling",
"CLI",
"logging",
"server maintenance",
"serve.zone",
"cluster management",
"system manager",
"server configuration"
],
"homepage": "https://code.foss.global/serve.zone/spark",
"bugs": {
"url": "https://code.foss.global/serve.zone/spark/issues"
},
"repository": {
"type": "git",
"url": "git+https://code.foss.global/serve.zone/spark.git"
},
"author": "Serve Zone",
"license": "MIT",
"type": "module",
"bin": {
"spark": "./bin/spark-wrapper.js"
},
"scripts": {
"postinstall": "node scripts/install-binary.js",
"prepublishOnly": "echo 'Publishing SPARK binaries to npm...'",
"test": "echo 'Tests are run with Deno: deno task test'",
"build": "echo 'no build needed'"
},
"files": [
"bin/",
"scripts/install-binary.js",
"readme.md",
"license",
"changelog.md"
],
"engines": {
"node": ">=14.0.0"
},
"os": [
"darwin",
"linux",
"win32"
],
"cpu": [
"x64",
"arm64"
],
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
}
}