dicebear 5.0.4 → 5.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.
@@ -26,6 +26,7 @@ export function addStyleCommand(cli, name, style) {
26
26
  const format = validated.format;
27
27
  const count = validated.count;
28
28
  const includeExif = validated.exif;
29
+ const json = validated.json;
29
30
  outputStyleLicenseBanner(name, style);
30
31
  bar.start(count, 0);
31
32
  const queue = new PQueue({ concurrency: os.cpus().length });
@@ -54,6 +55,13 @@ export function addStyleCommand(cli, name, style) {
54
55
  case 'jpeg':
55
56
  await avatar.jpeg({ includeExif }).toFile(fileName);
56
57
  break;
58
+ case 'json':
59
+ await fs.writeJSON(fileName, avatar.toJson(), { spaces: 2 });
60
+ break;
61
+ }
62
+ if (json && 'json' !== format) {
63
+ const jsonFileName = path.resolve(process.cwd(), outputPath, `${name}-${i}.json`);
64
+ await fs.writeJSON(jsonFileName, avatar.toJson(), { spaces: 2 });
57
65
  }
58
66
  bar.increment();
59
67
  });
@@ -13,7 +13,7 @@ export function getStyleCommandSchema(style) {
13
13
  },
14
14
  format: {
15
15
  type: 'string',
16
- enum: ['svg', 'png', 'jpg', 'jpeg'],
16
+ enum: ['svg', 'png', 'jpg', 'jpeg', 'json'],
17
17
  default: 'svg',
18
18
  },
19
19
  exif: {
@@ -21,6 +21,11 @@ export function getStyleCommandSchema(style) {
21
21
  type: 'boolean',
22
22
  default: false,
23
23
  },
24
+ json: {
25
+ description: 'Save JSON file in addition to image file',
26
+ type: 'boolean',
27
+ default: false,
28
+ }
24
29
  },
25
30
  },
26
31
  coreSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dicebear",
3
- "version": "5.0.4",
3
+ "version": "5.1.0",
4
4
  "private": false,
5
5
  "description": "CLI for DiceBear - An avatar library for designers and developers",
6
6
  "homepage": "https://github.com/dicebear/dicebear",
@@ -25,8 +25,8 @@
25
25
  "prepublishOnly": "npm run build"
26
26
  },
27
27
  "dependencies": {
28
- "@dicebear/collection": "^5.0.4",
29
- "@dicebear/core": "^5.0.4",
28
+ "@dicebear/collection": "^5.1.0",
29
+ "@dicebear/core": "^5.1.0",
30
30
  "@resvg/resvg-js": "^2.0.0",
31
31
  "ajv": "^8.11.0",
32
32
  "chalk": "^5.0.1",
@@ -53,5 +53,5 @@
53
53
  "engines": {
54
54
  "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
55
55
  },
56
- "gitHead": "0158d13ad3760498a3622ca8bda8420929acc6dc"
56
+ "gitHead": "4f9e4686aa33809026d6ce25c4a5f2d0750d59f4"
57
57
  }