@rahuldshetty/inscribe 0.0.1 → 0.0.2

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <div align="center">
2
- <img src="https://via.placeholder.com/150x150.png?text=Inscribe" alt="Inscribe Logo" width="120" />
3
- <h1>Inscribe</h1>
2
+ <img src="docs/inscribe.png" alt="Inscribe Logo" width="240" />
3
+ <!-- <h1>Inscribe</h1> -->
4
4
  <p><strong>A minimalist, high-performance Static Site Generator (SSG)</strong></p>
5
5
  <p>
6
6
  <img src="https://img.shields.io/badge/status-under%20development-orange" alt="Project Status" />
@@ -21,8 +21,8 @@ Inscribe is a modern static site generator built with **Bun**, **MDX**, and **Pr
21
21
  - [x] **CLI** – Simple commands to scaffold, develop, and build your site.
22
22
  - [x] **Dev Server** – Local development server with instant live reload.
23
23
  - [x] **MDX & Markdown** – Write content using powerful MDX and standard Markdown.
24
+ - [x] **Themes** – Customizable and extensible theme system.
24
25
  - [ ] **Search** – Integrated full-text search.
25
- - [ ] **Themes** – Customizable and extensible theme system.
26
26
  - [ ] **Plugins** – Flexible plugin architecture for extending functionality.
27
27
 
28
28
  ## 🚀 Quick Start
@@ -31,10 +31,10 @@ Inscribe is a modern static site generator built with **Bun**, **MDX**, and **Pr
31
31
 
32
32
  ```bash
33
33
  # Using Bun (Recommended)
34
- bun install -g inscribe-ssg
34
+ bun install -g @rahuldshetty/inscribe
35
35
 
36
36
  # Using npm
37
- npm install -g inscribe-ssg
37
+ npm install -g @rahuldshetty/inscribe
38
38
  ```
39
39
 
40
40
  ### Usage
@@ -142,4 +142,29 @@ export async function build(options: BuildOptions) {
142
142
  }
143
143
 
144
144
  await fs.writeFile(path.join(outputDir, "index.html"), indexPage);
145
+
146
+ // Copy static assets
147
+ console.log("Copying static assets...");
148
+ const excludedExtensions = [".md", ".mdx", ".njk", ".yaml", ".yml"];
149
+ const excludedDirs = ["layouts", ".git", "node_modules"];
150
+
151
+ const copyRecursive = async (src: string, dest: string) => {
152
+ const entries = fs.readdirSync(src, { withFileTypes: true });
153
+ for (const entry of entries) {
154
+ const srcPath = path.join(src, entry.name);
155
+ const destPath = path.join(dest, entry.name);
156
+
157
+ if (entry.isDirectory()) {
158
+ if (excludedDirs.includes(entry.name)) continue;
159
+ await fs.ensureDir(destPath);
160
+ await copyRecursive(srcPath, destPath);
161
+ } else {
162
+ if (excludedExtensions.includes(path.extname(entry.name))) continue;
163
+ if (entry.name === "inscribe.yaml" || entry.name === "inscribe.yml") continue;
164
+ await fs.copy(srcPath, destPath);
165
+ }
166
+ }
167
+ };
168
+
169
+ await copyRecursive(sourceDir, outputDir);
145
170
  }
package/cli/api/server.ts CHANGED
@@ -127,6 +127,16 @@ export const LocalServer = (sourceDir: string, isDev: boolean = false, port = 30
127
127
  }
128
128
  }
129
129
 
130
+ // Static files — serve if file exists in sourceDir
131
+ const relativePath = url.pathname.slice(1);
132
+ if (relativePath) {
133
+ const staticFilePath = path.join(sourceDir, relativePath);
134
+ if (fs.existsSync(staticFilePath) && fs.statSync(staticFilePath).isFile()) {
135
+ const file = Bun.file(staticFilePath);
136
+ return new Response(file);
137
+ }
138
+ }
139
+
130
140
  return new Response("Not Found", { status: 404 });
131
141
  },
132
142
  websocket: {