@glassly/miniapp-cli 0.1.5 → 0.1.6-beta.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/package.json +1 -1
- package/schema/miniapp.schema.json +6 -0
- package/src/manifest.test.ts +11 -0
- package/src/manifest.ts +13 -0
- package/src/schema.ts +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glassly/miniapp-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6-beta.0",
|
|
4
4
|
"description": "Build tooling for Glassly miniapps: dev server, packer, manifest validation, and JSON Schema. The `glassly` command that drives it ships in @glassly/cli.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -37,6 +37,12 @@
|
|
|
37
37
|
"maxLength": 80,
|
|
38
38
|
"description": "One line shown under the name in the Glassly Miniapp Store"
|
|
39
39
|
},
|
|
40
|
+
"releaseNotes": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"minLength": 1,
|
|
43
|
+
"maxLength": 500,
|
|
44
|
+
"description": "What changed in this version, shown in the Glassly Miniapp Store's version history"
|
|
45
|
+
},
|
|
40
46
|
"tags": {
|
|
41
47
|
"type": "array",
|
|
42
48
|
"maxItems": 5,
|
package/src/manifest.test.ts
CHANGED
|
@@ -352,6 +352,17 @@ describe('validateManifest', () => {
|
|
|
352
352
|
expect(validateManifest({...minimalValid, tagline: 'a\nb'}).valid).toBe(false);
|
|
353
353
|
});
|
|
354
354
|
|
|
355
|
+
test('accepts multi-line release notes up to 500 characters', () => {
|
|
356
|
+
expect(validateManifest({...minimalValid, releaseNotes: 'Faster sync.\nFixes the pause menu.'}).valid).toBe(true);
|
|
357
|
+
expect(validateManifest({...minimalValid, releaseNotes: 'x'.repeat(500)}).valid).toBe(true);
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
test('rejects blank or overlong release notes', () => {
|
|
361
|
+
expect(validateManifest({...minimalValid, releaseNotes: ' '}).valid).toBe(false);
|
|
362
|
+
const {errors} = validateManifest({...minimalValid, releaseNotes: 'x'.repeat(501)});
|
|
363
|
+
expect(errors.some((e) => e.includes('releaseNotes must be 500'))).toBe(true);
|
|
364
|
+
});
|
|
365
|
+
|
|
355
366
|
test('rejects more than five tags', () => {
|
|
356
367
|
const {errors} = validateManifest({...minimalValid, tags: ['a', 'b', 'c', 'd', 'e', 'f']});
|
|
357
368
|
expect(errors.some((e) => e.includes('5 entries or fewer'))).toBe(true);
|
package/src/manifest.ts
CHANGED
|
@@ -103,6 +103,8 @@ export interface MiniappManifestV1 {
|
|
|
103
103
|
tagline?: string;
|
|
104
104
|
/** Store tags, lowercase slugs, max 5 (e.g. ["productivity", "ai"]). */
|
|
105
105
|
tags?: string[];
|
|
106
|
+
/** What changed in this version, shown in the Store's version history. Max 500 characters. */
|
|
107
|
+
releaseNotes?: string;
|
|
106
108
|
icon?: string;
|
|
107
109
|
port?: number;
|
|
108
110
|
permissions?: ManifestPermission[];
|
|
@@ -130,6 +132,7 @@ export interface MiniappManifestV1 {
|
|
|
130
132
|
const ACTION_ID_RE = /^[a-z][a-z0-9_]*$/;
|
|
131
133
|
|
|
132
134
|
export const TAGLINE_MAX_LENGTH = 80;
|
|
135
|
+
export const RELEASE_NOTES_MAX_LENGTH = 500;
|
|
133
136
|
export const TAGS_MAX_COUNT = 5;
|
|
134
137
|
export const TAG_MAX_LENGTH = 32;
|
|
135
138
|
export const TAG_SLUG_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
@@ -155,6 +158,15 @@ export function validateTagline(tagline: unknown): string[] {
|
|
|
155
158
|
return [];
|
|
156
159
|
}
|
|
157
160
|
|
|
161
|
+
export function validateReleaseNotes(notes: unknown): string[] {
|
|
162
|
+
if (typeof notes !== 'string') return ['releaseNotes must be a string when set'];
|
|
163
|
+
if (!notes.trim()) return ['releaseNotes must not be blank when set'];
|
|
164
|
+
if (notes.length > RELEASE_NOTES_MAX_LENGTH) {
|
|
165
|
+
return [`releaseNotes must be ${RELEASE_NOTES_MAX_LENGTH} characters or fewer (got ${notes.length})`];
|
|
166
|
+
}
|
|
167
|
+
return [];
|
|
168
|
+
}
|
|
169
|
+
|
|
158
170
|
export function validateTags(tags: unknown): string[] {
|
|
159
171
|
if (!Array.isArray(tags)) return ['tags must be an array of lowercase slug strings when set'];
|
|
160
172
|
const errors: string[] = [];
|
|
@@ -251,6 +263,7 @@ export function validateManifest(manifest: unknown): { valid: boolean; errors: s
|
|
|
251
263
|
|
|
252
264
|
if (m.tagline !== undefined) errors.push(...validateTagline(m.tagline));
|
|
253
265
|
if (m.tags !== undefined) errors.push(...validateTags(m.tags));
|
|
266
|
+
if (m.releaseNotes !== undefined) errors.push(...validateReleaseNotes(m.releaseNotes));
|
|
254
267
|
|
|
255
268
|
// permissions — optional array of {type, required?, description?}
|
|
256
269
|
if (m.permissions !== undefined) {
|
package/src/schema.ts
CHANGED
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
ALLOWED_ACTION_PARAM_TYPES,
|
|
25
25
|
CARD_WIDGET_SIZES,
|
|
26
26
|
KNOWN_TAGS,
|
|
27
|
+
RELEASE_NOTES_MAX_LENGTH,
|
|
27
28
|
TAGLINE_MAX_LENGTH,
|
|
28
29
|
TAGS_MAX_COUNT,
|
|
29
30
|
TAG_MAX_LENGTH,
|
|
@@ -65,6 +66,12 @@ export function generateSchema(): Record<string, unknown> {
|
|
|
65
66
|
maxLength: TAGLINE_MAX_LENGTH,
|
|
66
67
|
description: 'One line shown under the name in the Glassly Miniapp Store',
|
|
67
68
|
},
|
|
69
|
+
releaseNotes: {
|
|
70
|
+
type: 'string',
|
|
71
|
+
minLength: 1,
|
|
72
|
+
maxLength: RELEASE_NOTES_MAX_LENGTH,
|
|
73
|
+
description: "What changed in this version, shown in the Glassly Miniapp Store's version history",
|
|
74
|
+
},
|
|
68
75
|
tags: {
|
|
69
76
|
type: 'array',
|
|
70
77
|
maxItems: TAGS_MAX_COUNT,
|