@qrdx/cli 0.0.4 → 0.0.6
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 +91 -24
- package/dist/index.js +926 -204
- package/package.json +38 -21
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 Ritesh Bucha and QRdx contributors
|
|
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,45 +1,64 @@
|
|
|
1
1
|
# @qrdx/cli
|
|
2
2
|
|
|
3
|
-
QR code generator CLI for developers. Generate styled, scannable QR codes as SVG or
|
|
3
|
+
QR code generator CLI for developers. Generate styled, scannable QR codes as SVG, PNG, WebP or vector EPS. It runs non-interactively in scripts and CI, and guides you with prompts when run in a terminal. It renders with the same [`qrdx`](https://www.npmjs.com/package/qrdx) library as the [QRdx](https://qrdx.dev) web app.
|
|
4
|
+
|
|
5
|
+
> [!NOTE]
|
|
6
|
+
> This README documents `@qrdx/cli` 0.0.6, the version in this repository. WebP output is new in 0.0.6; 0.0.5 has every other option here. Run `npm view @qrdx/cli version` to see what npm installs. Until it is 0.0.6, get WebP from the [image API](https://qrdx.dev/docs/developers/image-api): `curl -o qr.webp "https://api.qrdx.dev/v1/qr?data=https://example.com&format=webp"`.
|
|
4
7
|
|
|
5
8
|
## Install
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
# Install the qrdx library package (includes the CLI binary)
|
|
9
|
-
npm install -g qrdx
|
|
10
|
+
Run without installing:
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
```bash
|
|
13
|
+
npx @qrdx/cli generate "https://example.com" -o qr.svg
|
|
13
14
|
```
|
|
14
15
|
|
|
15
|
-
Or
|
|
16
|
+
Or install globally, which gives you the `qrdx` command:
|
|
16
17
|
|
|
17
18
|
```bash
|
|
18
|
-
|
|
19
|
+
npm install -g @qrdx/cli
|
|
20
|
+
qrdx generate "https://example.com" -o qr.svg
|
|
19
21
|
```
|
|
20
22
|
|
|
23
|
+
PNG and WebP output use [sharp](https://sharp.pixelplumbing.com). It is an optional dependency that npm installs automatically when your platform supports it; if it is missing, SVG and EPS output still work and the CLI tells you how to fix PNG and WebP.
|
|
24
|
+
|
|
25
|
+
> The `qrdx` npm package is the React library. The CLI lives only in `@qrdx/cli`.
|
|
26
|
+
|
|
21
27
|
## Usage
|
|
22
28
|
|
|
23
29
|
```bash
|
|
24
30
|
qrdx generate <data> [options]
|
|
25
31
|
```
|
|
26
32
|
|
|
33
|
+
`gen` and `g` are aliases for `generate`, and `qrdx <data>` works too.
|
|
34
|
+
|
|
27
35
|
**Options**
|
|
28
36
|
|
|
29
37
|
| Flag | Short | Default | Description |
|
|
30
38
|
|------|-------|---------|-------------|
|
|
31
|
-
| `--output` | `-o` |
|
|
32
|
-
| `--
|
|
39
|
+
| `--output` | `-o` | `qr.svg` | Output path; the extension sets the format (`.svg`, `.png`, `.webp` or `.eps`) |
|
|
40
|
+
| `--format` | | from the extension | `svg`, `png`, `webp` or `eps`, for a file name without an extension |
|
|
41
|
+
| `--size` | | `512` | Output size: pixels for SVG, PNG and WebP, points (72 per inch) for EPS |
|
|
33
42
|
| `--level` | `-l` | `Q` | Error correction: `L` `M` `Q` `H` |
|
|
34
43
|
| `--body` | | `square` | Body dot pattern |
|
|
35
44
|
| `--eye` | | `square` | Corner eye pattern |
|
|
36
45
|
| `--dot` | | `square` | Corner dot pattern |
|
|
37
|
-
| `--fg` | | `#000000` | Foreground color |
|
|
38
|
-
| `--bg` | | `#ffffff` | Background color |
|
|
39
|
-
| `--eye-color` | |
|
|
40
|
-
| `--dot-color` | |
|
|
41
|
-
| `--logo` | | — | Center logo URL |
|
|
46
|
+
| `--fg` | | `#000000` | Foreground color (hex or JSON gradient) |
|
|
47
|
+
| `--bg` | | `#ffffff` | Background color (hex or JSON gradient) |
|
|
48
|
+
| `--eye-color` | | matches `--fg` | Corner eye color (hex or JSON gradient) |
|
|
49
|
+
| `--dot-color` | | matches `--fg` | Corner dot color (hex or JSON gradient) |
|
|
50
|
+
| `--logo` | | — | Center logo image URL (use with `--level H`) |
|
|
51
|
+
| `--no-logo` | | — | Skip the logo prompt in interactive mode |
|
|
42
52
|
| `--margin` | | `0` | Quiet zone margin (modules) |
|
|
53
|
+
| `--template` | | — | Decorative template: `Arrow` `StandardBox` `SquareBorder` `StrikedBox` `Halloween` |
|
|
54
|
+
| `--frame` | | — | Call-to-action frame: <!-- catalogue:FRAME_STYLES -->`none`, `banner-bottom`, `banner-top`, `border`, `rounded-border`, `speech-bubble`, `banner-top-bottom`, `speech-bubble-top`, `chat-bubble`, `circle`, `polaroid`, `phone`, `ticket`, `badge`, `envelope`, `tag`, `menu-card`, `sticker`, `gradient-border`, `focus`<!-- /catalogue --> |
|
|
55
|
+
| `--frame-text` | | `Scan me` | Frame label, up to 24 characters (`""` hides it) |
|
|
56
|
+
| `--frame-color` | | `#000000` | Frame color (hex) |
|
|
57
|
+
| `--frame-text-color` | | white on banners | Frame label color (hex) |
|
|
58
|
+
| `--help` | `-h` | | Show all options |
|
|
59
|
+
| `--version` | `-v` | | Show the version |
|
|
60
|
+
|
|
61
|
+
Invalid values (unknown pattern, template, frame, level, size, output extension, malformed gradient JSON, frame text over 24 characters or a non-hex frame color) exit with code `1` and a message listing the accepted values. `--frame-text` or a frame color without `--frame` uses `banner-bottom`. A frame adds space around the code, so the file is larger than `--size`.
|
|
43
62
|
|
|
44
63
|
## Examples
|
|
45
64
|
|
|
@@ -50,6 +69,12 @@ qrdx generate "https://qrdx.dev" -o qr.svg
|
|
|
50
69
|
# High-res PNG for print
|
|
51
70
|
qrdx generate "https://qrdx.dev" -o qr.png --size 2048 --level H
|
|
52
71
|
|
|
72
|
+
# Lossless WebP for a website: the PNG's pixels in a smaller file
|
|
73
|
+
qrdx generate "https://qrdx.dev" -o qr.webp --size 1024
|
|
74
|
+
|
|
75
|
+
# Vector EPS for a print shop or Illustrator, 2 inches wide
|
|
76
|
+
qrdx generate "https://qrdx.dev" -o qr.eps --size 144
|
|
77
|
+
|
|
53
78
|
# Branded style
|
|
54
79
|
qrdx generate "https://qrdx.dev" \
|
|
55
80
|
--body circle --eye rounded \
|
|
@@ -59,7 +84,17 @@ qrdx generate "https://qrdx.dev" \
|
|
|
59
84
|
# With center logo
|
|
60
85
|
qrdx generate "https://qrdx.dev" \
|
|
61
86
|
--logo "https://qrdx.dev/logo.png" --level H \
|
|
62
|
-
-o logo-qr.
|
|
87
|
+
-o logo-qr.png
|
|
88
|
+
|
|
89
|
+
# Gradient foreground
|
|
90
|
+
qrdx generate "https://qrdx.dev" -o gradient.svg \
|
|
91
|
+
--fg '{"type":"linear","stops":[{"color":"#6366f1","offset":0},{"color":"#ec4899","offset":100}],"angle":135}'
|
|
92
|
+
|
|
93
|
+
# Template
|
|
94
|
+
qrdx generate "https://qrdx.dev" --template Arrow -o arrow.svg
|
|
95
|
+
|
|
96
|
+
# "Scan me" frame
|
|
97
|
+
qrdx generate "https://qrdx.dev/menu" --frame banner-bottom --frame-text "Scan for the menu" -o menu.png
|
|
63
98
|
|
|
64
99
|
# Wi-Fi QR
|
|
65
100
|
qrdx generate "WIFI:T:WPA;S:MyNetwork;P:MyPassword;;" -o wifi.svg
|
|
@@ -68,27 +103,59 @@ qrdx generate "WIFI:T:WPA;S:MyNetwork;P:MyPassword;;" -o wifi.svg
|
|
|
68
103
|
qrdx generate
|
|
69
104
|
```
|
|
70
105
|
|
|
106
|
+
## Batch: a code for every row of a CSV
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
qrdx batch products.csv -o codes --format png --size 1024 --body circle
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`qrdx batch` (or `qrdx b`) reads a CSV and writes one static QR code per row into a folder, with the same columns as the free [bulk generator](https://qrdx.dev/tools/bulk). The content comes from a column named `value`, `url`, `link`, `data`, `content`, `text` or `qr` (else the first column), and file names from one named `file name`, `name`, `label`, `id`, `title` or `sku` (else `qr-00001.svg`, `qr-00002.svg` and so on). Pick others with `--value-column` and `--name-column`, by header name or column number, and use `--no-header` when the first row is a code.
|
|
113
|
+
|
|
114
|
+
Every style option of `generate` applies to all the codes. The file is read as a stream and each code is written as soon as it's made, so there's no row limit; nothing is uploaded and no account is needed. Rows that can't be encoded are skipped and listed, with the reason, in `errors.csv` in the output folder. `--jobs` sets how many codes render at a time (4 for SVG, 8 for PNG and EPS by default).
|
|
115
|
+
|
|
71
116
|
## Patterns
|
|
72
117
|
|
|
73
|
-
**Body** (`--body`):
|
|
118
|
+
**Body** (`--body`): <!-- catalogue:BODY_PATTERN -->`circle`, `circle-large`, `square`, `diamond`, `circle-mixed`, `pacman`, `rounded`, `small-square`, `vertical-line`, `horizontal-line`, `liquid`, `liquid-horizontal`, `liquid-vertical`, `classy`, `classy-rounded`, `leaf`, `plus`, `hexagon`, `star`, `heart`, `random-dots`, `mosaic`, `octagon`<!-- /catalogue -->
|
|
119
|
+
|
|
120
|
+
**Eye** (`--eye`): <!-- catalogue:CORNER_EYE_PATTERNS -->`square`, `rounded`, `gear`, `circle`, `diya`, `extra-rounded`, `message`, `pointy`, `leaf`, `drop`, `octagon`, `bevel`, `squircle`, `cushion`, `shield`, `petal`, `leaf-reverse`<!-- /catalogue -->
|
|
121
|
+
|
|
122
|
+
**Dot** (`--dot`): <!-- catalogue:CORNER_EYE_DOT_PATTERNS -->`square`, `rounded`, `circle`, `message`, `message-reverse`, `diya`, `diya-reverse`, `rounded-triangle`, `leaf`, `drop`, `plus`, `cross-rounded`, `hexagon`, `octagon`, `flower`, `heart`, `squircle`, `dots`, `extra-rounded`, `leaf-reverse`, `drop-reverse`<!-- /catalogue -->
|
|
123
|
+
|
|
124
|
+
See them all at [qrdx.dev/docs/styles](https://qrdx.dev/docs/styles). Every option decodes in our tests; `square` and `rounded` eyes scan most reliably, and `circle` eyes may be missed by strict scanners. Curly eyes and diamond, star and banner dots were retired because they don't scan reliably.
|
|
125
|
+
|
|
126
|
+
## Gradients
|
|
127
|
+
|
|
128
|
+
Pass a JSON object to `--fg`, `--bg`, `--eye-color` or `--dot-color`:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# Linear (angle in degrees: 0 = left→right, 90 = top→bottom)
|
|
132
|
+
--fg '{"type":"linear","stops":[{"color":"#6366f1","offset":0},{"color":"#ec4899","offset":100}],"angle":135}'
|
|
133
|
+
|
|
134
|
+
# Radial
|
|
135
|
+
--bg '{"type":"radial","stops":[{"color":"#fef9c3","offset":0},{"color":"#fde047","offset":100}]}'
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Each gradient needs at least 2 stops; `offset` is a percentage from 0 to 100.
|
|
74
139
|
|
|
75
|
-
|
|
140
|
+
## EPS
|
|
76
141
|
|
|
77
|
-
|
|
142
|
+
`.eps` files are vector PostScript (EPSF-3.0) for print shops and design tools. `--size` is the width in points, so `--size 144` is 2 inches. Linear and radial gradients print as smooth PostScript Level 3 shadings, and there is no transparency. PNG and JPEG logos are embedded; other logo formats are converted with sharp when it is installed, and otherwise left out with a warning.
|
|
78
143
|
|
|
79
144
|
## Interactive mode
|
|
80
145
|
|
|
81
|
-
When run in a TTY without
|
|
146
|
+
When run in a TTY without an output path or data, `qrdx generate` starts a guided prompt flow: data, output path, then optional customizations (patterns, colors, template, logo, margin). In CI (`CI=true`) or when stdin/stdout is not a TTY it never prompts.
|
|
82
147
|
|
|
83
148
|
## Requirements
|
|
84
149
|
|
|
85
|
-
Node.js ≥
|
|
150
|
+
Node.js ≥ 22
|
|
86
151
|
|
|
87
152
|
## Links
|
|
88
153
|
|
|
89
|
-
- [
|
|
90
|
-
- [
|
|
154
|
+
- [CLI docs](https://qrdx.dev/docs/developers/cli)
|
|
155
|
+
- [qrdx.dev](https://qrdx.dev): the web app, with static and dynamic QR codes, hosted pages and scan analytics
|
|
156
|
+
- [Image API](https://qrdx.dev/docs/developers/image-api) and [MCP server](https://qrdx.dev/docs/developers/mcp): QR codes over HTTP or from AI assistants, with nothing to install
|
|
157
|
+
- [github.com/bucharitesh/qrdx](https://github.com/bucharitesh/qrdx): the source
|
|
91
158
|
|
|
92
159
|
## License
|
|
93
160
|
|
|
94
|
-
MIT
|
|
161
|
+
[MIT](./LICENSE) © Ritesh Bucha and QRdx contributors. Versions before 0.0.5 were published under AGPL-3.0-or-later.
|