@spwig/theme-validator 1.0.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.
Files changed (36) hide show
  1. package/README.md +367 -0
  2. package/dist/index.d.ts +12 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +11 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/schemas/component_manifest_schema.json +221 -0
  7. package/dist/schemas/theme_manifest_schema.json +267 -0
  8. package/dist/types/manifest.d.ts +183 -0
  9. package/dist/types/manifest.d.ts.map +1 -0
  10. package/dist/types/manifest.js +5 -0
  11. package/dist/types/manifest.js.map +1 -0
  12. package/dist/types/validation-result.d.ts +48 -0
  13. package/dist/types/validation-result.d.ts.map +1 -0
  14. package/dist/types/validation-result.js +26 -0
  15. package/dist/types/validation-result.js.map +1 -0
  16. package/dist/validators/component-validator.d.ts +50 -0
  17. package/dist/validators/component-validator.d.ts.map +1 -0
  18. package/dist/validators/component-validator.js +235 -0
  19. package/dist/validators/component-validator.js.map +1 -0
  20. package/dist/validators/design-tokens-validator.d.ts +46 -0
  21. package/dist/validators/design-tokens-validator.d.ts.map +1 -0
  22. package/dist/validators/design-tokens-validator.js +202 -0
  23. package/dist/validators/design-tokens-validator.js.map +1 -0
  24. package/dist/validators/manifest-validator.d.ts +69 -0
  25. package/dist/validators/manifest-validator.d.ts.map +1 -0
  26. package/dist/validators/manifest-validator.js +206 -0
  27. package/dist/validators/manifest-validator.js.map +1 -0
  28. package/dist/validators/template-validator.d.ts +34 -0
  29. package/dist/validators/template-validator.d.ts.map +1 -0
  30. package/dist/validators/template-validator.js +170 -0
  31. package/dist/validators/template-validator.js.map +1 -0
  32. package/dist/validators/theme-validator.d.ts +44 -0
  33. package/dist/validators/theme-validator.d.ts.map +1 -0
  34. package/dist/validators/theme-validator.js +237 -0
  35. package/dist/validators/theme-validator.js.map +1 -0
  36. package/package.json +50 -0
