@push.rocks/smartmta 5.2.5 → 5.2.6

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/changelog.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 2026-02-26 - 5.2.6 - fix(postinstall)
4
+ remove legacy postinstall binary installer and packaging entry
5
+
6
+ - Deleted scripts/install-binary.js (legacy postinstall script that downloaded platform-specific binaries).
7
+ - Removed reference to scripts/install-binary.js from package.json "files" array so the installer is no longer included in published packages.
8
+ - This prevents automatic binary downloads during npm install and reduces package size; recommend a patch version bump.
9
+
3
10
  ## 2026-02-26 - 5.2.5 - fix(package)
4
11
  remove CLI bin wrapper and exclude bin/ from published files
5
12
 
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@push.rocks/smartmta',
6
- version: '5.2.5',
6
+ version: '5.2.6',
7
7
  description: 'A high-performance, enterprise-grade Mail Transfer Agent (MTA) built from scratch in TypeScript with Rust acceleration.'
8
8
  };
9
9
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSxzQkFBc0I7SUFDNUIsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLHlIQUF5SDtDQUN2SSxDQUFBIn0=
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@push.rocks/smartmta",
3
- "version": "5.2.5",
3
+ "version": "5.2.6",
4
4
  "description": "A high-performance, enterprise-grade Mail Transfer Agent (MTA) built from scratch in TypeScript with Rust acceleration.",
