Skip to content

Commit

Permalink
Merge pull request #162 from timlrx/update-contentlayer
Browse files Browse the repository at this point in the history
Update contentlayer and other dependencies
  • Loading branch information
timlrx authored Mar 31, 2024
2 parents 4651f6d + f0a7c10 commit bdf8b55
Show file tree
Hide file tree
Showing 8 changed files with 2,075 additions and 1,477 deletions.
5 changes: 5 additions & 0 deletions .changeset/fluffy-rats-knock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'pliny': patch
---

Add liClassName prop for TOCInline
5 changes: 5 additions & 0 deletions .changeset/nervous-dryers-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'pliny': minor
---

update dependencies
5 changes: 5 additions & 0 deletions .changeset/nervous-ghosts-confess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'pliny': patch
---

Add microsoft clarity analytics
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"husky": "^8.0.0",
"lint-staged": "^13.0.0",
"prettier": "^3.0.0",
"turbo": "1.10.7",
"vitest": "0.33.0"
"turbo": "1.13.0",
"vitest": "1.4.0"
},
"workspaces": {
"packages": [
Expand Down
58 changes: 29 additions & 29 deletions packages/pliny/add-use-client.mjs
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
import fs from 'fs'
import globby from 'globby'

// Append "use client" to all path chunks that contain "use" hooks
// So these packages can be directly used in Next.js directly
// This allows us to see support file splitting with easy next import
;(async () => {
console.log('Added use client directive to the following files:')
const chunkPaths = await globby('chunk*')
for (const path of chunkPaths) {
const data = fs.readFileSync(path, 'utf8')
if (
/useState|useEffect|useRef|useCallback|useContext|useMemo|useTheme|useRouter|useRegisterActions|useMatches|useKBar/.test(
data
)
) {
// Append "use client" to all path chunks that contain "use" hooks
// So these packages can be directly used in Next.js directly
// This allows us to see support file splitting with easy next import
; (async () => {
console.log('Added use client directive to the following files:')
const chunkPaths = await globby('chunk*')
for (const path of chunkPaths) {
const data = fs.readFileSync(path, 'utf8')
if (
/useState|useEffect|useRef|useCallback|useContext|useMemo|useTheme|useRouter|useRegisterActions|useMatches|useKBar/.test(
data
)
) {
console.log(path)
const insert = Buffer.from('"use client"\n')
fs.writeFileSync(path, insert + data)
}
}
// Handle ui differently as they are not split
const clientPaths = await globby([
'ui/NewsletterForm.js',
'ui/BlogNewsletterForm.js',
'ui/Pre.js',
'search/KBarButton.js',
'search/AlgoliaButton.js',
])
for (const path of clientPaths) {
console.log(path)
const data = fs.readFileSync(path)
const insert = Buffer.from('"use client"\n')
fs.writeFileSync(path, insert + data)
}
}
// Handle ui differently as they are not split
const clientPaths = await globby([
'ui/NewsletterForm.js',
'ui/BlogNewsletterForm.js',
'ui/Pre.js',
'search/KBarButton.js',
'search/AlgoliaButton.js',
])
for (const path of clientPaths) {
console.log(path)
const data = fs.readFileSync(path)
const insert = Buffer.from('"use client"\n')
fs.writeFileSync(path, insert + data)
}
})()
})()
16 changes: 8 additions & 8 deletions packages/pliny/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@
"author": "Timothy Lin <timothy0336@hotmail.com> (https://timlrx.com)",
"dependencies": {
"@docsearch/react": "^3.5.0",
"@giscus/react": "^2.3.0",
"@giscus/react": "^3.0.0",
"@mailchimp/mailchimp_marketing": "^3.0.80",
"contentlayer": "^0.3.4",
"contentlayer2": "^0.4.4",
"copyfiles": "^2.4.1",
"github-slugger": "^2.0.0",
"js-yaml": "4.1.0",
"kbar": "0.1.0-beta.45",
"next-contentlayer": "^0.3.4",
"next-themes": "^0.2.1",
"next-contentlayer2": "^0.4.4",
"next-themes": "^0.3.0",
"probe-image-size": "^7.2.3",
"remark": "^14.0.2",
"unist-util-visit": "^4.1.0"
"remark": "^15.0.0",
"unist-util-visit": "^5.0.0"
},
"peerDependencies": {
"next": ">=13.0.0",
Expand All @@ -45,11 +45,11 @@
},
"devDependencies": {
"@types/copyfiles": "^2",
"next": "13.4.10",
"next": "14.1.4",
"react": "18.2.0",
"react-dom": "18.2.0",
"rimraf": "^3.0.2",
"tsup": "7.1.0",
"tsup": "8.0.2",
"typescript": "^5.1.6"
},
"lint-staged": {
Expand Down
2 changes: 1 addition & 1 deletion packages/pliny/src/utils/contentlayer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Document, MDX } from 'contentlayer/core'
import type { Document, MDX } from 'contentlayer2/core'

const isProduction = process.env.NODE_ENV === 'production'

Expand Down
Loading

0 comments on commit bdf8b55

Please sign in to comment.