@pixid/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/dist/cli.js +29 -0
- package/dist/index.cjs +28 -0
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +28 -0
- package/package.json +61 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 thilllon
|
|
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/dist/cli.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{randomUUID as h}from"crypto";import{writeFileSync as b}from"fs";import{resolve as v}from"path";import{parseArgs as y}from"util";import{toPng as x}from"@pixid/png";import{toSvg as _}from"@pixid/svg";var w="0.1.0",$=`pixid - blocky identicon generator
|
|
3
|
+
|
|
4
|
+
Usage:
|
|
5
|
+
pixid [seed] [options]
|
|
6
|
+
|
|
7
|
+
Options:
|
|
8
|
+
-s, --seed <seed> seed string (same as the positional argument)
|
|
9
|
+
-o, --out <file> output path (default: <seed>.<format>)
|
|
10
|
+
-f, --format <format> png or svg (default: inferred from --out, else png)
|
|
11
|
+
--size <n> cells per side (default: 8)
|
|
12
|
+
--scale <n> pixels per cell (default: 16)
|
|
13
|
+
--color <color> foreground color, #rgb or #rrggbb
|
|
14
|
+
--bgcolor <color> background color, #rgb or #rrggbb
|
|
15
|
+
--spotcolor <color> accent color, #rgb or #rrggbb
|
|
16
|
+
-h, --help show this message
|
|
17
|
+
-v, --version show the version
|
|
18
|
+
|
|
19
|
+
Examples:
|
|
20
|
+
npx pixid
|
|
21
|
+
npx pixid 0x8ba1f109551bd432803012645ac136ddd64dba72
|
|
22
|
+
npx pixid --seed alice --out alice.svg --scale 32
|
|
23
|
+
npx pixid --format svg --bgcolor "#ffffff"
|
|
24
|
+
`,t=s=>{process.stderr.write(`pixid: ${s}
|
|
25
|
+
|
|
26
|
+
Run "pixid --help" for usage.
|
|
27
|
+
`),process.exit(1)},l=(s,n)=>{let e=Number(n);return!Number.isInteger(e)||e<1?t(`--${s} must be a positive integer, got ${JSON.stringify(n)}`):e},d=(s=process.argv.slice(2))=>{let n;try{n=y({args:s,allowPositionals:!0,options:{seed:{type:"string",short:"s"},out:{type:"string",short:"o"},format:{type:"string",short:"f"},size:{type:"string"},scale:{type:"string"},color:{type:"string"},bgcolor:{type:"string"},spotcolor:{type:"string"},help:{type:"boolean",short:"h"},version:{type:"boolean",short:"v"}}})}catch(r){return t(r instanceof Error?r.message:String(r))}let{values:e,positionals:g}=n;if(e.help){process.stdout.write($);return}if(e.version){process.stdout.write(`${w}
|
|
28
|
+
`);return}if(g.length>1)return t(`expected at most one positional argument, got ${g.length}`);if(e.seed!==void 0&&g.length>0)return t("pass the seed either as a positional argument or with --seed, not both");let p=e.seed??g[0]??h(),o=e.format;if(o===void 0&&e.out!==void 0&&(o=e.out.toLowerCase().endsWith(".svg")?"svg":"png"),o??="png",o!=="png"&&o!=="svg")return t(`--format must be "png" or "svg", got ${JSON.stringify(o)}`);let f=e.out??`${p.replace(/[^a-zA-Z0-9._-]/g,"_")}.${o}`,u=e.size===void 0?void 0:l("size",e.size),m=e.scale===void 0?16:l("scale",e.scale),a={seed:p,size:u,scale:m,color:e.color,bgcolor:e.bgcolor,spotcolor:e.spotcolor},i;try{i=o==="png"?x(a):_(a)}catch(r){return t(r instanceof Error?r.message:String(r))}let c=v(process.cwd(),f);b(c,i),process.stdout.write(`${c} (${typeof i=="string"?i.length:i.byteLength} bytes)
|
|
29
|
+
`)};d();
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";var a=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var P=(r,o)=>{for(var e in o)a(r,e,{get:o[e],enumerable:!0})},E=(r,o,e,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of S(o))!z.call(r,t)&&t!==e&&a(r,t,{get:()=>o[t],enumerable:!(n=$(o,t))||n.enumerable});return r};var N=r=>E(a({},"__esModule",{value:!0}),r);var U={};P(U,{runCli:()=>O,version:()=>y});module.exports=N(U);var f=require("crypto"),u=require("fs"),m=require("path"),h=require("util"),b=require("@pixid/png"),v=require("@pixid/svg"),y="0.1.0",I=`pixid - blocky identicon generator
|
|
2
|
+
|
|
3
|
+
Usage:
|
|
4
|
+
pixid [seed] [options]
|
|
5
|
+
|
|
6
|
+
Options:
|
|
7
|
+
-s, --seed <seed> seed string (same as the positional argument)
|
|
8
|
+
-o, --out <file> output path (default: <seed>.<format>)
|
|
9
|
+
-f, --format <format> png or svg (default: inferred from --out, else png)
|
|
10
|
+
--size <n> cells per side (default: 8)
|
|
11
|
+
--scale <n> pixels per cell (default: 16)
|
|
12
|
+
--color <color> foreground color, #rgb or #rrggbb
|
|
13
|
+
--bgcolor <color> background color, #rgb or #rrggbb
|
|
14
|
+
--spotcolor <color> accent color, #rgb or #rrggbb
|
|
15
|
+
-h, --help show this message
|
|
16
|
+
-v, --version show the version
|
|
17
|
+
|
|
18
|
+
Examples:
|
|
19
|
+
npx pixid
|
|
20
|
+
npx pixid 0x8ba1f109551bd432803012645ac136ddd64dba72
|
|
21
|
+
npx pixid --seed alice --out alice.svg --scale 32
|
|
22
|
+
npx pixid --format svg --bgcolor "#ffffff"
|
|
23
|
+
`,g=r=>{process.stderr.write(`pixid: ${r}
|
|
24
|
+
|
|
25
|
+
Run "pixid --help" for usage.
|
|
26
|
+
`),process.exit(1)},d=(r,o)=>{let e=Number(o);return!Number.isInteger(e)||e<1?g(`--${r} must be a positive integer, got ${JSON.stringify(o)}`):e},O=(r=process.argv.slice(2))=>{let o;try{o=(0,h.parseArgs)({args:r,allowPositionals:!0,options:{seed:{type:"string",short:"s"},out:{type:"string",short:"o"},format:{type:"string",short:"f"},size:{type:"string"},scale:{type:"string"},color:{type:"string"},bgcolor:{type:"string"},spotcolor:{type:"string"},help:{type:"boolean",short:"h"},version:{type:"boolean",short:"v"}}})}catch(i){return g(i instanceof Error?i.message:String(i))}let{values:e,positionals:n}=o;if(e.help){process.stdout.write(I);return}if(e.version){process.stdout.write(`${y}
|
|
27
|
+
`);return}if(n.length>1)return g(`expected at most one positional argument, got ${n.length}`);if(e.seed!==void 0&&n.length>0)return g("pass the seed either as a positional argument or with --seed, not both");let t=e.seed??n[0]??(0,f.randomUUID)(),s=e.format;if(s===void 0&&e.out!==void 0&&(s=e.out.toLowerCase().endsWith(".svg")?"svg":"png"),s??="png",s!=="png"&&s!=="svg")return g(`--format must be "png" or "svg", got ${JSON.stringify(s)}`);let x=e.out??`${t.replace(/[^a-zA-Z0-9._-]/g,"_")}.${s}`,_=e.size===void 0?void 0:d("size",e.size),w=e.scale===void 0?16:d("scale",e.scale),c={seed:t,size:_,scale:w,color:e.color,bgcolor:e.bgcolor,spotcolor:e.spotcolor},p;try{p=s==="png"?(0,b.toPng)(c):(0,v.toSvg)(c)}catch(i){return g(i instanceof Error?i.message:String(i))}let l=(0,m.resolve)(process.cwd(),x);(0,u.writeFileSync)(l,p),process.stdout.write(`${l} (${typeof p=="string"?p.length:p.byteLength} bytes)
|
|
28
|
+
`)};0&&(module.exports={runCli,version});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Version of `@pixid/cli`, baked in at build time. */
|
|
2
|
+
declare const version: string;
|
|
3
|
+
/**
|
|
4
|
+
* Runs the `pixid` command-line interface.
|
|
5
|
+
*
|
|
6
|
+
* Writes the generated file to disk and reports the path on stdout. Invalid
|
|
7
|
+
* input is reported on stderr and terminates the process with exit code 1,
|
|
8
|
+
* so this is only meant for use as a program entry point.
|
|
9
|
+
*
|
|
10
|
+
* @param argv Arguments after the executable and script name.
|
|
11
|
+
* Defaults to `process.argv.slice(2)`.
|
|
12
|
+
*/
|
|
13
|
+
declare const runCli: (argv?: string[]) => void;
|
|
14
|
+
|
|
15
|
+
export { runCli, version };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Version of `@pixid/cli`, baked in at build time. */
|
|
2
|
+
declare const version: string;
|
|
3
|
+
/**
|
|
4
|
+
* Runs the `pixid` command-line interface.
|
|
5
|
+
*
|
|
6
|
+
* Writes the generated file to disk and reports the path on stdout. Invalid
|
|
7
|
+
* input is reported on stderr and terminates the process with exit code 1,
|
|
8
|
+
* so this is only meant for use as a program entry point.
|
|
9
|
+
*
|
|
10
|
+
* @param argv Arguments after the executable and script name.
|
|
11
|
+
* Defaults to `process.argv.slice(2)`.
|
|
12
|
+
*/
|
|
13
|
+
declare const runCli: (argv?: string[]) => void;
|
|
14
|
+
|
|
15
|
+
export { runCli, version };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import{randomUUID as m}from"crypto";import{writeFileSync as h}from"fs";import{resolve as b}from"path";import{parseArgs as v}from"util";import{toPng as y}from"@pixid/png";import{toSvg as x}from"@pixid/svg";var _="0.1.0",w=`pixid - blocky identicon generator
|
|
2
|
+
|
|
3
|
+
Usage:
|
|
4
|
+
pixid [seed] [options]
|
|
5
|
+
|
|
6
|
+
Options:
|
|
7
|
+
-s, --seed <seed> seed string (same as the positional argument)
|
|
8
|
+
-o, --out <file> output path (default: <seed>.<format>)
|
|
9
|
+
-f, --format <format> png or svg (default: inferred from --out, else png)
|
|
10
|
+
--size <n> cells per side (default: 8)
|
|
11
|
+
--scale <n> pixels per cell (default: 16)
|
|
12
|
+
--color <color> foreground color, #rgb or #rrggbb
|
|
13
|
+
--bgcolor <color> background color, #rgb or #rrggbb
|
|
14
|
+
--spotcolor <color> accent color, #rgb or #rrggbb
|
|
15
|
+
-h, --help show this message
|
|
16
|
+
-v, --version show the version
|
|
17
|
+
|
|
18
|
+
Examples:
|
|
19
|
+
npx pixid
|
|
20
|
+
npx pixid 0x8ba1f109551bd432803012645ac136ddd64dba72
|
|
21
|
+
npx pixid --seed alice --out alice.svg --scale 32
|
|
22
|
+
npx pixid --format svg --bgcolor "#ffffff"
|
|
23
|
+
`,t=s=>{process.stderr.write(`pixid: ${s}
|
|
24
|
+
|
|
25
|
+
Run "pixid --help" for usage.
|
|
26
|
+
`),process.exit(1)},l=(s,n)=>{let e=Number(n);return!Number.isInteger(e)||e<1?t(`--${s} must be a positive integer, got ${JSON.stringify(n)}`):e},I=(s=process.argv.slice(2))=>{let n;try{n=v({args:s,allowPositionals:!0,options:{seed:{type:"string",short:"s"},out:{type:"string",short:"o"},format:{type:"string",short:"f"},size:{type:"string"},scale:{type:"string"},color:{type:"string"},bgcolor:{type:"string"},spotcolor:{type:"string"},help:{type:"boolean",short:"h"},version:{type:"boolean",short:"v"}}})}catch(r){return t(r instanceof Error?r.message:String(r))}let{values:e,positionals:g}=n;if(e.help){process.stdout.write(w);return}if(e.version){process.stdout.write(`${_}
|
|
27
|
+
`);return}if(g.length>1)return t(`expected at most one positional argument, got ${g.length}`);if(e.seed!==void 0&&g.length>0)return t("pass the seed either as a positional argument or with --seed, not both");let p=e.seed??g[0]??m(),o=e.format;if(o===void 0&&e.out!==void 0&&(o=e.out.toLowerCase().endsWith(".svg")?"svg":"png"),o??="png",o!=="png"&&o!=="svg")return t(`--format must be "png" or "svg", got ${JSON.stringify(o)}`);let d=e.out??`${p.replace(/[^a-zA-Z0-9._-]/g,"_")}.${o}`,f=e.size===void 0?void 0:l("size",e.size),u=e.scale===void 0?16:l("scale",e.scale),a={seed:p,size:f,scale:u,color:e.color,bgcolor:e.bgcolor,spotcolor:e.spotcolor},i;try{i=o==="png"?y(a):x(a)}catch(r){return t(r instanceof Error?r.message:String(r))}let c=b(process.cwd(),d);h(c,i),process.stdout.write(`${c} (${typeof i=="string"?i.length:i.byteLength} bytes)
|
|
28
|
+
`)};export{I as runCli,_ as version};
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pixid/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Command-line blocky identicon generator. Writes deterministic PNG or SVG identicons from any seed string (npx @pixid/cli).",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"identicon",
|
|
7
|
+
"blockies",
|
|
8
|
+
"avatar",
|
|
9
|
+
"ethereum",
|
|
10
|
+
"pixel",
|
|
11
|
+
"cli",
|
|
12
|
+
"png",
|
|
13
|
+
"svg"
|
|
14
|
+
],
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"author": "thilllon",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/thilllon/pixid.git",
|
|
20
|
+
"directory": "packages/cli"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/thilllon/pixid",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/thilllon/pixid/issues"
|
|
25
|
+
},
|
|
26
|
+
"type": "module",
|
|
27
|
+
"sideEffects": [
|
|
28
|
+
"./dist/cli.js"
|
|
29
|
+
],
|
|
30
|
+
"main": "./dist/index.cjs",
|
|
31
|
+
"module": "./dist/index.js",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"import": "./dist/index.js",
|
|
37
|
+
"require": "./dist/index.cjs"
|
|
38
|
+
},
|
|
39
|
+
"./run": "./dist/cli.js",
|
|
40
|
+
"./package.json": "./package.json"
|
|
41
|
+
},
|
|
42
|
+
"bin": {
|
|
43
|
+
"pixid": "./dist/cli.js"
|
|
44
|
+
},
|
|
45
|
+
"files": [
|
|
46
|
+
"dist"
|
|
47
|
+
],
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@pixid/png": "^0.1.0",
|
|
50
|
+
"@pixid/svg": "^0.1.0"
|
|
51
|
+
},
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public"
|
|
54
|
+
},
|
|
55
|
+
"engines": {
|
|
56
|
+
"node": ">=18"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "tsup"
|
|
60
|
+
}
|
|
61
|
+
}
|