-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.mjs
58 lines (53 loc) · 1.01 KB
/
init.mjs
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import fs from 'fs';
import path from 'path';
const __dirname = path.resolve();
// 생성할 JSON 파일과 기본 내용 정의
const files = [
{
name: 'enPostMetadata.json',
content: [],
},
{
name: 'enPostTags.json',
content: [],
},
{
name: 'enPosts.json',
content: [],
},
{
name: 'postMetadata.json',
content: [],
},
{
name: 'postTags.json',
content: [],
},
{
name: 'posts.json',
content: [],
},
{
name: 'translations.json',
content: [],
},
{
name: 'translationsMetadata.json',
content: [],
},
];
// JSON 파일 생성 함수
function createJsonFiles() {
files.forEach((file) => {
const filePath = path.join(__dirname, '.velite', file.name);
if (!fs.existsSync(filePath)) {
fs.writeFileSync(filePath, JSON.stringify(file.content, null, 2));
console.log(`✅ Created: ${file.name}`);
}
else {
console.log(`⚠️ File already exists: ${file.name}`);
}
});
}
// 실행
createJsonFiles();