@machinemetrics/mm-react-components 0.2.3-2 → 0.2.3-20
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/README.md +89 -30
- package/agent-docs/agent-documentation-reference.md +364 -0
- package/agent-docs/ai-agent-guide.md +558 -0
- package/agent-docs/ai-agent-init-guide.md +465 -0
- package/agent-docs/chakra-migration-readme.md +265 -0
- package/agent-docs/chakra-migration-troubleshooting.md +649 -0
- package/agent-docs/component-mapping-reference.md +466 -0
- package/agent-docs/init-readme.md +283 -0
- package/agent-docs/init-troubleshooting.md +550 -0
- package/agent-docs/setup-reference.md +365 -0
- package/dist/App.d.ts.map +1 -1
- package/dist/README.md +89 -30
- package/dist/components/ui/alert-dialog.d.ts +15 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert.d.ts +10 -0
- package/dist/components/ui/alert.d.ts.map +1 -0
- package/dist/components/ui/avatar.d.ts +7 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/breadcrumb.d.ts +12 -0
- package/dist/components/ui/breadcrumb.d.ts.map +1 -0
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/card.d.ts +10 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/chart.d.ts +41 -0
- package/dist/components/ui/chart.d.ts.map +1 -0
- package/dist/components/ui/command.d.ts +19 -0
- package/dist/components/ui/command.d.ts.map +1 -0
- package/dist/components/ui/data-table/TableView.d.ts.map +1 -1
- package/dist/components/ui/data-table/cards/RowCard.d.ts.map +1 -1
- package/dist/components/ui/data-table/index.d.ts +3 -1
- package/dist/components/ui/data-table/index.d.ts.map +1 -1
- package/dist/components/ui/data-table/parts/BatchActionsToolbar.d.ts +6 -0
- package/dist/components/ui/data-table/parts/BatchActionsToolbar.d.ts.map +1 -0
- package/dist/components/ui/data-table/parts/CellContent.d.ts +7 -0
- package/dist/components/ui/data-table/parts/CellContent.d.ts.map +1 -0
- package/dist/components/ui/data-table/parts/ColGroup.d.ts +7 -0
- package/dist/components/ui/data-table/parts/ColGroup.d.ts.map +1 -0
- package/dist/components/ui/data-table/parts/SortableHeader.d.ts +13 -0
- package/dist/components/ui/data-table/parts/SortableHeader.d.ts.map +1 -0
- package/dist/components/ui/data-table/parts/TableBody.d.ts +11 -0
- package/dist/components/ui/data-table/parts/TableBody.d.ts.map +1 -0
- package/dist/components/ui/data-table/parts/TableHeader.d.ts +15 -0
- package/dist/components/ui/data-table/parts/TableHeader.d.ts.map +1 -0
- package/dist/components/ui/data-table/toolbar/DataTableToolbar.d.ts.map +1 -1
- package/dist/components/ui/data-table/types.d.ts +18 -10
- package/dist/components/ui/data-table/types.d.ts.map +1 -1
- package/dist/components/ui/data-table/utils.d.ts +2 -0
- package/dist/components/ui/data-table/utils.d.ts.map +1 -1
- package/dist/components/ui/date-picker.d.ts +36 -0
- package/dist/components/ui/date-picker.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +1 -1
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/form.d.ts +25 -0
- package/dist/components/ui/form.d.ts.map +1 -0
- package/dist/components/ui/hero-metric-card/HeroMetricCard.d.ts +4 -0
- package/dist/components/ui/hero-metric-card/HeroMetricCard.d.ts.map +1 -0
- package/dist/components/ui/hero-metric-card/HeroMetricCardItem.d.ts +4 -0
- package/dist/components/ui/hero-metric-card/HeroMetricCardItem.d.ts.map +1 -0
- package/dist/components/ui/hero-metric-card/constants.d.ts +13 -0
- package/dist/components/ui/hero-metric-card/constants.d.ts.map +1 -0
- package/dist/components/ui/hero-metric-card/grid.d.ts +4 -0
- package/dist/components/ui/hero-metric-card/grid.d.ts.map +1 -0
- package/dist/components/ui/hero-metric-card/hooks.d.ts +6 -0
- package/dist/components/ui/hero-metric-card/hooks.d.ts.map +1 -0
- package/dist/components/ui/hero-metric-card/index.d.ts +5 -0
- package/dist/components/ui/hero-metric-card/index.d.ts.map +1 -0
- package/dist/components/ui/hero-metric-card/parsing.d.ts +11 -0
- package/dist/components/ui/hero-metric-card/parsing.d.ts.map +1 -0
- package/dist/components/ui/hero-metric-card/refs.d.ts +3 -0
- package/dist/components/ui/hero-metric-card/refs.d.ts.map +1 -0
- package/dist/components/ui/hero-metric-card/trend.d.ts +4 -0
- package/dist/components/ui/hero-metric-card/trend.d.ts.map +1 -0
- package/dist/components/ui/hero-metric-card/types.d.ts +60 -0
- package/dist/components/ui/hero-metric-card/types.d.ts.map +1 -0
- package/dist/components/ui/hero-metric-card/utils.d.ts +10 -0
- package/dist/components/ui/hero-metric-card/utils.d.ts.map +1 -0
- package/dist/components/ui/pagination.d.ts +14 -0
- package/dist/components/ui/pagination.d.ts.map +1 -0
- package/dist/components/ui/progress.d.ts +1 -0
- package/dist/components/ui/progress.d.ts.map +1 -1
- package/dist/components/ui/separator.d.ts +5 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/simple-pagination.d.ts +8 -0
- package/dist/components/ui/simple-pagination.d.ts.map +1 -0
- package/dist/components/ui/sonner.d.ts +4 -0
- package/dist/components/ui/sonner.d.ts.map +1 -0
- package/dist/components/ui/spinner-carbide.d.ts +5 -0
- package/dist/components/ui/spinner-carbide.d.ts.map +1 -0
- package/dist/components/ui/spinner.d.ts +4 -0
- package/dist/components/ui/spinner.d.ts.map +1 -0
- package/dist/components/ui/textarea.d.ts +4 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/docs/GETTING_STARTED.md +13 -5
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/mm-react-components.css +1 -0
- package/dist/main.d.ts +1 -2
- package/dist/main.d.ts.map +1 -1
- package/dist/mm-react-components.es.js +16536 -7051
- package/dist/mm-react-components.es.js.map +1 -1
- package/dist/mm-react-components.umd.js +28 -11
- package/dist/mm-react-components.umd.js.map +1 -1
- package/dist/preview/AlertDialogPreview.d.ts +2 -0
- package/dist/preview/AlertDialogPreview.d.ts.map +1 -0
- package/dist/preview/AlertPreview.d.ts +2 -0
- package/dist/preview/AlertPreview.d.ts.map +1 -0
- package/dist/preview/AvatarPreview.d.ts +2 -0
- package/dist/preview/AvatarPreview.d.ts.map +1 -0
- package/dist/preview/BreadcrumbPreview.d.ts +2 -0
- package/dist/preview/BreadcrumbPreview.d.ts.map +1 -0
- package/dist/preview/CardPreview.d.ts +2 -0
- package/dist/preview/CardPreview.d.ts.map +1 -0
- package/dist/preview/ChartPreview.d.ts +2 -0
- package/dist/preview/ChartPreview.d.ts.map +1 -0
- package/dist/preview/ColorsPreview.d.ts +7 -0
- package/dist/preview/ColorsPreview.d.ts.map +1 -0
- package/dist/preview/CommandPreview.d.ts +2 -0
- package/dist/preview/CommandPreview.d.ts.map +1 -0
- package/dist/preview/DataTablePreview.d.ts.map +1 -1
- package/dist/preview/DatePickerPreview.d.ts +2 -0
- package/dist/preview/DatePickerPreview.d.ts.map +1 -0
- package/dist/preview/DateRangePickerPreview.d.ts.map +1 -1
- package/dist/preview/FormPreview.d.ts +2 -0
- package/dist/preview/FormPreview.d.ts.map +1 -0
- package/dist/preview/HeroMetricCardPreview.d.ts +2 -0
- package/dist/preview/HeroMetricCardPreview.d.ts.map +1 -0
- package/dist/preview/PaginationPreview.d.ts +2 -0
- package/dist/preview/PaginationPreview.d.ts.map +1 -0
- package/dist/preview/SeparatorPreview.d.ts +2 -0
- package/dist/preview/SeparatorPreview.d.ts.map +1 -0
- package/dist/preview/SonnerPreview.d.ts +2 -0
- package/dist/preview/SonnerPreview.d.ts.map +1 -0
- package/dist/preview/SpinnerPreview.d.ts +2 -0
- package/dist/preview/SpinnerPreview.d.ts.map +1 -0
- package/dist/preview/TextareaPreview.d.ts +2 -0
- package/dist/preview/TextareaPreview.d.ts.map +1 -0
- package/dist/scripts/chakra-to-shadcn-migrator/chakra-to-shadcn.config.json +577 -0
- package/dist/scripts/chakra-to-shadcn-migrator/lib/args.js +63 -0
- package/dist/scripts/chakra-to-shadcn-migrator/lib/colors.js +14 -0
- package/dist/scripts/chakra-to-shadcn-migrator/lib/config.js +15 -0
- package/dist/scripts/chakra-to-shadcn-migrator/lib/deps.js +125 -0
- package/dist/scripts/chakra-to-shadcn-migrator/lib/file-io.js +44 -0
- package/dist/scripts/chakra-to-shadcn-migrator/lib/render.js +89 -0
- package/dist/scripts/chakra-to-shadcn-migrator/lib/transform.js +550 -0
- package/dist/scripts/chakra-to-shadcn-migrator/package.json +11 -0
- package/dist/scripts/init.cjs +216 -0
- package/dist/scripts/npx-init.cjs +418 -0
- package/dist/tailwind.base.config.js +89 -0
- package/dist/themes/carbide.css +369 -91
- package/package.json +40 -10
- package/src/index.css +111 -498
- package/dist/index.css +0 -536
- package/dist/themes/base.css +0 -536
- package/dist/themes/complete.css +0 -8
- package/scripts/README.md +0 -171
- package/scripts/chakra-to-shadcn-migrator/README.md +0 -107
- package/src/themes/base.css +0 -536
- package/src/themes/carbide.css +0 -1257
- package/src/themes/complete.css +0 -8
- /package/{scripts → dist/scripts}/chakra-to-shadcn-migrator/bin/chakra-to-shadcn.js +0 -0
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
# Troubleshooting Guide: MachineMetrics React Components Initialization
|
|
2
|
+
|
|
3
|
+
## Common Issues and Solutions
|
|
4
|
+
|
|
5
|
+
### 1. Script Execution Issues
|
|
6
|
+
|
|
7
|
+
#### Error: `npx: command not found`
|
|
8
|
+
|
|
9
|
+
**Cause**: NPX not installed or not in PATH.
|
|
10
|
+
|
|
11
|
+
**Solution**:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Install NPX globally
|
|
15
|
+
npm install -g npx
|
|
16
|
+
|
|
17
|
+
# Or use npm directly
|
|
18
|
+
npm init @machinemetrics/mm-react-components
|
|
19
|
+
|
|
20
|
+
# Alternative: Use the package directly
|
|
21
|
+
npx @machinemetrics/mm-react-components init
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
#### Error: `Permission denied`
|
|
25
|
+
|
|
26
|
+
**Cause**: Insufficient permissions to execute the script.
|
|
27
|
+
|
|
28
|
+
**Solution**:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Fix npm permissions
|
|
32
|
+
sudo chown -R $(whoami) ~/.npm
|
|
33
|
+
|
|
34
|
+
# Or use a Node version manager
|
|
35
|
+
nvm install node
|
|
36
|
+
nvm use node
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
#### Error: `Network timeout` or `ECONNRESET`
|
|
40
|
+
|
|
41
|
+
**Cause**: Network connectivity issues or npm registry problems.
|
|
42
|
+
|
|
43
|
+
**Solution**:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Clear npm cache
|
|
47
|
+
npm cache clean --force
|
|
48
|
+
|
|
49
|
+
# Use different registry
|
|
50
|
+
npm config set registry https://registry.npmjs.org/
|
|
51
|
+
|
|
52
|
+
# Retry with verbose output
|
|
53
|
+
npx @machinemetrics/mm-react-components init --verbose
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 2. Dependency Installation Issues
|
|
57
|
+
|
|
58
|
+
#### Error: `Cannot find module '@machinemetrics/mm-react-components'`
|
|
59
|
+
|
|
60
|
+
**Cause**: Package installation failed or incomplete.
|
|
61
|
+
|
|
62
|
+
**Solution**:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Clear cache and reinstall
|
|
66
|
+
npm cache clean --force
|
|
67
|
+
rm -rf node_modules package-lock.json
|
|
68
|
+
npm install
|
|
69
|
+
|
|
70
|
+
# Install the package specifically
|
|
71
|
+
npm install @machinemetrics/mm-react-components@latest
|
|
72
|
+
|
|
73
|
+
# Verify installation
|
|
74
|
+
npm list @machinemetrics/mm-react-components
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
#### Error: `Peer dependency warnings`
|
|
78
|
+
|
|
79
|
+
**Cause**: Missing or incompatible peer dependencies.
|
|
80
|
+
|
|
81
|
+
**Solution**:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Install all peer dependencies
|
|
85
|
+
npm install class-variance-authority clsx tailwind-merge @radix-ui/react-slot lucide-react
|
|
86
|
+
|
|
87
|
+
# Install build dependencies
|
|
88
|
+
npm install -D tailwindcss autoprefixer postcss
|
|
89
|
+
|
|
90
|
+
# Check for version conflicts
|
|
91
|
+
npm ls
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
#### Error: `EACCES: permission denied`
|
|
95
|
+
|
|
96
|
+
**Cause**: File system permission issues.
|
|
97
|
+
|
|
98
|
+
**Solution**:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# Fix npm permissions
|
|
102
|
+
sudo chown -R $(whoami) ~/.npm
|
|
103
|
+
sudo chown -R $(whoami) /usr/local/lib/node_modules
|
|
104
|
+
|
|
105
|
+
# Or use a Node version manager
|
|
106
|
+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
|
|
107
|
+
nvm install node
|
|
108
|
+
nvm use node
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 3. Configuration Issues
|
|
112
|
+
|
|
113
|
+
#### Error: `Cannot find module 'tailwindcss'`
|
|
114
|
+
|
|
115
|
+
**Cause**: Tailwind CSS not installed or not configured.
|
|
116
|
+
|
|
117
|
+
**Solution**:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Install Tailwind CSS
|
|
121
|
+
npm install -D tailwindcss
|
|
122
|
+
|
|
123
|
+
# Initialize Tailwind
|
|
124
|
+
npx tailwindcss init -p
|
|
125
|
+
|
|
126
|
+
# Update tailwind.config.js
|
|
127
|
+
module.exports = {
|
|
128
|
+
content: [
|
|
129
|
+
"./src/**/*.{js,ts,jsx,tsx}",
|
|
130
|
+
"./node_modules/@machinemetrics/mm-react-components/dist/**/*.{js,ts,jsx,tsx}",
|
|
131
|
+
],
|
|
132
|
+
theme: {
|
|
133
|
+
extend: {},
|
|
134
|
+
},
|
|
135
|
+
plugins: [],
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
#### Error: `PostCSS plugin tailwindcss requires Tailwind CSS`
|
|
140
|
+
|
|
141
|
+
**Cause**: PostCSS configuration missing or incorrect.
|
|
142
|
+
|
|
143
|
+
**Solution**:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Install PostCSS dependencies
|
|
147
|
+
npm install -D postcss autoprefixer
|
|
148
|
+
|
|
149
|
+
# Create postcss.config.js
|
|
150
|
+
echo "module.exports = {
|
|
151
|
+
plugins: {
|
|
152
|
+
tailwindcss: {},
|
|
153
|
+
autoprefixer: {},
|
|
154
|
+
},
|
|
155
|
+
}" > postcss.config.js
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
#### Error: `Cannot resolve dependency 'lucide-react'`
|
|
159
|
+
|
|
160
|
+
**Cause**: Icon library not installed.
|
|
161
|
+
|
|
162
|
+
**Solution**:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
# Install Lucide React
|
|
166
|
+
npm install lucide-react
|
|
167
|
+
|
|
168
|
+
# Verify installation
|
|
169
|
+
npm list lucide-react
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### 4. Build and Runtime Issues
|
|
173
|
+
|
|
174
|
+
#### Error: `Module not found: Can't resolve 'clsx'`
|
|
175
|
+
|
|
176
|
+
**Cause**: Utility library not installed.
|
|
177
|
+
|
|
178
|
+
**Solution**:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# Install required utilities
|
|
182
|
+
npm install clsx tailwind-merge class-variance-authority
|
|
183
|
+
|
|
184
|
+
# Verify installation
|
|
185
|
+
npm list clsx tailwind-merge class-variance-authority
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
#### Error: `Cannot find module '@radix-ui/react-slot'`
|
|
189
|
+
|
|
190
|
+
**Cause**: Radix UI primitives not installed.
|
|
191
|
+
|
|
192
|
+
**Solution**:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
# Install Radix UI dependencies
|
|
196
|
+
npm install @radix-ui/react-slot
|
|
197
|
+
|
|
198
|
+
# Install additional Radix UI packages if needed
|
|
199
|
+
npm install @radix-ui/react-dialog @radix-ui/react-dropdown-menu
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
#### Error: `Components not styling correctly`
|
|
203
|
+
|
|
204
|
+
**Cause**: CSS not imported or theme not applied.
|
|
205
|
+
|
|
206
|
+
**Solution**:
|
|
207
|
+
|
|
208
|
+
```tsx
|
|
209
|
+
// Ensure CSS is imported in your main file
|
|
210
|
+
import '@machinemetrics/mm-react-components/themes/carbide';
|
|
211
|
+
|
|
212
|
+
// Ensure carbide class is applied to root element
|
|
213
|
+
function App() {
|
|
214
|
+
return (
|
|
215
|
+
<div className="carbide">
|
|
216
|
+
<YourApp />
|
|
217
|
+
</div>
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### 5. Framework-Specific Issues
|
|
223
|
+
|
|
224
|
+
#### Next.js Issues
|
|
225
|
+
|
|
226
|
+
**Error**: `Module not found: Can't resolve '@machinemetrics/mm-react-components'`
|
|
227
|
+
|
|
228
|
+
**Solution**:
|
|
229
|
+
|
|
230
|
+
```javascript
|
|
231
|
+
// next.config.js
|
|
232
|
+
/** @type {import('next').NextConfig} */
|
|
233
|
+
const nextConfig = {
|
|
234
|
+
transpilePackages: ['@machinemetrics/mm-react-components'],
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
module.exports = nextConfig;
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
**Error**: `CSS not loading in production`
|
|
241
|
+
|
|
242
|
+
**Solution**:
|
|
243
|
+
|
|
244
|
+
```tsx
|
|
245
|
+
// pages/_app.tsx
|
|
246
|
+
import '@machinemetrics/mm-react-components/themes/carbide';
|
|
247
|
+
import '../styles/globals.css';
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
#### Vite Issues
|
|
251
|
+
|
|
252
|
+
**Error**: `Build fails with CSS errors`
|
|
253
|
+
|
|
254
|
+
**Solution**:
|
|
255
|
+
|
|
256
|
+
```javascript
|
|
257
|
+
// vite.config.ts
|
|
258
|
+
import { defineConfig } from 'vite';
|
|
259
|
+
import react from '@vitejs/plugin-react';
|
|
260
|
+
|
|
261
|
+
export default defineConfig({
|
|
262
|
+
plugins: [react()],
|
|
263
|
+
css: {
|
|
264
|
+
postcss: {
|
|
265
|
+
plugins: [require('tailwindcss'), require('autoprefixer')],
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
});
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
#### Create React App Issues
|
|
272
|
+
|
|
273
|
+
**Error**: `Tailwind CSS not working`
|
|
274
|
+
|
|
275
|
+
**Solution**:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
# Install CRACO for Tailwind support
|
|
279
|
+
npm install -D @craco/craco
|
|
280
|
+
|
|
281
|
+
# Create craco.config.js
|
|
282
|
+
module.exports = {
|
|
283
|
+
style: {
|
|
284
|
+
postcss: {
|
|
285
|
+
plugins: [
|
|
286
|
+
require('tailwindcss'),
|
|
287
|
+
require('autoprefixer'),
|
|
288
|
+
],
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### 6. TypeScript Issues
|
|
295
|
+
|
|
296
|
+
#### Error: `Cannot find module '@machinemetrics/mm-react-components' or its corresponding type declarations`
|
|
297
|
+
|
|
298
|
+
**Cause**: TypeScript types not found.
|
|
299
|
+
|
|
300
|
+
**Solution**:
|
|
301
|
+
|
|
302
|
+
```bash
|
|
303
|
+
# Install TypeScript dependencies
|
|
304
|
+
npm install -D @types/react @types/react-dom typescript
|
|
305
|
+
|
|
306
|
+
# Update tsconfig.json
|
|
307
|
+
{
|
|
308
|
+
"compilerOptions": {
|
|
309
|
+
"types": ["@machinemetrics/mm-react-components"]
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
#### Error: `Property 'className' does not exist on type`
|
|
315
|
+
|
|
316
|
+
**Cause**: TypeScript configuration issues.
|
|
317
|
+
|
|
318
|
+
**Solution**:
|
|
319
|
+
|
|
320
|
+
```tsx
|
|
321
|
+
// Ensure proper imports
|
|
322
|
+
import { Button } from '@machinemetrics/mm-react-components';
|
|
323
|
+
import { cn } from '@machinemetrics/mm-react-components';
|
|
324
|
+
|
|
325
|
+
// Use proper typing
|
|
326
|
+
interface ButtonProps {
|
|
327
|
+
className?: string;
|
|
328
|
+
children: React.ReactNode;
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### 7. Performance Issues
|
|
333
|
+
|
|
334
|
+
#### Issue: `Bundle size too large`
|
|
335
|
+
|
|
336
|
+
**Cause**: Importing entire library instead of specific components.
|
|
337
|
+
|
|
338
|
+
**Solution**:
|
|
339
|
+
|
|
340
|
+
```tsx
|
|
341
|
+
// Import only needed components
|
|
342
|
+
import { Button, Input } from '@machinemetrics/mm-react-components';
|
|
343
|
+
|
|
344
|
+
// Instead of
|
|
345
|
+
import * as Components from '@machinemetrics/mm-react-components';
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
#### Issue: `Slow build times`
|
|
349
|
+
|
|
350
|
+
**Cause**: Inefficient build configuration.
|
|
351
|
+
|
|
352
|
+
**Solution**:
|
|
353
|
+
|
|
354
|
+
```javascript
|
|
355
|
+
// webpack.config.js
|
|
356
|
+
module.exports = {
|
|
357
|
+
optimization: {
|
|
358
|
+
usedExports: true,
|
|
359
|
+
sideEffects: false,
|
|
360
|
+
},
|
|
361
|
+
resolve: {
|
|
362
|
+
alias: {
|
|
363
|
+
'@machinemetrics/mm-react-components': path.resolve(
|
|
364
|
+
__dirname,
|
|
365
|
+
'node_modules/@machinemetrics/mm-react-components',
|
|
366
|
+
),
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
};
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### 8. Development Server Issues
|
|
373
|
+
|
|
374
|
+
#### Issue: `Hot reload not working`
|
|
375
|
+
|
|
376
|
+
**Cause**: File watching issues or configuration problems.
|
|
377
|
+
|
|
378
|
+
**Solution**:
|
|
379
|
+
|
|
380
|
+
```bash
|
|
381
|
+
# Clear cache and restart
|
|
382
|
+
npm run dev -- --force
|
|
383
|
+
|
|
384
|
+
# Check file permissions
|
|
385
|
+
ls -la src/
|
|
386
|
+
|
|
387
|
+
# Verify file structure
|
|
388
|
+
tree src/
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
#### Issue: `CSS not updating`
|
|
392
|
+
|
|
393
|
+
**Cause**: CSS processing issues.
|
|
394
|
+
|
|
395
|
+
**Solution**:
|
|
396
|
+
|
|
397
|
+
```bash
|
|
398
|
+
# Restart development server
|
|
399
|
+
npm run dev
|
|
400
|
+
|
|
401
|
+
# Clear build cache
|
|
402
|
+
rm -rf .next dist build
|
|
403
|
+
|
|
404
|
+
# Verify PostCSS configuration
|
|
405
|
+
cat postcss.config.js
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
### 9. Production Build Issues
|
|
409
|
+
|
|
410
|
+
#### Error: `Build fails in production`
|
|
411
|
+
|
|
412
|
+
**Cause**: Production-specific configuration issues.
|
|
413
|
+
|
|
414
|
+
**Solution**:
|
|
415
|
+
|
|
416
|
+
```bash
|
|
417
|
+
# Check build logs
|
|
418
|
+
npm run build 2>&1 | tee build.log
|
|
419
|
+
|
|
420
|
+
# Verify environment variables
|
|
421
|
+
echo $NODE_ENV
|
|
422
|
+
|
|
423
|
+
# Test production build locally
|
|
424
|
+
npm run build && npm run preview
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
#### Error: `CSS not loading in production`
|
|
428
|
+
|
|
429
|
+
**Cause**: CSS processing or import issues.
|
|
430
|
+
|
|
431
|
+
**Solution**:
|
|
432
|
+
|
|
433
|
+
```tsx
|
|
434
|
+
// Ensure CSS is imported in production
|
|
435
|
+
import '@machinemetrics/mm-react-components/themes/carbide';
|
|
436
|
+
|
|
437
|
+
// Check build output
|
|
438
|
+
ls -la dist/
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
### 10. Debugging Tools
|
|
442
|
+
|
|
443
|
+
#### Enable Verbose Logging
|
|
444
|
+
|
|
445
|
+
```bash
|
|
446
|
+
# Run with verbose output
|
|
447
|
+
npx @machinemetrics/mm-react-components init --verbose
|
|
448
|
+
|
|
449
|
+
# Check npm logs
|
|
450
|
+
npm config get loglevel
|
|
451
|
+
npm config set loglevel verbose
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
#### Check Dependencies
|
|
455
|
+
|
|
456
|
+
```bash
|
|
457
|
+
# List all dependencies
|
|
458
|
+
npm list --depth=0
|
|
459
|
+
|
|
460
|
+
# Check for conflicts
|
|
461
|
+
npm ls --depth=0
|
|
462
|
+
|
|
463
|
+
# Verify package integrity
|
|
464
|
+
npm audit
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
#### Debug Build Process
|
|
468
|
+
|
|
469
|
+
```bash
|
|
470
|
+
# Build with debug info
|
|
471
|
+
npm run build -- --debug
|
|
472
|
+
|
|
473
|
+
# Check webpack stats
|
|
474
|
+
npm run build -- --analyze
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
## Prevention Strategies
|
|
478
|
+
|
|
479
|
+
### 1. Environment Setup
|
|
480
|
+
|
|
481
|
+
```bash
|
|
482
|
+
# Use Node version manager
|
|
483
|
+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
|
|
484
|
+
nvm install --lts
|
|
485
|
+
nvm use --lts
|
|
486
|
+
|
|
487
|
+
# Verify Node and npm versions
|
|
488
|
+
node --version
|
|
489
|
+
npm --version
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
### 2. Project Structure
|
|
493
|
+
|
|
494
|
+
```
|
|
495
|
+
my-project/
|
|
496
|
+
├── src/
|
|
497
|
+
│ ├── index.css
|
|
498
|
+
│ ├── App.tsx
|
|
499
|
+
│ └── main.tsx
|
|
500
|
+
├── tailwind.config.js
|
|
501
|
+
├── postcss.config.js
|
|
502
|
+
├── package.json
|
|
503
|
+
└── node_modules/
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
### 3. Dependency Management
|
|
507
|
+
|
|
508
|
+
```bash
|
|
509
|
+
# Use exact versions for critical dependencies
|
|
510
|
+
npm install @machinemetrics/mm-react-components@latest
|
|
511
|
+
|
|
512
|
+
# Lock dependency versions
|
|
513
|
+
npm shrinkwrap
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
### 4. Configuration Validation
|
|
517
|
+
|
|
518
|
+
```bash
|
|
519
|
+
# Validate configuration files
|
|
520
|
+
npx tailwindcss --help
|
|
521
|
+
npx postcss --help
|
|
522
|
+
|
|
523
|
+
# Check for syntax errors
|
|
524
|
+
node -c tailwind.config.js
|
|
525
|
+
node -c postcss.config.js
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
## Getting Help
|
|
529
|
+
|
|
530
|
+
### Documentation
|
|
531
|
+
|
|
532
|
+
- [Component Library Docs](https://components.machinemetrics.com)
|
|
533
|
+
- [Setup Guide](https://components.machinemetrics.com/setup)
|
|
534
|
+
- [Troubleshooting](https://components.machinemetrics.com/troubleshooting)
|
|
535
|
+
|
|
536
|
+
### Community Support
|
|
537
|
+
|
|
538
|
+
- [GitHub Issues](https://github.com/machinemetrics/mm-react-components/issues)
|
|
539
|
+
- [Discord Community](https://discord.gg/machinemetrics)
|
|
540
|
+
- [Stack Overflow](https://stackoverflow.com/questions/tagged/machinemetrics)
|
|
541
|
+
|
|
542
|
+
### Professional Support
|
|
543
|
+
|
|
544
|
+
- [MachineMetrics Support](https://support.machinemetrics.com)
|
|
545
|
+
- [Enterprise Support](https://enterprise.machinemetrics.com)
|
|
546
|
+
- [Consulting Services](https://consulting.machinemetrics.com)
|
|
547
|
+
|
|
548
|
+
## Conclusion
|
|
549
|
+
|
|
550
|
+
This troubleshooting guide covers the most common issues encountered during MachineMetrics React Components initialization. Follow the solutions provided and use the debugging tools to resolve any issues. For additional help, refer to the documentation or contact support.
|