forked from Oky-period-tracker/periodtracker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetContent.ts
87 lines (66 loc) · 1.77 KB
/
getContent.ts
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import fs from 'fs'
import {
fromAvatarMessages,
fromDidYouKnows,
fromEncyclopedia,
fromHelpCenters,
fromQuizzes,
} from '@oky/core'
import { StaticContent } from './app/src/core/types'
const locale = 'en'
// /mobile/articles/en
const encyclopediaResponse = []
// /mobile/videos/en
const videosResponse = []
// /mobile/privacy-policy/en
const privacyPolicy = []
// /mobile/terms-and-conditions/en
const termsAndConditions = []
// /mobile/about/en
const about = []
//
const timestamp = 0
// /mobile/about-banner/en
const aboutBanner = []
// /mobile/help-center/en
const helpCenterResponse = []
// /mobile/help-center-attribute/en
const helpCenterAttributesResponse = []
// /mobile/quizzes/en
const quizzesResponse = []
// /mobile/didyouknows/en
const didYouKnowsResponse = []
// /mobile/avatar-messages/en
const avatarMessagesResponse = []
const { articles, categories, subCategories, videos } = fromEncyclopedia({
encyclopediaResponse,
videosResponse,
})
const { quizzes } = fromQuizzes(quizzesResponse)
const { didYouKnows } = fromDidYouKnows(didYouKnowsResponse)
const { helpCenters } = fromHelpCenters(helpCenterResponse)
const helpCenterAttributes = helpCenterAttributesResponse
const { avatarMessages } = fromAvatarMessages(avatarMessagesResponse)
const result: StaticContent = {
locale,
articles,
categories,
subCategories,
quizzes,
didYouKnows,
helpCenters,
helpCenterAttributes,
avatarMessages,
privacyPolicy,
termsAndConditions,
about,
allSurveys: [],
completedSurveys: [],
// aboutBanner: string,
videos,
}
const outputFilepath = `${locale}.ts`
const outputString = `
import { StaticContent } from '../../../core/types'
export const ${locale}: StaticContent = ${JSON.stringify(result)}`
fs.writeFileSync(outputFilepath, outputString)