@qodalis/cli-qr 0.0.3 → 2.0.0-beta.10
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/package.json +29 -25
- package/public-api.d.mts +22 -0
- package/public-api.d.ts +22 -3
- package/public-api.js +160 -0
- package/public-api.js.map +1 -0
- package/public-api.mjs +151 -0
- package/public-api.mjs.map +1 -0
- package/umd/index.global.js +3999 -0
- package/README.md +0 -17
- package/esm2022/lib/cli-qr.module.mjs +0 -19
- package/esm2022/lib/processors/cli-qr-command-processor.mjs +0 -86
- package/esm2022/lib/version.mjs +0 -3
- package/esm2022/public-api.mjs +0 -7
- package/esm2022/qodalis-cli-qr.mjs +0 -5
- package/fesm2022/qodalis-cli-qr.mjs +0 -115
- package/fesm2022/qodalis-cli-qr.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/cli-qr.module.d.ts +0 -6
- package/lib/processors/cli-qr-command-processor.d.ts +0 -15
- package/lib/version.d.ts +0 -1
- package/umd/index.js +0 -124
package/package.json
CHANGED
|
@@ -1,45 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qodalis/cli-qr",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.0.0-beta.10",
|
|
4
|
+
"description": "@qodalis/cli extension for generating and displaying QR codes.",
|
|
5
5
|
"author": "Nicolae Lupei, Qodalis Solutions",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/qodalis-solutions/
|
|
9
|
+
"url": "https://github.com/qodalis-solutions/web-cli"
|
|
10
10
|
},
|
|
11
11
|
"homepage": "https://qodalis.com",
|
|
12
12
|
"keywords": [
|
|
13
|
-
"angular",
|
|
14
13
|
"cli",
|
|
15
14
|
"qodalis",
|
|
16
15
|
"terminal",
|
|
17
|
-
"qr"
|
|
16
|
+
"qr",
|
|
17
|
+
"qr-code",
|
|
18
|
+
"barcode",
|
|
19
|
+
"generator"
|
|
18
20
|
],
|
|
19
|
-
"umd": "./umd/index.js",
|
|
20
|
-
"unpkg": "./umd/index.js",
|
|
21
|
-
"peerDependencies": {
|
|
22
|
-
"@angular/common": "^16.2.0",
|
|
23
|
-
"@angular/core": "^16.2.0"
|
|
24
|
-
},
|
|
21
|
+
"umd": "./umd/index.global.js",
|
|
22
|
+
"unpkg": "./umd/index.global.js",
|
|
25
23
|
"dependencies": {
|
|
26
|
-
"@qodalis/
|
|
27
|
-
"
|
|
28
|
-
"qr-code-styling": "^1.9.1",
|
|
29
|
-
"tslib": "^2.3.0"
|
|
24
|
+
"@qodalis/cli-core": "2.0.0-beta.10",
|
|
25
|
+
"qr-code-styling": "^1.9.1"
|
|
30
26
|
},
|
|
27
|
+
"cliDependencies": [
|
|
28
|
+
{
|
|
29
|
+
"name": "qr-code-styling",
|
|
30
|
+
"globalName": "QRCodeStyling",
|
|
31
|
+
"version": "1.9.1",
|
|
32
|
+
"url": "https://unpkg.com/qr-code-styling@1.9.1/lib/qr-code-styling.js"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
31
35
|
"sideEffects": false,
|
|
32
|
-
"
|
|
33
|
-
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "^22.13.11"
|
|
38
|
+
},
|
|
39
|
+
"main": "./public-api.js",
|
|
40
|
+
"module": "./public-api.mjs",
|
|
41
|
+
"types": "./public-api.d.ts",
|
|
34
42
|
"exports": {
|
|
35
|
-
"./package.json": {
|
|
36
|
-
"default": "./package.json"
|
|
37
|
-
},
|
|
38
43
|
".": {
|
|
39
|
-
"types": "./
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"default": "./fesm2022/qodalis-cli-qr.mjs"
|
|
44
|
+
"types": "./public-api.d.ts",
|
|
45
|
+
"import": "./public-api.mjs",
|
|
46
|
+
"require": "./public-api.js"
|
|
43
47
|
}
|
|
44
48
|
}
|
|
45
|
-
}
|
|
49
|
+
}
|
package/public-api.d.mts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as _qodalis_cli_core from '@qodalis/cli-core';
|
|
2
|
+
import { ICliCommandProcessor, CliProcessorMetadata, ICliConfigurationOption, CliProcessCommand, ICliExecutionContext, ICliModule } from '@qodalis/cli-core';
|
|
3
|
+
|
|
4
|
+
declare class CliQrCommandProcessor implements ICliCommandProcessor {
|
|
5
|
+
command: string;
|
|
6
|
+
description: string;
|
|
7
|
+
author: _qodalis_cli_core.ICliCommandAuthor;
|
|
8
|
+
version: string;
|
|
9
|
+
processors?: ICliCommandProcessor[] | undefined;
|
|
10
|
+
metadata?: CliProcessorMetadata | undefined;
|
|
11
|
+
configurationOptions?: ICliConfigurationOption[];
|
|
12
|
+
constructor();
|
|
13
|
+
processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
|
|
14
|
+
writeDescription(context: ICliExecutionContext): void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare const LIBRARY_VERSION = "2.0.0-beta.10";
|
|
18
|
+
declare const API_VERSION = 2;
|
|
19
|
+
|
|
20
|
+
declare const qrModule: ICliModule;
|
|
21
|
+
|
|
22
|
+
export { API_VERSION, CliQrCommandProcessor, LIBRARY_VERSION, qrModule };
|
package/public-api.d.ts
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as _qodalis_cli_core from '@qodalis/cli-core';
|
|
2
|
+
import { ICliCommandProcessor, CliProcessorMetadata, ICliConfigurationOption, CliProcessCommand, ICliExecutionContext, ICliModule } from '@qodalis/cli-core';
|
|
3
|
+
|
|
4
|
+
declare class CliQrCommandProcessor implements ICliCommandProcessor {
|
|
5
|
+
command: string;
|
|
6
|
+
description: string;
|
|
7
|
+
author: _qodalis_cli_core.ICliCommandAuthor;
|
|
8
|
+
version: string;
|
|
9
|
+
processors?: ICliCommandProcessor[] | undefined;
|
|
10
|
+
metadata?: CliProcessorMetadata | undefined;
|
|
11
|
+
configurationOptions?: ICliConfigurationOption[];
|
|
12
|
+
constructor();
|
|
13
|
+
processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
|
|
14
|
+
writeDescription(context: ICliExecutionContext): void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare const LIBRARY_VERSION = "2.0.0-beta.10";
|
|
18
|
+
declare const API_VERSION = 2;
|
|
19
|
+
|
|
20
|
+
declare const qrModule: ICliModule;
|
|
21
|
+
|
|
22
|
+
export { API_VERSION, CliQrCommandProcessor, LIBRARY_VERSION, qrModule };
|
package/public-api.js
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var cliCore = require('@qodalis/cli-core');
|
|
4
|
+
var QRCodeStyling = require('qr-code-styling');
|
|
5
|
+
|
|
6
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
|
|
8
|
+
var QRCodeStyling__default = /*#__PURE__*/_interopDefault(QRCodeStyling);
|
|
9
|
+
|
|
10
|
+
// src/lib/processors/cli-qr-command-processor.ts
|
|
11
|
+
|
|
12
|
+
// src/lib/version.ts
|
|
13
|
+
var LIBRARY_VERSION = "2.0.0-beta.10";
|
|
14
|
+
var API_VERSION = 2;
|
|
15
|
+
|
|
16
|
+
// src/lib/processors/cli-qr-command-processor.ts
|
|
17
|
+
var CliQrCommandProcessor = class {
|
|
18
|
+
constructor() {
|
|
19
|
+
this.command = "qr";
|
|
20
|
+
this.description = 'Provide utility functions to generate QR codes. Usage: qr generate --text "https://example.com" --fileName "my-qr"';
|
|
21
|
+
this.author = cliCore.DefaultLibraryAuthor;
|
|
22
|
+
this.version = LIBRARY_VERSION;
|
|
23
|
+
this.processors = [];
|
|
24
|
+
this.metadata = {
|
|
25
|
+
requiredCoreVersion: ">=2.0.0 <3.0.0",
|
|
26
|
+
requiredCliVersion: ">=2.0.0 <3.0.0"
|
|
27
|
+
};
|
|
28
|
+
this.configurationOptions = [
|
|
29
|
+
{
|
|
30
|
+
key: "defaultWidth",
|
|
31
|
+
label: "Default Width",
|
|
32
|
+
description: "Default QR code width in pixels",
|
|
33
|
+
type: "number",
|
|
34
|
+
defaultValue: 300,
|
|
35
|
+
validator: (v) => ({
|
|
36
|
+
valid: typeof v === "number" && v >= 50 && v <= 2e3,
|
|
37
|
+
message: "Must be between 50 and 2000"
|
|
38
|
+
})
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
key: "defaultHeight",
|
|
42
|
+
label: "Default Height",
|
|
43
|
+
description: "Default QR code height in pixels",
|
|
44
|
+
type: "number",
|
|
45
|
+
defaultValue: 300,
|
|
46
|
+
validator: (v) => ({
|
|
47
|
+
valid: typeof v === "number" && v >= 50 && v <= 2e3,
|
|
48
|
+
message: "Must be between 50 and 2000"
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
];
|
|
52
|
+
this.processors = [
|
|
53
|
+
{
|
|
54
|
+
command: "generate",
|
|
55
|
+
description: 'Generate a QR code and download it as PNG. Usage: qr generate --text "https://example.com"',
|
|
56
|
+
parameters: [
|
|
57
|
+
{
|
|
58
|
+
name: "text",
|
|
59
|
+
description: "Text or URL to encode as a QR code",
|
|
60
|
+
type: "string",
|
|
61
|
+
required: true
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "fileName",
|
|
65
|
+
description: "the file name",
|
|
66
|
+
type: "string",
|
|
67
|
+
required: false
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
processCommand: async (command, context) => {
|
|
71
|
+
const text = command.args["text"];
|
|
72
|
+
if (!text) {
|
|
73
|
+
context.writer.writeError(
|
|
74
|
+
"Missing required parameter: --text"
|
|
75
|
+
);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const fileName = command.args["fileName"] || "qr-code";
|
|
79
|
+
const width = command.args["width"] ?? cliCore.getPluginConfigValue(context, "qr", "defaultWidth", 300);
|
|
80
|
+
const height = command.args["height"] ?? cliCore.getPluginConfigValue(context, "qr", "defaultHeight", 300);
|
|
81
|
+
try {
|
|
82
|
+
const qrCode = new QRCodeStyling__default.default({
|
|
83
|
+
width,
|
|
84
|
+
height,
|
|
85
|
+
data: text,
|
|
86
|
+
type: "svg"
|
|
87
|
+
});
|
|
88
|
+
await qrCode.download({
|
|
89
|
+
name: fileName,
|
|
90
|
+
extension: "png"
|
|
91
|
+
});
|
|
92
|
+
context.writer.writeSuccess(
|
|
93
|
+
`QR Code for "${text}" downloaded as ${fileName}.png`
|
|
94
|
+
);
|
|
95
|
+
} catch (err) {
|
|
96
|
+
context.writer.writeError(
|
|
97
|
+
`Failed to generate QR code: ${err}`
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
];
|
|
103
|
+
}
|
|
104
|
+
async processCommand(command, context) {
|
|
105
|
+
context.executor.showHelp(command, context);
|
|
106
|
+
}
|
|
107
|
+
writeDescription(context) {
|
|
108
|
+
const { writer } = context;
|
|
109
|
+
writer.writeln(
|
|
110
|
+
"Generate QR codes from text or URLs and download as PNG"
|
|
111
|
+
);
|
|
112
|
+
writer.writeln();
|
|
113
|
+
writer.writeln("\u{1F4CB} Usage:");
|
|
114
|
+
writer.writeln(
|
|
115
|
+
` ${writer.wrapInColor('qr generate --text="<content>"', cliCore.CliForegroundColor.Cyan)}`
|
|
116
|
+
);
|
|
117
|
+
writer.writeln();
|
|
118
|
+
writer.writeln("\u2699\uFE0F Options:");
|
|
119
|
+
writer.writeln(
|
|
120
|
+
` ${writer.wrapInColor("--text", cliCore.CliForegroundColor.Yellow)} Text or URL to encode (required)`
|
|
121
|
+
);
|
|
122
|
+
writer.writeln(
|
|
123
|
+
` ${writer.wrapInColor("--fileName", cliCore.CliForegroundColor.Yellow)} Output filename (default: qr-code)`
|
|
124
|
+
);
|
|
125
|
+
writer.writeln();
|
|
126
|
+
writer.writeln("\u{1F4DD} Examples:");
|
|
127
|
+
writer.writeln(
|
|
128
|
+
` qr generate --text="https://example.com" ${writer.wrapInColor("# URL QR code", cliCore.CliForegroundColor.Green)}`
|
|
129
|
+
);
|
|
130
|
+
writer.writeln(
|
|
131
|
+
` qr generate --text="Hello!" --fileName="my-qr" ${writer.wrapInColor("# Custom filename", cliCore.CliForegroundColor.Green)}`
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// src/public-api.ts
|
|
137
|
+
var qrModule = {
|
|
138
|
+
apiVersion: API_VERSION,
|
|
139
|
+
name: "@qodalis/cli-qr",
|
|
140
|
+
processors: [new CliQrCommandProcessor()],
|
|
141
|
+
translations: {
|
|
142
|
+
es: { "cli.qr.description": "Generar c\xF3digos QR" },
|
|
143
|
+
fr: { "cli.qr.description": "G\xE9n\xE9rer des codes QR" },
|
|
144
|
+
de: { "cli.qr.description": "QR-Codes generieren" },
|
|
145
|
+
pt: { "cli.qr.description": "Gerar c\xF3digos QR" },
|
|
146
|
+
it: { "cli.qr.description": "Generare codici QR" },
|
|
147
|
+
ja: { "cli.qr.description": "QR\u30B3\u30FC\u30C9\u3092\u751F\u6210" },
|
|
148
|
+
ko: { "cli.qr.description": "QR \uCF54\uB4DC \uC0DD\uC131" },
|
|
149
|
+
zh: { "cli.qr.description": "\u751F\u6210\u4E8C\u7EF4\u7801" },
|
|
150
|
+
ru: { "cli.qr.description": "\u0413\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u044F QR-\u043A\u043E\u0434\u043E\u0432" },
|
|
151
|
+
ro: { "cli.qr.description": "Generare coduri QR" }
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
exports.API_VERSION = API_VERSION;
|
|
156
|
+
exports.CliQrCommandProcessor = CliQrCommandProcessor;
|
|
157
|
+
exports.LIBRARY_VERSION = LIBRARY_VERSION;
|
|
158
|
+
exports.qrModule = qrModule;
|
|
159
|
+
//# sourceMappingURL=public-api.js.map
|
|
160
|
+
//# sourceMappingURL=public-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../packages/plugins/qr/src/lib/version.ts","../../packages/plugins/qr/src/lib/processors/cli-qr-command-processor.ts","../../packages/plugins/qr/src/public-api.ts"],"names":["DefaultLibraryAuthor","getPluginConfigValue","QRCodeStyling","CliForegroundColor"],"mappings":";;;;;;;;;;;;AAEO,IAAM,eAAA,GAAkB;AACxB,IAAM,WAAA,GAAc;;;ACUpB,IAAM,wBAAN,MAA4D;AAAA,EA0C/D,WAAA,GAAc;AAzCd,IAAA,IAAA,CAAA,OAAA,GAAU,IAAA;AAEV,IAAA,IAAA,CAAA,WAAA,GACI,oHAAA;AAEJ,IAAA,IAAA,CAAA,MAAA,GAASA,4BAAA;AAET,IAAA,IAAA,CAAA,OAAA,GAAU,eAAA;AAEV,IAAA,IAAA,CAAA,UAAA,GAAkD,EAAC;AAEnD,IAAA,IAAA,CAAA,QAAA,GAA8C;AAAA,MAC1C,mBAAA,EAAqB,gBAAA;AAAA,MACrB,kBAAA,EAAoB;AAAA,KACxB;AAEA,IAAA,IAAA,CAAA,oBAAA,GAAmD;AAAA,MAC/C;AAAA,QACI,GAAA,EAAK,cAAA;AAAA,QACL,KAAA,EAAO,eAAA;AAAA,QACP,WAAA,EAAa,iCAAA;AAAA,QACb,IAAA,EAAM,QAAA;AAAA,QACN,YAAA,EAAc,GAAA;AAAA,QACd,SAAA,EAAW,CAAC,CAAA,MAAO;AAAA,UACf,OAAO,OAAO,CAAA,KAAM,QAAA,IAAY,CAAA,IAAK,MAAM,CAAA,IAAK,GAAA;AAAA,UAChD,OAAA,EAAS;AAAA,SACb;AAAA,OACJ;AAAA,MACA;AAAA,QACI,GAAA,EAAK,eAAA;AAAA,QACL,KAAA,EAAO,gBAAA;AAAA,QACP,WAAA,EAAa,kCAAA;AAAA,QACb,IAAA,EAAM,QAAA;AAAA,QACN,YAAA,EAAc,GAAA;AAAA,QACd,SAAA,EAAW,CAAC,CAAA,MAAO;AAA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VERSION = '2.0.0-beta.10';\nexport const API_VERSION = 2;\n ","import {\n CliForegroundColor,\n CliProcessCommand,\n CliProcessorMetadata,\n DefaultLibraryAuthor,\n ICliCommandProcessor,\n ICliConfigurationOption,\n ICliExecutionContext,\n getPluginConfigValue,\n} from '@qodalis/cli-core';\nimport QRCodeStyling from 'qr-code-styling';\nimport { LIBRARY_VERSION } from '../version';\n\nexport class CliQrCommandProcessor implements ICliCommandProcessor {\n command = 'qr';\n\n description =\n 'Provide utility functions to generate QR codes. Usage: qr generate --text \"https://example.com\" --fileName \"my-qr\"';\n\n author = DefaultLibraryAuthor;\n\n version = LIBRARY_VERSION;\n\n processors?: ICliCommandProcessor[] | undefined = [];\n\n metadata?: CliProcessorMetadata | undefined = {\n requiredCoreVersion: '>=2.0.0 <3.0.0',\n requiredCliVersion: '>=2.0.0 <3.0.0',\n };\n\n configurationOptions?: ICliConfigurationOption[] = [\n {\n key: 'defaultWidth',\n label: 'Default Width',\n description: 'Default QR code width in pixels',\n type: 'number',\n defaultValue: 300,\n validator: (v) => ({\n valid: typeof v === 'number' && v >= 50 && v <= 2000,\n message: 'Must be between 50 and 2000',\n }),\n },\n {\n key: 'defaultHeight',\n label: 'Default Height',\n description: 'Default QR code height in pixels',\n type: 'number',\n defaultValue: 300,\n validator: (v) => ({\n valid: typeof v === 'number' && v >= 50 && v <= 2000,\n message: 'Must be between 50 and 2000',\n }),\n },\n ];\n\n constructor() {\n this.processors = [\n {\n command: 'generate',\n description:\n 'Generate a QR code and download it as PNG. Usage: qr generate --text \"https://example.com\"',\n parameters: [\n {\n name: 'text',\n description: 'Text or URL to encode as a QR code',\n type: 'string',\n required: true,\n },\n {\n name: 'fileName',\n description: 'the file name',\n type: 'string',\n required: false,\n },\n ],\n processCommand: async (command, context) => {\n const text = command.args['text'];\n\n if (!text) {\n context.writer.writeError(\n 'Missing required parameter: --text',\n );\n return;\n }\n\n const fileName = command.args['fileName'] || 'qr-code';\n const width = command.args['width'] ?? getPluginConfigValue(context, 'qr', 'defaultWidth', 300);\n const height = command.args['height'] ?? getPluginConfigValue(context, 'qr', 'defaultHeight', 300);\n\n try {\n const qrCode = new QRCodeStyling({\n width,\n height,\n data: text,\n type: 'svg',\n });\n\n await qrCode.download({\n name: fileName,\n extension: 'png',\n });\n\n context.writer.writeSuccess(\n `QR Code for \"${text}\" downloaded as ${fileName}.png`,\n );\n } catch (err) {\n context.writer.writeError(\n `Failed to generate QR code: ${err}`,\n );\n }\n },\n },\n ];\n }\n\n async processCommand(\n command: CliProcessCommand,\n context: ICliExecutionContext,\n ): Promise<void> {\n context.executor.showHelp(command, context);\n }\n\n writeDescription(context: ICliExecutionContext): void {\n const { writer } = context;\n writer.writeln(\n 'Generate QR codes from text or URLs and download as PNG',\n );\n writer.writeln();\n writer.writeln('📋 Usage:');\n writer.writeln(\n ` ${writer.wrapInColor('qr generate --text=\"<content>\"', CliForegroundColor.Cyan)}`,\n );\n writer.writeln();\n writer.writeln('⚙️ Options:');\n writer.writeln(\n ` ${writer.wrapInColor('--text', CliForegroundColor.Yellow)} Text or URL to encode (required)`,\n );\n writer.writeln(\n ` ${writer.wrapInColor('--fileName', CliForegroundColor.Yellow)} Output filename (default: qr-code)`,\n );\n writer.writeln();\n writer.writeln('📝 Examples:');\n writer.writeln(\n ` qr generate --text=\"https://example.com\" ${writer.wrapInColor('# URL QR code', CliForegroundColor.Green)}`,\n );\n writer.writeln(\n ` qr generate --text=\"Hello!\" --fileName=\"my-qr\" ${writer.wrapInColor('# Custom filename', CliForegroundColor.Green)}`,\n );\n }\n}\n","/*\n * Public API Surface of qr\n */\n\nexport * from './lib/processors/cli-qr-command-processor';\n\nexport * from './lib/version';\n\nimport { ICliModule } from '@qodalis/cli-core';\nimport { CliQrCommandProcessor } from './lib/processors/cli-qr-command-processor';\nimport { API_VERSION } from './lib/version';\n\nexport const qrModule: ICliModule = {\n apiVersion: API_VERSION,\n name: '@qodalis/cli-qr',\n processors: [new CliQrCommandProcessor()],\n translations: {\n es: { 'cli.qr.description': 'Generar códigos QR' },\n fr: { 'cli.qr.description': 'Générer des codes QR' },\n de: { 'cli.qr.description': 'QR-Codes generieren' },\n pt: { 'cli.qr.description': 'Gerar códigos QR' },\n it: { 'cli.qr.description': 'Generare codici QR' },\n ja: { 'cli.qr.description': 'QRコードを生成' },\n ko: { 'cli.qr.description': 'QR 코드 생성' },\n zh: { 'cli.qr.description': '生成二维码' },\n ru: { 'cli.qr.description': 'Генерация QR-кодов' },\n ro: { 'cli.qr.description': 'Generare coduri QR' },\n },\n};\n"]}
|
package/public-api.mjs
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { DefaultLibraryAuthor, getPluginConfigValue, CliForegroundColor } from '@qodalis/cli-core';
|
|
2
|
+
import QRCodeStyling from 'qr-code-styling';
|
|
3
|
+
|
|
4
|
+
// src/lib/processors/cli-qr-command-processor.ts
|
|
5
|
+
|
|
6
|
+
// src/lib/version.ts
|
|
7
|
+
var LIBRARY_VERSION = "2.0.0-beta.10";
|
|
8
|
+
var API_VERSION = 2;
|
|
9
|
+
|
|
10
|
+
// src/lib/processors/cli-qr-command-processor.ts
|
|
11
|
+
var CliQrCommandProcessor = class {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.command = "qr";
|
|
14
|
+
this.description = 'Provide utility functions to generate QR codes. Usage: qr generate --text "https://example.com" --fileName "my-qr"';
|
|
15
|
+
this.author = DefaultLibraryAuthor;
|
|
16
|
+
this.version = LIBRARY_VERSION;
|
|
17
|
+
this.processors = [];
|
|
18
|
+
this.metadata = {
|
|
19
|
+
requiredCoreVersion: ">=2.0.0 <3.0.0",
|
|
20
|
+
requiredCliVersion: ">=2.0.0 <3.0.0"
|
|
21
|
+
};
|
|
22
|
+
this.configurationOptions = [
|
|
23
|
+
{
|
|
24
|
+
key: "defaultWidth",
|
|
25
|
+
label: "Default Width",
|
|
26
|
+
description: "Default QR code width in pixels",
|
|
27
|
+
type: "number",
|
|
28
|
+
defaultValue: 300,
|
|
29
|
+
validator: (v) => ({
|
|
30
|
+
valid: typeof v === "number" && v >= 50 && v <= 2e3,
|
|
31
|
+
message: "Must be between 50 and 2000"
|
|
32
|
+
})
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
key: "defaultHeight",
|
|
36
|
+
label: "Default Height",
|
|
37
|
+
description: "Default QR code height in pixels",
|
|
38
|
+
type: "number",
|
|
39
|
+
defaultValue: 300,
|
|
40
|
+
validator: (v) => ({
|
|
41
|
+
valid: typeof v === "number" && v >= 50 && v <= 2e3,
|
|
42
|
+
message: "Must be between 50 and 2000"
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
];
|
|
46
|
+
this.processors = [
|
|
47
|
+
{
|
|
48
|
+
command: "generate",
|
|
49
|
+
description: 'Generate a QR code and download it as PNG. Usage: qr generate --text "https://example.com"',
|
|
50
|
+
parameters: [
|
|
51
|
+
{
|
|
52
|
+
name: "text",
|
|
53
|
+
description: "Text or URL to encode as a QR code",
|
|
54
|
+
type: "string",
|
|
55
|
+
required: true
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "fileName",
|
|
59
|
+
description: "the file name",
|
|
60
|
+
type: "string",
|
|
61
|
+
required: false
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
processCommand: async (command, context) => {
|
|
65
|
+
const text = command.args["text"];
|
|
66
|
+
if (!text) {
|
|
67
|
+
context.writer.writeError(
|
|
68
|
+
"Missing required parameter: --text"
|
|
69
|
+
);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const fileName = command.args["fileName"] || "qr-code";
|
|
73
|
+
const width = command.args["width"] ?? getPluginConfigValue(context, "qr", "defaultWidth", 300);
|
|
74
|
+
const height = command.args["height"] ?? getPluginConfigValue(context, "qr", "defaultHeight", 300);
|
|
75
|
+
try {
|
|
76
|
+
const qrCode = new QRCodeStyling({
|
|
77
|
+
width,
|
|
78
|
+
height,
|
|
79
|
+
data: text,
|
|
80
|
+
type: "svg"
|
|
81
|
+
});
|
|
82
|
+
await qrCode.download({
|
|
83
|
+
name: fileName,
|
|
84
|
+
extension: "png"
|
|
85
|
+
});
|
|
86
|
+
context.writer.writeSuccess(
|
|
87
|
+
`QR Code for "${text}" downloaded as ${fileName}.png`
|
|
88
|
+
);
|
|
89
|
+
} catch (err) {
|
|
90
|
+
context.writer.writeError(
|
|
91
|
+
`Failed to generate QR code: ${err}`
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
];
|
|
97
|
+
}
|
|
98
|
+
async processCommand(command, context) {
|
|
99
|
+
context.executor.showHelp(command, context);
|
|
100
|
+
}
|
|
101
|
+
writeDescription(context) {
|
|
102
|
+
const { writer } = context;
|
|
103
|
+
writer.writeln(
|
|
104
|
+
"Generate QR codes from text or URLs and download as PNG"
|
|
105
|
+
);
|
|
106
|
+
writer.writeln();
|
|
107
|
+
writer.writeln("\u{1F4CB} Usage:");
|
|
108
|
+
writer.writeln(
|
|
109
|
+
` ${writer.wrapInColor('qr generate --text="<content>"', CliForegroundColor.Cyan)}`
|
|
110
|
+
);
|
|
111
|
+
writer.writeln();
|
|
112
|
+
writer.writeln("\u2699\uFE0F Options:");
|
|
113
|
+
writer.writeln(
|
|
114
|
+
` ${writer.wrapInColor("--text", CliForegroundColor.Yellow)} Text or URL to encode (required)`
|
|
115
|
+
);
|
|
116
|
+
writer.writeln(
|
|
117
|
+
` ${writer.wrapInColor("--fileName", CliForegroundColor.Yellow)} Output filename (default: qr-code)`
|
|
118
|
+
);
|
|
119
|
+
writer.writeln();
|
|
120
|
+
writer.writeln("\u{1F4DD} Examples:");
|
|
121
|
+
writer.writeln(
|
|
122
|
+
` qr generate --text="https://example.com" ${writer.wrapInColor("# URL QR code", CliForegroundColor.Green)}`
|
|
123
|
+
);
|
|
124
|
+
writer.writeln(
|
|
125
|
+
` qr generate --text="Hello!" --fileName="my-qr" ${writer.wrapInColor("# Custom filename", CliForegroundColor.Green)}`
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// src/public-api.ts
|
|
131
|
+
var qrModule = {
|
|
132
|
+
apiVersion: API_VERSION,
|
|
133
|
+
name: "@qodalis/cli-qr",
|
|
134
|
+
processors: [new CliQrCommandProcessor()],
|
|
135
|
+
translations: {
|
|
136
|
+
es: { "cli.qr.description": "Generar c\xF3digos QR" },
|
|
137
|
+
fr: { "cli.qr.description": "G\xE9n\xE9rer des codes QR" },
|
|
138
|
+
de: { "cli.qr.description": "QR-Codes generieren" },
|
|
139
|
+
pt: { "cli.qr.description": "Gerar c\xF3digos QR" },
|
|
140
|
+
it: { "cli.qr.description": "Generare codici QR" },
|
|
141
|
+
ja: { "cli.qr.description": "QR\u30B3\u30FC\u30C9\u3092\u751F\u6210" },
|
|
142
|
+
ko: { "cli.qr.description": "QR \uCF54\uB4DC \uC0DD\uC131" },
|
|
143
|
+
zh: { "cli.qr.description": "\u751F\u6210\u4E8C\u7EF4\u7801" },
|
|
144
|
+
ru: { "cli.qr.description": "\u0413\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u044F QR-\u043A\u043E\u0434\u043E\u0432" },
|
|
145
|
+
ro: { "cli.qr.description": "Generare coduri QR" }
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export { API_VERSION, CliQrCommandProcessor, LIBRARY_VERSION, qrModule };
|
|
150
|
+
//# sourceMappingURL=public-api.mjs.map
|
|
151
|
+
//# sourceMappingURL=public-api.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../packages/plugins/qr/src/lib/version.ts","../../packages/plugins/qr/src/lib/processors/cli-qr-command-processor.ts","../../packages/plugins/qr/src/public-api.ts"],"names":[],"mappings":";;;;;;AAEO,IAAM,eAAA,GAAkB;AACxB,IAAM,WAAA,GAAc;;;ACUpB,IAAM,wBAAN,MAA4D;AAAA,EA0C/D,WAAA,GAAc;AAzCd,IAAA,IAAA,CAAA,OAA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K,CAAC,CAAA;AAAA,KAClI;AAAA,EACJ;AACJ;;;ACzIO,IAAM,QAAA,GAAuB;AAAA,EAChC,UAAA,EAAY,WAAA;AAAA,EACZ,IAAA,EAAM,iBAAA;AAAA,EACN,UAAA,EAAY,CAAC,IAAI,qBAAA,EAAuB,CAAA;AAAA,EACxC,YAAA,EAAc;AAAA,IACV,EAAA,EAAI,EAAE,oBAAA,EAAsB,uBAAA,EAAqB;AAAA,IACjD,EAAA,EAAI,EAAE,oBAAA,EAAsB,4BAAA,EAAuB;AAAA,IACnD,EAAA,EAAI,EAAE,oBAAA,EAAsB,qBAAA,EAAsB;AAAA,IAClD,EAAA,EAAI,EAAE,oBAAA,EAAsB,qBAAA,EAAmB;AAAA,IAC/C,EAAA,EAAI,EAAE,oBAAA,EAAsB,oBAAA,EAAqB;AAAA,IACjD,EAAA,EAAI,EAAE,oBAAA,EAAsB,wCAAA,EAAW;AAAA,IACvC,EAAA,EAAI,EAAE,oBAAA,EAAsB,8BAAA,EAAW;AAAA,IACvC,EAAA,EAAI,EAAE,oBAAA,EAAsB,gCAAA,EAAQ;AAAA,IACpC,EAAA,EAAI,EAAE,oBAAA,EAAsB,0FAAA,EAAqB;AAAA,IACjD,EAAA,EAAI,EAAE,oBAAA,EAAsB,oBAAA;AAAqB;AAEzD","file":"public-api.mjs","sourcesContent":["\n// Automatically generated during build\nexport const LIBRARY_VERSION = '2.0.0-beta.10';\nexport const API_VERSION = 2;\n ","import {\n CliForegroundColor,\n CliProcessCommand,\n CliProcessorMetadata,\n DefaultLibraryAuthor,\n ICliCommandProcessor,\n ICliConfigurationOption,\n ICliExecutionContext,\n getPluginConfigValue,\n} from '@qodalis/cli-core';\nimport QRCodeStyling from 'qr-code-styling';\nimport { LIBRARY_VERSION } from '../version';\n\nexport class CliQrCommandProcessor implements ICliCommandProcessor {\n command = 'qr';\n\n description =\n 'Provide utility functions to generate QR codes. Usage: qr generate --text \"https://example.com\" --fileName \"my-qr\"';\n\n author = DefaultLibraryAuthor;\n\n version = LIBRARY_VERSION;\n\n processors?: ICliCommandProcessor[] | undefined = [];\n\n metadata?: CliProcessorMetadata | undefined = {\n requiredCoreVersion: '>=2.0.0 <3.0.0',\n requiredCliVersion: '>=2.0.0 <3.0.0',\n };\n\n configurationOptions?: ICliConfigurationOption[] = [\n {\n key: 'defaultWidth',\n label: 'Default Width',\n description: 'Default QR code width in pixels',\n type: 'number',\n defaultValue: 300,\n validator: (v) => ({\n valid: typeof v === 'number' && v >= 50 && v <= 2000,\n message: 'Must be between 50 and 2000',\n }),\n },\n {\n key: 'defaultHeight',\n label: 'Default Height',\n description: 'Default QR code height in pixels',\n type: 'number',\n defaultValue: 300,\n validator: (v) => ({\n valid: typeof v === 'number' && v >= 50 && v <= 2000,\n message: 'Must be between 50 and 2000',\n }),\n },\n ];\n\n constructor() {\n this.processors = [\n {\n command: 'generate',\n description:\n 'Generate a QR code and download it as PNG. Usage: qr generate --text \"https://example.com\"',\n parameters: [\n {\n name: 'text',\n description: 'Text or URL to encode as a QR code',\n type: 'string',\n required: true,\n },\n {\n name: 'fileName',\n description: 'the file name',\n type: 'string',\n required: false,\n },\n ],\n processCommand: async (command, context) => {\n const text = command.args['text'];\n\n if (!text) {\n context.writer.writeError(\n 'Missing required parameter: --text',\n );\n return;\n }\n\n const fileName = command.args['fileName'] || 'qr-code';\n const width = command.args['width'] ?? getPluginConfigValue(context, 'qr', 'defaultWidth', 300);\n const height = command.args['height'] ?? getPluginConfigValue(context, 'qr', 'defaultHeight', 300);\n\n try {\n const qrCode = new QRCodeStyling({\n width,\n height,\n data: text,\n type: 'svg',\n });\n\n await qrCode.download({\n name: fileName,\n extension: 'png',\n });\n\n context.writer.writeSuccess(\n `QR Code for \"${text}\" downloaded as ${fileName}.png`,\n );\n } catch (err) {\n context.writer.writeError(\n `Failed to generate QR code: ${err}`,\n );\n }\n },\n },\n ];\n }\n\n async processCommand(\n command: CliProcessCommand,\n context: ICliExecutionContext,\n ): Promise<void> {\n context.executor.showHelp(command, context);\n }\n\n writeDescription(context: ICliExecutionContext): void {\n const { writer } = context;\n writer.writeln(\n 'Generate QR codes from text or URLs and download as PNG',\n );\n writer.writeln();\n writer.writeln('📋 Usage:');\n writer.writeln(\n ` ${writer.wrapInColor('qr generate --text=\"<content>\"', CliForegroundColor.Cyan)}`,\n );\n writer.writeln();\n writer.writeln('⚙️ Options:');\n writer.writeln(\n ` ${writer.wrapInColor('--text', CliForegroundColor.Yellow)} Text or URL to encode (required)`,\n );\n writer.writeln(\n ` ${writer.wrapInColor('--fileName', CliForegroundColor.Yellow)} Output filename (default: qr-code)`,\n );\n writer.writeln();\n writer.writeln('📝 Examples:');\n writer.writeln(\n ` qr generate --text=\"https://example.com\" ${writer.wrapInColor('# URL QR code', CliForegroundColor.Green)}`,\n );\n writer.writeln(\n ` qr generate --text=\"Hello!\" --fileName=\"my-qr\" ${writer.wrapInColor('# Custom filename', CliForegroundColor.Green)}`,\n );\n }\n}\n","/*\n * Public API Surface of qr\n */\n\nexport * from './lib/processors/cli-qr-command-processor';\n\nexport * from './lib/version';\n\nimport { ICliModule } from '@qodalis/cli-core';\nimport { CliQrCommandProcessor } from './lib/processors/cli-qr-command-processor';\nimport { API_VERSION } from './lib/version';\n\nexport const qrModule: ICliModule = {\n apiVersion: API_VERSION,\n name: '@qodalis/cli-qr',\n processors: [new CliQrCommandProcessor()],\n translations: {\n es: { 'cli.qr.description': 'Generar códigos QR' },\n fr: { 'cli.qr.description': 'Générer des codes QR' },\n de: { 'cli.qr.description': 'QR-Codes generieren' },\n pt: { 'cli.qr.description': 'Gerar códigos QR' },\n it: { 'cli.qr.description': 'Generare codici QR' },\n ja: { 'cli.qr.description': 'QRコードを生成' },\n ko: { 'cli.qr.description': 'QR 코드 생성' },\n zh: { 'cli.qr.description': '生成二维码' },\n ru: { 'cli.qr.description': 'Генерация QR-кодов' },\n ro: { 'cli.qr.description': 'Generare coduri QR' },\n },\n};\n"]}
|