Skip to content

Commit 50849ad

Browse files
committed
feat: migrateTable
1 parent 7eeb986 commit 50849ad

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { readFileSync, writeFileSync } from 'node:fs';
2+
3+
function migrateThead() {
4+
const filePath = 'src/table/thead.tsx';
5+
let content = readFileSync(filePath, 'utf8');
6+
if (content.includes('setup(props: TheadProps')) {
7+
content = content.replace('setup(props: TheadProps', 'setup(props');
8+
writeFileSync(filePath, content, 'utf8');
9+
}
10+
}
11+
function migrateTbody() {
12+
const filePath = 'src/table/tbody.tsx';
13+
let content = readFileSync(filePath, 'utf8');
14+
if (content.includes('setup(props: TableBodyProps')) {
15+
content = content.replace('setup(props: TableBodyProps', 'setup(props');
16+
writeFileSync(filePath, content, 'utf8');
17+
}
18+
}
19+
function migrateTfoot() {
20+
const filePath = 'src/table/tfoot.tsx';
21+
let content = readFileSync(filePath, 'utf8');
22+
if (content.includes('setup(props: TFootProps')) {
23+
content = content.replace('setup(props: TFootProps', 'setup(props');
24+
writeFileSync(filePath, content, 'utf8');
25+
}
26+
}
27+
function migrateTr() {
28+
const filePath = 'src/table/tr.tsx';
29+
let content = readFileSync(filePath, 'utf8');
30+
if (content.includes('setup(props: TrProps')) {
31+
content = content.replace('setup(props: TrProps', 'setup(props');
32+
writeFileSync(filePath, content, 'utf8');
33+
}
34+
}
35+
export default function migrateTable() {
36+
migrateThead();
37+
migrateTbody();
38+
migrateTfoot();
39+
migrateTr();
40+
}

script/migrate/migrateComponent.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import migrateHelper from './utils/helper.mjs';
1010
import migrateRenderTNode from './utils/render-tnode.mjs';
1111
import migrateHooks from './hooks/index.mjs';
1212
import migrateUpload from './components/upload.mjs';
13+
import migrateTable from './components/table.mjs';
1314

1415
function run() {
1516
migrateSingleFile();
@@ -20,6 +21,7 @@ function run() {
2021
migrateDropdown();
2122
migrateCard();
2223
migrateUpload();
24+
migrateTable();
2325
migrateTree();
2426

2527
migrateHelper();

0 commit comments

Comments
 (0)