Skip to content

Commit 3fbbbeb

Browse files
author
jj
committed
bump versions add timer
1 parent 8797a38 commit 3fbbbeb

File tree

9 files changed

+713
-853
lines changed

9 files changed

+713
-853
lines changed

‎appConfig.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,6 @@ export const customNavigation: NavItem[] = [{ label: 'Contact', url: '/contact'
5050

5151
// Incremental Static Regenerations (ISR)
5252
export const isr: boolean = true
53+
export const revalidate: number = 10
5354
export const maxNumberOfPosts: number = 20
5455
export const maxNumberOfPages: number = 20

‎lib/processEnv.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export interface ProcessEnvProps {
6464
customNavigation: NavItem[]
6565
isr: {
6666
enable: boolean
67+
revalidate: number
6768
maxNumberOfPosts: number
6869
maxNumberOfPages: number
6970
}
@@ -101,6 +102,7 @@ export const processEnv: ProcessEnvProps = {
101102
customNavigation: reolveJSON(process.env.JAMIFY_CUSTOM_NAVIGATION, appConfig.customNavigation),
102103
isr: {
103104
enable: resolveBool(process.env.JAMIFY_NEXT_ISR, appConfig.isr),
105+
revalidate: resolveNumber(process.env.JAMIFY_NEXT_ISR_REVALIDATE, appConfig.revalidate),
104106
maxNumberOfPosts: resolveNumber(process.env.JAMIFY_NEXT_ISR_MAX_NUMBER_POSTS, appConfig.maxNumberOfPosts),
105107
maxNumberOfPages: resolveNumber(process.env.JAMIFY_NEXT_ISR_MAX_NUMBER_PAGES, appConfig.maxNumberOfPages),
106108
},

‎next-env.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/// <reference types="next" />
2-
/// <reference types="next/types/global" />
32
/// <reference types="next/image-types/global" />
43

54
// NOTE: This file should not be edited

‎package.json

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -39,56 +39,56 @@
3939
"postbuild": "next-sitemap"
4040
},
4141
"dependencies": {
42-
"@tryghost/content-api": "^1.5.13",
42+
"@tryghost/content-api": "^1.5.16",
4343
"cheerio": "^1.0.0-rc.10",
44-
"crypto-hash": "^2.0.0",
44+
"crypto-hash": "^2.0.1",
4545
"dayjs": "^1.10.7",
4646
"disqus-react": "^1.1.2",
4747
"email-validator": "^2.0.4",
4848
"fs": "^0.0.1-security",
4949
"lodash.throttle": "^4.1.1",
50-
"next": "^12.0.1",
51-
"nodemailer": "^6.7.0",
52-
"probe-image-size": "^7.2.1",
50+
"next": "^12.0.7",
51+
"nodemailer": "^6.7.2",
52+
"probe-image-size": "^7.2.2",
5353
"react": "17.0.2",
5454
"react-dom": "17.0.2",
5555
"react-is": "^17.0.2",
5656
"refractor": "^3.3.1",
5757
"rehype": "^11.0.0",
5858
"rehype-react": "^6.2.1",
5959
"rss": "^1.2.2",
60-
"sanitize-html": "^2.5.2",
61-
"sharp": "^0.29.2",
60+
"sanitize-html": "^2.6.1",
61+
"sharp": "^0.29.3",
6262
"unist-util-visit": "^2.0.3"
6363
},
6464
"devDependencies": {
65-
"@next/bundle-analyzer": "^12.0.1",
65+
"@next/bundle-analyzer": "^12.0.7",
6666
"@types/cheerio": "^0.22.30",
67-
"@types/lodash": "^4.14.176",
68-
"@types/node": "^16.11.6",
67+
"@types/lodash": "^4.14.178",
68+
"@types/node": "^16.11.12",
6969
"@types/nodemailer": "^6.4.4",
70-
"@types/react": "^17.0.33",
70+
"@types/react": "^17.0.37",
7171
"@types/refractor": "^3.0.2",
7272
"@types/rss": "^0.0.29",
73-
"@types/sanitize-html": "^2.5.0",
74-
"@types/styled-components": "^5.1.15",
73+
"@types/sanitize-html": "^2.6.0",
74+
"@types/styled-components": "^5.1.17",
7575
"@types/testing-library__react": "^10.2.0",
76-
"@types/tryghost__content-api": "^1.3.7",
77-
"@typescript-eslint/eslint-plugin": "^5.2.0",
78-
"@typescript-eslint/parser": "^5.2.0",
79-
"autoprefixer": "^10.3.7",
80-
"critters": "^0.0.14",
76+
"@types/tryghost__content-api": "^1.3.8",
77+
"@typescript-eslint/eslint-plugin": "^5.6.0",
78+
"@typescript-eslint/parser": "^5.6.0",
79+
"autoprefixer": "^10.4.0",
80+
"critters": "^0.0.15",
8181
"eslint": "<8.0.0",
82-
"eslint-config-next": "^12.0.1",
82+
"eslint-config-next": "^12.0.7",
8383
"eslint-config-prettier": "^8.3.0",
84-
"eslint-plugin-react": "^7.26.1",
85-
"eslint-plugin-react-hooks": "^4.2.0",
86-
"next-sitemap": "^1.6.192",
87-
"postcss": "^8.3.11",
84+
"eslint-plugin-react": "^7.27.1",
85+
"eslint-plugin-react-hooks": "^4.3.0",
86+
"next-sitemap": "^1.6.203",
87+
"postcss": "^8.4.5",
8888
"postcss-color-mod-function": "^3.0.3",
8989
"postcss-easy-import": "^3.0.0",
90-
"postcss-preset-env": "^6.7.0",
91-
"prettier": "^2.4.1",
92-
"typescript": "^4.4.4"
90+
"postcss-preset-env": "^7.0.1",
91+
"prettier": "^2.5.1",
92+
"typescript": "^4.5.3"
9393
}
9494
}

‎pages/[...slug].tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
6565
if (!(params && params.slug && Array.isArray(params.slug))) throw Error('getStaticProps: wrong parameters.')
6666
const [slug] = params.slug.reverse()
6767

68+
console.time('Post - getStaticProps')
69+
6870
const settings = await getAllSettings()
6971

7072
let post: GhostPostOrPage | null = null
@@ -125,6 +127,8 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
125127

126128
const tags = (contactPage && contactPage.tags) || (page && page.tags) || undefined
127129

130+
console.timeEnd('Post - getStaticProps')
131+
128132
return {
129133
props: {
130134
cmsData: {
@@ -140,7 +144,7 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
140144
bodyClass: BodyClass({ isPost, page: contactPage || page || undefined, tags }),
141145
},
142146
},
143-
...(processEnv.isr.enable && { revalidate: 1 }), // re-generate at most once every second
147+
...(processEnv.isr.enable && { revalidate: processEnv.isr.revalidate }), // re-generate at most once every revalidate second
144148
}
145149
}
146150

‎pages/author/[...slug].tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
7979
bodyClass: BodyClass({ author }),
8080
},
8181
},
82-
...(processEnv.isr.enable && { revalidate: 1 }), // re-generate at most once every second
82+
...(processEnv.isr.enable && { revalidate: processEnv.isr.revalidate }), // re-generate at most once every revalidate second
8383
}
8484
}
8585

‎pages/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ export const getStaticProps: GetStaticProps = async () => {
6060
let settings
6161
let posts: GhostPostsOrPages | []
6262

63+
console.time('Index - getStaticProps')
64+
6365
try {
6466
settings = await getAllSettings()
6567
posts = await getAllPosts()
@@ -74,10 +76,12 @@ export const getStaticProps: GetStaticProps = async () => {
7476
bodyClass: BodyClass({ isHome: true }),
7577
}
7678

79+
console.timeEnd('Index - getStaticProps')
80+
7781
return {
7882
props: {
7983
cmsData,
8084
},
81-
...(processEnv.isr.enable && { revalidate: 1 }), // re-generate at most once every second
85+
...(processEnv.isr.enable && { revalidate: processEnv.isr.revalidate }), // re-generate at most once every revalidate second
8286
}
8387
}

‎pages/tag/[...slug].tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
7373
bodyClass: BodyClass({ tags: [tag] }),
7474
},
7575
},
76-
...(processEnv.isr.enable && { revalidate: 1 }), // re-generate at most once every second
76+
...(processEnv.isr.enable && { revalidate: processEnv.isr.revalidate }), // re-generate at most once every revalidate second
7777
}
7878
}
7979

0 commit comments

Comments
 (0)