@ecuafact/cli 0.0.0-stage → 0.0.1-preview
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/LICENSE +21 -0
- package/README.md +15 -2
- package/bin/ecuafact.js +71 -0
- package/package.json +38 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ecuanexus
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ecuafact/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
CLI oficial de facturación electrónica de Ecuafact (SRI, Ecuador): emite comprobantes desde JSON, JSONL, carpetas, CSV o Excel; valida sin consumir cupo; sigue operaciones; descarga RIDE y XML; consulta el SRI; reanuda lotes; vigila carpetas y prueba webhooks.
|
|
4
|
+
|
|
5
|
+
El paquete instala un binario nativo para tu plataforma (Windows, Linux o macOS; x64 o arm64). No necesita .NET.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @ecuafact/cli@preview # o: bun add -g @ecuafact/cli@preview / pnpm add -g @ecuafact/cli@preview
|
|
9
|
+
npx @ecuafact/cli@preview --help # o: bunx @ecuafact/cli@preview --help
|
|
10
|
+
|
|
11
|
+
ecuafact login # guarda tu API Key en el almacen de credenciales del sistema
|
|
12
|
+
ecuafact doctor
|
|
13
|
+
ecuafact emitir factura.json --esperar --descargar ride
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Ayuda: `ecuafact ayuda`, `ecuafact <comando> --help` y https://docsapi.ecuafact.com/v1/guias/.
|
package/bin/ecuafact.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Lanzador del CLI ecuafact para npm, Bun, pnpm y Yarn: ubica el binario nativo del paquete de la
|
|
3
|
+
// plataforma (instalado como dependencia opcional) y le pasa los argumentos, la entrada y la salida.
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const { spawnSync } = require("node:child_process");
|
|
7
|
+
const fs = require("node:fs");
|
|
8
|
+
|
|
9
|
+
const PLATAFORMAS = {
|
|
10
|
+
"win32-x64": "@ecuafact/cli-win32-x64",
|
|
11
|
+
"win32-arm64": "@ecuafact/cli-win32-arm64",
|
|
12
|
+
"linux-x64": "@ecuafact/cli-linux-x64",
|
|
13
|
+
"linux-arm64": "@ecuafact/cli-linux-arm64",
|
|
14
|
+
"linux-x64-musl": "@ecuafact/cli-linux-x64-musl",
|
|
15
|
+
"darwin-x64": "@ecuafact/cli-darwin-x64",
|
|
16
|
+
"darwin-arm64": "@ecuafact/cli-darwin-arm64",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
function sufijoLibc() {
|
|
20
|
+
if (process.platform !== "linux") {
|
|
21
|
+
return "";
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
const reporte = process.report && process.report.getReport();
|
|
25
|
+
return reporte && reporte.header && reporte.header.glibcVersionRuntime ? "" : "-musl";
|
|
26
|
+
} catch {
|
|
27
|
+
return "";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function binario() {
|
|
32
|
+
if (process.env.ECUAFACT_BINARIO) {
|
|
33
|
+
return process.env.ECUAFACT_BINARIO;
|
|
34
|
+
}
|
|
35
|
+
const clave = `${process.platform}-${process.arch}${sufijoLibc()}`;
|
|
36
|
+
const paquete = PLATAFORMAS[clave];
|
|
37
|
+
if (!paquete) {
|
|
38
|
+
console.error(`ecuafact: no hay binario para esta plataforma (${clave}).`);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
const archivo = process.platform === "win32" ? "ecuafact.exe" : "ecuafact";
|
|
42
|
+
try {
|
|
43
|
+
return require.resolve(`${paquete}/bin/${archivo}`);
|
|
44
|
+
} catch {
|
|
45
|
+
console.error(`ecuafact: falta el paquete ${paquete}.`);
|
|
46
|
+
console.error("Reinstala sin omitir dependencias opcionales, por ejemplo: npm install -g @ecuafact/cli");
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const ruta = binario();
|
|
52
|
+
if (process.platform !== "win32") {
|
|
53
|
+
try {
|
|
54
|
+
fs.accessSync(ruta, fs.constants.X_OK);
|
|
55
|
+
} catch {
|
|
56
|
+
// Algunos empaquetados pierden el permiso de ejecucion: se restablece.
|
|
57
|
+
try {
|
|
58
|
+
fs.chmodSync(ruta, 0o755);
|
|
59
|
+
} catch (error) {
|
|
60
|
+
console.error(`ecuafact: el binario no es ejecutable (${ruta}): ${error.message}`);
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const resultado = spawnSync(ruta, process.argv.slice(2), { stdio: "inherit", windowsHide: false });
|
|
67
|
+
if (resultado.error) {
|
|
68
|
+
console.error(`ecuafact: no se pudo ejecutar ${ruta}: ${resultado.error.message}`);
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
process.exit(resultado.status === null ? 1 : resultado.status);
|
package/package.json
CHANGED
|
@@ -1,6 +1,38 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@ecuafact/cli",
|
|
3
|
+
"version": "0.0.1-preview",
|
|
4
|
+
"description": "CLI de facturacion electronica de Ecuafact (SRI Ecuador).",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/Ecuanexus/ecuafact-cli.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://docsapi.ecuafact.com/",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"ecuafact",
|
|
13
|
+
"sri",
|
|
14
|
+
"ecuador",
|
|
15
|
+
"facturacion-electronica",
|
|
16
|
+
"cli"
|
|
17
|
+
],
|
|
18
|
+
"bin": {
|
|
19
|
+
"ecuafact": "bin/ecuafact.js"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"bin/ecuafact.js",
|
|
23
|
+
"README.md",
|
|
24
|
+
"LICENSE"
|
|
25
|
+
],
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": "\u003e=18"
|
|
28
|
+
},
|
|
29
|
+
"optionalDependencies": {
|
|
30
|
+
"@ecuafact/cli-win32-x64": "0.0.1-preview",
|
|
31
|
+
"@ecuafact/cli-win32-arm64": "0.0.1-preview",
|
|
32
|
+
"@ecuafact/cli-linux-x64": "0.0.1-preview",
|
|
33
|
+
"@ecuafact/cli-linux-arm64": "0.0.1-preview",
|
|
34
|
+
"@ecuafact/cli-linux-x64-musl": "0.0.1-preview",
|
|
35
|
+
"@ecuafact/cli-darwin-x64": "0.0.1-preview",
|
|
36
|
+
"@ecuafact/cli-darwin-arm64": "0.0.1-preview"
|
|
37
|
+
}
|
|
38
|
+
}
|