@equal-experts/kuat-react 0.2.4 → 0.2.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equal-experts/kuat-react",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -10,12 +10,33 @@
10
10
  "import": "./dist/index.js",
11
11
  "types": "./dist/index.d.ts"
12
12
  },
13
+ "./button": {
14
+ "import": "./dist/button.js",
15
+ "types": "./dist/button.d.ts"
16
+ },
17
+ "./accordion": {
18
+ "import": "./dist/accordion.js",
19
+ "types": "./dist/accordion.d.ts"
20
+ },
21
+ "./alert-dialog": {
22
+ "import": "./dist/alert-dialog.js",
23
+ "types": "./dist/alert-dialog.d.ts"
24
+ },
25
+ "./badge": {
26
+ "import": "./dist/badge.js",
27
+ "types": "./dist/badge.d.ts"
28
+ },
29
+ "./button-group": {
30
+ "import": "./dist/button-group.js",
31
+ "types": "./dist/button-group.d.ts"
32
+ },
13
33
  "./styles": "./dist/style.css",
14
34
  "./docs/*": "./docs/*"
15
35
  },
16
36
  "files": [
17
37
  "dist",
18
38
  "docs",
39
+ "scripts",
19
40
  "README.md"
20
41
  ],
21
42
  "keywords": [
@@ -48,7 +69,7 @@
48
69
  "typescript": "^5.3.3",
49
70
  "vite": "^5.1.0",
50
71
  "vite-plugin-dts": "^3.6.4",
51
- "@equal-experts/kuat-core": "0.2.4"
72
+ "@equal-experts/kuat-core": "0.2.6"
52
73
  },
53
74
  "peerDependencies": {
54
75
  "react": "^18.2.0",
@@ -79,10 +100,11 @@
79
100
  "@radix-ui/react-toggle": "^1.0.3",
80
101
  "@radix-ui/react-toggle-group": "^1.0.3",
81
102
  "@radix-ui/react-tooltip": "^1.0.7",
82
- "lucide-react": "^0.344.0"
103
+ "lucide-react": "^0.344.0 || >=0.400.0"
83
104
  },
