@vaibhavjha/qrfy 1.0.7 → 1.0.9
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/README.md +36 -8
- package/bin/qrfy.js +17 -2
- package/lib/qr.js +19 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,11 +20,11 @@ Stop typing IPs. Start scanning.
|
|
|
20
20
|
## Quick Start
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
# Install
|
|
24
|
-
npm install -
|
|
23
|
+
# Install as a dev dependency
|
|
24
|
+
npm install -D @vaibhavjha/qrfy
|
|
25
25
|
|
|
26
26
|
# Run with your dev server
|
|
27
|
-
qrfy next dev
|
|
27
|
+
npx qrfy next dev
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
That's it. A QR code appears in your terminal. Scan it. Done.
|
|
@@ -60,13 +60,26 @@ $ qrfy next dev
|
|
|
60
60
|
## Install
|
|
61
61
|
|
|
62
62
|
```bash
|
|
63
|
-
|
|
63
|
+
# As a dev dependency
|
|
64
|
+
npm install -D @vaibhavjha/qrfy
|
|
64
65
|
```
|
|
65
66
|
|
|
66
67
|
<details>
|
|
67
68
|
<summary><b>yarn / pnpm / bun</b></summary>
|
|
68
69
|
|
|
69
70
|
```bash
|
|
71
|
+
yarn add -D @vaibhavjha/qrfy
|
|
72
|
+
pnpm add -D @vaibhavjha/qrfy
|
|
73
|
+
bun add -d @vaibhavjha/qrfy
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
</details>
|
|
77
|
+
|
|
78
|
+
<details>
|
|
79
|
+
<summary><b>Install globally (optional)</b></summary>
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npm install -g @vaibhavjha/qrfy
|
|
70
83
|
yarn global add @vaibhavjha/qrfy
|
|
71
84
|
pnpm add -g @vaibhavjha/qrfy
|
|
72
85
|
bun add -g @vaibhavjha/qrfy
|
|
@@ -112,12 +125,27 @@ Now `npm run dev` gives you a QR code every time. Your whole team gets it for fr
|
|
|
112
125
|
|
|
113
126
|
---
|
|
114
127
|
|
|
128
|
+
## QR for Anything
|
|
129
|
+
|
|
130
|
+
Need a QR code for a URL, a WiFi password, or any piece of text? Use `-q`:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
qrfy -q https://example.com
|
|
134
|
+
qrfy -q "hello world"
|
|
135
|
+
qrfy -q "WIFI:T:WPA;S:MyNetwork;P:mypassword;;"
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
No dev server, no port detection — just a scannable QR code in your terminal.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
115
142
|
## CLI Options
|
|
116
143
|
|
|
117
144
|
```bash
|
|
118
|
-
qrfy <command>
|
|
119
|
-
qrfy
|
|
120
|
-
qrfy --
|
|
145
|
+
qrfy <command> # Wrap a dev server
|
|
146
|
+
qrfy -q <text|url...> # QR code for any text or URL
|
|
147
|
+
qrfy --help, -h # Show help
|
|
148
|
+
qrfy --version, -v # Show version
|
|
121
149
|
```
|
|
122
150
|
|
|
123
151
|
---
|
|
@@ -161,7 +189,7 @@ qrfy --version, -v # Show version
|
|
|
161
189
|
| | Requirement |
|
|
162
190
|
|---|---|
|
|
163
191
|
| **Runtime** | Node.js >= 14 |
|
|
164
|
-
| **Network** |
|
|
192
|
+
| **Network** | Same WiFi |
|
|
165
193
|
| **OS** | macOS, Linux, Windows |
|
|
166
194
|
|
|
167
195
|
---
|
package/bin/qrfy.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const { getLocalIP } = require("../lib/network");
|
|
4
|
-
const { displayQR } = require("../lib/qr");
|
|
4
|
+
const { displayQR, displayStaticQR } = require("../lib/qr");
|
|
5
5
|
const { runServer } = require("../lib/runner");
|
|
6
6
|
|
|
7
7
|
const { version } = require("../package.json");
|
|
@@ -18,20 +18,35 @@ if (args.length === 0 || args[0] === "--help" || args[0] === "-h") {
|
|
|
18
18
|
console.log(` \x1b[1mqrfy\x1b[0m v${version} - Scan your dev server instantly`);
|
|
19
19
|
console.log("");
|
|
20
20
|
console.log(" \x1b[1mUsage:\x1b[0m");
|
|
21
|
-
console.log(" qrfy <command> [args...]");
|
|
21
|
+
console.log(" qrfy <command> [args...] Wrap a dev server");
|
|
22
|
+
console.log(" qrfy -q <text|url...> QR code for any text or URL");
|
|
22
23
|
console.log("");
|
|
23
24
|
console.log(" \x1b[1mExamples:\x1b[0m");
|
|
24
25
|
console.log(" qrfy next dev");
|
|
25
26
|
console.log(" qrfy vite");
|
|
26
27
|
console.log(" qrfy npm run dev");
|
|
28
|
+
console.log(" qrfy -q https://example.com");
|
|
29
|
+
console.log(" qrfy -q \"hello world\"");
|
|
27
30
|
console.log("");
|
|
28
31
|
console.log(" \x1b[1mOptions:\x1b[0m");
|
|
32
|
+
console.log(" -q, --qr Generate QR for any text or URL");
|
|
29
33
|
console.log(" -h, --help Show this help message");
|
|
30
34
|
console.log(" -v, --version Show version number");
|
|
31
35
|
console.log("");
|
|
32
36
|
process.exit(0);
|
|
33
37
|
}
|
|
34
38
|
|
|
39
|
+
// Static QR: explicit QR mode
|
|
40
|
+
if (args[0] === "--qr" || args[0] === "-q") {
|
|
41
|
+
const content = args.slice(1).join(" ");
|
|
42
|
+
if (!content) {
|
|
43
|
+
console.error("\x1b[31m QRfy: -q requires content\x1b[0m");
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
displayStaticQR(content);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
35
50
|
const ip = getLocalIP();
|
|
36
51
|
|
|
37
52
|
if (!ip) {
|
package/lib/qr.js
CHANGED
|
@@ -23,4 +23,22 @@ function displayQR(localUrl, mobileUrl) {
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
function displayStaticQR(content) {
|
|
27
|
+
console.log("");
|
|
28
|
+
console.log("\x1b[1m\x1b[34m QRfy\x1b[0m");
|
|
29
|
+
console.log("");
|
|
30
|
+
console.log(` Content: \x1b[32m${content}\x1b[0m`);
|
|
31
|
+
console.log("");
|
|
32
|
+
console.log(" Scan with your phone:");
|
|
33
|
+
console.log("");
|
|
34
|
+
qrcode.generate(content, { small: true }, (code) => {
|
|
35
|
+
const indented = code
|
|
36
|
+
.split("\n")
|
|
37
|
+
.map((line) => " " + line)
|
|
38
|
+
.join("\n");
|
|
39
|
+
console.log(indented);
|
|
40
|
+
console.log("");
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
module.exports = { displayQR, displayStaticQR };
|