@razorpay/blade 11.34.1 → 11.36.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.
- package/build/lib/native/components/Box/BaseBox/types/propsTypes.js.map +1 -1
- package/build/lib/native/components/Card/Card.js.map +1 -1
- package/build/lib/native/components/Icons/Battery100PercentIcon/Battery100PercentIcon.js +12 -0
- package/build/lib/native/components/Icons/Battery100PercentIcon/Battery100PercentIcon.js.map +1 -0
- package/build/lib/native/components/Icons/Battery20PercentIcon/Battery20PercentIcon.js +12 -0
- package/build/lib/native/components/Icons/Battery20PercentIcon/Battery20PercentIcon.js.map +1 -0
- package/build/lib/native/components/Icons/Battery40PercentIcon/Battery40PercentIcon.js +12 -0
- package/build/lib/native/components/Icons/Battery40PercentIcon/Battery40PercentIcon.js.map +1 -0
- package/build/lib/native/components/Icons/Battery60PercentIcon/Battery60PercentIcon.js +12 -0
- package/build/lib/native/components/Icons/Battery60PercentIcon/Battery60PercentIcon.js.map +1 -0
- package/build/lib/native/components/Icons/Battery80PercentIcon/Battery80PercentIcon.js +12 -0
- package/build/lib/native/components/Icons/Battery80PercentIcon/Battery80PercentIcon.js.map +1 -0
- package/build/lib/native/components/Icons/BillMeIcon/BillMeIcon.js +12 -0
- package/build/lib/native/components/Icons/BillMeIcon/BillMeIcon.js.map +1 -0
- package/build/lib/native/components/Icons/NoSignalIcon/NoSignalIcon.js +12 -0
- package/build/lib/native/components/Icons/NoSignalIcon/NoSignalIcon.js.map +1 -0
- package/build/lib/native/components/Icons/Signal1BarIcon/Signal1BarIcon.js +12 -0
- package/build/lib/native/components/Icons/Signal1BarIcon/Signal1BarIcon.js.map +1 -0
- package/build/lib/native/components/Icons/Signal2BarIcon/Signal2BarIcon.js +12 -0
- package/build/lib/native/components/Icons/Signal2BarIcon/Signal2BarIcon.js.map +1 -0
- package/build/lib/native/components/Icons/Signal3BarIcon/Signal3BarIcon.js +12 -0
- package/build/lib/native/components/Icons/Signal3BarIcon/Signal3BarIcon.js.map +1 -0
- package/build/lib/native/components/Icons/Signal4BarIcon/Signal4BarIcon.js +12 -0
- package/build/lib/native/components/Icons/Signal4BarIcon/Signal4BarIcon.js.map +1 -0
- package/build/lib/native/components/Icons/SignalIcon/SignalIcon.js +12 -0
- package/build/lib/native/components/Icons/SignalIcon/SignalIcon.js.map +1 -0
- package/build/lib/native/components/Icons/SimCardIcon/SimCardIcon.js +12 -0
- package/build/lib/native/components/Icons/SimCardIcon/SimCardIcon.js.map +1 -0
- package/build/lib/native/components/Icons/TwitterIcon/TwitterIcon.js +1 -1
- package/build/lib/native/components/Icons/TwitterIcon/TwitterIcon.js.map +1 -1
- package/build/lib/native/components/Icons/UpiIcon/UpiIcon.js +12 -0
- package/build/lib/native/components/Icons/UpiIcon/UpiIcon.js.map +1 -0
- package/build/lib/native/components/Icons/YoutubeIcon/YoutubeIcon.js +12 -0
- package/build/lib/native/components/Icons/YoutubeIcon/YoutubeIcon.js.map +1 -0
- package/build/lib/native/components/Input/TextInput/TextInput.js.map +1 -1
- package/build/lib/native/components/index.js +15 -0
- package/build/lib/native/components/index.js.map +1 -1
- package/build/lib/native/utils/useCallbackRef.js +6 -0
- package/build/lib/native/utils/useCallbackRef.js.map +1 -0
- package/build/lib/native/utils/useControllable.js +2 -1
- package/build/lib/native/utils/useControllable.js.map +1 -1
- package/build/lib/web/development/components/Box/BaseBox/types/propsTypes.js.map +1 -1
- package/build/lib/web/development/components/Card/Card.js.map +1 -1
- package/build/lib/web/development/components/Carousel/Carousel.web.js +65 -57
- package/build/lib/web/development/components/Carousel/Carousel.web.js.map +1 -1
- package/build/lib/web/development/components/Icons/Battery100PercentIcon/Battery100PercentIcon.js +57 -0
- package/build/lib/web/development/components/Icons/Battery100PercentIcon/Battery100PercentIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/Battery100PercentIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/Battery100PercentIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/Battery20PercentIcon/Battery20PercentIcon.js +45 -0
- package/build/lib/web/development/components/Icons/Battery20PercentIcon/Battery20PercentIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/Battery20PercentIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/Battery20PercentIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/Battery40PercentIcon/Battery40PercentIcon.js +48 -0
- package/build/lib/web/development/components/Icons/Battery40PercentIcon/Battery40PercentIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/Battery40PercentIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/Battery40PercentIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/Battery60PercentIcon/Battery60PercentIcon.js +51 -0
- package/build/lib/web/development/components/Icons/Battery60PercentIcon/Battery60PercentIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/Battery60PercentIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/Battery60PercentIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/Battery80PercentIcon/Battery80PercentIcon.js +54 -0
- package/build/lib/web/development/components/Icons/Battery80PercentIcon/Battery80PercentIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/Battery80PercentIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/Battery80PercentIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/BillMeIcon/BillMeIcon.js +51 -0
- package/build/lib/web/development/components/Icons/BillMeIcon/BillMeIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/BillMeIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/BillMeIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/NoSignalIcon/NoSignalIcon.js +37 -0
- package/build/lib/web/development/components/Icons/NoSignalIcon/NoSignalIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/NoSignalIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/NoSignalIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/Signal1BarIcon/Signal1BarIcon.js +37 -0
- package/build/lib/web/development/components/Icons/Signal1BarIcon/Signal1BarIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/Signal1BarIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/Signal1BarIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/Signal2BarIcon/Signal2BarIcon.js +37 -0
- package/build/lib/web/development/components/Icons/Signal2BarIcon/Signal2BarIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/Signal2BarIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/Signal2BarIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/Signal3BarIcon/Signal3BarIcon.js +37 -0
- package/build/lib/web/development/components/Icons/Signal3BarIcon/Signal3BarIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/Signal3BarIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/Signal3BarIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/Signal4BarIcon/Signal4BarIcon.js +37 -0
- package/build/lib/web/development/components/Icons/Signal4BarIcon/Signal4BarIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/Signal4BarIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/Signal4BarIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/SignalIcon/SignalIcon.js +37 -0
- package/build/lib/web/development/components/Icons/SignalIcon/SignalIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/SignalIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/SignalIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/SimCardIcon/SimCardIcon.js +57 -0
- package/build/lib/web/development/components/Icons/SimCardIcon/SimCardIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/SimCardIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/SimCardIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/TwitterIcon/TwitterIcon.js +1 -1
- package/build/lib/web/development/components/Icons/TwitterIcon/TwitterIcon.js.map +1 -1
- package/build/lib/web/development/components/Icons/UpiIcon/UpiIcon.js +39 -0
- package/build/lib/web/development/components/Icons/UpiIcon/UpiIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/UpiIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/UpiIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/YoutubeIcon/YoutubeIcon.js +44 -0
- package/build/lib/web/development/components/Icons/YoutubeIcon/YoutubeIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/YoutubeIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/YoutubeIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/index.js +15 -0
- package/build/lib/web/development/components/Icons/index.js.map +1 -1
- package/build/lib/web/development/components/Input/TextInput/TextInput.js.map +1 -1
- package/build/lib/web/development/components/Modal/ModalBody.web.js.map +1 -1
- package/build/lib/web/development/components/index.js +15 -0
- package/build/lib/web/development/components/index.js.map +1 -1
- package/build/lib/web/development/utils/useCallbackRef.js +31 -0
- package/build/lib/web/development/utils/useCallbackRef.js.map +1 -0
- package/build/lib/web/development/utils/useControllable.js +13 -5
- package/build/lib/web/development/utils/useControllable.js.map +1 -1
- package/build/lib/web/production/components/Box/BaseBox/types/propsTypes.js.map +1 -1
- package/build/lib/web/production/components/Card/Card.js.map +1 -1
- package/build/lib/web/production/components/Carousel/Carousel.web.js +65 -57
- package/build/lib/web/production/components/Carousel/Carousel.web.js.map +1 -1
- package/build/lib/web/production/components/Icons/Battery100PercentIcon/Battery100PercentIcon.js +57 -0
- package/build/lib/web/production/components/Icons/Battery100PercentIcon/Battery100PercentIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/Battery100PercentIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/Battery100PercentIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/Battery20PercentIcon/Battery20PercentIcon.js +45 -0
- package/build/lib/web/production/components/Icons/Battery20PercentIcon/Battery20PercentIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/Battery20PercentIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/Battery20PercentIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/Battery40PercentIcon/Battery40PercentIcon.js +48 -0
- package/build/lib/web/production/components/Icons/Battery40PercentIcon/Battery40PercentIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/Battery40PercentIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/Battery40PercentIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/Battery60PercentIcon/Battery60PercentIcon.js +51 -0
- package/build/lib/web/production/components/Icons/Battery60PercentIcon/Battery60PercentIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/Battery60PercentIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/Battery60PercentIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/Battery80PercentIcon/Battery80PercentIcon.js +54 -0
- package/build/lib/web/production/components/Icons/Battery80PercentIcon/Battery80PercentIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/Battery80PercentIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/Battery80PercentIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/BillMeIcon/BillMeIcon.js +51 -0
- package/build/lib/web/production/components/Icons/BillMeIcon/BillMeIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/BillMeIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/BillMeIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/NoSignalIcon/NoSignalIcon.js +37 -0
- package/build/lib/web/production/components/Icons/NoSignalIcon/NoSignalIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/NoSignalIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/NoSignalIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/Signal1BarIcon/Signal1BarIcon.js +37 -0
- package/build/lib/web/production/components/Icons/Signal1BarIcon/Signal1BarIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/Signal1BarIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/Signal1BarIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/Signal2BarIcon/Signal2BarIcon.js +37 -0
- package/build/lib/web/production/components/Icons/Signal2BarIcon/Signal2BarIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/Signal2BarIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/Signal2BarIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/Signal3BarIcon/Signal3BarIcon.js +37 -0
- package/build/lib/web/production/components/Icons/Signal3BarIcon/Signal3BarIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/Signal3BarIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/Signal3BarIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/Signal4BarIcon/Signal4BarIcon.js +37 -0
- package/build/lib/web/production/components/Icons/Signal4BarIcon/Signal4BarIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/Signal4BarIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/Signal4BarIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/SignalIcon/SignalIcon.js +37 -0
- package/build/lib/web/production/components/Icons/SignalIcon/SignalIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/SignalIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/SignalIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/SimCardIcon/SimCardIcon.js +57 -0
- package/build/lib/web/production/components/Icons/SimCardIcon/SimCardIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/SimCardIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/SimCardIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/TwitterIcon/TwitterIcon.js +1 -1
- package/build/lib/web/production/components/Icons/TwitterIcon/TwitterIcon.js.map +1 -1
- package/build/lib/web/production/components/Icons/UpiIcon/UpiIcon.js +39 -0
- package/build/lib/web/production/components/Icons/UpiIcon/UpiIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/UpiIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/UpiIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/YoutubeIcon/YoutubeIcon.js +44 -0
- package/build/lib/web/production/components/Icons/YoutubeIcon/YoutubeIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/YoutubeIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/YoutubeIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/index.js +15 -0
- package/build/lib/web/production/components/Icons/index.js.map +1 -1
- package/build/lib/web/production/components/Input/TextInput/TextInput.js.map +1 -1
- package/build/lib/web/production/components/Modal/ModalBody.web.js.map +1 -1
- package/build/lib/web/production/components/index.js +15 -0
- package/build/lib/web/production/components/index.js.map +1 -1
- package/build/lib/web/production/utils/useCallbackRef.js +31 -0
- package/build/lib/web/production/utils/useCallbackRef.js.map +1 -0
- package/build/lib/web/production/utils/useControllable.js +13 -5
- package/build/lib/web/production/utils/useControllable.js.map +1 -1
- package/build/types/components/index.d.ts +64 -23
- package/build/types/components/index.native.d.ts +62 -21
- package/codemods/aicodemod/README.md +26 -0
- package/codemods/aicodemod/bin.mjs +128 -0
- package/codemods/aicodemod/knowledge/Table.md +596 -0
- package/codemods/aicodemod/knowledge/presets/dashboard/table-pattern-1.md +319 -0
- package/package.json +4 -2
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Blade AI Codemod
|
|
2
|
+
|
|
3
|
+
## 1. Install Blade Globally
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install -g @razorpay/blade
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## 2. Run `aicodemod` Command to Migrate
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
aicodemod <path-to-migrate>
|
|
13
|
+
--code-knowledge presets/dashboard/table-pattern-1
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`--code-knowledge`: The AI needs some info about existing codebase and some patterns on how to migrate. We currently have created a preset knowledge for migrating one of the patterns in table.
|
|
17
|
+
|
|
18
|
+
## 3. Fix any visual or syntax issues if there
|
|
19
|
+
|
|
20
|
+
AI Codemod is there to help you get going with migration. You might still have 10% work left to review if the code logic is in place and visually things are looking as expected.
|
|
21
|
+
|
|
22
|
+
> [!NOTE]
|
|
23
|
+
>
|
|
24
|
+
> **POC Limitations**
|
|
25
|
+
>
|
|
26
|
+
> As currently its just POC, its optimized to only migrate to Blade Table component. It can also
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
|
|
5
|
+
const getFlagValue = (flag) => {
|
|
6
|
+
const flagIndex = process.argv.indexOf(flag);
|
|
7
|
+
if (flagIndex < 0) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return process.argv[flagIndex + 1];
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// This is for passing ngrok instance URL
|
|
15
|
+
const BASE_URL = 'https://blade-chat.dev.razorpay.in';
|
|
16
|
+
const SERVER_ENDPOINT = '/chat';
|
|
17
|
+
|
|
18
|
+
const preset = getFlagValue('--code-knowledge') ?? 'presets/dashboard/table-pattern-1';
|
|
19
|
+
|
|
20
|
+
const getChatCompletionFromServer = async (messages) => {
|
|
21
|
+
const url = BASE_URL + SERVER_ENDPOINT;
|
|
22
|
+
|
|
23
|
+
// Define the fetch options
|
|
24
|
+
const options = {
|
|
25
|
+
method: 'POST',
|
|
26
|
+
headers: {
|
|
27
|
+
'Content-Type': 'application/json',
|
|
28
|
+
'rzpctx-dev-serve-user': 'base',
|
|
29
|
+
},
|
|
30
|
+
body: JSON.stringify({ input: messages }),
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
// Make the fetch call
|
|
35
|
+
const response = await fetch(url, options);
|
|
36
|
+
return response.text();
|
|
37
|
+
} catch (err) {
|
|
38
|
+
throw err;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const __dirname = new URL('.', import.meta.url).pathname;
|
|
43
|
+
const cwd = process.cwd();
|
|
44
|
+
|
|
45
|
+
let codeKnowledge;
|
|
46
|
+
const consumerPresetPath = path.join(cwd, preset);
|
|
47
|
+
const predefinedPresetPath = path.join(__dirname, 'knowledge', `${preset}.md`);
|
|
48
|
+
|
|
49
|
+
if (fs.existsSync(consumerPresetPath)) {
|
|
50
|
+
codeKnowledge = fs.readFileSync(consumerPresetPath, 'utf-8');
|
|
51
|
+
} else {
|
|
52
|
+
codeKnowledge = fs.readFileSync(predefinedPresetPath, 'utf-8');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const bladeKnowledge = fs.readFileSync(path.resolve(__dirname, './knowledge/Table.md'), 'utf-8');
|
|
56
|
+
|
|
57
|
+
const usageFileArg = process.argv[2];
|
|
58
|
+
const usageFilePath = path.join(cwd, usageFileArg);
|
|
59
|
+
const usage = fs.readFileSync(usageFilePath, 'utf-8');
|
|
60
|
+
|
|
61
|
+
const ultimatePrompt = `
|
|
62
|
+
I want you to migrate our old codebase code from custom implementation, to use our design-system component called Blade.
|
|
63
|
+
|
|
64
|
+
You will find code snippets of these things below-
|
|
65
|
+
|
|
66
|
+
1. Blade's Table Documentation: Documentation of our design-system table
|
|
67
|
+
2. Custom Component Definitions: Custom component implementations to help figure out what some of the internally used components do
|
|
68
|
+
3. Migration Example: A reference example of migration. How the output migrated code would look like on given certain input.
|
|
69
|
+
4. Code to Migrate: Migrate this code to use our design-system components
|
|
70
|
+
|
|
71
|
+
Return Format:
|
|
72
|
+
- Refer to Blade's Table documentation and Custom Component Definitons and Migration Example and return the migrated code snippet of usage using Blade
|
|
73
|
+
- Return raw migrated code without additional text
|
|
74
|
+
- Don't change unrelated code and imports
|
|
75
|
+
- If something existed in previous code, but does not map to anything in new code. Add a TODO comment describing what needs to be done
|
|
76
|
+
- Remove unused variables, functions, and imports
|
|
77
|
+
- Make sure Blade's Header and Footer are also used wherever needed.
|
|
78
|
+
- Ignore the code related to mobile responsiveness as Blade components are responsive by default
|
|
79
|
+
|
|
80
|
+
## 1. Blade's Table Documentation
|
|
81
|
+
${bladeKnowledge}
|
|
82
|
+
|
|
83
|
+
${codeKnowledge}
|
|
84
|
+
|
|
85
|
+
## 4. Code to Migrate
|
|
86
|
+
\`\`\`jsx
|
|
87
|
+
${usage}
|
|
88
|
+
\`\`\`
|
|
89
|
+
`;
|
|
90
|
+
|
|
91
|
+
const messages = [
|
|
92
|
+
{
|
|
93
|
+
role: 'system',
|
|
94
|
+
content: [
|
|
95
|
+
{
|
|
96
|
+
type: 'text',
|
|
97
|
+
text:
|
|
98
|
+
'You are an AI assistant that helps in migrating codebase from old custom implementation to our internal design-system components',
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
role: 'user',
|
|
104
|
+
content: [
|
|
105
|
+
{
|
|
106
|
+
type: 'text',
|
|
107
|
+
text: ultimatePrompt,
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
];
|
|
112
|
+
|
|
113
|
+
const answer = await getChatCompletionFromServer(messages);
|
|
114
|
+
|
|
115
|
+
if (answer) {
|
|
116
|
+
console.log('USAGE STATS', {
|
|
117
|
+
inputLength: JSON.stringify(messages).length,
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const cleanOut = answer.startsWith('```jsx')
|
|
121
|
+
? answer.slice(`\`\`\`jsx`.length + 1, -('```'.length + 1))
|
|
122
|
+
: answer;
|
|
123
|
+
fs.writeFileSync(usageFilePath, cleanOut);
|
|
124
|
+
} else {
|
|
125
|
+
console.log(
|
|
126
|
+
"Something's not right. The server didn't respond correctly. Hopefully there are more helpful logs above ^^",
|
|
127
|
+
);
|
|
128
|
+
}
|