84
105
  "scripts": {
85
106
  "copy-docs": "node scripts/copy-docs.js",
107
+ "setup-docs": "node scripts/setup-docs.js",
86
108
  "build": "vite build",
87
109
  "dev": "vite build --watch",
88
110
  "lint": "eslint . --max-warnings 0"
@@ -0,0 +1,88 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+
5
+ // Get __dirname equivalent in ES modules
6
+ const __filename = fileURLToPath(import.meta.url);
7
+ const __dirname = path.dirname(__filename);
8
+
9
+ // Paths
10
+ const docsSource = path.join(__dirname, '../../../docs/agent');
11
+ const docsTarget = path.join(__dirname, '../docs');
12
+
13
+ // Clean target directory
14
+ if (fs.existsSync(docsTarget)) {
15
+ fs.rmSync(docsTarget, { recursive: true });
16
+ }
17
+
18
+ // Create target directory
19
+ fs.mkdirSync(docsTarget, { recursive: true });
20
+
21
+ // Copy design docs
22
+ console.log('Copying design documentation...');
23
+ fs.cpSync(
24
+ path.join(docsSource, 'design'),
25
+ path.join(docsTarget, 'design'),
26
+ { recursive: true }
27
+ );
28
+
29
+ // Copy component guidelines
30
+ console.log('Copying component guidelines...');
31
+ fs.mkdirSync(path.join(docsTarget, 'components'), { recursive: true });
32
+ fs.copyFileSync(
33
+ path.join(docsSource, 'technical/component-guidelines.md'),
34
+ path.join(docsTarget, 'components/guidelines.md')
35
+ );
36
+
37
+ // Copy content guidelines
38
+ console.log('Copying content guidelines...');
39
+ fs.cpSync(
40
+ path.join(docsSource, 'content'),
41
+ path.join(docsTarget, 'content'),
42
+ { recursive: true }
43
+ );
44
+
45
+ // Create README
46
+ console.log('Creating docs README...');
47
+ const readme = `# Agent Documentation
48
+
49
+ This directory contains AI-friendly documentation for the Kuat Design System React library.
50
+
51
+ ## Contents
52
+
53
+ - **[Design System](./design/)** - Colors, typography, spacing, borders
54
+ - [Colours](./design/colours.md) - Brand colors and usage guidelines
55
+ - [Typography](./design/typography.md) - Font scales and text styling
56
+ - [Spacing](./design/spacing.md) - Spacing system and patterns
57
+ - [Borders](./design/borders.md) - Border usage and specifications
58
+ - [Design System Overview](./design/design-system.md) - Complete design system guide
59
+
60
+ - **[Component Guidelines](./components/guidelines.md)** - Component development patterns and best practices
61
+
62
+ - **[Content Guidelines](./content/)** - Content writing guidelines
63
+ - [Content Foundations](./content/content-foundations.md) - Universal content principles
64
+ - [Marketing & Sales](./content/content-marketing-sales.md) - Marketing content guidelines
65
+ - [Product & UX](./content/content-product-ux.md) - Product interface writing
66
+
67
+ ## Purpose
68
+
69
+ These docs are optimized for LLM consumption and provide context for:
70
+ - Understanding the design system
71
+ - Using components correctly
72
+ - Maintaining brand consistency
73
+ - Writing appropriate content
74
+
75
+ ## Version
76
+
77
+ These docs are synchronized with @equal-experts/kuat-react.
78
+
79
+ ## Source
80
+
81
+ Documentation is sourced from the [Kuat monorepo](https://github.com/equal-experts/kuat) and copied during the build process.
82
+ `;
83
+
84
+ fs.writeFileSync(path.join(docsTarget, 'README.md'), readme);
85
+
86
+ console.log('✓ Documentation copied successfully!');
87
+ console.log(` Target: ${docsTarget}`);
88
+
@@ -0,0 +1,169 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+
5
+ // Get __dirname equivalent in ES modules
6
+ const __filename = fileURLToPath(import.meta.url);
7
+ const __dirname = path.dirname(__filename);
8
+
9
+ /**
10
+ * Find the consuming app's root directory by looking for package.json
11
+ * in parent directories starting from node_modules/@equal-experts/kuat-react
12
+ */
13
+ function findAppRoot(startDir) {
14
+ let currentDir = startDir;
15
+
16
+ // First, go up from node_modules/@equal-experts/kuat-react to node_modules
17
+ // Then go up to the app root
18
+ while (currentDir !== path.dirname(currentDir)) {
19
+ const packageJsonPath = path.join(currentDir, 'package.json');
20
+ if (fs.existsSync(packageJsonPath)) {
21
+ // Check if this is the app root (not the package itself)
22
+ const nodeModulesPath = path.join(currentDir, 'node_modules');
23
+ if (!fs.existsSync(nodeModulesPath) || !currentDir.includes('node_modules')) {
24
+ // This might be the app root, but let's check if we're in node_modules
25
+ // If we're in node_modules, the app root is typically 2 levels up
26
+ if (currentDir.includes('node_modules')) {
27
+ // Go up from node_modules/@equal-experts/kuat-react to app root
28
+ let checkDir = currentDir;
29
+ while (checkDir !== path.dirname(checkDir)) {
30
+ const checkPackageJson = path.join(checkDir, 'package.json');
31
+ const checkNodeModules = path.join(checkDir, 'node_modules');
32
+ if (fs.existsSync(checkPackageJson) && fs.existsSync(checkNodeModules)) {
33
+ return checkDir;
34
+ }
35
+ checkDir = path.dirname(checkDir);
36
+ }
37
+ }
38
+ return currentDir;
39
+ }
40
+ }
41
+ currentDir = path.dirname(currentDir);
42
+ }
43
+
44
+ // Fallback: assume we're in node_modules/@equal-experts/kuat-react
45
+ // App root should be 3 levels up (node_modules/@equal-experts/kuat-react -> node_modules/@equal-experts -> node_modules -> app root)
46
+ let fallbackDir = startDir;
47
+ for (let i = 0; i < 3; i++) {
48
+ fallbackDir = path.dirname(fallbackDir);
49
+ }
50
+ return fallbackDir;
51
+ }
52
+
53
+ /**
54
+ * Setup agent documentation by copying from package to .cursor/rules/kuat-docs/
55
+ */
56
+ function setupDocs() {
57
+ try {
58
+ // Get the package directory (where this script is located)
59
+ const packageDir = path.dirname(__dirname);
60
+ const docsSource = path.join(packageDir, 'docs');
61
+
62
+ // Check if docs exist in the package
63
+ if (!fs.existsSync(docsSource)) {
64
+ console.error('❌ Error: Documentation not found in package.');
65
+ console.error(` Expected location: ${docsSource}`);
66
+ console.error(' Make sure the package is built and docs are included.');
67
+ process.exit(1);
68
+ }
69
+
70
+ // Find the consuming app's root
71
+ const appRoot = findAppRoot(packageDir);
72
+ const docsTarget = path.join(appRoot, '.cursor', 'rules', 'kuat-docs');
73
+
74
+ // Create .cursor/rules directory if it doesn't exist
75
+ const cursorRulesDir = path.dirname(docsTarget);
76
+ if (!fs.existsSync(cursorRulesDir)) {
77
+ fs.mkdirSync(cursorRulesDir, { recursive: true });
78
+ console.log(`✓ Created directory: ${cursorRulesDir}`);
79
+ }
80
+
81
+ // Clean existing docs if they exist
82
+ if (fs.existsSync(docsTarget)) {
83
+ fs.rmSync(docsTarget, { recursive: true });
84
+ console.log(`✓ Cleaned existing docs: ${docsTarget}`);
85
+ }
86
+
87
+ // Create target directory
88
+ fs.mkdirSync(docsTarget, { recursive: true });
89
+
90
+ // Copy all docs recursively
91
+ console.log('📚 Copying agent documentation...');
92
+ console.log(` From: ${docsSource}`);
93
+ console.log(` To: ${docsTarget}`);
94
+
95
+ fs.cpSync(docsSource, docsTarget, { recursive: true });
96
+
97
+ // Create a README in the destination explaining the source
98
+ const readmeContent = `# Kuat Design System - Agent Documentation
99
+
100
+ This directory contains AI-friendly documentation for the Kuat Design System.
101
+
102
+ ## Source
103
+
104
+ These docs were copied from \`@equal-experts/kuat-react\` package.
105
+
106
+ **Version:** ${getPackageVersion(packageDir)}
107
+ **Last Updated:** ${new Date().toISOString()}
108
+
109
+ ## Contents
110
+
111
+ - **[Design System](./design/)** - Colors, typography, spacing, borders, layouts
112
+ - **[Component Guidelines](./components/)** - Component development patterns
113
+ - **[Content Guidelines](./content/)** - Content writing guidelines
114
+
115
+ ## Purpose
116
+
117
+ These docs are optimized for LLM consumption and provide context for:
118
+ - Understanding the design system
119
+ - Using components correctly
120
+ - Maintaining brand consistency
121
+ - Writing appropriate content
122
+
123
+ ## Updating
124
+
125
+ To update these docs after installing a new version of \`@equal-experts/kuat-react\`, run:
126
+
127
+ \`\`\`bash
128
+ pnpm exec @equal-experts/kuat-react setup-docs
129
+ \`\`\`
130
+
131
+ Or if you have the package installed locally:
132
+
133
+ \`\`\`bash
134
+ cd node_modules/@equal-experts/kuat-react && pnpm setup-docs
135
+ \`\`\`
136
+ `;
137
+
138
+ fs.writeFileSync(path.join(docsTarget, 'README.md'), readmeContent);
139
+
140
+ console.log('✓ Documentation copied successfully!');
141
+ console.log(`\n📖 Documentation is now available at: ${docsTarget}`);
142
+ console.log(' You can reference these files in your Cursor rules or LLM context.\n');
143
+
144
+ } catch (error) {
145
+ console.error('❌ Error setting up documentation:');
146
+ console.error(error.message);
147
+ process.exit(1);
148
+ }
149
+ }
150
+
151
+ /**
152
+ * Get package version from package.json
153
+ */
154
+ function getPackageVersion(packageDir) {
155
+ try {
156
+ const packageJsonPath = path.join(packageDir, 'package.json');
157
+ if (fs.existsSync(packageJsonPath)) {
158
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
159
+ return packageJson.version || 'unknown';
160
+ }
161
+ } catch (error) {
162
+ // Ignore errors
163
+ }
164
+ return 'unknown';
165
+ }
166
+
167
+ // Run the setup
168
+ setupDocs();
169
+