@machinemetrics/mm-react-components 1.0.0-rc.1 → 1.0.0-rc.3
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/agent-docs/ai-agent-init-guide.md +3 -3
- package/agent-docs/cursor-skill-mm-carbide.md +14 -12
- package/agent-docs/init-readme.md +8 -4
- package/agent-docs/init-troubleshooting.md +19 -0
- package/dist/App.d.ts.map +1 -1
- package/dist/cursor-skill/mm-carbide/SKILL.md +25 -2
- package/dist/cursor-skill/mm-carbide/reference.md +13 -0
- package/dist/docs/GETTING_STARTED.md +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/mm-react-components.css +1 -1
- package/dist/mm-react-components.es.js +709 -719
- package/dist/mm-react-components.es.js.map +1 -1
- package/dist/mm-react-components.umd.js +1 -1
- package/dist/mm-react-components.umd.js.map +1 -1
- package/dist/scripts/ascii-logo.cjs +1 -1
- package/dist/scripts/chakra-to-shadcn-migrator/lib/transform.js +5 -12
- package/dist/scripts/init.cjs +159 -72
- package/dist/scripts/install-skill.cjs +6 -1
- package/package.json +8 -4
- package/dist/scripts/npx-init.cjs +0 -479
|
@@ -1,479 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* MM React Components - NPX Initialization Script
|
|
5
|
-
*
|
|
6
|
-
* This script is designed to be run via npx only
|
|
7
|
-
* Usage: npx @machinemetrics/mm-react-components init
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/* eslint-disable no-undef, no-unused-vars */
|
|
11
|
-
|
|
12
|
-
const { execSync } = require('child_process');
|
|
13
|
-
const fs = require('fs');
|
|
14
|
-
const path = require('path');
|
|
15
|
-
const readline = require('readline');
|
|
16
|
-
|
|
17
|
-
// Read the version from package.json
|
|
18
|
-
// When built, this script is at dist/scripts/npx-init.cjs, so go up two levels
|
|
19
|
-
const packageJsonPath = path.join(__dirname, '..', '..', 'package.json');
|
|
20
|
-
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
21
|
-
const version = packageJson.version;
|
|
22
|
-
|
|
23
|
-
// Colors for console output
|
|
24
|
-
const { ASCII_LOGO } = require(path.join(__dirname, 'ascii-logo.cjs'));
|
|
25
|
-
|
|
26
|
-
const colors = {
|
|
27
|
-
reset: '\x1b[0m',
|
|
28
|
-
bright: '\x1b[1m',
|
|
29
|
-
green: '\x1b[32m',
|
|
30
|
-
blue: '\x1b[34m',
|
|
31
|
-
cyan: '\x1b[36m',
|
|
32
|
-
yellow: '\x1b[33m',
|
|
33
|
-
red: '\x1b[31m',
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
function logLogo() {
|
|
37
|
-
console.log(`${colors.bright}${colors.green}${ASCII_LOGO}${colors.reset}\n`);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function log(message, color = 'reset') {
|
|
41
|
-
console.log(`${colors[color]}${message}${colors.reset}`);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function logWarning(message) {
|
|
45
|
-
log(`⚠️ ${message}`, 'yellow');
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function detectChakraUI() {
|
|
49
|
-
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
|
50
|
-
if (!fs.existsSync(packageJsonPath)) {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
55
|
-
const deps = { ...packageJson.dependencies, ...packageJson.devDependencies };
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
deps['@chakra-ui/react'] ||
|
|
59
|
-
deps['@chakra-ui/core'] ||
|
|
60
|
-
deps['@chakra-ui/system']
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function askQuestion(question) {
|
|
65
|
-
const rl = readline.createInterface({
|
|
66
|
-
input: process.stdin,
|
|
67
|
-
output: process.stdout,
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
return new Promise((resolve) => {
|
|
71
|
-
rl.question(question, (answer) => {
|
|
72
|
-
rl.close();
|
|
73
|
-
resolve(answer);
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function checkReactProject() {
|
|
79
|
-
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
|
80
|
-
|
|
81
|
-
if (!fs.existsSync(packageJsonPath)) {
|
|
82
|
-
log(
|
|
83
|
-
'❌ No package.json found. Please run this script from your React project root.',
|
|
84
|
-
'red',
|
|
85
|
-
);
|
|
86
|
-
process.exit(1);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
90
|
-
|
|
91
|
-
if (!packageJson.dependencies?.react && !packageJson.devDependencies?.react) {
|
|
92
|
-
log(
|
|
93
|
-
"❌ React not found in dependencies. Please ensure you're in a React project.",
|
|
94
|
-
'red',
|
|
95
|
-
);
|
|
96
|
-
process.exit(1);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return packageJson;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
async function main() {
|
|
103
|
-
logLogo();
|
|
104
|
-
log('MM React Components - NPX Setup', 'bright');
|
|
105
|
-
log(
|
|
106
|
-
'Setting up MachineMetrics React Components in your project...\n',
|
|
107
|
-
'blue',
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
try {
|
|
111
|
-
// Check if we're in a React project
|
|
112
|
-
checkReactProject();
|
|
113
|
-
log('✅ React project detected', 'green');
|
|
114
|
-
|
|
115
|
-
// Check for Chakra UI before installation
|
|
116
|
-
const hasChakra = detectChakraUI();
|
|
117
|
-
|
|
118
|
-
// Install the component library
|
|
119
|
-
log(`📦 Installing MM React Components v${version}...`, 'cyan');
|
|
120
|
-
execSync(`npm install @machinemetrics/mm-react-components@beta`, {
|
|
121
|
-
stdio: 'inherit',
|
|
122
|
-
});
|
|
123
|
-
log('✅ MM React Components installed', 'green');
|
|
124
|
-
|
|
125
|
-
log('\n💡 Zero-config mode: No build tools needed!', 'yellow');
|
|
126
|
-
log(' Using pre-compiled CSS (118 KB, 18 KB gzipped)\n', 'cyan');
|
|
127
|
-
|
|
128
|
-
// Check React version compatibility
|
|
129
|
-
log('🔍 Checking React version compatibility...', 'cyan');
|
|
130
|
-
try {
|
|
131
|
-
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
|
132
|
-
const reactVersion =
|
|
133
|
-
packageJson.dependencies?.react || packageJson.devDependencies?.react;
|
|
134
|
-
|
|
135
|
-
if (reactVersion && reactVersion.includes('18')) {
|
|
136
|
-
log(
|
|
137
|
-
'✅ React 18 detected - library supports React 18.2+ and 19+',
|
|
138
|
-
'green',
|
|
139
|
-
);
|
|
140
|
-
// Check if React version is 18.2.0 or higher (required for useId hook)
|
|
141
|
-
const versionMatch = reactVersion.match(/18\.(\d+)\./);
|
|
142
|
-
if (versionMatch && parseInt(versionMatch[1]) < 2) {
|
|
143
|
-
log(
|
|
144
|
-
'⚠️ React 18.0.x or 18.1.x detected - upgrading to React 18.2+ for compatibility',
|
|
145
|
-
'yellow',
|
|
146
|
-
);
|
|
147
|
-
execSync(
|
|
148
|
-
'npm install react@^18.2.0 react-dom@^18.2.0',
|
|
149
|
-
{ stdio: 'inherit' },
|
|
150
|
-
);
|
|
151
|
-
log('✅ React upgraded to 18.2+', 'green');
|
|
152
|
-
}
|
|
153
|
-
} else if (reactVersion && reactVersion.includes('19')) {
|
|
154
|
-
log(
|
|
155
|
-
'✅ React 19 detected - library fully compatible',
|
|
156
|
-
'green',
|
|
157
|
-
);
|
|
158
|
-
// Check if react-scripts needs updating for React 19
|
|
159
|
-
try {
|
|
160
|
-
const packageJson = JSON.parse(
|
|
161
|
-
fs.readFileSync('package.json', 'utf8'),
|
|
162
|
-
);
|
|
163
|
-
const scriptsVersion = packageJson.dependencies?.['react-scripts'];
|
|
164
|
-
if (scriptsVersion && scriptsVersion.includes('5.0')) {
|
|
165
|
-
log(
|
|
166
|
-
'⚠️ Updating react-scripts for React 19 compatibility',
|
|
167
|
-
'yellow',
|
|
168
|
-
);
|
|
169
|
-
execSync('npm install react-scripts@latest', { stdio: 'inherit' });
|
|
170
|
-
log('✅ react-scripts updated', 'green');
|
|
171
|
-
}
|
|
172
|
-
} catch (_error) {
|
|
173
|
-
log('⚠️ Could not check react-scripts version', 'yellow');
|
|
174
|
-
}
|
|
175
|
-
} else {
|
|
176
|
-
log(
|
|
177
|
-
'⚠️ No React version detected - installing React 18.2+ (supports both 18.2+ and 19+)',
|
|
178
|
-
'yellow',
|
|
179
|
-
);
|
|
180
|
-
execSync(
|
|
181
|
-
'npm install react@^18.2.0 react-dom@^18.2.0',
|
|
182
|
-
{ stdio: 'inherit' },
|
|
183
|
-
);
|
|
184
|
-
log('✅ React 18.2+ installed', 'green');
|
|
185
|
-
}
|
|
186
|
-
} catch (_error) {
|
|
187
|
-
log('⚠️ Could not check React version, continuing...', 'yellow');
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// Setup CSS (zero-config approach)
|
|
191
|
-
const srcPath = path.join(process.cwd(), 'src');
|
|
192
|
-
const indexCssPath = path.join(srcPath, 'index.css');
|
|
193
|
-
|
|
194
|
-
// Ensure src directory exists
|
|
195
|
-
if (!fs.existsSync(srcPath)) {
|
|
196
|
-
fs.mkdirSync(srcPath, { recursive: true });
|
|
197
|
-
log('✅ Created src/ directory', 'green');
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
// Setup CSS with pre-compiled styles
|
|
201
|
-
const cssContent = `/* MM React Components - Pre-compiled CSS (zero-config) */
|
|
202
|
-
@import '@machinemetrics/mm-react-components/styles';
|
|
203
|
-
`;
|
|
204
|
-
|
|
205
|
-
if (fs.existsSync(indexCssPath)) {
|
|
206
|
-
const existingContent = fs.readFileSync(indexCssPath, 'utf8');
|
|
207
|
-
if (!existingContent.includes('@machinemetrics/mm-react-components')) {
|
|
208
|
-
fs.writeFileSync(indexCssPath, cssContent + '\n' + existingContent);
|
|
209
|
-
log('✅ Added MM styles import to existing index.css', 'green');
|
|
210
|
-
} else {
|
|
211
|
-
log('✅ MM styles import already present in index.css', 'green');
|
|
212
|
-
}
|
|
213
|
-
} else {
|
|
214
|
-
fs.writeFileSync(indexCssPath, cssContent);
|
|
215
|
-
log('✅ Created index.css with MM styles import', 'green');
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// Create example component
|
|
219
|
-
const examplesDir = path.join(process.cwd(), 'mm-components-examples');
|
|
220
|
-
if (!fs.existsSync(examplesDir)) {
|
|
221
|
-
fs.mkdirSync(examplesDir);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
const exampleComponent = `import React from 'react';
|
|
225
|
-
import { Button, Input, Label, Card, CardHeader, CardTitle, CardDescription, CardContent } from '@machinemetrics/mm-react-components';
|
|
226
|
-
|
|
227
|
-
export function MMComponentsExample() {
|
|
228
|
-
return (
|
|
229
|
-
<div className="carbide p-8 space-y-6">
|
|
230
|
-
<h1 className="text-3xl font-bold">MM React Components</h1>
|
|
231
|
-
|
|
232
|
-
{/* Button Examples */}
|
|
233
|
-
<div className="space-y-4">
|
|
234
|
-
<h2 className="text-xl font-semibold">Buttons</h2>
|
|
235
|
-
<div className="flex gap-4">
|
|
236
|
-
<Button>Default</Button>
|
|
237
|
-
<Button variant="secondary">Secondary</Button>
|
|
238
|
-
<Button variant="outline">Outline</Button>
|
|
239
|
-
<Button variant="destructive">Destructive</Button>
|
|
240
|
-
</div>
|
|
241
|
-
</div>
|
|
242
|
-
|
|
243
|
-
{/* Form Example */}
|
|
244
|
-
<div className="space-y-4">
|
|
245
|
-
<h2 className="text-xl font-semibold">Form Components</h2>
|
|
246
|
-
<div className="w-96 space-y-4">
|
|
247
|
-
<div>
|
|
248
|
-
<Label htmlFor="machine-name">Machine Name</Label>
|
|
249
|
-
<Input id="machine-name" placeholder="Enter machine name" />
|
|
250
|
-
</div>
|
|
251
|
-
<Button>Save Configuration</Button>
|
|
252
|
-
</div>
|
|
253
|
-
</div>
|
|
254
|
-
|
|
255
|
-
{/* Card Example using actual Card components */}
|
|
256
|
-
<div className="space-y-4">
|
|
257
|
-
<h2 className="text-xl font-semibold">Card Components</h2>
|
|
258
|
-
<Card className="w-96">
|
|
259
|
-
<CardHeader>
|
|
260
|
-
<CardTitle>Machine Status</CardTitle>
|
|
261
|
-
<CardDescription>CNC-101 • Floor 1, Bay A</CardDescription>
|
|
262
|
-
</CardHeader>
|
|
263
|
-
<CardContent>
|
|
264
|
-
<div className="space-y-2">
|
|
265
|
-
<div className="flex justify-between">
|
|
266
|
-
<span className="text-sm text-muted-foreground">Status</span>
|
|
267
|
-
<span className="text-sm font-medium">Running</span>
|
|
268
|
-
</div>
|
|
269
|
-
<div className="flex justify-between">
|
|
270
|
-
<span className="text-sm text-muted-foreground">Uptime</span>
|
|
271
|
-
<span className="text-sm font-medium">127h 45m</span>
|
|
272
|
-
</div>
|
|
273
|
-
</div>
|
|
274
|
-
<div className="mt-4">
|
|
275
|
-
<Button>View Details</Button>
|
|
276
|
-
</div>
|
|
277
|
-
</CardContent>
|
|
278
|
-
</Card>
|
|
279
|
-
</div>
|
|
280
|
-
</div>
|
|
281
|
-
);
|
|
282
|
-
}`;
|
|
283
|
-
|
|
284
|
-
fs.writeFileSync(
|
|
285
|
-
path.join(examplesDir, 'MMComponentsExample.tsx'),
|
|
286
|
-
exampleComponent,
|
|
287
|
-
);
|
|
288
|
-
log('✅ Created example component', 'green');
|
|
289
|
-
|
|
290
|
-
// Create JavaScript theme activation example
|
|
291
|
-
const themeActivationExample = `// MM React Components - Zero Config Setup
|
|
292
|
-
// The CSS is already imported via @import in index.css
|
|
293
|
-
|
|
294
|
-
// Activate the Carbide industrial theme by adding the class to your root element
|
|
295
|
-
|
|
296
|
-
// Option 1: Add to HTML (recommended)
|
|
297
|
-
// In your index.html or App component:
|
|
298
|
-
// <div className="carbide">
|
|
299
|
-
// <App />
|
|
300
|
-
// </div>
|
|
301
|
-
|
|
302
|
-
// Option 2: JavaScript activation
|
|
303
|
-
// Add this to your main entry file (e.g., src/main.tsx or src/index.tsx):
|
|
304
|
-
document.documentElement.classList.add('carbide');
|
|
305
|
-
|
|
306
|
-
// The carbide theme provides:
|
|
307
|
-
// • Industrial-appropriate colors and styling
|
|
308
|
-
// • Dark mode support
|
|
309
|
-
// • Enhanced focus states for accessibility
|
|
310
|
-
// • Pre-compiled Tailwind utilities
|
|
311
|
-
|
|
312
|
-
// No build tools needed!`;
|
|
313
|
-
|
|
314
|
-
fs.writeFileSync(
|
|
315
|
-
path.join(examplesDir, 'theme-activation.js'),
|
|
316
|
-
themeActivationExample,
|
|
317
|
-
);
|
|
318
|
-
log('✅ Created theme activation example', 'green');
|
|
319
|
-
|
|
320
|
-
// Success message
|
|
321
|
-
log(`\n🎉 Zero-Config Setup Complete!`, 'green');
|
|
322
|
-
log('\n📚 What was installed:', 'bright');
|
|
323
|
-
log(` • @machinemetrics/mm-react-components@${version}`);
|
|
324
|
-
log(' • Pre-compiled CSS with all styles');
|
|
325
|
-
log(' • Example component in mm-components-examples/');
|
|
326
|
-
log(' • Theme activation example in mm-components-examples/');
|
|
327
|
-
|
|
328
|
-
log('\n✅ What you got:', 'bright');
|
|
329
|
-
log(' • Pre-compiled CSS with all Tailwind utilities');
|
|
330
|
-
log(' • Carbide industrial theme');
|
|
331
|
-
log(' • Dark mode support');
|
|
332
|
-
log(' • All component styles (focus, hover, etc.)');
|
|
333
|
-
log(' • Google Fonts included');
|
|
334
|
-
|
|
335
|
-
log('\n💡 No build tools needed!', 'yellow');
|
|
336
|
-
log(' This is a zero-config setup - everything just works!');
|
|
337
|
-
|
|
338
|
-
log('\n🚀 Next steps:', 'bright');
|
|
339
|
-
log(' 1. Add Carbide class to your root element:');
|
|
340
|
-
log(' document.documentElement.classList.add("carbide")', 'cyan');
|
|
341
|
-
log(' 2. Import components:');
|
|
342
|
-
log(
|
|
343
|
-
' import { Button, Input } from "@machinemetrics/mm-react-components"',
|
|
344
|
-
'cyan',
|
|
345
|
-
);
|
|
346
|
-
log(' 3. Check out the example:');
|
|
347
|
-
log(' ./mm-components-examples/MMComponentsExample.tsx', 'cyan');
|
|
348
|
-
log(' 4. Use components - everything is pre-styled and ready!');
|
|
349
|
-
|
|
350
|
-
log('\n📖 Documentation:', 'bright');
|
|
351
|
-
log(' • Getting Started: docs/GETTING_STARTED.md');
|
|
352
|
-
log(' • CSS Options: docs/CSS_EXPORTS.md');
|
|
353
|
-
log(' • Dependencies: docs/DEPENDENCIES.md');
|
|
354
|
-
log(' • GitHub: https://github.com/machinemetrics/mm-react-components');
|
|
355
|
-
|
|
356
|
-
// Offer Carbide AI skill installation
|
|
357
|
-
log('\n🤖 Carbide AI skill', 'bright');
|
|
358
|
-
log(
|
|
359
|
-
' Install the mm-carbide skill so your AI assistant can generate Carbide-styled UIs.\n',
|
|
360
|
-
'cyan',
|
|
361
|
-
);
|
|
362
|
-
const installSkillAnswer = await askQuestion(
|
|
363
|
-
' Install the Carbide skill for your AI editor? (y/N): ',
|
|
364
|
-
);
|
|
365
|
-
if (
|
|
366
|
-
installSkillAnswer.toLowerCase() === 'y' ||
|
|
367
|
-
installSkillAnswer.toLowerCase() === 'yes'
|
|
368
|
-
) {
|
|
369
|
-
const aiPrompt =
|
|
370
|
-
' Which AI do you use? (1) Cursor (2) VS Code / GitHub Copilot (3) Claude Code (4) Gemini CLI: ';
|
|
371
|
-
const aiAnswer = (await askQuestion(aiPrompt)).trim().toLowerCase();
|
|
372
|
-
const targetMap = {
|
|
373
|
-
'1': 'cursor',
|
|
374
|
-
cursor: 'cursor',
|
|
375
|
-
'2': 'copilot',
|
|
376
|
-
copilot: 'copilot',
|
|
377
|
-
'3': 'claude',
|
|
378
|
-
claude: 'claude',
|
|
379
|
-
'4': 'gemini',
|
|
380
|
-
gemini: 'gemini',
|
|
381
|
-
};
|
|
382
|
-
const target = targetMap[aiAnswer] || 'cursor';
|
|
383
|
-
const installSkillPath = path.join(__dirname, 'install-skill.cjs');
|
|
384
|
-
if (fs.existsSync(installSkillPath)) {
|
|
385
|
-
try {
|
|
386
|
-
execSync(
|
|
387
|
-
`node "${installSkillPath}" --target=${target} --scope=project`,
|
|
388
|
-
{ stdio: 'inherit' },
|
|
389
|
-
);
|
|
390
|
-
} catch (err) {
|
|
391
|
-
log(' Could not run skill installer.', 'yellow');
|
|
392
|
-
log(
|
|
393
|
-
' You can install later: npx @machinemetrics/mm-react-components mm-install-skill --target=<cursor|copilot|claude|gemini>',
|
|
394
|
-
'cyan',
|
|
395
|
-
);
|
|
396
|
-
}
|
|
397
|
-
} else {
|
|
398
|
-
log(' Skill installer not found; install later with mm-install-skill.', 'yellow');
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
// Offer Chakra migration if detected
|
|
403
|
-
if (hasChakra) {
|
|
404
|
-
log('\n🔄 Chakra UI Detected!', 'yellow');
|
|
405
|
-
log(
|
|
406
|
-
' We can help you migrate from Chakra UI to MM React Components\n',
|
|
407
|
-
'cyan',
|
|
408
|
-
);
|
|
409
|
-
|
|
410
|
-
const answer = await askQuestion(
|
|
411
|
-
' Would you like to run the Chakra UI migration now? (y/N): ',
|
|
412
|
-
);
|
|
413
|
-
|
|
414
|
-
if (answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes') {
|
|
415
|
-
log('\n🔄 Starting Chakra UI migration...', 'cyan');
|
|
416
|
-
|
|
417
|
-
const migrationScriptPath = path.join(
|
|
418
|
-
__dirname,
|
|
419
|
-
'chakra-to-shadcn-migrator',
|
|
420
|
-
'bin',
|
|
421
|
-
'chakra-to-shadcn.js',
|
|
422
|
-
);
|
|
423
|
-
const migrationConfigPath = path.join(
|
|
424
|
-
__dirname,
|
|
425
|
-
'chakra-to-shadcn-migrator',
|
|
426
|
-
'chakra-to-shadcn.config.json',
|
|
427
|
-
);
|
|
428
|
-
|
|
429
|
-
if (fs.existsSync(migrationScriptPath)) {
|
|
430
|
-
try {
|
|
431
|
-
execSync(
|
|
432
|
-
`node "${migrationScriptPath}" --config "${migrationConfigPath}" --apply`,
|
|
433
|
-
{
|
|
434
|
-
stdio: 'inherit',
|
|
435
|
-
},
|
|
436
|
-
);
|
|
437
|
-
log('\n✅ Chakra UI migration complete!', 'green');
|
|
438
|
-
} catch (error) {
|
|
439
|
-
log('\n⚠️ Migration encountered issues', 'yellow');
|
|
440
|
-
log(` ${error.message}`, 'yellow');
|
|
441
|
-
log(
|
|
442
|
-
' You can run it manually: node scripts/chakra-to-shadcn-migrator/chakra-to-shadcn.js',
|
|
443
|
-
'cyan',
|
|
444
|
-
);
|
|
445
|
-
}
|
|
446
|
-
} else {
|
|
447
|
-
log(
|
|
448
|
-
'\n⚠️ Migration script not found at expected location',
|
|
449
|
-
'yellow',
|
|
450
|
-
);
|
|
451
|
-
log(
|
|
452
|
-
' Clone the repo to access migration tools: https://github.com/machinemetrics/mm-react-components',
|
|
453
|
-
'cyan',
|
|
454
|
-
);
|
|
455
|
-
}
|
|
456
|
-
} else {
|
|
457
|
-
log('\n No problem! You can migrate later with:', 'cyan');
|
|
458
|
-
log(
|
|
459
|
-
' node scripts/chakra-to-shadcn-migrator/chakra-to-shadcn.js --apply',
|
|
460
|
-
'cyan',
|
|
461
|
-
);
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
log('\n🚀 Happy coding!', 'cyan');
|
|
466
|
-
} catch (error) {
|
|
467
|
-
log(`❌ Setup failed: ${error.message}`, 'red');
|
|
468
|
-
process.exit(1);
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
if (require.main === module) {
|
|
473
|
-
main().catch((error) => {
|
|
474
|
-
log(`❌ Setup failed: ${error.message}`, 'red');
|
|
475
|
-
process.exit(1);
|
|
476
|
-
});
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
module.exports = { main };
|