@leadertechie/create-personal-site 0.1.0-alpha.10

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 leadertechie
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # create-personal-site
2
+
3
+ A CLI to scaffold a personal website powered by [@leadertechie/personal-site-kit](https://github.com/leadertechie/personal-site-kit).
4
+
5
+ ## Features
6
+
7
+ - Interactive CLI prompts for project setup
8
+ - Auto-fetches GitHub profile to personalize content
9
+ - Generates project structure with Cloudflare Workers configuration
10
+ - Creates starter content (home page, about page, metadata)
11
+
12
+ ## Usage
13
+
14
+ ```bash
15
+ npx @leadertechie/create-personal-site [project-name]
16
+ ```
17
+
18
+ Examples:
19
+
20
+ ```bash
21
+ # Interactive prompts
22
+ npx @leadertechie/create-personal-site
23
+
24
+ # Specify project name upfront
25
+ npx @leadertechie/create-personal-site my-portfolio
26
+ ```
27
+
28
+ ## Requirements
29
+
30
+ - Node.js 20+
31
+ - npm
32
+
33
+ ## What it creates
34
+
35
+ - `content/` - Your website content (pages, markdown files)
36
+ - `api/` - Cloudflare Worker API entry point
37
+ - `ui/` - Frontend entry point
38
+ - `prerender/` - Static prerendering setup
39
+ - `wrangler.toml` - Cloudflare Workers configuration
package/dist/index.js ADDED
@@ -0,0 +1,141 @@
1
+ #!/usr/bin/env node
2
+ import prompts from 'prompts';
3
+ import { red, green, blue } from 'kolorist';
4
+ import fs from 'fs-extra';
5
+ import path from 'path';
6
+ import { fileURLToPath } from 'url';
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = path.dirname(__filename);
9
+ async function fetchGithubProfile(username) {
10
+ if (!username)
11
+ return null;
12
+ try {
13
+ const res = await fetch("https://api.github.com/users/" + username);
14
+ if (res.ok)
15
+ return await res.json();
16
+ }
17
+ catch (_e) { }
18
+ return null;
19
+ }
20
+ async function init() {
21
+ const args = process.argv.slice(2);
22
+ const projectNameArg = args[0];
23
+ const response = await prompts([
24
+ {
25
+ type: projectNameArg ? null : 'text',
26
+ name: 'projectName',
27
+ message: 'Project name:',
28
+ initial: 'my-personal-site'
29
+ },
30
+ {
31
+ type: 'text',
32
+ name: 'githubUsername',
33
+ message: 'GitHub username: (optional, press enter to skip)',
34
+ initial: ''
35
+ },
36
+ {
37
+ type: 'text',
38
+ name: 'siteTitle',
39
+ message: 'Site title:',
40
+ initial: 'My Personal Website'
41
+ }
42
+ ]);
43
+ const projectName = projectNameArg || response.projectName;
44
+ const { githubUsername, siteTitle } = response;
45
+ if (!projectName) {
46
+ console.log(red('Cancelled.'));
47
+ return;
48
+ }
49
+ const root = path.join(process.cwd(), projectName);
50
+ console.log("\nCreating project in " + blue(root) + "...");
51
+ await fs.ensureDir(root);
52
+ let profile = await fetchGithubProfile(githubUsername);
53
+ if (profile) {
54
+ console.log(green("Fetched GitHub profile for " + profile.name));
55
+ }
56
+ const contentDir = path.join(root, 'content');
57
+ const pagesDir = path.join(contentDir, 'pages');
58
+ await fs.ensureDir(contentDir);
59
+ await fs.ensureDir(pagesDir);
60
+ const aboutMe = "# About Me\n\n" + (profile?.bio || "Welcome to my site!") + "\n\nFind more on my [GitHub](" + (profile?.html_url || "") + ").";
61
+ await fs.writeFile(path.join(contentDir, 'about-me.md'), aboutMe);
62
+ const homePageTitle = profile?.name || "My Personal Website";
63
+ const homePage = `---
64
+ title: ${homePageTitle}
65
+ date: ${new Date().toISOString().split('T')[0]}
66
+ description: Welcome to my personal website.
67
+ ---
68
+
69
+ # ${homePageTitle}
70
+
71
+ Welcome to my site!`;
72
+ await fs.writeFile(path.join(pagesDir, 'home.md'), homePage);
73
+ const staticDetails = {
74
+ siteTitle: siteTitle || profile?.name || "My Personal Website",
75
+ siteDescription: profile?.bio || "Welcome to my professional portfolio.",
76
+ copyright: new Date().getFullYear() + " " + (profile?.name || "All Rights Reserved"),
77
+ linkedin: "",
78
+ github: profile?.html_url || "",
79
+ email: profile?.email || ""
80
+ };
81
+ await fs.writeFile(path.join(contentDir, 'static-details.json'), JSON.stringify(staticDetails, null, 2));
82
+ await fs.copy(path.join(__dirname, '..', 'templates'), root);
83
+ await fs.ensureDir(path.join(root, 'api'));
84
+ await fs.ensureDir(path.join(root, 'ui'));
85
+ await fs.ensureDir(path.join(root, 'prerender'));
86
+ await fs.ensureDir(path.join(root, 'scripts'));
87
+ // Copy seed script from dist to target
88
+ const seedSrc = path.join(__dirname, 'scripts/seed.js');
89
+ if (await fs.pathExists(seedSrc)) {
90
+ await fs.copy(seedSrc, path.join(root, 'scripts/seed.js'));
91
+ }
92
+ await fs.writeFile(path.join(root, 'api/index.ts'), "import { WebsiteAPI } from '@leadertechie/personal-site-kit/api';\n\nconst api = new WebsiteAPI();\nexport default api;\n");
93
+ // UI Entry with Hook pattern - NO local styles.css
94
+ await fs.writeFile(path.join(root, 'ui/index.ts'), "import '@leadertechie/personal-site-kit/styles/theme.css';\nimport { WebsiteUI } from '@leadertechie/personal-site-kit/shared';\nimport '@leadertechie/personal-site-kit/ui';\n\nWebsiteUI.getInstance({\n // Using hooks for style overriding or custom logic\n theme: {\n // primaryColor: '#646cff',\n // customCss: ':root { --nav-link-color: blue; }'\n },\n onBootstrap: (ui) => {\n console.log('Site is booting up with kit!');\n }\n}).bootstrap();\n");
95
+ await fs.writeFile(path.join(root, 'prerender/index.ts'), "import { WebsitePrerender } from '@leadertechie/personal-site-kit/prerender';\n\nexport default new WebsitePrerender();\n");
96
+ const wranglerToml = await fs.readFile(path.join(root, 'wrangler.toml'), 'utf-8');
97
+ const processedToml = wranglerToml
98
+ .replace(/\{\{name\}\}/g, projectName)
99
+ .replace(/\{\{siteTitle\}\}/g, siteTitle || 'My Personal Website');
100
+ await fs.writeFile(path.join(root, 'wrangler.toml'), processedToml);
101
+ const indexHtmlPath = path.join(root, 'ui/index.html');
102
+ if (await fs.pathExists(indexHtmlPath)) {
103
+ const indexHtml = await fs.readFile(indexHtmlPath, 'utf-8');
104
+ await fs.writeFile(indexHtmlPath, indexHtml.replace(/\{\{siteTitle\}\}/g, siteTitle || 'My Personal Website'));
105
+ }
106
+ const readme = await fs.readFile(path.join(root, 'README.md'), 'utf-8');
107
+ await fs.writeFile(path.join(root, 'README.md'), readme.replace(/\{\{name\}\}/g, projectName));
108
+ const pkg = {
109
+ name: projectName,
110
+ version: '0.1.0',
111
+ private: true,
112
+ type: 'module',
113
+ scripts: {
114
+ "dev": "concurrently \"npm run dev:api\" \"npm run dev:ui\"",
115
+ "dev:api": "wrangler dev",
116
+ "dev:ui": "vite",
117
+ "build": "npm run build:ui && npm run build:api",
118
+ "build:ui": "vite build",
119
+ "build:api": "wrangler deploy --dry-run --outdir dist/api",
120
+ "deploy": "npm run build && wrangler deploy",
121
+ "seed": "node scripts/seed.js"
122
+ },
123
+ dependencies: {
124
+ "@leadertechie/personal-site-kit": "latest",
125
+ "lit": "^3.2.1"
126
+ },
127
+ devDependencies: {
128
+ "wrangler": "^4.79.0",
129
+ "vite": "^7.3.1",
130
+ "typescript": "^5.7.3",
131
+ "concurrently": "^9.1.2"
132
+ }
133
+ };
134
+ await fs.writeFile(path.join(root, 'package.json'), JSON.stringify(pkg, null, 2));
135
+ console.log("\n" + green('Done!') + " Now run:\n");
136
+ console.log(" cd " + projectName);
137
+ console.log(" npm install");
138
+ console.log(" # Update wrangler.toml with your R2 bucket name");
139
+ console.log(" npm run dev");
140
+ }
141
+ init().catch(e => console.error(red(e)));
@@ -0,0 +1,97 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
5
+ const ROOT = path.join(__dirname, '..');
6
+ const CONTENT_DIR = path.join(ROOT, 'content');
7
+ // Configuration - can be overridden by env vars
8
+ const API_URL = process.env.API_URL || 'http://localhost:8787';
9
+ const ADMIN_USER = process.env.ADMIN_USER || 'admin';
10
+ const ADMIN_PASS = process.env.ADMIN_PASS || 'adminpassword123';
11
+ async function seed() {
12
+ console.log(`🚀 Starting seed process for ${API_URL}...`);
13
+ try {
14
+ // 1. Check Auth Status
15
+ const statusRes = await fetch(`${API_URL}/api/auth/status`);
16
+ const status = await statusRes.json();
17
+ let sessionToken = '';
18
+ if (!status.configured) {
19
+ console.log('📝 Admin not configured. Performing first-time setup...');
20
+ const setupRes = await fetch(`${API_URL}/api/auth/setup`, {
21
+ method: 'POST',
22
+ headers: { 'Content-Type': 'application/json' },
23
+ body: JSON.stringify({ username: ADMIN_USER, password: ADMIN_PASS })
24
+ });
25
+ if (!setupRes.ok) {
26
+ const error = await setupRes.json();
27
+ throw new Error(`Setup failed: ${error.error || setupRes.statusText}`);
28
+ }
29
+ sessionToken = setupRes.headers.get('X-Session-Token');
30
+ console.log('✅ Admin configured successfully.');
31
+ }
32
+ else {
33
+ console.log(`🔑 Admin already configured as "${status.username}". Logging in...`);
34
+ const loginRes = await fetch(`${API_URL}/api/auth/login`, {
35
+ method: 'POST',
36
+ headers: { 'Content-Type': 'application/json' },
37
+ body: JSON.stringify({ username: ADMIN_USER, password: ADMIN_PASS })
38
+ });
39
+ if (!loginRes.ok) {
40
+ throw new Error('Login failed. Please check ADMIN_USER and ADMIN_PASS env vars.');
41
+ }
42
+ sessionToken = loginRes.headers.get('X-Session-Token');
43
+ console.log('✅ Login successful.');
44
+ }
45
+ if (!sessionToken) {
46
+ throw new Error('No session token received.');
47
+ }
48
+ // 2. Upload Content
49
+ console.log('📂 Syncing content directory...');
50
+ await uploadDirectory(CONTENT_DIR, '', sessionToken);
51
+ console.log('\n✨ Seeding complete!');
52
+ }
53
+ catch (err) {
54
+ console.error(`\n❌ Seeding failed: ${err instanceof Error ? err.message : String(err)}`);
55
+ process.exit(1);
56
+ }
57
+ }
58
+ async function uploadDirectory(dir, subpath, token) {
59
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
60
+ for (const entry of entries) {
61
+ const fullPath = path.join(dir, entry.name);
62
+ const remotePath = subpath ? `${subpath}/${entry.name}` : entry.name;
63
+ if (entry.isDirectory()) {
64
+ await uploadDirectory(fullPath, remotePath, token);
65
+ }
66
+ else {
67
+ process.stdout.write(` ⬆️ Uploading ${remotePath}... `);
68
+ const content = fs.readFileSync(fullPath);
69
+ const res = await fetch(`${API_URL}/api/content/${remotePath}`, {
70
+ method: 'PUT',
71
+ headers: {
72
+ 'X-Session-Token': token,
73
+ 'Content-Type': getContentType(entry.name)
74
+ },
75
+ body: content
76
+ });
77
+ if (res.ok) {
78
+ console.log('Done.');
79
+ }
80
+ else {
81
+ console.log('Failed.');
82
+ const err = await res.json().catch(() => ({ error: res.statusText }));
83
+ console.error(` Error: ${err.error}`);
84
+ }
85
+ }
86
+ }
87
+ }
88
+ function getContentType(filename) {
89
+ if (filename.endsWith('.md'))
90
+ return 'text/markdown';
91
+ if (filename.endsWith('.json'))
92
+ return 'application/json';
93
+ if (filename.endsWith('.svg'))
94
+ return 'image/svg+xml';
95
+ return 'application/octet-stream';
96
+ }
97
+ seed();
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@leadertechie/create-personal-site",
3
+ "version": "0.1.0-alpha.10",
4
+ "description": "Scaffold a personal website powered by Cloudflare Workers and R2. Fetches GitHub profile to auto-populate content.",
5
+ "bin": {
6
+ "create-personal-site": "./dist/index.js"
7
+ },
8
+ "type": "module",
9
+ "engines": {
10
+ "node": ">=20"
11
+ },
12
+ "license": "MIT",
13
+ "files": [
14
+ "dist",
15
+ "templates",
16
+ "README.md"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsc && node --input-type=module -e \"import{writeFileSync,chmodSync,readFileSync}from'fs';const p='dist/index.js';let c=readFileSync(p,'utf8');if(!c.startsWith('#!')){writeFileSync(p,'#!/usr/bin/env node\\n'+c);chmodSync(p,493)}\"",
20
+ "prepublishOnly": "npm run build"
21
+ },
22
+ "keywords": [
23
+ "cli",
24
+ "personal-site",
25
+ "cloudflare-workers"
26
+ ],
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "https://github.com/leadertechie/create-personal-site"
30
+ },
31
+ "dependencies": {
32
+ "execa": "^8.0.1",
33
+ "fs-extra": "^11.1.1",
34
+ "kolorist": "^1.8.0",
35
+ "prompts": "^2.4.2"
36
+ },
37
+ "devDependencies": {
38
+ "@types/fs-extra": "^11.0.4",
39
+ "@types/prompts": "^2.4.9",
40
+ "typescript": "^5.4.0"
41
+ }
42
+ }
@@ -0,0 +1,16 @@
1
+ # {{name}}
2
+
3
+ A personal website powered by [@leadertechie/personal-site-kit](https://github.com/leadertechie/personal-site-kit).
4
+
5
+ ## Getting Started
6
+
7
+ 1. Add your content in the `content/` directory
8
+ 2. Configure `wrangler.toml` with your R2 bucket details
9
+ 3. Run `npm run dev` to test locally
10
+ 4. Run `npm run deploy` to publish
11
+
12
+ ## Content Structure
13
+
14
+ - `content/pages/home.md` - Your home page content
15
+ - `content/about-me.md` - Your about page content
16
+ - `content/static-details.json` - Site metadata (title, social links, etc.)
@@ -0,0 +1,21 @@
1
+ <svg width="600" height="320" viewBox="0 0 600 320" xmlns="http://www.w3.org/2000/svg">
2
+ <style>
3
+ .text-main {
4
+ fill: light-dark(#4A5568, #E2E8F0);
5
+ font-family: 'Segoe UI', 'Arial Black', sans-serif;
6
+ font-weight: 900;
7
+ font-size: 46px;
8
+ letter-spacing: -0.01em;
9
+ text-anchor: middle;
10
+ }
11
+ </style>
12
+
13
+ <!-- Big circle placeholder -->
14
+ <circle cx="300" cy="160" r="100" fill="none" stroke="light-dark(#A0AEC0, #718096)" stroke-width="2" stroke-dasharray="8 4" opacity="0.5" />
15
+
16
+ <!-- Plus sign in circle -->
17
+ <line x1="300" y1="100" x2="300" y2="220" stroke="light-dark(#A0AEC0, #718096)" stroke-width="2" opacity="0.3" />
18
+ <line x1="240" y1="160" x2="360" y2="160" stroke="light-dark(#A0AEC0, #718096)" stroke-width="2" opacity="0.3" />
19
+
20
+ <text x="300" y="290" class="text-main">YOUR LOGO</text>
21
+ </svg>
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "ESNext",
5
+ "moduleResolution": "Bundler",
6
+ "lib": ["ESNext", "DOM", "DOM.Iterable"],
7
+ "strict": true,
8
+ "esModuleInterop": true,
9
+ "skipLibCheck": true,
10
+ "forceConsistentCasingInFileNames": true,
11
+ "resolveJsonModule": true,
12
+ "allowSyntheticDefaultImports": true
13
+ },
14
+ "include": ["api/**/*.ts", "ui/**/*.ts", "prerender/**/*.ts"]
15
+ }
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/favicon.ico" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>{{siteTitle}}</title>
8
+ </head>
9
+ <body>
10
+ <div id="app"></div>
11
+ <script type="module" src="/index.ts"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,20 @@
1
+ import { defineConfig } from 'vite';
2
+ import { resolve } from 'path';
3
+
4
+ export default defineConfig({
5
+ root: 'ui',
6
+ build: {
7
+ outDir: '../dist/ui',
8
+ emptyOutDir: true,
9
+ },
10
+ server: {
11
+ port: 5173,
12
+ proxy: {
13
+ '/api': {
14
+ target: 'http://localhost:8787',
15
+ changeOrigin: true,
16
+ rewrite: (path) => path.replace(/^\/api/, ''),
17
+ },
18
+ },
19
+ },
20
+ });
@@ -0,0 +1,10 @@
1
+ name = "{{name}}"
2
+ main = "api/index.ts"
3
+ compatibility_date = "2024-01-01"
4
+
5
+ [vars]
6
+ SITE_TITLE = "{{siteTitle}}"
7
+
8
+ [[r2_buckets]]
9
+ binding = "CONTENT_BUCKET"
10
+ bucket_name = "your-content-bucket"