superprint 1.0.101 → 1.0.103
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/cli.mjs +82 -9
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -25,10 +25,11 @@ const APP_ZIP_URL = 'https://app.zigmoon.com/sp213-local.zip';
|
|
|
25
25
|
// le zip ET le site, sinon `npx superprint` s'arrête sur « downloaded
|
|
26
26
|
// version is invalid or older than the online version ».
|
|
27
27
|
// La version du paquet npm, elle, vit dans package.json.
|
|
28
|
-
// 📌 Dernier plancher avancé : 1.7.
|
|
29
|
-
// vérifié octet à octet le
|
|
30
|
-
//
|
|
31
|
-
|
|
28
|
+
// 📌 Dernier plancher avancé : 1.7.503 (zip 1.7.503 en ligne sur app.zigmoon.com,
|
|
29
|
+
// vérifié octet à octet le 20/09/2026 — 61 558 074 octets). ⚠️ `version.txt`
|
|
30
|
+
// sur superprint.cc doit être téléversé en 1.7.503 : c'est le fichier que ce CLI
|
|
31
|
+
// lit pour annoncer la version en ligne.
|
|
32
|
+
const MIN_APP_VERSION = '1.7.503';
|
|
32
33
|
const APP_DIR = path.join(os.homedir(), '.superprint', 'app');
|
|
33
34
|
const ZIP_PATH = path.join(os.homedir(), '.superprint', 'sp213-local.zip');
|
|
34
35
|
const VERSION_FILE = path.join(APP_DIR, 'version.txt');
|
|
@@ -180,6 +181,23 @@ function dependenciesReady() {
|
|
|
180
181
|
path.join(APP_DIR, 'node_modules', '@e965', 'xlsx', 'package.json')
|
|
181
182
|
].every(existsSync);
|
|
182
183
|
}
|
|
184
|
+
// 🛡️ v1.0.102 : une installation ABÎMÉE (dossier vidé, extraction interrompue,
|
|
185
|
+
// vieux paquet sans le studio local) ne doit jamais être considérée comme bonne :
|
|
186
|
+
// sinon `npx superprint` sert un lanceur auquel il manque des pages — c'est le
|
|
187
|
+
// symptôme « je ne peux pas ouvrir le Studio IA en local ».
|
|
188
|
+
// ⚠️ Les 7 pages du lanceur : s'il en manque UNE, on retélécharge tout.
|
|
189
|
+
function installationComplete() {
|
|
190
|
+
return [
|
|
191
|
+
path.join(APP_DIR, 'index.html'),
|
|
192
|
+
path.join(APP_DIR, 'vite.config.js'),
|
|
193
|
+
path.join(APP_DIR, 'public', 'superprint', 'version.txt'),
|
|
194
|
+
path.join(APP_DIR, 'public', 'superprint', 'app', 'index.html'),
|
|
195
|
+
path.join(APP_DIR, 'public', 'superprint', 'sp213-studio.html'),
|
|
196
|
+
path.join(APP_DIR, 'public', 'superprint', 'supertypo', 'index.html'),
|
|
197
|
+
path.join(APP_DIR, 'public', 'superprint', 'documentation.html'),
|
|
198
|
+
path.join(APP_DIR, 'public', 'superprint', 'api.html')
|
|
199
|
+
].every(existsSync);
|
|
200
|
+
}
|
|
183
201
|
function runNpmInstall() {
|
|
184
202
|
return spawnSync(isWin ? 'npm.cmd' : 'npm', ['install', '--no-audit', '--no-fund'], {
|
|
185
203
|
stdio: 'inherit', cwd: APP_DIR, shell: isWin
|
|
@@ -200,7 +218,10 @@ async function main() {
|
|
|
200
218
|
const localVer = installedVersion();
|
|
201
219
|
|
|
202
220
|
if (isInstalled()) {
|
|
203
|
-
if (!
|
|
221
|
+
if (!installationComplete()) {
|
|
222
|
+
warn('The local installation is incomplete (pages missing) — reinstalling.');
|
|
223
|
+
}
|
|
224
|
+
if (!localVer || compareVersions(localVer, onlineVersion) < 0 || !installationComplete()) {
|
|
204
225
|
info('Online version (' + onlineVersion + ') is newer than local (' + (localVer || '?') + ') — updating.');
|
|
205
226
|
// Remove the old app to re-download the new one
|
|
206
227
|
const { rmSync } = await import('node:fs');
|
|
@@ -276,20 +297,72 @@ async function main() {
|
|
|
276
297
|
|
|
277
298
|
// ---- Launch Vite ----
|
|
278
299
|
const viteBin = path.join(APP_DIR, 'node_modules', 'vite', 'bin', 'vite.js');
|
|
300
|
+
// v1.0.102 : plus de port calculé ici — c'est Vite qui décide (il bascule de port
|
|
301
|
+
// si 5173 est occupé) et on relaie SON adresse (voir plus bas).
|
|
279
302
|
const userArgs = process.argv.slice(2);
|
|
280
303
|
const hasExplicitHost = userArgs.some(arg => arg === '--host' || arg.startsWith('--host='));
|
|
281
|
-
const portArgIndex = userArgs.findIndex(arg => arg === '--port');
|
|
282
|
-
const inlinePort = userArgs.find(arg => arg.startsWith('--port='));
|
|
283
|
-
const displayPort = inlinePort ? inlinePort.slice('--port='.length) : (portArgIndex >= 0 ? userArgs[portArgIndex + 1] : '5173');
|
|
284
304
|
const args = hasExplicitHost ? userArgs : ['--host', '127.0.0.1', ...userArgs];
|
|
285
305
|
|
|
286
306
|
console.log(SEP);
|
|
287
307
|
console.log(C.green + C.bold + ' Starting SuperPrint…' + C.reset);
|
|
288
|
-
console.log(C.dim + '
|
|
308
|
+
console.log(C.dim + ' The address is displayed below as soon as the server is ready.' + C.reset);
|
|
309
|
+
console.log(C.dim + ' (the port changes automatically if 5173 is already taken)' + C.reset);
|
|
289
310
|
console.log(SEP);
|
|
311
|
+
|
|
312
|
+
// 🛡️ v1.0.102 : on ne DEVINE plus l'adresse. Avant, le message annonçait 5173 en dur
|
|
313
|
+
// (la valeur par défaut) alors que Vite bascule sur 5174/5175 si 5173 est occupé :
|
|
314
|
+
// l'utilisateur atterrissait sur une AUTRE application et croyait que SuperPrint
|
|
315
|
+
// ne s'ouvrait pas (« je ne peux pas ouvrir le studio en local »).
|
|
316
|
+
// Ici on SONDE les ports, en écartant d'abord ceux qui répondent DÉJÀ (un autre
|
|
317
|
+
// outil, un ancien serveur, une autre copie de SuperPrint) : seuls les ports
|
|
318
|
+
// ouverts APRÈS notre démarrage sont candidats.
|
|
319
|
+
const portDemande = (() => {
|
|
320
|
+
const enLigne = userArgs.find((arg) => arg.startsWith('--port='));
|
|
321
|
+
if (enLigne) return enLigne.slice('--port='.length);
|
|
322
|
+
const index = userArgs.indexOf('--port');
|
|
323
|
+
return index >= 0 ? userArgs[index + 1] : null;
|
|
324
|
+
})();
|
|
325
|
+
const ports = [];
|
|
326
|
+
if (portDemande) ports.push(String(portDemande));
|
|
327
|
+
for (let p = 5173; p <= 5185; p++) if (!ports.includes(String(p))) ports.push(String(p));
|
|
328
|
+
|
|
329
|
+
const dejaOuverts = new Set();
|
|
330
|
+
for (const port of ports) {
|
|
331
|
+
try {
|
|
332
|
+
const reponse = await fetch('http://127.0.0.1:' + port + '/', { redirect: 'manual', signal: AbortSignal.timeout(800) });
|
|
333
|
+
await reponse.text();
|
|
334
|
+
dejaOuverts.add(port);
|
|
335
|
+
} catch (_) { /* personne sur ce port : c'est un candidat */ }
|
|
336
|
+
}
|
|
337
|
+
if (dejaOuverts.size) {
|
|
338
|
+
info('Port(s) already busy (ignored): ' + [...dejaOuverts].join(', '));
|
|
339
|
+
}
|
|
340
|
+
|
|
290
341
|
const child = spawn(process.execPath, [viteBin, ...args], {
|
|
291
342
|
stdio: 'inherit', cwd: APP_DIR
|
|
292
343
|
});
|
|
344
|
+
|
|
345
|
+
(async () => {
|
|
346
|
+
for (let essai = 0; essai < 80; essai++) {
|
|
347
|
+
for (const port of ports) {
|
|
348
|
+
if (dejaOuverts.has(port)) continue;
|
|
349
|
+
let texte = '';
|
|
350
|
+
try {
|
|
351
|
+
const reponse = await fetch('http://127.0.0.1:' + port + '/', { redirect: 'manual', signal: AbortSignal.timeout(1500) });
|
|
352
|
+
if (!reponse.ok) continue;
|
|
353
|
+
texte = await reponse.text();
|
|
354
|
+
} catch (_) { continue; }
|
|
355
|
+
if (texte.indexOf('SuperPrint') < 0) continue; // un autre outil a pris ce port
|
|
356
|
+
console.log('');
|
|
357
|
+
console.log(C.green + C.bold + ' ✔ SuperPrint runs at: http://127.0.0.1:' + port + '/' + C.reset);
|
|
358
|
+
console.log(C.dim + ' Open that exact address, then pick Editor, Studio IA, SuperTyPo,' + C.reset);
|
|
359
|
+
console.log(C.dim + ' Documentation or API on the page.' + C.reset);
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
await new Promise((suite) => setTimeout(suite, 250));
|
|
363
|
+
}
|
|
364
|
+
})();
|
|
365
|
+
|
|
293
366
|
child.on('close', (code) => {
|
|
294
367
|
if (code !== 0 && code !== null) {
|
|
295
368
|
console.log(C.yellow + '\n The server stopped (code ' + code + ').' + C.reset);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "superprint",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.103",
|
|
4
4
|
"description": "SuperPrint by 2.13 — professional desktop publishing (DTP) and prepress, in your browser. Free, no subscription, no account. CMYK/PDF up to 600 DPI with bleed & imposition, advanced typography, vector text export, offline PWA, the SP213 AI layout studio (local WebLLM or cloud) and the SuperTyPo font editor (decompose & reshape any typeface). Use online at https://superprint.cc or run locally with npx.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"superprint",
|