@edenapp/genesis 0.2.0
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/README.md +171 -0
- package/dist/bundler.d.ts +110 -0
- package/dist/bundler.d.ts.map +1 -0
- package/dist/bundler.js +501 -0
- package/dist/bundler.js.map +1 -0
- package/dist/bundler.test.d.ts +2 -0
- package/dist/bundler.test.d.ts.map +1 -0
- package/dist/bundler.test.js +217 -0
- package/dist/bundler.test.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +195 -0
- package/dist/cli.js.map +1 -0
- package/dist/compression.d.ts +43 -0
- package/dist/compression.d.ts.map +1 -0
- package/dist/compression.js +85 -0
- package/dist/compression.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/package.json +53 -0
package/README.md
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# @edenapp/genesis
|
|
2
|
+
|
|
3
|
+
📦 **Genesis** - Package and bundle Eden applications.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Genesis is the official bundler for Eden apps. It packages your Eden applications into `.edenite` format using modern Zstandard (zstd) compression - ready to be planted in any Eden environment.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- 🗜️ **High-Performance Compression**: Uses Zstandard compression for superior compression ratios
|
|
12
|
+
- 🔒 **Integrity Verification**: Built-in SHA256 checksums for archive verification
|
|
13
|
+
- 🎯 **Metadata Support**: Archive format versioning for forward compatibility
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install -g @edenapp/genesis
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
### Build an App
|
|
24
|
+
|
|
25
|
+
Bundle your app into `.edenite` format:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
genesis build ./my-app
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
With custom output path:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
genesis build ./my-app -o ./dist/my-app.edenite
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
With custom compression level (1-22, default 11):
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
genesis build ./my-app -c 9
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Verbose output:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
genesis build ./my-app -v
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Dry run (validate without creating files):
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
genesis build ./my-app --dry-run
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Extract an App
|
|
56
|
+
|
|
57
|
+
Extract an `.edenite` file to a directory:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
genesis extract my-app.edenite ./output-dir
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
With verbose output:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
genesis extract my-app.edenite ./output-dir -v
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Skip checksum verification (not recommended):
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
genesis extract my-app.edenite ./output-dir --no-verify
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Validate an App
|
|
76
|
+
|
|
77
|
+
Check if your app manifest and files are valid:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
genesis validate ./my-app
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Get Info
|
|
84
|
+
|
|
85
|
+
Display information about an `.edenite` file:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
genesis info my-app-1.0.0.edenite
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## App Structure
|
|
92
|
+
|
|
93
|
+
Your Eden app directory should contain:
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
my-app/
|
|
97
|
+
├── manifest.json # Required: App metadata
|
|
98
|
+
├── index.html # Optional: Frontend entry point (can be remote URL)
|
|
99
|
+
├── backend.js # Optional: Backend entry point (app can be frontend-only)
|
|
100
|
+
├── app.js # Optional: Frontend logic
|
|
101
|
+
├── icon.png # Optional: App icon
|
|
102
|
+
└── ... # Any other app files
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## manifest.json
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"id": "com.example.myapp",
|
|
110
|
+
"name": "My App",
|
|
111
|
+
"version": "1.0.0",
|
|
112
|
+
"description": "My awesome Eden app",
|
|
113
|
+
"author": "Your Name",
|
|
114
|
+
"backend": {
|
|
115
|
+
"entry": "backend.js"
|
|
116
|
+
},
|
|
117
|
+
"frontend": {
|
|
118
|
+
"entry": "index.html"
|
|
119
|
+
},
|
|
120
|
+
"icon": "icon.png"
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## .edenite Format
|
|
125
|
+
|
|
126
|
+
An `.edenite` file is a Zstandard-compressed TAR archive with the following structure:
|
|
127
|
+
|
|
128
|
+
- **Format**: `[4 bytes metadata length][metadata JSON][zstd-compressed TAR]`
|
|
129
|
+
- **Metadata**: Includes format version, SHA256 checksum, creation time, and app manifest
|
|
130
|
+
- **Compression**: Zstandard (zstd) compression with configurable levels (1-22)
|
|
131
|
+
- **Integrity**: SHA256 checksum verification on extraction
|
|
132
|
+
|
|
133
|
+
### Why Zstandard?
|
|
134
|
+
|
|
135
|
+
- **Better Compression**: ~20-40% better compression than gzip
|
|
136
|
+
- **Faster**: Significantly faster decompression than other algorithms
|
|
137
|
+
- **Flexible**: Compression levels from 1 (fast) to 22 (maximum compression)
|
|
138
|
+
- **Modern**: Industry standard used by Facebook, Linux kernel, and many others
|
|
139
|
+
|
|
140
|
+
## Programmatic API
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
import { GenesisBundler } from '@edenapp/genesis';
|
|
144
|
+
|
|
145
|
+
// Bundle an app
|
|
146
|
+
const result = await GenesisBundler.bundle({
|
|
147
|
+
appDirectory: './my-app',
|
|
148
|
+
outputPath: './output/my-app.edenite',
|
|
149
|
+
verbose: true,
|
|
150
|
+
compressionLevel: 9, // Optional: 1-22, default 3
|
|
151
|
+
dryRun: false, // Optional: validate only
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// Extract an app
|
|
155
|
+
const extractResult = await GenesisBundler.extract({
|
|
156
|
+
edenitePath: './my-app.edenite',
|
|
157
|
+
outputDirectory: './extracted',
|
|
158
|
+
verbose: true,
|
|
159
|
+
verifyChecksum: true, // Optional: verify integrity
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
// Get archive info
|
|
163
|
+
const info = await GenesisBundler.getInfo('./my-app.edenite');
|
|
164
|
+
console.log(info.manifest);
|
|
165
|
+
console.log(info.checksum);
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## License
|
|
169
|
+
|
|
170
|
+
GPL-2.0
|
|
171
|
+
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
export interface AppManifest {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
version: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
author?: string;
|
|
7
|
+
build?: {
|
|
8
|
+
command: string;
|
|
9
|
+
cwd?: string;
|
|
10
|
+
};
|
|
11
|
+
backend?: {
|
|
12
|
+
entry: string;
|
|
13
|
+
options?: any;
|
|
14
|
+
};
|
|
15
|
+
frontend: {
|
|
16
|
+
entry: string;
|
|
17
|
+
};
|
|
18
|
+
icon?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface BundleOptions {
|
|
21
|
+
appDirectory: string;
|
|
22
|
+
outputPath?: string;
|
|
23
|
+
extractToDirectory?: string;
|
|
24
|
+
verbose?: boolean;
|
|
25
|
+
dryRun?: boolean;
|
|
26
|
+
compressionLevel?: number;
|
|
27
|
+
}
|
|
28
|
+
export interface BundleResult {
|
|
29
|
+
success: boolean;
|
|
30
|
+
outputPath?: string;
|
|
31
|
+
manifest?: AppManifest;
|
|
32
|
+
error?: string;
|
|
33
|
+
checksum?: string;
|
|
34
|
+
size?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface ExtractOptions {
|
|
37
|
+
edenitePath: string;
|
|
38
|
+
outputDirectory: string;
|
|
39
|
+
verbose?: boolean;
|
|
40
|
+
verifyChecksum?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Genesis Bundler
|
|
44
|
+
* Packages Eden apps into .edenite format
|
|
45
|
+
*/
|
|
46
|
+
export declare class GenesisBundler {
|
|
47
|
+
private static compressor;
|
|
48
|
+
private static isInitialized;
|
|
49
|
+
/**
|
|
50
|
+
* Initialize compression library
|
|
51
|
+
*/
|
|
52
|
+
private static initCompressor;
|
|
53
|
+
private static isRemoteEntry;
|
|
54
|
+
/**
|
|
55
|
+
* Calculate SHA256 checksum of data
|
|
56
|
+
*/
|
|
57
|
+
private static calculateChecksum;
|
|
58
|
+
/**
|
|
59
|
+
* Execute build command if defined in manifest
|
|
60
|
+
*/
|
|
61
|
+
static executeBuild(appDirectory: string, manifest: AppManifest, verbose?: boolean): Promise<{
|
|
62
|
+
success: boolean;
|
|
63
|
+
error?: string;
|
|
64
|
+
}>;
|
|
65
|
+
/**
|
|
66
|
+
* Validate an app manifest
|
|
67
|
+
*/
|
|
68
|
+
static validateManifest(manifestPath: string): Promise<{
|
|
69
|
+
valid: boolean;
|
|
70
|
+
errors: string[];
|
|
71
|
+
manifest?: AppManifest;
|
|
72
|
+
}>;
|
|
73
|
+
/**
|
|
74
|
+
* Verify that required files exist
|
|
75
|
+
*/
|
|
76
|
+
static verifyFiles(appDirectory: string, manifest: AppManifest): Promise<{
|
|
77
|
+
valid: boolean;
|
|
78
|
+
errors: string[];
|
|
79
|
+
}>;
|
|
80
|
+
/**
|
|
81
|
+
* Extract app files directly to a directory (no compression)
|
|
82
|
+
*/
|
|
83
|
+
private static extractToDirectory;
|
|
84
|
+
/**
|
|
85
|
+
* Create a TAR archive and compress with Zstandard
|
|
86
|
+
*/
|
|
87
|
+
private static createArchive;
|
|
88
|
+
/**
|
|
89
|
+
* Bundle an app into .edenite format or extract to directory
|
|
90
|
+
*/
|
|
91
|
+
static bundle(options: BundleOptions): Promise<BundleResult>;
|
|
92
|
+
/**
|
|
93
|
+
* Extract info from an .edenite file
|
|
94
|
+
*/
|
|
95
|
+
static getInfo(edenitePath: string): Promise<{
|
|
96
|
+
success: boolean;
|
|
97
|
+
manifest?: AppManifest;
|
|
98
|
+
error?: string;
|
|
99
|
+
checksum?: string;
|
|
100
|
+
}>;
|
|
101
|
+
/**
|
|
102
|
+
* Extract an .edenite file to a directory
|
|
103
|
+
*/
|
|
104
|
+
static extract(options: ExtractOptions): Promise<{
|
|
105
|
+
success: boolean;
|
|
106
|
+
error?: string;
|
|
107
|
+
manifest?: AppManifest;
|
|
108
|
+
}>;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=bundler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundler.d.ts","sourceRoot":"","sources":["../src/bundler.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;IACF,OAAO,CAAC,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,GAAG,CAAC;KACf,CAAC;IACF,Q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