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": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "assets/icons/icon-16-light.png",
|
"src": "assets/icons/icon-16-light.png",
|
||||||
"sizes": "16x16",
|
"size": "16x16",
|
||||||
"theme": "light"
|
"theme": "light"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "assets/icons/icon-16-dark.png",
|
"src": "assets/icons/icon-16-dark.png",
|
||||||
"sizes": "16x16",
|
"size": "16x16",
|
||||||
"theme": "dark"
|
"theme": "dark"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
@ -237,7 +237,7 @@ A full `manifest.json` with most of the optional fields looks like this:
|
||||||
### Optional Fields
|
### Optional Fields
|
||||||
|
|
||||||
- **icon**: Path to a png icon file, either relative in the package or a `https://` url.
|
- **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.
|
- 🌎 **display_name**: Human-friendly name for UI display. This field is localizable.
|
||||||
- 🌎 **long_description**: Detailed description for extension stores, markdown. This field is localizable.
|
- 🌎 **long_description**: Detailed description for extension stores, markdown. This field is localizable.
|
||||||
- **repository**: Source code repository information (type and url).
|
- **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
|
```json
|
||||||
"icons": [
|
"icons": [
|
||||||
{ "src": "assets/icons/icon-16-light.png", "sizes": "16x16", "theme": "light" },
|
{ "src": "assets/icons/icon-16-light.png", "size": "16x16", "theme": "light" },
|
||||||
{ "src": "assets/icons/icon-16-dark.png", "sizes": "16x16", "theme": "dark" }
|
{ "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`).
|
- `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.
|
- The legacy `icon` field remains supported for single assets—clients use it when `icons` is omitted.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@
|
||||||
"src": {
|
"src": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"sizes": {
|
"size": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"pattern": "^\\d+x\\d+$"
|
"pattern": "^\\d+x\\d+$"
|
||||||
},
|
},
|
||||||
|
|
@ -99,7 +99,7 @@
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"src",
|
"src",
|
||||||
"sizes"
|
"size"
|
||||||
],
|
],
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@
|
||||||
"src": {
|
"src": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"sizes": {
|
"size": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"pattern": "^\\d+x\\d+$"
|
"pattern": "^\\d+x\\d+$"
|
||||||
},
|
},
|
||||||
|
|
@ -99,7 +99,7 @@
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"src",
|
"src",
|
||||||
"sizes"
|
"size"
|
||||||
],
|
],
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -456,7 +456,7 @@ export async function promptVisualAssets() {
|
||||||
|
|
||||||
const icons: Array<{
|
const icons: Array<{
|
||||||
src: string;
|
src: string;
|
||||||
sizes: string;
|
size: string;
|
||||||
theme?: 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):",
|
message: "Icon size (e.g., 16x16):",
|
||||||
validate: (value) => {
|
validate: (value) => {
|
||||||
if (!value.trim()) return "Icon size is required";
|
if (!value.trim()) return "Icon size is required";
|
||||||
|
|
@ -490,7 +490,7 @@ export async function promptVisualAssets() {
|
||||||
|
|
||||||
icons.push({
|
icons.push({
|
||||||
src: iconSrc,
|
src: iconSrc,
|
||||||
sizes: iconSizes,
|
size: iconSize,
|
||||||
...(iconTheme.trim() ? { theme: iconTheme.trim() } : {}),
|
...(iconTheme.trim() ? { theme: iconTheme.trim() } : {}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -825,7 +825,7 @@ export function buildManifest(
|
||||||
icon: string;
|
icon: string;
|
||||||
icons: Array<{
|
icons: Array<{
|
||||||
src: string;
|
src: string;
|
||||||
sizes: string;
|
size: string;
|
||||||
theme?: string;
|
theme?: string;
|
||||||
}>;
|
}>;
|
||||||
screenshots: string[];
|
screenshots: string[];
|
||||||
|
|
|
||||||
|
|
@ -98,11 +98,11 @@ export const McpbManifestLocalizationSchema = z.strictObject({
|
||||||
|
|
||||||
export const McpbManifestIconSchema = z.strictObject({
|
export const McpbManifestIconSchema = z.strictObject({
|
||||||
src: z.string(),
|
src: z.string(),
|
||||||
sizes: z
|
size: z
|
||||||
.string()
|
.string()
|
||||||
.regex(
|
.regex(
|
||||||
ICON_SIZE_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(),
|
theme: z.string().min(1, "theme cannot be empty when provided").optional(),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -102,11 +102,11 @@ export const McpbManifestLocalizationSchema = z
|
||||||
export const McpbManifestIconSchema = z
|
export const McpbManifestIconSchema = z
|
||||||
.object({
|
.object({
|
||||||
src: z.string(),
|
src: z.string(),
|
||||||
sizes: z
|
size: z
|
||||||
.string()
|
.string()
|
||||||
.regex(
|
.regex(
|
||||||
ICON_SIZE_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(),
|
theme: z.string().min(1).optional(),
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -263,12 +263,12 @@ describe("init functions", () => {
|
||||||
icons: [
|
icons: [
|
||||||
{
|
{
|
||||||
src: "assets/icons/icon-16-light.png",
|
src: "assets/icons/icon-16-light.png",
|
||||||
sizes: "16x16",
|
size: "16x16",
|
||||||
theme: "light",
|
theme: "light",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
src: "assets/icons/icon-16-dark.png",
|
src: "assets/icons/icon-16-dark.png",
|
||||||
sizes: "16x16",
|
size: "16x16",
|
||||||
theme: "dark",
|
theme: "dark",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
@ -341,12 +341,12 @@ describe("init functions", () => {
|
||||||
icons: [
|
icons: [
|
||||||
{
|
{
|
||||||
src: "assets/icons/icon-16-light.png",
|
src: "assets/icons/icon-16-light.png",
|
||||||
sizes: "16x16",
|
size: "16x16",
|
||||||
theme: "light",
|
theme: "light",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
src: "assets/icons/icon-16-dark.png",
|
src: "assets/icons/icon-16-dark.png",
|
||||||
sizes: "16x16",
|
size: "16x16",
|
||||||
theme: "dark",
|
theme: "dark",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -76,12 +76,12 @@ describe("McpbManifestSchema", () => {
|
||||||
icons: [
|
icons: [
|
||||||
{
|
{
|
||||||
src: "assets/icons/icon-16-light.png",
|
src: "assets/icons/icon-16-light.png",
|
||||||
sizes: "16x16",
|
size: "16x16",
|
||||||
theme: "light",
|
theme: "light",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
src: "assets/icons/icon-16-dark.png",
|
src: "assets/icons/icon-16-dark.png",
|
||||||
sizes: "16x16",
|
size: "16x16",
|
||||||
theme: "dark",
|
theme: "dark",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
@ -320,7 +320,7 @@ describe("McpbManifestSchema", () => {
|
||||||
it("rejects icons with invalid size format", () => {
|
it("rejects icons with invalid size format", () => {
|
||||||
const manifest = {
|
const manifest = {
|
||||||
...base,
|
...base,
|
||||||
icons: [{ src: "assets/icon.png", sizes: "16", theme: "light" }],
|
icons: [{ src: "assets/icon.png", size: "16", theme: "light" }],
|
||||||
};
|
};
|
||||||
const result = McpbManifestSchema.safeParse(manifest);
|
const result = McpbManifestSchema.safeParse(manifest);
|
||||||
expect(result.success).toBe(false);
|
expect(result.success).toBe(false);
|
||||||
|
|
@ -329,7 +329,7 @@ describe("McpbManifestSchema", () => {
|
||||||
it("allows icons without theme", () => {
|
it("allows icons without theme", () => {
|
||||||
const manifest = {
|
const manifest = {
|
||||||
...base,
|
...base,
|
||||||
icons: [{ src: "assets/icon.png", sizes: "128x128" }],
|
icons: [{ src: "assets/icon.png", size: "128x128" }],
|
||||||
};
|
};
|
||||||
const result = McpbManifestSchema.safeParse(manifest);
|
const result = McpbManifestSchema.safeParse(manifest);
|
||||||
expect(result.success).toBe(true);
|
expect(result.success).toBe(true);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue