@leadertechie/create-personal-site 0.1.0-alpha.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/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,2 @@
1
+ # create-personal-site
2
+ A CLI project to create the personal site from the other package
package/bin/index.js ADDED
@@ -0,0 +1,156 @@
1
+ #!/usr/bin/env node
2
+ import prompts from 'prompts';
3
+ import { red, green, blue, bold } from 'kolorist';
4
+ import fs from 'fs-extra';
5
+ import path from 'path';
6
+ import { fileURLToPath } from 'url';
7
+
8
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
+
10
+ async function fetchGithubProfile(username) {
11
+ if (!username) return null;
12
+ try {
13
+ const res = await fetch("https://api.github.com/users/" + username);
14
+ if (res.ok) return await res.json();
15
+ } catch (e) {}
16
+ return null;
17
+ }
18
+
19
+ async function init() {
20
+ const response = await prompts([
21
+ {
22
+ type: 'text',
23
+ name: 'projectName',
24
+ message: 'Project name:',
25
+ initial: 'my-personal-site'
26
+ },
27
+ {
28
+ type: 'text',
29
+ name: 'githubUsername',
30
+ message: 'GitHub username:'
31
+ },
32
+ {
33
+ type: 'text',
34
+ name: 'siteTitle',
35
+ message: 'Site title:',
36
+ initial: 'My Personal Website'
37
+ }
38
+ ]);
39
+
40
+ const { projectName, githubUsername, siteTitle } = response;
41
+ if (!projectName) {
42
+ console.log(red('Cancelled.'));
43
+ return;
44
+ }
45
+
46
+ const root = path.join(process.cwd(), projectName);
47
+
48
+ console.log("
49
+ Creating project in " + blue(root) + "...");
50
+
51
+ // 1. Create directory
52
+ await fs.ensureDir(root);
53
+
54
+ // 2. Fetch Github profile to personalize
55
+ let profile = await fetchGithubProfile(githubUsername);
56
+ if (profile) {
57
+ console.log(green("Fetched GitHub profile for " + profile.name));
58
+ }
59
+
60
+ // 3. Create personalized content
61
+ const contentDir = path.join(root, 'content');
62
+ const pagesDir = path.join(contentDir, 'pages');
63
+ await fs.ensureDir(contentDir);
64
+ await fs.ensureDir(pagesDir);
65
+
66
+ const aboutMe = "# About Me
67
+
68
+ " + (profile?.bio || "Welcome to my site!") + "
69
+
70
+ Find more on my [GitHub](" + (profile?.html_url || "") + ").";
71
+ await fs.writeFile(path.join(contentDir, 'about-me.md'), aboutMe);
72
+
73
+ const homePageTitle = profile?.name || "My Personal Website";
74
+ const homePage = `---
75
+ title: ${homePageTitle}
76
+ date: ${new Date().toISOString().split('T')[0]}
77
+ description: Welcome to my personal website.
78
+ ---
79
+
80
+ # ${homePageTitle}
81
+
82
+ Welcome to my site!`;
83
+ await fs.writeFile(path.join(pagesDir, 'home.md'), homePage);
84
+
85
+ const staticDetails = {
86
+ siteTitle: siteTitle || profile?.name || "My Personal Website",
87
+ siteDescription: profile?.bio || "Welcome to my professional portfolio.",
88
+ copyright: new Date().getFullYear() + " " + (profile?.name || "All Rights Reserved"),
89
+ linkedin: "",
90
+ github: profile?.html_url || "",
91
+ email: profile?.email || ""
92
+ };
93
+ await fs.writeFile(path.join(contentDir, 'static-details.json'), JSON.stringify(staticDetails, null, 2));
94
+
95
+ // 4. Copy templates
96
+ await fs.copy(path.join(__dirname, '..', 'templates'), root);
97
+
98
+ // 5. Create project-specific files
99
+ await fs.ensureDir(path.join(root, 'api'));
100
+ await fs.ensureDir(path.join(root, 'ui'));
101
+ await fs.ensureDir(path.join(root, 'prerender'));
102
+
103
+ await fs.writeFile(path.join(root, 'api/index.ts'), "import { WebsiteAPI } from '@leadertechie/personal-site-kit/api';
104
+
105
+ export default new WebsiteAPI();
106
+ ");
107
+ await fs.writeFile(path.join(root, 'ui/index.ts'), "import { WebsiteUI } from '@leadertechie/personal-site-kit/shared';
108
+ import '@leadertechie/personal-site-kit/ui/banner';
109
+ import '@leadertechie/personal-site-kit/ui/footer';
110
+ import '@leadertechie/personal-site-kit/ui/about-me';
111
+
112
+ WebsiteUI.bootstrap();
113
+ ");
114
+ await fs.writeFile(path.join(root, 'prerender/index.ts'), "import { WebsitePrerender } from '@leadertechie/personal-site-kit/prerender';
115
+
116
+ export default new WebsitePrerender();
117
+ ");
118
+
119
+ // Replace template variables in wrangler.toml
120
+ const wranglerToml = await fs.readFile(path.join(root, 'wrangler.toml'), 'utf-8');
121
+ const processedToml = wranglerToml
122
+ .replace(/\{\{name\}\}/g, projectName)
123
+ .replace(/\{\{siteTitle\}\}/g, siteTitle || 'My Personal Website');
124
+ await fs.writeFile(path.join(root, 'wrangler.toml'), processedToml);
125
+
126
+ // Replace template variables in README
127
+ const readme = await fs.readFile(path.join(root, 'README.md'), 'utf-8');
128
+ await fs.writeFile(path.join(root, 'README.md'), readme.replace(/\{\{name\}\}/g, projectName));
129
+
130
+ // 6. Create package.json
131
+ const pkg = {
132
+ name: projectName,
133
+ version: '0.1.0',
134
+ private: true,
135
+ scripts: {
136
+ "dev": "wrangler dev",
137
+ "deploy": "wrangler deploy",
138
+ "seed": "# Script to upload content to R2"
139
+ },
140
+ dependencies: {
141
+ "@leadertechie/personal-site-kit": "latest",
142
+ "lit": "^3.2.1"
143
+ }
144
+ };
145
+ await fs.writeFile(path.join(root, 'package.json'), JSON.stringify(pkg, null, 2));
146
+
147
+ console.log("
148
+ " + green('Done!') + " Now run:
149
+ ");
150
+ console.log(" cd " + projectName);
151
+ console.log(" npm install");
152
+ console.log(" # Update wrangler.toml with your R2 bucket name");
153
+ console.log(" npm run dev");
154
+ }
155
+
156
+ init().catch(e => console.error(red(e)));
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@leadertechie/create-personal-site",
3
+ "version": "0.1.0-alpha.4",
4
+ "description": "Create a personal website powered by @leadertechie/personal-site-kit",
5
+ "bin": {
6
+ "create-personal-site": "./bin/index.js"
7
+ },
8
+ "type": "module",
9
+ "engines": {
10
+ "node": ">=20"
11
+ },
12
+ "license": "MIT",
13
+ "files": [
14
+ "bin",
15
+ "templates"
16
+ ],
17
+ "keywords": [
18
+ "cli",
19
+ "personal-site",
20
+ "cloudflare-workers"
21
+ ],
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "https://github.com/leadertechie/create-personal-site"
25
+ },
26
+ "dependencies": {
27
+ "prompts": "^2.4.2",
28
+ "kolorist": "^1.8.0",
29
+ "fs-extra": "^11.1.1",
30
+ "execa": "^8.0.1"
31
+ }
32
+ }
@@ -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,10 @@
1
+ name = "{{name}}"
2
+ main = "dist/worker.js"
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"