astro-blog-kit 0.2.3 → 0.2.4

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.
package/bin/cli.js CHANGED
@@ -42,9 +42,9 @@ async function main() {
42
42
  }
43
43
  }
44
44
  }),
45
- layoutComponent: () => p.text({
46
- message: "Layout component path (leave empty to skip)",
47
- placeholder: "../../layouts/Layout.astro"
45
+ hasLayout: () => p.confirm({
46
+ message: "Do you have a Layout component?",
47
+ initialValue: true
48
48
  }),
49
49
  postsPerPage: () => p.text({
50
50
  message: "Posts per page",
@@ -82,22 +82,23 @@ async function main() {
82
82
  }
83
83
  }
84
84
  );
85
- const layoutPath = answers.layoutComponent || "";
85
+ const hasLayout = answers.hasLayout;
86
86
  const replacements = {
87
87
  WP_URL: answers.wpUrl,
88
88
  POSTS_PER_PAGE: answers.postsPerPage,
89
89
  DEFAULT_LAYOUT: answers.defaultLayout,
90
90
  LOCALE: answers.locale,
91
- LAYOUT_IMPORT: layoutPath ? `import Layout from "${layoutPath}";` : "",
92
- LAYOUT_IMPORT_PAGE: layoutPath ? `import Layout from "../${layoutPath}";` : "",
93
- LAYOUT_OPEN: layoutPath ? `<Layout>` : `<html lang={config.locale ?? "en"}>
91
+ LAYOUT_IMPORT: hasLayout ? `import Layout from "../../layouts/Layout.astro";` : "",
92
+ LAYOUT_IMPORT_PAGE: hasLayout ? `import Layout from "../../../layouts/Layout.astro";` : "",
93
+ LAYOUT_IMPORT_SLUG: hasLayout ? `import Layout from "../../layouts/Layout.astro";` : "",
94
+ LAYOUT_OPEN: hasLayout ? `<Layout>` : `<html lang={config.locale ?? "en"}>
94
95
  <head>
95
96
  <meta charset="UTF-8" />
96
97
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
97
98
  <title>Blog</title>
98
99
  </head>
99
100
  <body>`,
100
- LAYOUT_CLOSE: layoutPath ? `</Layout>` : ` </body>
101
+ LAYOUT_CLOSE: hasLayout ? `</Layout>` : ` </body>
101
102
  </html>`
102
103
  };
103
104
  const cwd = process.cwd();
package/cli.ts CHANGED
@@ -65,10 +65,10 @@ async function main() {
65
65
  }
66
66
  },
67
67
  }),
68
- layoutComponent: () =>
69
- p.text({
70
- message: "Layout component path (leave empty to skip)",
71
- placeholder: "../../layouts/Layout.astro",
68
+ hasLayout: () =>
69
+ p.confirm({
70
+ message: "Do you have a Layout component?",
71
+ initialValue: true,
72
72
  }),
73
73
 
74
74
  postsPerPage: () =>
@@ -117,23 +117,26 @@ async function main() {
117
117
 
118
118
  // ── Replacements ──────────────────────────────────────────
119
119
 
120
- const layoutPath = (answers.layoutComponent as string) || "";
120
+ const hasLayout = answers.hasLayout as boolean;
121
121
 
122
122
  const replacements: Record<string, string> = {
123
123
  WP_URL: answers.wpUrl as string,
124
124
  POSTS_PER_PAGE: answers.postsPerPage as string,
125
125
  DEFAULT_LAYOUT: answers.defaultLayout as string,
126
126
  LOCALE: answers.locale as string,
127
- LAYOUT_IMPORT: layoutPath
128
- ? `import Layout from "${layoutPath}";`
127
+ LAYOUT_IMPORT: hasLayout
128
+ ? `import Layout from "../../layouts/Layout.astro";`
129
+ : "",
130
+ LAYOUT_IMPORT_PAGE: hasLayout
131
+ ? `import Layout from "../../../layouts/Layout.astro";`
129
132
  : "",
130
- LAYOUT_IMPORT_PAGE: layoutPath
131
- ? `import Layout from "../${layoutPath}";`
133
+ LAYOUT_IMPORT_SLUG: hasLayout
134
+ ? `import Layout from "../../layouts/Layout.astro";`
132
135
  : "",
133
- LAYOUT_OPEN: layoutPath
136
+ LAYOUT_OPEN: hasLayout
134
137
  ? `<Layout>`
135
138
  : `<html lang={config.locale ?? "en"}>\n <head>\n <meta charset="UTF-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <title>Blog</title>\n </head>\n <body>`,
136
- LAYOUT_CLOSE: layoutPath
139
+ LAYOUT_CLOSE: hasLayout
137
140
  ? `</Layout>`
138
141
  : ` </body>\n</html>`,
139
142
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-blog-kit",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "A ready-to-use blog system for Astro with WordPress headless support, optional i18n, multiple layouts, and a comment system.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -2,7 +2,7 @@
2
2
  import { BlogList } from "astro-blog-kit/components";
3
3
  import { createWPClient, getStaticPathsForPages } from "astro-blog-kit/utils";
4
4
  import config from "../../../../blog.config";
5
- __LAYOUT_IMPORT__
5
+ __LAYOUT_IMPORT_PAGE__
6
6
 
7
7
  export async function getStaticPaths() {
8
8
  const wp = createWPClient(config.wpUrl);
@@ -2,7 +2,7 @@
2
2
  import { BlogPost, Comments, CommentForm } from "astro-blog-kit/components";
3
3
  import { createWPClient, getStaticPathsForPosts } from "astro-blog-kit/utils";
4
4
  import config from "../../../blog.config";
5
- __LAYOUT_IMPORT__
5
+ __LAYOUT_IMPORT_SLUG__
6
6
 
7
7
  export async function getStaticPaths() {
8
8
  const wp = createWPClient(config.wpUrl);