nexo-md-to-pdf-cli 0.1.0
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 +246 -0
- package/assets/brand/nexo_logo_primary.svg +6 -0
- package/assets/brand/nexo_logo_primary_mono.svg +6 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +166 -0
- package/dist/cli.js.map +1 -0
- package/dist/free-convert.d.ts +138 -0
- package/dist/free-convert.js +130 -0
- package/dist/free-convert.js.map +1 -0
- package/dist/free-limits.d.ts +27 -0
- package/dist/free-limits.js +40 -0
- package/dist/free-limits.js.map +1 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Davi Speck
|
|
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
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# NEXO CLI
|
|
2
|
+
|
|
3
|
+
Official command-line interface for converting Markdown files into polished PDFs using the hosted NEXO conversion API.
|
|
4
|
+
|
|
5
|
+
This package is designed for developers, technical writers, consultants, and teams that want the same PDF output available in the NEXO web product, but from scripts, terminals, CI jobs, or bulk local workflows.
|
|
6
|
+
|
|
7
|
+
## Why this exists
|
|
8
|
+
|
|
9
|
+
The NEXO web app is the best place for richer document workflows, previews, and attachment-heavy conversions. The CLI exists for a different use case:
|
|
10
|
+
|
|
11
|
+
- run conversions from the terminal
|
|
12
|
+
- automate repetitive document generation
|
|
13
|
+
- process multiple Markdown files quickly
|
|
14
|
+
- keep output consistent with the hosted NEXO product
|
|
15
|
+
|
|
16
|
+
Instead of generating PDFs locally with its own rendering stack, the CLI sends conversion jobs to the same backend used by the public NEXO experience.
|
|
17
|
+
|
|
18
|
+
That means:
|
|
19
|
+
|
|
20
|
+
- the PDF layout stays aligned with the product
|
|
21
|
+
- free-mode rules stay centralized
|
|
22
|
+
- usage is still tracked in the NEXO backend
|
|
23
|
+
- CLI traffic is identified separately from website traffic
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
Global install:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install -g nexo-md-to-pdf-cli
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
After installation, the command is:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
nexo --help
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
You can also run it without a global install:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx nexo-md-to-pdf-cli --help
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Quick start
|
|
46
|
+
|
|
47
|
+
Convert one Markdown file:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
nexo release-summary.md
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Write to a specific output path:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
nexo release-summary.md --output ./release-summary.pdf
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Convert several files at once:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
nexo a.md b.md c.md --output-dir ./pdfs
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Use a custom logo:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
nexo release-summary.md --logo ./brand.svg --logo-tone light
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Target another environment:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
nexo release-summary.md --api-base-url http://localhost:3000
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## How it works
|
|
78
|
+
|
|
79
|
+
By default, the CLI sends requests to:
|
|
80
|
+
|
|
81
|
+
```text
|
|
82
|
+
https://nexo.speck-solutions.com.br/api/free/convert
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Each input `.md` file is processed as its own conversion job. This makes bulk usage easier while preserving the same per-conversion rules enforced by the hosted free flow.
|
|
86
|
+
|
|
87
|
+
The CLI identifies itself with a dedicated request header, so the backend can distinguish:
|
|
88
|
+
|
|
89
|
+
- website usage
|
|
90
|
+
- CLI usage
|
|
91
|
+
|
|
92
|
+
This keeps metrics and operational visibility clean without splitting rendering logic across multiple codebases.
|
|
93
|
+
|
|
94
|
+
## Command reference
|
|
95
|
+
|
|
96
|
+
### Basic usage
|
|
97
|
+
|
|
98
|
+
```text
|
|
99
|
+
nexo <file.md>
|
|
100
|
+
nexo <file.md> --output <file.pdf>
|
|
101
|
+
nexo <file-a.md> <file-b.md> --output-dir <directory>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Options
|
|
105
|
+
|
|
106
|
+
- `--output <file>`: write the generated PDF to a specific path for a single Markdown input
|
|
107
|
+
- `--output-dir <directory>`: choose the output directory when converting multiple files
|
|
108
|
+
- `--logo <file>`: provide an optional logo in `png`, `jpg`, `webp`, or `svg`
|
|
109
|
+
- `--logo-tone <dark|light>`: choose the logo header background tone, default is `dark`
|
|
110
|
+
- `--api-base-url <url>`: point the CLI to another NEXO environment such as local development or staging
|
|
111
|
+
- `-h, --help`: show command help
|
|
112
|
+
|
|
113
|
+
### Output behavior
|
|
114
|
+
|
|
115
|
+
- without `--output-dir`, the generated PDF is written next to the original Markdown file
|
|
116
|
+
- `--output` can only be used with a single Markdown input
|
|
117
|
+
- each input file generates one PDF
|
|
118
|
+
- the CLI exits with a non-zero status if one or more conversions fail
|
|
119
|
+
|
|
120
|
+
## Current scope
|
|
121
|
+
|
|
122
|
+
This first version of the CLI intentionally focuses on the most common command-line workflow:
|
|
123
|
+
|
|
124
|
+
- Markdown input
|
|
125
|
+
- optional custom logo
|
|
126
|
+
- hosted conversion through the NEXO API
|
|
127
|
+
|
|
128
|
+
The following are intentionally out of scope for now:
|
|
129
|
+
|
|
130
|
+
- attachments
|
|
131
|
+
- multi-asset document packaging
|
|
132
|
+
- interactive preview flows
|
|
133
|
+
|
|
134
|
+
For richer document assembly, use the web application at [nexo.speck-solutions.com.br](https://nexo.speck-solutions.com.br).
|
|
135
|
+
|
|
136
|
+
## Free-mode limits
|
|
137
|
+
|
|
138
|
+
The CLI follows the same unauthenticated limits enforced by the public NEXO free flow.
|
|
139
|
+
|
|
140
|
+
Current limits:
|
|
141
|
+
|
|
142
|
+
- up to 3 Markdown documents per request
|
|
143
|
+
- up to 120,000 characters per document
|
|
144
|
+
- up to 180,000 characters total per request
|
|
145
|
+
- optional custom logo up to 2 MB
|
|
146
|
+
- accepted logo formats: `png`, `jpeg`, `webp`, `svg`
|
|
147
|
+
|
|
148
|
+
Because this CLI sends each input file as a separate conversion job, those limits apply to each generated PDF request individually.
|
|
149
|
+
|
|
150
|
+
## Examples
|
|
151
|
+
|
|
152
|
+
Single document:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
nexo weekly-report.md
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Single document with explicit output:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
nexo weekly-report.md --output ./exports/weekly-report.pdf
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Bulk conversion:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
nexo docs/release-1.md docs/release-2.md docs/release-3.md --output-dir ./exports
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Local backend:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
nexo weekly-report.md --api-base-url http://localhost:3000
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Error behavior
|
|
177
|
+
|
|
178
|
+
The CLI validates payloads before sending them and also surfaces hosted API errors clearly.
|
|
179
|
+
|
|
180
|
+
Typical failure cases include:
|
|
181
|
+
|
|
182
|
+
- unsupported logo file type
|
|
183
|
+
- using `--output` with more than one Markdown input
|
|
184
|
+
- exceeding hosted free-mode limits
|
|
185
|
+
- API errors returned by the NEXO backend
|
|
186
|
+
- network failures when the hosted service is unreachable
|
|
187
|
+
|
|
188
|
+
For successful conversions, the CLI prints a line like:
|
|
189
|
+
|
|
190
|
+
```text
|
|
191
|
+
[ok] /absolute/input.md -> /absolute/output.pdf
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
For failed conversions, it prints:
|
|
195
|
+
|
|
196
|
+
```text
|
|
197
|
+
[erro] /absolute/input.md -> reason
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Development
|
|
201
|
+
|
|
202
|
+
Install dependencies:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
yarn install
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Type-check:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
yarn typecheck
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Build:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
yarn build
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Run locally without publishing:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
node dist/cli.js --help
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Test the command locally via npm linking:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
npm link
|
|
230
|
+
nexo --help
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Relationship to the main NEXO repo
|
|
234
|
+
|
|
235
|
+
This repository contains the distributable CLI package.
|
|
236
|
+
|
|
237
|
+
The main NEXO product lives here:
|
|
238
|
+
|
|
239
|
+
- Website: [nexo.speck-solutions.com.br](https://nexo.speck-solutions.com.br)
|
|
240
|
+
- Main repository: [github.com/DaviSpeck/nexo](https://github.com/DaviSpeck/nexo)
|
|
241
|
+
|
|
242
|
+
If you want the browser experience, previews, richer document flows, or the primary product documentation, start from the main repository.
|
|
243
|
+
|
|
244
|
+
## License
|
|
245
|
+
|
|
246
|
+
[MIT](./LICENSE)
|