@iksdev/shard-cli 0.1.44 → 0.1.45
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/bin/shard.js +34 -7
- package/package.json +1 -1
package/bin/shard.js
CHANGED
|
@@ -1144,7 +1144,7 @@ async function syncFolder(positionals, flags) {
|
|
|
1144
1144
|
}
|
|
1145
1145
|
}
|
|
1146
1146
|
|
|
1147
|
-
async function main() {
|
|
1147
|
+
async function main() {
|
|
1148
1148
|
const { command, positionals, flags } = parseArgs(process.argv.slice(2));
|
|
1149
1149
|
|
|
1150
1150
|
// Vérifie la mise à jour à chaque commande (sauf --help)
|
|
@@ -1212,10 +1212,37 @@ async function main() {
|
|
|
1212
1212
|
throw new Error('Usage: shard config show | shard config set-server <url>');
|
|
1213
1213
|
}
|
|
1214
1214
|
|
|
1215
|
-
throw new Error(`Commande inconnue: ${command}`);
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1215
|
+
throw new Error(`Commande inconnue: ${command}`);
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
function printPlanLimitBox(error) {
|
|
1219
|
+
const data = error?.data || {};
|
|
1220
|
+
const plan = String(data.plan || '').toUpperCase() || 'FREE';
|
|
1221
|
+
const maxFileSize = Number(data.maxFileSize || 0);
|
|
1222
|
+
const fileSize = Number(data.fileSize || 0);
|
|
1223
|
+
const maxLabel = maxFileSize > 0 ? formatBytes(maxFileSize) : '?';
|
|
1224
|
+
const fileLabel = fileSize > 0 ? formatBytes(fileSize) : '?';
|
|
1225
|
+
const lines = [
|
|
1226
|
+
'',
|
|
1227
|
+
'╔════════════════════════════════════════════════════╗',
|
|
1228
|
+
`║ ⚠ Limite du plan ${plan}`.padEnd(52) + ' ║',
|
|
1229
|
+
'╠════════════════════════════════════════════════════╣',
|
|
1230
|
+
`║ Taille fichier : ${fileLabel}`.padEnd(52) + ' ║',
|
|
1231
|
+
`║ Limite max : ${maxLabel} / fichier`.padEnd(52) + ' ║',
|
|
1232
|
+
'║ ║',
|
|
1233
|
+
'║ Passe a une offre superieure pour continuer. ║',
|
|
1234
|
+
'╚════════════════════════════════════════════════════╝',
|
|
1235
|
+
''
|
|
1236
|
+
];
|
|
1237
|
+
console.error(lines.join('\n'));
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
main().catch((error) => {
|
|
1241
|
+
if (error?.data?.code === 'PLAN_FILE_LIMIT_EXCEEDED') {
|
|
1242
|
+
printPlanLimitBox(error);
|
|
1243
|
+
process.exitCode = 1;
|
|
1244
|
+
return;
|
|
1245
|
+
}
|
|
1246
|
+
console.error(`Erreur: ${error.message}`);
|
|
1247
|
+
process.exitCode = 1;
|
|
1221
1248
|
});
|