dicebear 8.0.2 → 9.0.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 Florian Körner
3
+ Copyright (c) 2024 Florian Körner
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  <h1><img src="https://www.dicebear.com/logo-readme.svg" width="28" /> DiceBear CLI</h1>
2
2
 
3
3
  <p>
4
- <img src="https://api.dicebear.com/8.x/adventurer/svg?seed=Mimi&backgroundColor=0077b6&radius=10" width="64" />
5
- <img src="https://api.dicebear.com/8.x/open-peeps/svg?seed=Kitty&backgroundColor=0096c7&radius=10" width="64" />
6
- <img src="https://api.dicebear.com/8.x/pixel-art/svg?seed=Lilly&backgroundColor=00b4d8&radius=10" width="64" />
7
- <img src="https://api.dicebear.com/8.x/lorelei/svg?seed=Tigger&backgroundColor=48cae4&radius=10" width="64" />
8
- <img src="https://api.dicebear.com/8.x/bottts/svg?seed=Zoe&backgroundColor=90e0ef&radius=10" width="64" />
9
- <img src="https://api.dicebear.com/8.x/initials/svg?seed=..&backgroundColor=ade8f4&radius=10" width="64" />
4
+ <img src="https://api.dicebear.com/9.x/adventurer/svg?seed=Mimi&backgroundColor=0077b6&radius=10" width="64" />
5
+ <img src="https://api.dicebear.com/9.x/open-peeps/svg?seed=Kitty&backgroundColor=0096c7&radius=10" width="64" />
6
+ <img src="https://api.dicebear.com/9.x/pixel-art/svg?seed=Lilly&backgroundColor=00b4d8&radius=10" width="64" />
7
+ <img src="https://api.dicebear.com/9.x/lorelei/svg?seed=Tigger&backgroundColor=48cae4&radius=10" width="64" />
8
+ <img src="https://api.dicebear.com/9.x/bottts/svg?seed=Zoe&backgroundColor=90e0ef&radius=10" width="64" />
9
+ <img src="https://api.dicebear.com/9.x/initials/svg?seed=..&backgroundColor=ade8f4&radius=10" width="64" />
10
10
  </p>
11
11
 
12
12
  [Playground](https://www.dicebear.com/playground) |
@@ -1,3 +1,3 @@
1
- import { Style } from '@dicebear/core';
1
+ import type { Style } from '@dicebear/core';
2
2
  import yargs from 'yargs';
3
3
  export declare function addStyleCommand(cli: yargs.Argv<{}>, name: string, style: Style<any>): yargs.Argv<{}>;
@@ -1,4 +1,5 @@
1
1
  import { createAvatar } from '@dicebear/core';
2
+ import { toJpeg, toPng } from '@dicebear/converter';
2
3
  import cliProgress from 'cli-progress';
3
4
  import PQueue from 'p-queue';
4
5
  import os from 'node:os';
@@ -10,6 +11,7 @@ import { getOptionsBySchema } from './getOptionsBySchema.js';
10
11
  import { validateInputBySchema } from './validateInputBySchema.js';
11
12
  import { outputStyleLicenseBanner } from './outputStyleLicenseBanner.js';
12
13
  import { createRandomSeed } from './createRandomSeed.js';
14
+ import { writeFile } from './writeFile.js';
13
15
  export function addStyleCommand(cli, name, style) {
14
16
  const schema = getStyleCommandSchema(style);
15
17
  return cli.command({
@@ -46,17 +48,17 @@ export function addStyleCommand(cli, name, style) {
46
48
  });
47
49
  switch (format) {
48
50
  case 'svg':
49
- await avatar.toFile(fileName);
51
+ await writeFile(fileName, avatar.toString());
50
52
  break;
51
53
  case 'png':
52
- await avatar.png({ includeExif }).toFile(fileName);
54
+ await writeFile(fileName, await toPng(avatar.toString(), { includeExif }).toArrayBuffer());
53
55
  break;
54
56
  case 'jpg':
55
57
  case 'jpeg':
56
- await avatar.jpeg({ includeExif }).toFile(fileName);
58
+ await writeFile(fileName, await toJpeg(avatar.toString(), { includeExif }).toArrayBuffer());
57
59
  break;
58
60
  case 'json':
59
- await fs.writeJSON(fileName, avatar.toJson(), { spaces: 2 });
61
+ await writeFile(fileName, JSON.stringify(avatar.toJson(), null, 2));
60
62
  break;
61
63
  }
62
64
  if (json && 'json' !== format) {
@@ -0,0 +1 @@
1
+ export declare function writeFile(filePath: string, content: string | ArrayBuffer): Promise<void>;
@@ -0,0 +1,14 @@
1
+ import fs from 'fs-extra';
2
+ import path from 'node:path';
3
+ export async function writeFile(filePath, content) {
4
+ if (fs.existsSync(filePath)) {
5
+ throw new Error(`File already exists at ${filePath}`);
6
+ }
7
+ fs.ensureDir(path.dirname(filePath));
8
+ if (typeof content === 'string') {
9
+ await fs.writeFile(filePath, content);
10
+ }
11
+ else {
12
+ await fs.writeFile(filePath, new Uint8Array(content));
13
+ }
14
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dicebear",
3
- "version": "8.0.2",
3
+ "version": "9.0.1",
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,18 +25,16 @@
25
25
  "prepublishOnly": "npm run build"
26
26
  },
27
27
  "dependencies": {
28
- "@dicebear/collection": "8.0.2",
29
- "@dicebear/core": "8.0.2",
30
- "@resvg/resvg-js": "^2.4.1",
28
+ "@dicebear/collection": "9.0.1",
29
+ "@dicebear/converter": "9.0.1",
30
+ "@dicebear/core": "9.0.1",
31
31
  "ajv": "^8.12.0",
32
32
  "chalk": "^5.2.0",
33
33
  "chalk-template": "^1.0.0",
34
34
  "cli-progress": "^3.12.0",
35
- "exiftool-vendored": "^23.0.0",
36
35
  "fs-extra": "^11.1.1",
37
36
  "json-schema-merge-allof": "^0.8.1",
38
37
  "p-queue": "^7.3.4",
39
- "sharp": "^0.32.6",
40
38
  "update-notifier": "^6.0.2",
41
39
  "yargs": "^17.7.1"
42
40
  },
@@ -51,7 +49,7 @@
51
49
  "typescript": "^5.1.6"
52
50
  },
53
51
  "engines": {
54
- "node": ">=16.0.0"
52
+ "node": ">=18.0.0"
55
53
  },
56
- "gitHead": "a81631f25e0723edc73cf40c1423f7b5242fafe5"
54
+ "gitHead": "96e800ad4a1f2175f225fe1639fb91624013e01c"
57
55
  }