@@ -0,0 +1,237 @@
1
+ /**
2
+ * Theme Validator
3
+ * Validates theme packages with bundled components
4
+ */
5
+ import path from 'path';
6
+ import fs from 'fs-extra';
7
+ import { ManifestValidator } from './manifest-validator.js';
8
+ import { ComponentValidator } from './component-validator.js';
9
+ import { createError, createWarning, } from '../types/validation-result.js';
10
+ export class ThemeValidator extends ManifestValidator {
11
+ themeDir;
12
+ manifest = null;
13
+ constructor(themeDir) {
14
+ super();
15
+ this.themeDir = path.resolve(themeDir);
16
+ }
17
+ /**
18
+ * Validate complete theme package
19
+ */
20
+ async validate() {
21
+ this.reset();
22
+ // 1. Check directory exists
23
+ if (!(await this.directoryExists(this.themeDir))) {
24
+ this.addError(createError('directory_not_found', `Theme directory does not exist: ${this.themeDir}`));
25
+ return this.buildResult();
26
+ }
27
+ // 2. Check required files
28
+ const manifestPath = path.join(this.themeDir, 'manifest.json');
29
+ if (!(await this.fileExists(manifestPath))) {
30
+ this.addError(createError('missing_file', 'Required file missing: manifest.json'));
31
+ return this.buildResult();
32
+ }
33
+ // 3. Load and validate manifest
34
+ try {
35
+ this.manifest = await this.loadJSON(manifestPath);
36
+ }
37
+ catch {
38
+ return this.buildResult();
39
+ }
40
+ // Load theme manifest schema
41
+ const schemaPath = path.join(__dirname, '../../schemas/theme_manifest_schema.json');
42
+ const schema = await this.loadSchema(schemaPath);
43
+ if (!this.validateAgainstSchema(this.manifest, schema, 'theme manifest')) {
44
+ return this.buildResult();
45
+ }
46
+ // 4. Validate bundled components (if any)
47
+ if (this.manifest.bundled_components && this.manifest.bundled_components.length > 0) {
48
+ await this.validateBundledComponents();
49
+ }
50
+ // 5. Validate page schemas (if declared)
51
+ if (this.manifest.page_schemas) {
52
+ await this.validatePageSchemas();
53
+ }
54
+ // 6. Validate design tokens (if declared)
55
+ if (this.manifest.design_tokens) {
56
+ await this.validateDesignTokens();
57
+ }
58
+ // 7. Validate preview image (if declared)
59
+ if (this.manifest.preview_image) {
60
+ await this.validatePreviewImage();
61
+ }
62
+ // 8. Validate screenshots (if declared)
63
+ if (this.manifest.screenshots && this.manifest.screenshots.length > 0) {
64
+ await this.validateScreenshots();
65
+ }
66
+ return this.buildResult();
67
+ }
68
+ /**
69
+ * Validate all bundled components
70
+ */
71
+ async validateBundledComponents() {
72
+ if (!this.manifest?.bundled_components)
73
+ return;
74
+ for (const componentRef of this.manifest.bundled_components) {
75
+ const componentPath = path.join(this.themeDir, componentRef.path);
76
+ if (!(await this.directoryExists(componentPath))) {
77
+ this.addError(createError('missing_component', `Bundled component not found: ${componentRef.path}`));
78
+ continue;
79
+ }
80
+ // Validate component using ComponentValidator
81
+ const componentValidator = new ComponentValidator(componentPath);
82
+ const result = await componentValidator.validate();
83
+ if (!result.isValid) {
84
+ this.addError(createError('component_validation_failed', `Component validation failed for ${componentRef.name}:`));
85
+ // Add component errors as sub-errors
86
+ for (const error of result.errors) {
87
+ this.addError({
88
+ ...error,
89
+ message: ` - ${error.message}`,
90
+ });
91
+ }
92
+ }
93
+ // Add component warnings
94
+ for (const warning of result.warnings) {
95
+ this.addWarning({
96
+ ...warning,
97
+ message: `[${componentRef.name}] ${warning.message}`,
98
+ });
99
+ }
100
+ }
101
+ }
102
+ /**
103
+ * Validate page schema files exist
104
+ */
105
+ async validatePageSchemas() {
106
+ if (!this.manifest?.page_schemas)
107
+ return;
108
+ for (const [pageType, schemaPath] of Object.entries(this.manifest.page_schemas)) {
109
+ if (!schemaPath)
110
+ continue;
111
+ const fullPath = path.join(this.themeDir, schemaPath);
112
+ if (!(await this.fileExists(fullPath))) {
113
+ this.addError(createError('missing_schema', `Page schema not found: ${schemaPath} (for ${pageType})`));
114
+ continue;
115
+ }
116
+ // Validate it's valid JSON
117
+ try {
118
+ await this.loadJSON(fullPath);
119
+ }
120
+ catch {
121
+ // Error already added by loadJSON
122
+ }
123
+ }
124
+ }
125
+ /**
126
+ * Validate design tokens file exists and is valid JSON
127
+ */
128
+ async validateDesignTokens() {
129
+ if (!this.manifest?.design_tokens)
130
+ return;
131
+ const tokensPath = path.join(this.themeDir, this.manifest.design_tokens);
132
+ if (!(await this.fileExists(tokensPath))) {
133
+ this.addError(createError('missing_tokens', `Design tokens file not found: ${this.manifest.design_tokens}`));
134
+ return;
135
+ }
136
+ // Validate it's valid JSON
137
+ try {
138
+ const tokens = await this.loadJSON(tokensPath);
139
+ // Basic validation - check for expected properties
140
+ if (!tokens.colors && !tokens.typography && !tokens.spacing) {
141
+ this.addWarning(createWarning('incomplete_tokens', 'Design tokens file is missing common properties (colors, typography, spacing)', {
142
+ suggestion: 'Add at least colors, typography, and spacing definitions',
143
+ }));
144
+ }
145
+ }
146
+ catch {
147
+ // Error already added by loadJSON
148
+ }
149
+ }
150
+ /**
151
+ * Validate preview image exists
152
+ */
153
+ async validatePreviewImage() {
154
+ if (!this.manifest?.preview_image)
155
+ return;
156
+ const previewPath = path.join(this.themeDir, this.manifest.preview_image);
157
+ if (!(await this.fileExists(previewPath))) {
158
+ this.addError(createError('missing_preview', `Preview image not found: ${this.manifest.preview_image}`));
159
+ return;
160
+ }
161
+ // Check file size (max 5MB like component previews)
162
+ const maxSize = 5 * 1024 * 1024; // 5 MB
163
+ const stats = await fs.stat(previewPath);
164
+ if (stats.size > maxSize) {
165
+ this.addError(createError('file_too_large', `Preview image too large (max 5MB): ${this.manifest.preview_image}`));
166
+ }
167
+ }
168
+ /**
169
+ * Validate screenshot files exist
170
+ */
171
+ async validateScreenshots() {
172
+ if (!this.manifest?.screenshots)
173
+ return;
174
+ for (const screenshot of this.manifest.screenshots) {
175
+ const screenshotPath = path.join(this.themeDir, screenshot);
176
+ if (!(await this.fileExists(screenshotPath))) {
177
+ this.addError(createError('missing_screenshot', `Screenshot not found: ${screenshot}`));
178
+ continue;
179
+ }
180
+ // Check file size (max 5MB each)
181
+ const maxSize = 5 * 1024 * 1024; // 5 MB
182
+ const stats = await fs.stat(screenshotPath);
183
+ if (stats.size > maxSize) {
184
+ this.addWarning(createWarning('large_screenshot', `Screenshot is large (>5MB): ${screenshot}`, {
185
+ suggestion: 'Consider optimizing the screenshot to reduce file size',
186
+ }));
187
+ }
188
+ }
189
+ }
190
+ /**
191
+ * Build validation result
192
+ */
193
+ buildResult() {
194
+ return {
195
+ isValid: this.getErrors().length === 0,
196
+ errors: this.getErrors(),
197
+ warnings: this.getWarnings(),
198
+ themeInfo: this.manifest,
199
+ };
200
+ }
201
+ /**
202
+ * Generate human-readable validation report
203
+ */
204
+ getValidationReport() {
205
+ const lines = [];
206
+ if (this.manifest) {
207
+ lines.push(`Theme: ${this.manifest.display_name || 'Unknown'}`);
208
+ lines.push(`Name: ${this.manifest.name || 'Unknown'}`);
209
+ lines.push(`Version: ${this.manifest.version || 'Unknown'}`);
210
+ lines.push('');
211
+ }
212
+ const errors = this.getErrors();
213
+ if (errors.length > 0) {
214
+ lines.push(`❌ ERRORS (${errors.length}):`);
215
+ for (const error of errors) {
216
+ lines.push(` - ${error.message}`);
217
+ }
218
+ lines.push('');
219
+ }
220
+ const warnings = this.getWarnings();
221
+ if (warnings.length > 0) {
222
+ lines.push(`⚠️ WARNINGS (${warnings.length}):`);
223
+ for (const warning of warnings) {
224
+ lines.push(` - ${warning.message}`);
225
+ if (warning.suggestion) {
226
+ lines.push(` Suggestion: ${warning.suggestion}`);
227
+ }
228
+ }
229
+ lines.push('');
230
+ }
231
+ if (errors.length === 0 && warnings.length === 0) {
232
+ lines.push('✅ Validation passed with no errors or warnings');
233
+ }
234
+ return lines.join('\n');
235
+ }
236
+ }
237
+ //# sourceMappingURL=theme-validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-validator.js","sourceRoot":"","sources":["../../src/validators/theme-validator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAEL,WAAW,EACX,aAAa,GACd,MAA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.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@spwig/theme-validator",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "description": "Spwig Theme validation library",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist",
10
+ "README.md"
11
+ ],
12
+ "scripts": {
13
+ "build": "tsc && npm run copy-assets",
14
+ "copy-assets": "cp -r schemas dist/",
15
+ "dev": "tsc --watch",
16
+ "test": "jest",
17
+ "test:watch": "jest --watch",
18
+ "lint": "eslint src --ext .ts",
19
+ "format": "prettier --write 'src/**/*.ts'",
20
+ "clean": "rm -rf dist"
21
+ },
22
+ "keywords": [
23
+ "spwig",
24
+ "theme",
25
+ "validator",
26
+ "validation"
27
+ ],
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/spwig/theme-sdk.git",
31
+ "directory": "packages/validator"
32
+ },
33
+ "author": "Spwig",
34
+ "license": "Apache-2.0",
35
+ "dependencies": {
36
+ "ajv": "^8.12.0",
37
+ "ajv-errors": "^3.0.0",
38
+ "fs-extra": "^11.2.0"
39
+ },
40
+ "devDependencies": {
41
+ "@types/fs-extra": "^11.0.4",
42
+ "@types/node": "^20.10.0",
43
+ "jest": "^29.7.0",
44
+ "ts-jest": "^29.1.1",
45
+ "typescript": "^5.3.0"
46
+ },
47
+ "engines": {
48
+ "node": ">=18.0.0"
49
+ }
50
+ }