next-staticblog 0.2.0-beta.4 → 0.2.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.ts +2 -6
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -39,9 +39,7 @@ export function getAllPostSlugs(directory: string = "posts/") {
39
39
  return fs.readdirSync(postsDirectory);
40
40
  }
41
41
 
42
- export function getAllPosts<
43
- T extends Record<string, unknown> = Record<string, unknown>,
44
- >(
42
+ export function getAllPosts<T extends object = Record<string, unknown>>(
45
43
  directory: string = "posts/",
46
44
  ): { slug: string; metadata: T; content: string }[] {
47
45
  const slugs = getAllPostSlugs(directory);
@@ -53,9 +51,7 @@ export function getAllPostParams(directory: string = "posts/") {
53
51
  return slugs.map((slug) => ({ slug: slug.replace(/\.md$/, "") }));
54
52
  }
55
53
 
56
- export function getPostBySlug<
57
- T extends Record<string, unknown> = Record<string, unknown>,
58
- >(
54
+ export function getPostBySlug<T extends object = Record<string, unknown>>(
59
55
  slug: string,
60
56
  directory: string = "posts/",
61
57
  ): { slug: string; metadata: T; content: string } {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-staticblog",
3
- "version": "0.2.0-beta.4",
3
+ "version": "0.2.0-beta.5",
4
4
  "description": "Load the article and parse the YAML into Next.js!",
5
5
  "homepage": "https://github.com/yd-tw/next-posts",
6
6
  "license": "MIT",