-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrenameLables.js
40 lines (36 loc) · 1.18 KB
/
renameLables.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import fs from 'fs'
// read src\generated\client\index.ts and replace all label_replace_by_generated_column by label
fs.readFile('src/generated/client/index.ts', 'utf8', function (err, data) {
if (err) {
return console.log(err)
}
var result = data.replace(/label_replace_by_generated_column/g, 'label')
fs.writeFile('src/generated/client/index.ts', result, 'utf8', function (err) {
if (err) return console.log(err)
console.log(
'label_replace_by_generated_column replaced by label in src/generated/client/index.ts',
)
})
})
// read src\generated\client\prismaClient.d.ts and replace all label_replace_by_generated_column by label
fs.readFile(
'src/generated/client/prismaClient.d.ts',
'utf8',
function (err, data) {
if (err) {
return console.log(err)
}
var result = data.replace(/label_replace_by_generated_column/g, 'label')
fs.writeFile(
'src/generated/client/prismaClient.d.ts',
result,
'utf8',
function (err) {
if (err) return console.log(err)
console.log(
'label_replace_by_generated_column replaced by label in src/generated/client/prismaClient.d.ts',
)
},
)
},
)