@fydemy/cms 1.0.0 → 1.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 +310 -0
- package/dist/bin.d.mts +1 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +199 -0
- package/dist/bin.js.map +1 -0
- package/dist/bin.mjs +176 -0
- package/dist/bin.mjs.map +1 -0
- package/dist/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +1196 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1194 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -1
package/dist/bin.mjs
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/init/setup.ts
|
|
4
|
+
import fs from "fs/promises";
|
|
5
|
+
import path from "path";
|
|
6
|
+
async function initCMS(config = {}) {
|
|
7
|
+
const contentDir = config.contentDir || "public/content";
|
|
8
|
+
const fullPath = path.join(process.cwd(), contentDir);
|
|
9
|
+
const appDir = path.join(process.cwd(), "app");
|
|
10
|
+
try {
|
|
11
|
+
await fs.access(appDir);
|
|
12
|
+
} catch {
|
|
13
|
+
console.error(
|
|
14
|
+
'\u274C Error: "app" directory not found. This init script requires Next.js App Router.'
|
|
15
|
+
);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
console.log("\u{1F680} Initializing @fydemy/cms...");
|
|
19
|
+
await fs.mkdir(fullPath, { recursive: true });
|
|
20
|
+
const exampleContent = `---
|
|
21
|
+
title: Example Post
|
|
22
|
+
description: This is an example markdown file
|
|
23
|
+
date: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
# Welcome to your CMS!
|
|
27
|
+
|
|
28
|
+
This is an example markdown file. You can edit or delete it from the admin dashboard.
|
|
29
|
+
|
|
30
|
+
## Features
|
|
31
|
+
|
|
32
|
+
- File-based content storage
|
|
33
|
+
- Markdown with frontmatter
|
|
34
|
+
- GitHub integration for production
|
|
35
|
+
- Simple authentication
|
|
36
|
+
- No database required
|
|
37
|
+
`;
|
|
38
|
+
const examplePath = path.join(fullPath, "example.md");
|
|
39
|
+
await fs.writeFile(examplePath, exampleContent, "utf-8");
|
|
40
|
+
console.log("\u2705 Created content directory and example file");
|
|
41
|
+
const adminDir = path.join(appDir, "admin");
|
|
42
|
+
const loginDir = path.join(adminDir, "login");
|
|
43
|
+
await fs.mkdir(loginDir, { recursive: true });
|
|
44
|
+
await fs.writeFile(
|
|
45
|
+
path.join(adminDir, "page.tsx"),
|
|
46
|
+
`import { AdminDashboard } from '@fydemy/cms';
|
|
47
|
+
|
|
48
|
+
export default AdminDashboard;
|
|
49
|
+
`,
|
|
50
|
+
"utf-8"
|
|
51
|
+
);
|
|
52
|
+
await fs.writeFile(
|
|
53
|
+
path.join(loginDir, "page.tsx"),
|
|
54
|
+
`import { Login } from '@fydemy/cms';
|
|
55
|
+
|
|
56
|
+
export default Login;
|
|
57
|
+
`,
|
|
58
|
+
"utf-8"
|
|
59
|
+
);
|
|
60
|
+
console.log("\u2705 Created Admin UI pages");
|
|
61
|
+
const apiCmsDir = path.join(appDir, "api", "cms");
|
|
62
|
+
await fs.mkdir(path.join(apiCmsDir, "login"), { recursive: true });
|
|
63
|
+
await fs.writeFile(
|
|
64
|
+
path.join(apiCmsDir, "login", "route.ts"),
|
|
65
|
+
`import { handleLogin } from '@fydemy/cms';
|
|
66
|
+
export { handleLogin as POST };
|
|
67
|
+
`,
|
|
68
|
+
"utf-8"
|
|
69
|
+
);
|
|
70
|
+
await fs.mkdir(path.join(apiCmsDir, "logout"), { recursive: true });
|
|
71
|
+
await fs.writeFile(
|
|
72
|
+
path.join(apiCmsDir, "logout", "route.ts"),
|
|
73
|
+
`import { handleLogout } from '@fydemy/cms';
|
|
74
|
+
export { handleLogout as POST };
|
|
75
|
+
`,
|
|
76
|
+
"utf-8"
|
|
77
|
+
);
|
|
78
|
+
await fs.mkdir(path.join(apiCmsDir, "upload"), { recursive: true });
|
|
79
|
+
await fs.writeFile(
|
|
80
|
+
path.join(apiCmsDir, "upload", "route.ts"),
|
|
81
|
+
`import { handleUpload } from '@fydemy/cms';
|
|
82
|
+
export { handleUpload as POST };
|
|
83
|
+
`,
|
|
84
|
+
"utf-8"
|
|
85
|
+
);
|
|
86
|
+
await fs.mkdir(path.join(apiCmsDir, "list", "[[...path]]"), {
|
|
87
|
+
recursive: true
|
|
88
|
+
});
|
|
89
|
+
await fs.writeFile(
|
|
90
|
+
path.join(apiCmsDir, "list", "[[...path]]", "route.ts"),
|
|
91
|
+
`import { createListApiHandlers } from '@fydemy/cms';
|
|
92
|
+
|
|
93
|
+
const handlers = createListApiHandlers();
|
|
94
|
+
export const GET = handlers.GET;
|
|
95
|
+
`,
|
|
96
|
+
"utf-8"
|
|
97
|
+
);
|
|
98
|
+
await fs.mkdir(path.join(apiCmsDir, "content", "[...path]"), {
|
|
99
|
+
recursive: true
|
|
100
|
+
});
|
|
101
|
+
await fs.writeFile(
|
|
102
|
+
path.join(apiCmsDir, "content", "[...path]", "route.ts"),
|
|
103
|
+
`import { createContentApiHandlers } from '@fydemy/cms';
|
|
104
|
+
|
|
105
|
+
const handlers = createContentApiHandlers();
|
|
106
|
+
export const GET = handlers.GET;
|
|
107
|
+
export const POST = handlers.POST;
|
|
108
|
+
export const DELETE = handlers.DELETE;
|
|
109
|
+
`,
|
|
110
|
+
"utf-8"
|
|
111
|
+
);
|
|
112
|
+
console.log("\u2705 Created API routes");
|
|
113
|
+
const middlewarePath = path.join(process.cwd(), "middleware.ts");
|
|
114
|
+
try {
|
|
115
|
+
await fs.access(middlewarePath);
|
|
116
|
+
console.log(
|
|
117
|
+
"\u26A0\uFE0F middleware.ts already exists. Please manually add the CMS auth middleware:"
|
|
118
|
+
);
|
|
119
|
+
console.log(`
|
|
120
|
+
import { createAuthMiddleware } from '@fydemy/cms';
|
|
121
|
+
// ... existing imports
|
|
122
|
+
|
|
123
|
+
export function middleware(request: NextRequest) {
|
|
124
|
+
// Add this:
|
|
125
|
+
const authResponse = createAuthMiddleware()(request);
|
|
126
|
+
if (authResponse) return authResponse;
|
|
127
|
+
|
|
128
|
+
// ... existing middleware logic
|
|
129
|
+
}
|
|
130
|
+
`);
|
|
131
|
+
} catch {
|
|
132
|
+
await fs.writeFile(
|
|
133
|
+
middlewarePath,
|
|
134
|
+
`import { createAuthMiddleware } from '@fydemy/cms';
|
|
135
|
+
import { NextRequest } from 'next/server';
|
|
136
|
+
|
|
137
|
+
export function middleware(request: NextRequest) {
|
|
138
|
+
return createAuthMiddleware()(request);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export const config = {
|
|
142
|
+
matcher: ['/admin/:path*'],
|
|
143
|
+
};
|
|
144
|
+
`,
|
|
145
|
+
"utf-8"
|
|
146
|
+
);
|
|
147
|
+
console.log("\u2705 Created middleware.ts");
|
|
148
|
+
}
|
|
149
|
+
const envExamplePath = path.join(process.cwd(), ".env.local.example");
|
|
150
|
+
await fs.writeFile(
|
|
151
|
+
envExamplePath,
|
|
152
|
+
`CMS_ADMIN_USERNAME=admin
|
|
153
|
+
CMS_ADMIN_PASSWORD=password
|
|
154
|
+
CMS_SESSION_SECRET=ensure_this_is_at_least_32_chars_long_random_string
|
|
155
|
+
|
|
156
|
+
# GitHub Storage (Production)
|
|
157
|
+
GITHUB_TOKEN=
|
|
158
|
+
GITHUB_REPO=owner/repo
|
|
159
|
+
GITHUB_BRANCH=main
|
|
160
|
+
`,
|
|
161
|
+
"utf-8"
|
|
162
|
+
);
|
|
163
|
+
console.log("");
|
|
164
|
+
console.log("\u{1F389} CMS initialized successfully!");
|
|
165
|
+
console.log(
|
|
166
|
+
"1. Copy .env.local.example to .env.local and set your credentials"
|
|
167
|
+
);
|
|
168
|
+
console.log("2. Run your dev server and visit /admin");
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// src/bin.ts
|
|
172
|
+
initCMS().catch((err) => {
|
|
173
|
+
console.error("Error initializing CMS:", err);
|
|
174
|
+
process.exit(1);
|
|
175
|
+
});
|
|
176
|
+
//# sourceMappingURL=bin.mjs.map
|
package/dist/bin.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/init/setup.ts","../src/bin.ts"],"sourcesContent":["import fs from \"fs/promises\";\nimport path from \"path\";\n\nexport interface InitCMSConfig {\n /** Directory where content is stored (default: \"public/content\") */\n contentDir?: string;\n}\n\n/**\n * Initialize CMS in a Next.js project\n * Creates the content directory and an example markdown file.\n * @param config - Configuration options\n */\nexport async function initCMS(config: InitCMSConfig = {}) {\n const contentDir = config.contentDir || \"public/content\";\n const fullPath = path.join(process.cwd(), contentDir);\n const appDir = path.join(process.cwd(), \"app\");\n\n // Check if we are in a Next.js App Router project\n try {\n await fs.access(appDir);\n } catch {\n console.error(\n '❌ Error: \"app\" directory not found. This init script requires Next.js App Router.'\n );\n return;\n }\n\n console.log(\"🚀 Initializing @fydemy/cms...\");\n\n // 1. Create content directory and example file\n await fs.mkdir(fullPath, { recursive: true });\n\n const exampleContent = `---\ntitle: Example Post\ndescription: This is an example markdown file\ndate: ${new Date().toISOString()}\n---\n\n# Welcome to your CMS!\n\nThis is an example markdown file. You can edit or delete it from the admin dashboard.\n\n## Features\n\n- File-based content storage\n- Markdown with frontmatter\n- GitHub integration for production\n- Simple authentication\n- No database required\n`;\n\n const examplePath = path.join(fullPath, \"example.md\");\n await fs.writeFile(examplePath, exampleContent, \"utf-8\");\n console.log(\"✅ Created content directory and example file\");\n\n // 2. Scaffold Admin Pages\n const adminDir = path.join(appDir, \"admin\");\n const loginDir = path.join(adminDir, \"login\");\n\n await fs.mkdir(loginDir, { recursive: true });\n\n await fs.writeFile(\n path.join(adminDir, \"page.tsx\"),\n `import { AdminDashboard } from '@fydemy/cms';\\n\\nexport default AdminDashboard;\\n`,\n \"utf-8\"\n );\n\n await fs.writeFile(\n path.join(loginDir, \"page.tsx\"),\n `import { Login } from '@fydemy/cms';\\n\\nexport default Login;\\n`,\n \"utf-8\"\n );\n console.log(\"✅ Created Admin UI pages\");\n\n // 3. Scaffold API Routes\n const apiCmsDir = path.join(appDir, \"api\", \"cms\");\n\n // Login\n await fs.mkdir(path.join(apiCmsDir, \"login\"), { recursive: true });\n await fs.writeFile(\n path.join(apiCmsDir, \"login\", \"route.ts\"),\n `import { handleLogin } from '@fydemy/cms';\\nexport { handleLogin as POST };\\n`,\n \"utf-8\"\n );\n\n // Logout\n await fs.mkdir(path.join(apiCmsDir, \"logout\"), { recursive: true });\n await fs.writeFile(\n path.join(apiCmsDir, \"logout\", \"route.ts\"),\n `import { handleLogout } from '@fydemy/cms';\\nexport { handleLogout as POST };\\n`,\n \"utf-8\"\n );\n\n // Upload\n await fs.mkdir(path.join(apiCmsDir, \"upload\"), { recursive: true });\n await fs.writeFile(\n path.join(apiCmsDir, \"upload\", \"route.ts\"),\n `import { handleUpload } from '@fydemy/cms';\\nexport { handleUpload as POST };\\n`,\n \"utf-8\"\n );\n\n // List\n await fs.mkdir(path.join(apiCmsDir, \"list\", \"[[...path]]\"), {\n recursive: true,\n });\n await fs.writeFile(\n path.join(apiCmsDir, \"list\", \"[[...path]]\", \"route.ts\"),\n `import { createListApiHandlers } from '@fydemy/cms';\\n\\nconst handlers = createListApiHandlers();\\nexport const GET = handlers.GET;\\n`,\n \"utf-8\"\n );\n\n // Content\n await fs.mkdir(path.join(apiCmsDir, \"content\", \"[...path]\"), {\n recursive: true,\n });\n await fs.writeFile(\n path.join(apiCmsDir, \"content\", \"[...path]\", \"route.ts\"),\n `import { createContentApiHandlers } from '@fydemy/cms';\\n\\nconst handlers = createContentApiHandlers();\\nexport const GET = handlers.GET;\\nexport const POST = handlers.POST;\\nexport const DELETE = handlers.DELETE;\\n`,\n \"utf-8\"\n );\n console.log(\"✅ Created API routes\");\n\n // 4. Middleware\n const middlewarePath = path.join(process.cwd(), \"middleware.ts\");\n try {\n await fs.access(middlewarePath);\n console.log(\n \"⚠️ middleware.ts already exists. Please manually add the CMS auth middleware:\"\n );\n console.log(`\nimport { createAuthMiddleware } from '@fydemy/cms';\n// ... existing imports\n\nexport function middleware(request: NextRequest) {\n // Add this:\n const authResponse = createAuthMiddleware()(request);\n if (authResponse) return authResponse;\n \n // ... existing middleware logic\n}\n`);\n } catch {\n await fs.writeFile(\n middlewarePath,\n `import { createAuthMiddleware } from '@fydemy/cms';\\nimport { NextRequest } from 'next/server';\\n\\nexport function middleware(request: NextRequest) {\\n return createAuthMiddleware()(request);\\n}\\n\\nexport const config = {\\n matcher: ['/admin/:path*'],\\n};\\n`,\n \"utf-8\"\n );\n console.log(\"✅ Created middleware.ts\");\n }\n\n // 5. Env example\n const envExamplePath = path.join(process.cwd(), \".env.local.example\");\n await fs.writeFile(\n envExamplePath,\n `CMS_ADMIN_USERNAME=admin\\nCMS_ADMIN_PASSWORD=password\\nCMS_SESSION_SECRET=ensure_this_is_at_least_32_chars_long_random_string\\n\\n# GitHub Storage (Production)\\nGITHUB_TOKEN=\\nGITHUB_REPO=owner/repo\\nGITHUB_BRANCH=main\\n`,\n \"utf-8\"\n );\n\n console.log(\"\");\n console.log(\"🎉 CMS initialized successfully!\");\n console.log(\n \"1. Copy .env.local.example to .env.local and set your credentials\"\n );\n console.log(\"2. Run your dev server and visit /admin\");\n}\n","#!/usr/bin/env node\n\nimport { initCMS } from \"./init/setup\";\n\ninitCMS().catch((err: unknown) => {\n console.error(\"Error initializing CMS:\", err);\n process.exit(1);\n});\n"],"mappings":";;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AAYjB,eAAsB,QAAQ,SAAwB,CAAC,GAAG;AACxD,QAAM,aAAa,OAAO,cAAc;AACxC,QAAM,WAAW,KAAK,KAAK,QAAQ,IAAI,GAAG,UAAU;AACpD,QAAM,SAAS,KAAK,KAAK,QAAQ,IAAI,GAAG,KAAK;AAG7C,MAAI;AACF,UAAM,GAAG,OAAO,MAAM;AAAA,EACxB,QAAQ;AACN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AAE;AACd,UAAQ,IAAI,yCAAkC;AAC9C,UAAQ;AAAA,IACN;AAAA,EACF;AACA,UAAQ,IAAI,yCAAyC;AACvD;;;ACjKA,QAAQ,EAAE,MAAM,CAAC,QAAiB;AAChC,UAAQ,MAAM,2BAA2B,GAAG;AAC5C,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
3
|
|
|
3
4
|
interface MarkdownData {
|
|
4
5
|
content: string;
|
|
@@ -338,6 +339,10 @@ declare function handleUpload(request: NextRequest): Promise<NextResponse<{
|
|
|
338
339
|
filename: string;
|
|
339
340
|
}>>;
|
|
340
341
|
|
|
342
|
+
declare function AdminDashboard(): react_jsx_runtime.JSX.Element;
|
|
343
|
+
|
|
344
|
+
declare function Login(): react_jsx_runtime.JSX.Element;
|
|
345
|
+
|
|
341
346
|
/**
|
|
342
347
|
* Create middleware to protect admin routes
|
|
343
348
|
*/
|
|
@@ -428,4 +433,4 @@ declare function incrementRateLimit(identifier: string): void;
|
|
|
428
433
|
*/
|
|
429
434
|
declare function resetRateLimit(identifier: string): void;
|
|
430
435
|
|
|
431
|
-
export { type CollectionItem, type FileEntry, GitHubStorage, type InitCMSConfig, LocalStorage, MAX_FILE_SIZE, MAX_PASSWORD_LENGTH, MAX_USERNAME_LENGTH, type MarkdownData, type StorageProvider, checkRateLimit, clearSessionCookie, createAuthMiddleware, createContentApiHandlers, createListApiHandlers, createSession, deleteMarkdownContent, getCollectionItem, getCollectionItems, getCollections, getMarkdownContent, getSessionFromCookies, getStorageProvider, handleDeleteContent, handleGetContent, handleListFiles, handleLogin, handleLogout, handleSaveContent, handleUpload, incrementRateLimit, initCMS, listDirectory, listMarkdownFiles, markdownFileExists, parseMarkdown, resetRateLimit, sanitizeFrontmatter, saveMarkdownContent, setSessionCookie, stringifyMarkdown, uploadFile, validateCredentials, validateFilePath, validateFileSize, validatePassword, validateUsername, verifySession };
|
|
436
|
+
export { AdminDashboard, type CollectionItem, type FileEntry, GitHubStorage, type InitCMSConfig, LocalStorage, Login, MAX_FILE_SIZE, MAX_PASSWORD_LENGTH, MAX_USERNAME_LENGTH, type MarkdownData, type StorageProvider, checkRateLimit, clearSessionCookie, createAuthMiddleware, createContentApiHandlers, createListApiHandlers, createSession, deleteMarkdownContent, getCollectionItem, getCollectionItems, getCollections, getMarkdownContent, getSessionFromCookies, getStorageProvider, handleDeleteContent, handleGetContent, handleListFiles, handleLogin, handleLogout, handleSaveContent, handleUpload, incrementRateLimit, initCMS, listDirectory, listMarkdownFiles, markdownFileExists, parseMarkdown, resetRateLimit, sanitizeFrontmatter, saveMarkdownContent, setSessionCookie, stringifyMarkdown, uploadFile, validateCredentials, validateFilePath, validateFileSize, validatePassword, validateUsername, verifySession };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
3
|
|
|
3
4
|
interface MarkdownData {
|
|
4
5
|
content: string;
|
|
@@ -338,6 +339,10 @@ declare function handleUpload(request: NextRequest): Promise<NextResponse<{
|
|
|
338
339
|
filename: string;
|
|
339
340
|
}>>;
|
|
340
341
|
|
|
342
|
+
declare function AdminDashboard(): react_jsx_runtime.JSX.Element;
|
|
343
|
+
|
|
344
|
+
declare function Login(): react_jsx_runtime.JSX.Element;
|
|
345
|
+
|
|
341
346
|
/**
|
|
342
347
|
* Create middleware to protect admin routes
|
|
343
348
|
*/
|
|
@@ -428,4 +433,4 @@ declare function incrementRateLimit(identifier: string): void;
|
|
|
428
433
|
*/
|
|
429
434
|
declare function resetRateLimit(identifier: string): void;
|
|
430
435
|
|
|
431
|
-
export { type CollectionItem, type FileEntry, GitHubStorage, type InitCMSConfig, LocalStorage, MAX_FILE_SIZE, MAX_PASSWORD_LENGTH, MAX_USERNAME_LENGTH, type MarkdownData, type StorageProvider, checkRateLimit, clearSessionCookie, createAuthMiddleware, createContentApiHandlers, createListApiHandlers, createSession, deleteMarkdownContent, getCollectionItem, getCollectionItems, getCollections, getMarkdownContent, getSessionFromCookies, getStorageProvider, handleDeleteContent, handleGetContent, handleListFiles, handleLogin, handleLogout, handleSaveContent, handleUpload, incrementRateLimit, initCMS, listDirectory, listMarkdownFiles, markdownFileExists, parseMarkdown, resetRateLimit, sanitizeFrontmatter, saveMarkdownContent, setSessionCookie, stringifyMarkdown, uploadFile, validateCredentials, validateFilePath, validateFileSize, validatePassword, validateUsername, verifySession };
|
|
436
|
+
export { AdminDashboard, type CollectionItem, type FileEntry, GitHubStorage, type InitCMSConfig, LocalStorage, Login, MAX_FILE_SIZE, MAX_PASSWORD_LENGTH, MAX_USERNAME_LENGTH, type MarkdownData, type StorageProvider, checkRateLimit, clearSessionCookie, createAuthMiddleware, createContentApiHandlers, createListApiHandlers, createSession, deleteMarkdownContent, getCollectionItem, getCollectionItems, getCollections, getMarkdownContent, getSessionFromCookies, getStorageProvider, handleDeleteContent, handleGetContent, handleListFiles, handleLogin, handleLogout, handleSaveContent, handleUpload, incrementRateLimit, initCMS, listDirectory, listMarkdownFiles, markdownFileExists, parseMarkdown, resetRateLimit, sanitizeFrontmatter, saveMarkdownContent, setSessionCookie, stringifyMarkdown, uploadFile, validateCredentials, validateFilePath, validateFileSize, validatePassword, validateUsername, verifySession };
|