execonvert 0.5.3 → 0.5.4

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
@@ -9,6 +9,18 @@ Categorías usadas: **Añadido**, **Cambiado**, **Corregido**, **Eliminado**.
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [0.5.4] - 2026-09-05
13
+
14
+ ### Corregido
15
+ - Una opción mal escrita con un solo guion (por ejemplo `-o salida.elpx`) se
16
+ tomaba como si fuera un archivo de entrada y se descartaba sin decir nada,
17
+ mientras la conversión escribía en su destino por defecto. Si allí ya había un
18
+ archivo con ese nombre, se sobrescribía sin aviso. Ahora se rechaza como
19
+ opción desconocida. Para elegir la salida siguen estando
20
+ `execonvert <entrada> <salida>` y `--out-dir`.
21
+ - Los archivos de entrada que se descartan por no admitir la conversión pedida
22
+ se anuncian por la salida de errores en lugar de desaparecer en silencio.
23
+
12
24
  ## [0.5.3] - 2026-09-05
13
25
 
14
26
  ### Corregido
@@ -10,9 +10,9 @@ import { convertElpToElpx } from '../src/legacy-elp.js';
10
10
  import { convertMarkdownToElpx } from '../src/markdown-import.js';
11
11
  import { installCliRuntime } from './runtime.js';
12
12
  import { automaticCheck, autoCheckAllowed, runUpdate, updateText } from './updates.js';
13
- const CLI_VERSION = '0.5.3'.startsWith('__')
13
+ const CLI_VERSION = '0.5.4'.startsWith('__')
14
14
  ? String(JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8')).version)
15
- : '0.5.3';
15
+ : '0.5.4';
16
16
  const cliMessages = {
17
17
  es: {
18
18
  'help.title': 'CLI de eXeConvert',
@@ -31,6 +31,7 @@ const cliMessages = {
31
31
  'help.output.docx': 'desde .docx: .elpx',
32
32
  'help.output.markdown': 'desde .md/.txt: .elpx',
33
33
  'help.option.to': 'Formato de salida para conversión múltiple (elpx, docx, md, pdf). Los archivos no compatibles se ignoran.',
34
+ 'warn.skippedInput': 'Aviso: se ignora {file}: no se puede convertir a {format}.',
34
35
  'help.option.outDir': 'Directorio de salida (por defecto: mismo directorio que cada entrada)',
35
36
  'help.option.json': 'Imprime JSON legible por máquina',
36
37
  'help.option.pages': 'Exporta solo las referencias de página seleccionadas de un .elpx',
@@ -79,6 +80,7 @@ const cliMessages = {
79
80
  'help.output.docx': 'des de .docx: .elpx',
80
81
  'help.output.markdown': 'des de .md/.txt: .elpx',
81
82
  'help.option.to': 'Format de sortida per a conversió múltiple (elpx, docx, md, pdf). Els fitxers no compatibles s’ignoren.',
83
+ 'warn.skippedInput': 'Avís: s’ignora {file}: no es pot convertir a {format}.',
82
84
  'help.option.outDir': 'Directori de sortida (per defecte: mateix directori que cada entrada)',
83
85
  'help.option.json': 'Imprimeix JSON llegible per màquines',
84
86
  'help.option.pages': 'Exporta només les referències de pàgina seleccionades d’un .elpx',
@@ -127,6 +129,7 @@ const cliMessages = {
127
129
  'help.output.docx': 'from .docx: .elpx',
128
130
  'help.output.markdown': 'from .md/.txt: .elpx',
129
131
  'help.option.to': 'Output format for batch conversion (elpx, docx, md, pdf). Incompatible files are skipped.',
132
+ 'warn.skippedInput': 'Warning: skipping {file}: it cannot be converted to {format}.',
130
133
  'help.option.outDir': 'Output directory (default: same directory as each input)',
131
134
  'help.option.json': 'Print machine-readable JSON',
132
135
  'help.option.pages': 'Export only selected page refs from an .elpx input',
@@ -343,6 +346,12 @@ function parseOptionFlags(args, defaults, t) {
343
346
  for (let index = 0; index < args.length; index += 1) {
344
347
  const value = args[index];
345
348
  if (!value.startsWith('--')) {
349
+ // A single dash is a mistyped option, not a file: taking it as one made
350
+ // "-o out.elpx" silently convert to the default destination instead,
351
+ // which can overwrite an existing file next to the input.
352
+ if (value.length > 1 && value.startsWith('-')) {
353
+ throw new Error(t('error.unknownOption', { value }));
354
+ }
346
355
  positionals.push(value);
347
356
  continue;
348
357
  }
@@ -767,6 +776,16 @@ async function runBatch(args) {
767
776
  return false;
768
777
  }
769
778
  });
779
+ // Skipping is deliberate for globs like "*.docx --to pdf", but doing it in
780
+ // silence hides typos: an unknown option taken as a filename disappeared
781
+ // without a word while the conversion wrote to its default destination.
782
+ if (!args.json) {
783
+ for (const inputPath of inputPaths) {
784
+ if (!eligible.includes(inputPath)) {
785
+ stderr.write(i18n.t('warn.skippedInput', { file: basename(inputPath), format: toRaw }) + '\n');
786
+ }
787
+ }
788
+ }
770
789
  let count = 0;
771
790
  for (const inputPath of eligible) {
772
791
  if (!args.json) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "execonvert",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -39,7 +39,8 @@
39
39
  "test:updates": "node --import tsx --test tests/updates.test.ts",
40
40
  "test:runtime": "node scripts/test-runtime.mjs",
41
41
  "test:cli": "node --test tests/cli-update.test.mjs",
42
- "test:docx": "node --test tests/docx-omml.test.mjs"
42
+ "test:docx": "node --test tests/docx-omml.test.mjs",
43
+ "test:args": "node --test tests/cli-args.test.mjs"
43
44
  },
44
45
  "dependencies": {
45
46
  "@resvg/resvg-js": "^2.6.2",