fix: update icon size property from 'sizes' to 'size' in manifest and schema files
This commit is contained in:
parent
406e7bb5bd
commit
257af30812
8 changed files with 26 additions and 26 deletions
12
MANIFEST.md
12
MANIFEST.md
|
|
@ -93,12 +93,12 @@ A full `manifest.json` with most of the optional fields looks like this:
|
|||
"icons": [
|
||||
{
|
||||
"src": "assets/icons/icon-16-light.png",
|
||||
"sizes": "16x16",
|
||||
"size": "16x16",
|
||||
"theme": "light"
|
||||
},
|
||||
{
|
||||
"src": "assets/icons/icon-16-dark.png",
|
||||
"sizes": "16x16",
|
||||
"size": "16x16",
|
||||
"theme": "dark"
|
||||
}
|
||||
],
|
||||
|
|
@ -237,7 +237,7 @@ A full `manifest.json` with most of the optional fields looks like this:
|
|||
### Optional Fields
|
||||
|
||||
- **icon**: Path to a png icon file, either relative in the package or a `https://` url.
|
||||
- **icons**: Array of icon descriptors (`src`, `sizes`, optional `theme`) for light/dark or size-specific assets.
|
||||
- **icons**: Array of icon descriptors (`src`, `size`, optional `theme`) for light/dark or size-specific assets.
|
||||
- 🌎 **display_name**: Human-friendly name for UI display. This field is localizable.
|
||||
- 🌎 **long_description**: Detailed description for extension stores, markdown. This field is localizable.
|
||||
- **repository**: Source code repository information (type and url).
|
||||
|
|
@ -288,12 +288,12 @@ Use the `icons` array when you need multiple icon variants (different sizes or t
|
|||
|
||||
```json
|
||||
"icons": [
|
||||
{ "src": "assets/icons/icon-16-light.png", "sizes": "16x16", "theme": "light" },
|
||||
{ "src": "assets/icons/icon-16-dark.png", "sizes": "16x16", "theme": "dark" }
|
||||
{ "src": "assets/icons/icon-16-light.png", "size": "16x16", "theme": "light" },
|
||||
{ "src": "assets/icons/icon-16-dark.png", "size": "16x16", "theme": "dark" }
|
||||
]
|
||||
```
|
||||
|
||||
- `sizes` must be in `WIDTHxHEIGHT` form (e.g., `128x128`).
|
||||
- `size` must be in `WIDTHxHEIGHT` form (e.g., `128x128`).
|
||||
- `theme` is optional; use values like `light`, `dark`, or platform-specific labels (e.g., `high-contrast`).
|
||||
- The legacy `icon` field remains supported for single assets—clients use it when `icons` is omitted.
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@
|
|||
"src": {
|
||||
"type": "string"
|
||||
},
|
||||
"sizes": {
|
||||
"size": {
|
||||
"type": "string",
|
||||
"pattern": "^\\d+x\\d+$"
|
||||
},
|
||||
|
|
@ -99,7 +99,7 @@
|
|||
},
|
||||
"required": [
|
||||
"src",
|
||||
"sizes"
|
||||
"size"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@
|
|||
"src": {
|
||||
"type": "string"
|
||||
},
|
||||
"sizes": {
|
||||
"size": {
|
||||
"type": "string",
|
||||
"pattern": "^\\d+x\\d+$"
|
||||
},
|
||||
|
|
@ -99,7 +99,7 @@
|
|||
},
|
||||
"required": [
|
||||
"src",
|
||||
"sizes"
|
||||
"size"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -456,7 +456,7 @@ export async function promptVisualAssets() {
|
|||
|
||||
const icons: Array<{
|
||||
src: string;
|
||||
sizes: string;
|
||||
size: string;
|
||||
theme?: string;
|
||||
}> = [];
|
||||
|
||||
|
|
@ -472,7 +472,7 @@ export async function promptVisualAssets() {
|
|||
},
|
||||
});
|
||||
|
||||
const iconSizes = await input({
|
||||
const iconSize = await input({
|
||||
message: "Icon size (e.g., 16x16):",
|
||||
validate: (value) => {
|
||||
if (!value.trim()) return "Icon size is required";
|
||||
|
|
@ -490,7 +490,7 @@ export async function promptVisualAssets() {
|
|||
|
||||
icons.push({
|
||||
src: iconSrc,
|
||||
sizes: iconSizes,
|
||||
size: iconSize,
|
||||
...(iconTheme.trim() ? { theme: iconTheme.trim() } : {}),
|
||||
});
|
||||
|
||||
|
|
@ -825,7 +825,7 @@ export function buildManifest(
|
|||
icon: string;
|
||||
icons: Array<{
|
||||
src: string;
|
||||
sizes: string;
|
||||
size: string;
|
||||
theme?: string;
|
||||
}>;
|
||||
screenshots: string[];
|
||||
|
|
|
|||
|
|
@ -98,11 +98,11 @@ export const McpbManifestLocalizationSchema = z.strictObject({
|
|||
|
||||
export const McpbManifestIconSchema = z.strictObject({
|
||||
src: z.string(),
|
||||
sizes: z
|
||||
size: z
|
||||
.string()
|
||||
.regex(
|
||||
ICON_SIZE_REGEX,
|
||||
'sizes must be in the format "WIDTHxHEIGHT" (e.g., "16x16")',
|
||||
'size must be in the format "WIDTHxHEIGHT" (e.g., "16x16")',
|
||||
),
|
||||
theme: z.string().min(1, "theme cannot be empty when provided").optional(),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -102,11 +102,11 @@ export const McpbManifestLocalizationSchema = z
|
|||
export const McpbManifestIconSchema = z
|
||||
.object({
|
||||
src: z.string(),
|
||||
sizes: z
|
||||
size: z
|
||||
.string()
|
||||
.regex(
|
||||
ICON_SIZE_REGEX,
|
||||
'sizes must be in the format "WIDTHxHEIGHT" (e.g., "16x16")',
|
||||
'size must be in the format "WIDTHxHEIGHT" (e.g., "16x16")',
|
||||
),
|
||||
theme: z.string().min(1).optional(),
|
||||
})
|
||||
|
|
|
|||
|
|
@ -263,12 +263,12 @@ describe("init functions", () => {
|
|||
icons: [
|
||||
{
|
||||
src: "assets/icons/icon-16-light.png",
|
||||
sizes: "16x16",
|
||||
size: "16x16",
|
||||
theme: "light",
|
||||
},
|
||||
{
|
||||
src: "assets/icons/icon-16-dark.png",
|
||||
sizes: "16x16",
|
||||
size: "16x16",
|
||||
theme: "dark",
|
||||
},
|
||||
],
|
||||
|
|
@ -341,12 +341,12 @@ describe("init functions", () => {
|
|||
icons: [
|
||||
{
|
||||
src: "assets/icons/icon-16-light.png",
|
||||
sizes: "16x16",
|
||||
size: "16x16",
|
||||
theme: "light",
|
||||
},
|
||||
{
|
||||
src: "assets/icons/icon-16-dark.png",
|
||||
sizes: "16x16",
|
||||
size: "16x16",
|
||||
theme: "dark",
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -76,12 +76,12 @@ describe("McpbManifestSchema", () => {
|
|||
icons: [
|
||||
{
|
||||
src: "assets/icons/icon-16-light.png",
|
||||
sizes: "16x16",
|
||||
size: "16x16",
|
||||
theme: "light",
|
||||
},
|
||||
{
|
||||
src: "assets/icons/icon-16-dark.png",
|
||||
sizes: "16x16",
|
||||
size: "16x16",
|
||||
theme: "dark",
|
||||
},
|
||||
],
|
||||
|
|
@ -320,7 +320,7 @@ describe("McpbManifestSchema", () => {
|
|||
it("rejects icons with invalid size format", () => {
|
||||
const manifest = {
|
||||
...base,
|
||||
icons: [{ src: "assets/icon.png", sizes: "16", theme: "light" }],
|
||||
icons: [{ src: "assets/icon.png", size: "16", theme: "light" }],
|
||||
};
|
||||
const result = McpbManifestSchema.safeParse(manifest);
|
||||
expect(result.success).toBe(false);
|
||||
|
|
@ -329,7 +329,7 @@ describe("McpbManifestSchema", () => {
|
|||
it("allows icons without theme", () => {
|
||||
const manifest = {
|
||||
...base,
|
||||
icons: [{ src: "assets/icon.png", sizes: "128x128" }],
|
||||
icons: [{ src: "assets/icon.png", size: "128x128" }],
|
||||
};
|
||||
const result = McpbManifestSchema.safeParse(manifest);
|
||||
expect(result.success).toBe(true);
|
||||
|
|
|
|||
Loading…
Reference in a new issue