UNPKG

@spaced-out/ui-design-system

Version:
66 lines (53 loc) โ€ข 2.47 kB
#!/usr/bin/env node /** * Quick test to verify the MCP server can load data */ import { readFileSync } from 'fs'; import { join, dirname } from 'path'; import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); console.log('๐Ÿงช Testing Genesis MCP Server...\n'); try { // Test 1: Load the data file console.log('Test 1: Loading bundled data...'); const dataPath = join(__dirname, 'data', 'design-system.json'); const data = JSON.parse(readFileSync(dataPath, 'utf-8')); console.log(' โœ… Data loaded successfully'); // Test 2: Verify structure console.log('\nTest 2: Verifying data structure...'); if (!data.metadata) throw new Error('Missing metadata'); if (!data.components) throw new Error('Missing components'); if (!data.hooks) throw new Error('Missing hooks'); if (!data.tokens) throw new Error('Missing tokens'); console.log(' โœ… Data structure valid'); // Test 3: Check content console.log('\nTest 3: Checking content...'); const componentCount = Object.keys(data.components).length; const hookCount = Object.keys(data.hooks).length; const tokenCategories = Object.keys(data.tokens).length; console.log(` - Components: ${componentCount}`); console.log(` - Hooks: ${hookCount}`); console.log(` - Token categories: ${tokenCategories}`); console.log(` - Version: ${data.metadata.version}`); console.log(` - Built: ${new Date(data.metadata.buildDate).toLocaleString()}`); console.log(' โœ… Content verified'); // Test 4: Sample a component console.log('\nTest 4: Sampling component data...'); const sampleComponent = Object.keys(data.components)[0]; const component = data.components[sampleComponent]; console.log(` - Sample: ${sampleComponent}`); console.log(` - Has main file: ${!!component.files.main}`); console.log(` - Has story file: ${!!component.files.story}`); console.log(` - Has CSS file: ${!!component.files.css}`); console.log(' โœ… Component data complete'); console.log('\nโœจ All tests passed!'); console.log('\n๐Ÿ“ Next steps:'); console.log(' 1. Update package.json version if needed'); console.log(' 2. Publish: npm publish'); console.log(' 3. Users can run: npx @spaced-out/genesis-mcp@latest'); console.log('\n๐ŸŽ‰ MCP server is ready to use!\n'); } catch (error) { console.error('\nโŒ Test failed:', error.message); process.exit(1); }