5
5
  "keywords": [
6
6
  "mta",
@@ -58,7 +58,6 @@
58
58
  "files": [
59
59
  "ts/**/*",
60
60
  "dist_ts/**/*",
61
- "scripts/install-binary.js",
62
61
  "dist_rust/**/*",
63
62
  "readme.md",
64
63
  "license",
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@push.rocks/smartmta',
6
- version: '5.2.5',
6
+ version: '5.2.6',
7
7
  description: 'A high-performance, enterprise-grade Mail Transfer Agent (MTA) built from scratch in TypeScript with Rust acceleration.'
8
8
  }
@@ -1,230 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * MAILER npm postinstall script
5
- * Downloads the appropriate binary for the current platform from GitHub releases
6
- */
7
-
8
- import { platform, arch } from 'os';
9
- import { existsSync, mkdirSync, writeFileSync, chmodSync, unlinkSync } from 'fs';
10
- import { join, dirname } from 'path';
11
- import { fileURLToPath } from 'url';
12
- import https from 'https';
13
- import { pipeline } from 'stream';
14
- import { promisify } from 'util';
15
- import { createWriteStream } from 'fs';
16
-
17
- const __filename = fileURLToPath(import.meta.url);
18
- const __dirname = dirname(__filename);
19
- const streamPipeline = promisify(pipeline);
20
-
21
- // Configuration
22
- const REPO_BASE = 'https://code.foss.global/serve.zone/mailer';
23
- const VERSION = process.env.npm_package_version || '1.0.0';
24
-
25
- function getBinaryInfo() {
26
- const plat = platform();
27
- const architecture = arch();
28
-
29
- const platformMap = {
30
- 'darwin': 'macos',
31
- 'linux': 'linux',
32
- 'win32': 'windows'
33
- };
34
-
35
- const archMap = {
36
- 'x64': 'x64',
37
- 'arm64': 'arm64'
38
- };
39
-
40
- const mappedPlatform = platformMap[plat];
41
- const mappedArch = archMap[architecture];
42
-
43
- if (!mappedPlatform || !mappedArch) {
44
- return { supported: false, platform: plat, arch: architecture };
45
- }
46
-
47
- let binaryName = `mailer-${mappedPlatform}-${mappedArch}`;
48
- if (plat === 'win32') {
49
- binaryName += '.exe';
50
- }
51
-
52
- return {
53
- supported: true,
54
- platform: mappedPlatform,
55
- arch: mappedArch,
56
- binaryName,
57
- originalPlatform: plat
58
- };
59
- }
60
-
61
- function downloadFile(url, destination) {
62
- return new Promise((resolve, reject) => {
63
- console.log(`Downloading from: ${url}`);
64
-
65
- // Follow redirects
66
- const download = (url, redirectCount = 0) => {
67
- if (redirectCount > 5) {
68
- reject(new Error('Too many redirects'));
69
- return;
70
- }
71
-
72
- https.get(url, (response) => {
73
- if (response.statusCode === 301 || response.statusCode === 302) {
74
- console.log(`Following redirect to: ${response.headers.location}`);
75
- download(response.headers.location, redirectCount + 1);
76
- return;
77
- }
78
-
79
- if (response.statusCode !== 200) {
80
- reject(new Error(`Failed to download: ${response.statusCode} ${response.statusMessage}`));
81
- return;
82
- }
83
-
84
- const totalSize = parseInt(response.headers['content-length'], 10);
85
- let downloadedSize = 0;
86
- let lastProgress = 0;
87
-
88
- response.on('data', (chunk) => {
89
- downloadedSize += chunk.length;
90
- const progress = Math.round((downloadedSize / totalSize) * 100);
91
-
92
- // Only log every 10% to reduce noise
93
- if (progress >= lastProgress + 10) {
94
- console.log(`Download progress: ${progress}%`);
95
- lastProgress = progress;
96
- }
97
- });
98
-
99
- const file = createWriteStream(destination);
100
-
101
- pipeline(response, file, (err) => {
102
- if (err) {
103
- reject(err);
104
- } else {
105
- console.log('Download complete!');
106
- resolve();
107
- }
108
- });
109
- }).on('error', reject);
110
- };
111
-
112
- download(url);
113
- });
114
- }
115
-
116
- async function main() {
117
- console.log('===========================================');
118
- console.log(' MAILER - Binary Installation');
119
- console.log('===========================================');
120
- console.log('');
121
-
122
- const binaryInfo = getBinaryInfo();
123
-
124
- if (!binaryInfo.supported) {
125
- console.error(`❌ Error: Unsupported platform/architecture: ${binaryInfo.platform}/${binaryInfo.arch}`);
126
- console.error('');
127
- console.error('Supported platforms:');
128
- console.error(' • Linux (x64, arm64)');
129
- console.error(' • macOS (x64, arm64)');
130
- console.error(' • Windows (x64)');
131
- console.error('');
132
- console.error('If you believe your platform should be supported, please file an issue:');
133
- console.error(' https://code.foss.global/serve.zone/mailer/issues');
134
- process.exit(1);
135
- }
136
-
137
- console.log(`Platform: ${binaryInfo.platform} (${binaryInfo.originalPlatform})`);
138
- console.log(`Architecture: ${binaryInfo.arch}`);
139
- console.log(`Binary: ${binaryInfo.binaryName}`);
140
- console.log(`Version: ${VERSION}`);
141
- console.log('');
142
-
143
- // Create dist/binaries directory if it doesn't exist
144
- const binariesDir = join(__dirname, '..', 'dist', 'binaries');
145
- if (!existsSync(binariesDir)) {
146
- console.log('Creating binaries directory...');
147
- mkdirSync(binariesDir, { recursive: true });
148
- }
149
-
150
- const binaryPath = join(binariesDir, binaryInfo.binaryName);
151
-
152
- // Check if binary already exists and skip download
153
- if (existsSync(binaryPath)) {
154
- console.log('✓ Binary already exists, skipping download');
155
- } else {
156
- // Construct download URL
157
- // Try release URL first, fall back to raw branch if needed
158
- const releaseUrl = `${REPO_BASE}/releases/download/v${VERSION}/${binaryInfo.binaryName}`;
159
- const fallbackUrl = `${REPO_BASE}/raw/branch/main/dist/binaries/${binaryInfo.binaryName}`;
160
-
161
- console.log('Downloading platform-specific binary...');
162
- console.log('This may take a moment depending on your connection speed.');
163
- console.log('');
164
-
165
- try {
166
- // Try downloading from release
167
- await downloadFile(releaseUrl, binaryPath);
168
- } catch (err) {
169
- console.log(`Release download failed: ${err.message}`);
170
- console.log('Trying fallback URL...');
171
-
172
- try {
173
- // Try fallback URL
174
- await downloadFile(fallbackUrl, binaryPath);
175
- } catch (fallbackErr) {
176
- console.error(`❌ Error: Failed to download binary`);
177
- console.error(` Primary URL: ${releaseUrl}`);
178
- console.error(` Fallback URL: ${fallbackUrl}`);
179
- console.error('');
180
- console.error('This might be because:');
181
- console.error('1. The release has not been created yet');
182
- console.error('2. Network connectivity issues');
183
- console.error('3. The version specified does not exist');
184
- console.error('');
185
- console.error('You can try:');
186
- console.error('1. Installing from source: https://code.foss.global/serve.zone/mailer');
187
- console.error('2. Downloading the binary manually from the releases page');
188
-
189
- // Clean up partial download
190
- if (existsSync(binaryPath)) {
191
- unlinkSync(binaryPath);
192
- }
193
-
194
- process.exit(1);
195
- }
196
- }
197
-
198
- console.log(`✓ Binary downloaded successfully`);
199
- }
200
-
201
- // On Unix-like systems, ensure the binary is executable
202
- if (binaryInfo.originalPlatform !== 'win32') {
203
- try {
204
- console.log('Setting executable permissions...');
205
- chmodSync(binaryPath, 0o755);
206
- console.log('✓ Binary permissions updated');
207
- } catch (err) {
208
- console.error(`⚠️ Warning: Could not set executable permissions: ${err.message}`);
209
- console.error(' You may need to manually run:');
210
- console.error(` chmod +x ${binaryPath}`);
211
- }
212
- }
213
-
214
- console.log('');
215
- console.log('✅ MAILER installation completed successfully!');
216
- console.log('');
217
- console.log('You can now use MAILER by running:');
218
- console.log(' mailer --help');
219
- console.log('');
220
- console.log('For initial setup, run:');
221
- console.log(' sudo mailer service enable');
222
- console.log('');
223
- console.log('===========================================');
224
- }
225
-
226
- // Run the installation
227
- main().catch(err => {
228
- console.error(`❌ Installation failed: ${err.message}`);
229
- process.exit(1);
230
- });