portosaurus 1.15.1 → 1.16.0

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.
Files changed (59) hide show
  1. package/README.md +30 -13
  2. package/bin/portosaurus.js +74 -24
  3. package/package.json +4 -4
  4. package/src/internal/README.md +3 -0
  5. package/src/template/README.md +82 -0
  6. package/src/template/blog/authors.yml +5 -0
  7. package/{template → src/template}/blog/welcome.md +1 -1
  8. package/{template/notes/getting-started.md → src/template/notes/welcome.md} +1 -0
  9. package/{utils → src/utils}/createConfig.js +6 -5
  10. package/{utils → src/utils}/packageManager.js +2 -1
  11. package/internal/src/config/sidebar.js +0 -20
  12. package/template/README.md +0 -70
  13. package/template/blog/authors.yml +0 -5
  14. /package/{internal → src/internal}/notes/index.md +0 -0
  15. /package/{internal → src/internal}/src/components/AboutSection/index.js +0 -0
  16. /package/{internal → src/internal}/src/components/AboutSection/styles.module.css +0 -0
  17. /package/{internal → src/internal}/src/components/ContactSection/index.js +0 -0
  18. /package/{internal → src/internal}/src/components/ContactSection/styles.module.css +0 -0
  19. /package/{internal → src/internal}/src/components/ExperienceSection/index.js +0 -0
  20. /package/{internal → src/internal}/src/components/ExperienceSection/styles.module.css +0 -0
  21. /package/{internal → src/internal}/src/components/HeroSection/index.js +0 -0
  22. /package/{internal → src/internal}/src/components/HeroSection/styles.module.css +0 -0
  23. /package/{internal → src/internal}/src/components/NoteIndex/index.js +0 -0
  24. /package/{internal → src/internal}/src/components/NoteIndex/styles.module.css +0 -0
  25. /package/{internal → src/internal}/src/components/ProjectsSection/index.js +0 -0
  26. /package/{internal → src/internal}/src/components/ProjectsSection/styles.module.css +0 -0
  27. /package/{internal → src/internal}/src/components/ScrollToTop/index.js +0 -0
  28. /package/{internal → src/internal}/src/components/ScrollToTop/styles.module.css +0 -0
  29. /package/{internal → src/internal}/src/components/SocialLinks/index.js +0 -0
  30. /package/{internal → src/internal}/src/components/SocialLinks/styles.module.css +0 -0
  31. /package/{internal → src/internal}/src/components/Tooltip/index.js +0 -0
  32. /package/{internal → src/internal}/src/components/Tooltip/styles.module.css +0 -0
  33. /package/{internal → src/internal}/src/config/iconMappings.js +0 -0
  34. /package/{internal → src/internal}/src/config/metaTags.js +0 -0
  35. /package/{internal → src/internal}/src/config/prism.js +0 -0
  36. /package/{internal → src/internal/src/config}/sidebars.js +0 -0
  37. /package/{internal → src/internal}/src/css/bootstrap.css +0 -0
  38. /package/{internal → src/internal}/src/css/catppuccin.css +0 -0
  39. /package/{internal → src/internal}/src/css/custom.css +0 -0
  40. /package/{internal → src/internal}/src/css/tasks.css +0 -0
  41. /package/{internal → src/internal}/src/pages/index.js +0 -0
  42. /package/{internal → src/internal}/src/pages/notes.js +0 -0
  43. /package/{internal → src/internal}/src/pages/tasks.js +0 -0
  44. /package/{internal → src/internal}/src/utils/HashNavigation.js +0 -0
  45. /package/{internal → src/internal}/src/utils/appVersion.js +0 -0
  46. /package/{internal → src/internal}/src/utils/compileConfig.js +0 -0
  47. /package/{internal → src/internal}/src/utils/cssUtils.js +0 -0
  48. /package/{internal → src/internal}/src/utils/filterEnabledItems.js +0 -0
  49. /package/{internal → src/internal}/src/utils/generateFavicon.js +0 -0
  50. /package/{internal → src/internal}/src/utils/generateRobotsTxt.js +0 -0
  51. /package/{internal → src/internal}/src/utils/iconExtractor.js +0 -0
  52. /package/{internal → src/internal}/src/utils/imageDownloader.js +0 -0
  53. /package/{internal → src/internal}/src/utils/imageProcessor.js +0 -0
  54. /package/{internal → src/internal}/src/utils/linkShortner.js +0 -0
  55. /package/{internal → src/internal}/src/utils/updateTitle.js +0 -0
  56. /package/{template → src/template}/.github/workflows/deploy.yml +0 -0
  57. /package/{template → src/template}/config.js +0 -0
  58. /package/{template → src/template}/static/README.md +0 -0
  59. /package/{utils → src/utils}/logger.js +0 -0
package/README.md CHANGED
@@ -37,10 +37,10 @@ npx portosaurus init my-portfolio
37
37
 
38
38
  **Options:**
39
39
 
40
- - `-gh`: Automatically sets up GitHub Actions workflow for deployment.
41
- - `--install`: Installs dependencies automatically.
40
+ - `-ngh, --no-github-pages`: Skip setting up GitHub Actions workflow for deployment.
41
+ - `-ni, --no-install`: Skip automatic dependency installation.
42
42
 
43
- ### 2. Start Development
43
+ ### 2. Start Development Server
44
44
 
45
45
  Navigate to your project and start the development server:
46
46
 
@@ -58,6 +58,26 @@ Your site will be available at `http://localhost:3000`.
58
58
 
59
59
  ### 3. Build & Deploy
60
60
 
61
+ #### GitHub Pages
62
+
63
+ 1. Create a repository on GitHub named `yourUsername.github.io`.
64
+ 2. Go to the repo's `Settings` > `Pages` > `Build and deployment` > `Source` > **`GitHub Actions`**.
65
+ 3. Push your code:
66
+ ```bash
67
+ git remote add origin https://github.com/yourUsername/yourUsername.github.io.git
68
+ git branch -M main
69
+ git push -u origin main
70
+ ```
71
+
72
+ #### Other Providers
73
+
74
+ A portosaurus project can be deployed to any static hosting provider like:
75
+
76
+ - Netlify
77
+ - Vercel
78
+ - Cloudflare Pages
79
+ - Other static providers
80
+
61
81
  To generate the static site for production:
62
82
 
63
83
  ```bash
@@ -70,18 +90,15 @@ npm run build
70
90
 
71
91
  The output will be in the `build/` directory.
72
92
 
73
- #### GitHub Pages (Automated)
93
+ To preview the production build locally:
74
94
 
75
- If you used the `-gh` flag during init, just push to your repository:
95
+ ```bash
96
+ # With Bun
97
+ bun run serve
76
98
 
77
- 1. Create a repository on GitHub.
78
- 2. Push your code:
79
- ```bash
80
- git remote add origin https://github.com/username/repo.git
81
- git branch -M main
82
- git push -u origin main
83
- ```
84
- 3. Go to GitHub Settings > Pages > Build and deployment > Source > **GitHub Actions**.
99
+ # With npm
100
+ npm run serve
101
+ ```
85
102
 
86
103
  <br>
87
104
 
@@ -18,8 +18,8 @@ import { fileURLToPath } from "url";
18
18
  import { spawn, execSync } from "child_process";
19
19
  import { createRequire } from "module";
20
20
 
21
- import { logger } from "../utils/logger.js";
22
- import { createConfig } from "../utils/createConfig.js";
21
+ import { logger } from "../src/utils/logger.js";
22
+ import { createConfig } from "../src/utils/createConfig.js";
23
23
 
24
24
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
25
25
 
@@ -32,10 +32,18 @@ const program = new Command();
32
32
  program
33
33
  .name("portosaurus")
34
34
  .description("CLI for Portosaurus - The complete portfolio solution")
35
- .version(packageJson.version);
35
+ .version(packageJson.version, "-v, --version", "output the current version");
36
36
 
37
37
  // ----------- HELPERS -------------
38
38
 
39
+ // Helper to clean up internal index.md from user notes
40
+ function cleanUserNotesIndex(projectRoot) {
41
+ const userNotesIndex = path.join(projectRoot, "notes", "index.md");
42
+ if (existsSync(userNotesIndex)) {
43
+ removeSync(userNotesIndex);
44
+ }
45
+ }
46
+
39
47
  async function prepareDocusaurusRun(projectRoot) {
40
48
  const configPath = path.join(projectRoot, "config.js");
41
49
 
@@ -48,22 +56,34 @@ async function prepareDocusaurusRun(projectRoot) {
48
56
  }
49
57
 
50
58
  // Ensure internal files are synced to .portosaurus
51
- const internalSrc = path.join(__dirname, "../internal/src");
52
- const internalSidebars = path.join(__dirname, "../internal/sidebars.js");
53
- const internalNotesIndex = path.join(__dirname, "../internal/notes/index.md");
54
-
59
+ const internalDir = path.join(__dirname, "../src/internal");
55
60
  const dotPorto = path.join(projectRoot, ".portosaurus");
56
- const userSrc = path.join(dotPorto, "src");
57
- const userSidebars = path.join(dotPorto, "sidebars.js");
58
61
 
59
- // Ensure .portosaurus exists
60
- fs.ensureDirSync(dotPorto);
62
+ // Ensure .portosaurus exists and is clean
63
+ fs.emptyDirSync(dotPorto);
61
64
 
62
- // Always copy/overwrite src/
63
- fs.copySync(internalSrc, userSrc);
65
+ // 1. Copy everything from internal to .portosaurus
66
+ fs.copySync(internalDir, dotPorto);
64
67
 
65
- // Always copy/overwrite sidebars.js
66
- fs.copySync(internalSidebars, userSidebars);
68
+ // 2. Overwrite with user files if they exist in project root
69
+ const internalFiles = readdirSync(internalDir);
70
+
71
+ for (const file of internalFiles) {
72
+ const userFile = path.join(projectRoot, file);
73
+
74
+ if (existsSync(userFile)) {
75
+ fs.copySync(userFile, path.join(dotPorto, file), {
76
+ overwrite: true,
77
+ filter: (src) => {
78
+ // Ignore notes/index.md
79
+ if (src.endsWith(path.join("notes", "index.md"))) {
80
+ return false;
81
+ }
82
+ return true;
83
+ },
84
+ });
85
+ }
86
+ }
67
87
 
68
88
  // Ensure user has essential folders
69
89
  const userRootNotes = path.join(projectRoot, "notes");
@@ -74,12 +94,6 @@ async function prepareDocusaurusRun(projectRoot) {
74
94
  fs.ensureDirSync(userRootBlog);
75
95
  fs.ensureDirSync(userRootStatic);
76
96
 
77
- // Always ensure index.md exists (framework-managed file)
78
- const userNotesIndex = path.join(userRootNotes, "index.md");
79
- if (!fs.existsSync(userNotesIndex)) {
80
- fs.copySync(internalNotesIndex, userNotesIndex);
81
- }
82
-
83
97
  // Load user config
84
98
  const require = createRequire(import.meta.url);
85
99
 
@@ -119,7 +133,7 @@ module.exports = ${JSON.stringify(docusaurusConfig, null, 2)};`;
119
133
 
120
134
  async function runDocusaurus(command, args, dotPorto, projectRoot) {
121
135
  // Detect package manager and find docusaurus binary
122
- const { findDocusaurusBin } = await import("../utils/packageManager.js");
136
+ const { findDocusaurusBin } = await import("../src/utils/packageManager.js");
123
137
  const docusaurus = findDocusaurusBin(projectRoot || process.cwd());
124
138
 
125
139
  logger.info(
@@ -176,7 +190,7 @@ program
176
190
  mkdirSync(projectPath);
177
191
 
178
192
  // Copy template files
179
- const templatePath = path.resolve(__dirname, "../template");
193
+ const templatePath = path.resolve(__dirname, "../src/template");
180
194
 
181
195
  // Check if template exists (it might not be populated yet)
182
196
  if (!existsSync(templatePath)) {
@@ -209,6 +223,7 @@ program
209
223
  scripts: {
210
224
  dev: "portosaurus dev",
211
225
  start: "portosaurus start",
226
+ serve: "portosaurus serve",
212
227
  build: "portosaurus build",
213
228
  },
214
229
  dependencies: {
@@ -251,7 +266,7 @@ program
251
266
 
252
267
  // Detect package manager for install instructions
253
268
  const { detectPackageManager } =
254
- await import("../utils/packageManager.js");
269
+ await import("../src/utils/packageManager.js");
255
270
  const pm = detectPackageManager(projectPath) || "npm";
256
271
  const installCmd = pm === "npm" ? "npm install" : `${pm} install`;
257
272
  const runCmd = pm === "npm" ? "npm run" : `${pm} run`;
@@ -287,6 +302,8 @@ program
287
302
  }
288
303
  });
289
304
 
305
+
306
+
290
307
  // --- START COMMAND ---
291
308
 
292
309
  program
@@ -302,6 +319,8 @@ program
302
319
  } catch (error) {
303
320
  logger.error(`Failed to start: ${error.message}`);
304
321
  process.exit(1);
322
+ } finally {
323
+ cleanUserNotesIndex(projectRoot);
305
324
  }
306
325
  });
307
326
 
@@ -334,6 +353,37 @@ program
334
353
  } catch (error) {
335
354
  logger.error(`Failed to build: ${error.message}`);
336
355
  process.exit(1);
356
+ } finally {
357
+ cleanUserNotesIndex(projectRoot);
358
+ }
359
+ });
360
+
361
+ // --- SERVE COMMAND ---
362
+
363
+ program
364
+ .command("serve")
365
+ .description("Serve the built static site locally")
366
+ .action(async () => {
367
+ const projectRoot = process.cwd();
368
+ logger.info("Serving Portosaurus site...");
369
+
370
+ try {
371
+ const { dotPorto } = await prepareDocusaurusRun(projectRoot);
372
+ const buildDir = path.join(projectRoot, "build");
373
+
374
+ if (!existsSync(buildDir)) {
375
+ logger.error(
376
+ "Build directory not found. Run 'portosaurus build' first.",
377
+ );
378
+ process.exit(1);
379
+ }
380
+
381
+ await runDocusaurus("serve", ["--dir", buildDir], dotPorto, projectRoot);
382
+ } catch (error) {
383
+ logger.error(`Failed to serve: ${error.message}`);
384
+ process.exit(1);
385
+ } finally {
386
+ cleanUserNotesIndex(projectRoot);
337
387
  }
338
388
  });
339
389
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "portosaurus",
3
- "version": "1.15.1",
3
+ "version": "1.16.0",
4
4
  "author": "soymadip",
5
5
  "license": "GPL-3.0-only",
6
6
  "description": "Complete portfolio cum personal website solution for your digital personality.",
@@ -26,9 +26,9 @@
26
26
  },
27
27
  "files": [
28
28
  "bin/",
29
- "internal/",
30
- "template/",
31
- "utils/"
29
+ "src/internal/",
30
+ "src/template/",
31
+ "src/utils/"
32
32
  ],
33
33
  "dependencies": {
34
34
  "@docusaurus/core": "^3.9.2",
@@ -0,0 +1,3 @@
1
+ # Inernals
2
+
3
+ Everything in this dir will copied at runtime at portusaurus working dir and will be overriten if user has any duplicate file.
@@ -0,0 +1,82 @@
1
+ <br>
2
+ <div align="center">
3
+ <img src="https://raw.githubusercontent.com/soymadip/portosaurus/refs/heads/compiler/static/img/icon.png" width=90>
4
+ <h1>My Portfolio Site</h1>
5
+ <p>
6
+ Complete portfolio cum personal website for my digital personality
7
+ <br>
8
+ <small>Made with <a href="https://github.com/soymadip/portosaurus">Portosaurus</a></small>
9
+ </p>
10
+ </div>
11
+
12
+ ## Project Structure
13
+
14
+ ```
15
+ .
16
+ ├── config.js # Site configuration
17
+ ├── blog/ # Blog posts (Markdown/MDX)
18
+ ├── notes/ # Documentation (Markdown/MDX)
19
+ ├── static/ # Static assets (images, files, binaries)
20
+ └── package.json # Dependencies
21
+ ```
22
+
23
+ ## Configuration
24
+
25
+ Edit [`config.js`](./config.js) to customize your site. See the [Portosaurus documentation](https://github.com/soymadip/portosaurus#configuration) for all available options.
26
+
27
+ ## Development
28
+
29
+ Start the development server:
30
+
31
+ ```bash
32
+ # With Bun
33
+ bun run dev
34
+
35
+ # With npm
36
+ npm run dev
37
+ ```
38
+
39
+ The site will be available at `http://localhost:3000`.
40
+
41
+ ## Build & Deploy
42
+
43
+ ### GitHub Pages
44
+
45
+ 1. Create a repository on GitHub named `yourUsername.github.io`.
46
+ 2. Go to the repo's `Settings` > `Pages` > `Build and deployment` > `Source` > **`GitHub Actions`**.
47
+ 3. Push your code:
48
+ ```bash
49
+ git remote add origin https://github.com/yourUsername/yourUsername.github.io.git
50
+ git branch -M main
51
+ git push -u origin main
52
+ ```
53
+
54
+ ### Other Providers
55
+
56
+ A portosaurus project can be deployed to any static hosting provider like:
57
+
58
+ - Netlify
59
+ - Vercel
60
+ - Cloudflare pages
61
+ - Other static providers
62
+
63
+ To generate the static site for production:
64
+
65
+ ```bash
66
+ # With Bun
67
+ bun run build
68
+
69
+ # With npm
70
+ npm run build
71
+ ```
72
+
73
+ The output will be in the `build/` directory.
74
+
75
+ ---
76
+
77
+ <div align="center">
78
+
79
+ Made with [Portosaurus](https://github.com/soymadip/portosaurus)
80
+
81
+ <br>
82
+ </div>
@@ -0,0 +1,5 @@
1
+ you:
2
+ name: Your Name
3
+ title: Maintainer
4
+ url: https://github.com/yourUsername
5
+ image_url: https://github.com/yourUsername.png
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  slug: welcome
3
3
  title: Welcome
4
- authors: [soymadip]
4
+ authors: [you]
5
5
  tags: [hello, portosaurus]
6
6
  ---
7
7
 
@@ -1,4 +1,5 @@
1
1
  ---
2
+ title: getting-started
2
3
  sidebar_position: 1
3
4
  ---
4
5
 
@@ -66,10 +66,11 @@ export function createConfig(userConfig, projectRoot = process.cwd()) {
66
66
  const title = usrConf.hero_section?.title || projName;
67
67
  const tagline = usrConf.hero_section?.description || projDesc;
68
68
 
69
- // Resolve paths relative to project root (where config.js is)
70
- const notesPath = path.resolve(projectRoot, "notes");
71
- const blogPath = path.resolve(projectRoot, "blog");
72
- const staticPath = path.resolve(projectRoot, "static");
69
+ // Resolve paths relative to .portosaurus (the build context)
70
+ const dotPorto = path.resolve(projectRoot, ".portosaurus");
71
+ const notesPath = path.resolve(dotPorto, "notes");
72
+ const blogPath = path.resolve(dotPorto, "blog");
73
+ const staticPath = path.resolve(dotPorto, "static");
73
74
 
74
75
  // ---------- Docusaurus Config -----------
75
76
  const config = {
@@ -109,7 +110,7 @@ export function createConfig(userConfig, projectRoot = process.cwd()) {
109
110
  docs: {
110
111
  path: notesPath,
111
112
  routeBasePath: "notes",
112
- sidebarPath: "./sidebars.js", // Inside .portosaurus
113
+ sidebarPath: "./src/config/sidebars.js", // Inside .portosaurus
113
114
  // editUrl: '...',
114
115
  },
115
116
  blog: {
@@ -34,7 +34,7 @@ export function detectPackageManager(projectRoot) {
34
34
  }
35
35
  }
36
36
 
37
- return "npm"; // Ultimate fallback
37
+ return "npm"; // fallback
38
38
  }
39
39
 
40
40
  /**
@@ -44,6 +44,7 @@ export function detectPackageManager(projectRoot) {
44
44
  export function getRunCommand(packageManager, binaryName, args = []) {
45
45
  switch (packageManager) {
46
46
  case "bun":
47
+
47
48
  // Bun can run binaries directly with `bun run`
48
49
  return {
49
50
  command: "bun",
@@ -1,20 +0,0 @@
1
-
2
- const sidebar = {
3
-
4
- notes: [
5
- {
6
- type: 'category',
7
- label: 'Notes',
8
- link: { type: 'doc', id: 'index' },
9
- items: [
10
- {
11
- type: 'autogenerated',
12
- dirName: '.'
13
- }
14
- ]
15
- }
16
- ]
17
- };
18
-
19
-
20
- module.exports = sidebar;
@@ -1,70 +0,0 @@
1
- # Portosaurus Project
2
-
3
- A portfolio website built with [Portosaurus](https://github.com/soymadip/portosaurus).
4
-
5
- ## Getting Started
6
-
7
- ### Development
8
-
9
- Start the development server:
10
-
11
- ```bash
12
- # With Bun
13
- bun run dev
14
-
15
- # With npm
16
- npm run dev
17
- ```
18
-
19
- The site will be available at `http://localhost:3000`.
20
-
21
- ### Build
22
-
23
- Build the static site:
24
-
25
- ```bash
26
- # With Bun
27
- bun run build
28
-
29
- # With npm
30
- npm run build
31
- ```
32
-
33
- The output will be in the `build/` directory.
34
-
35
- ## Project Structure
36
-
37
- ```
38
- .
39
- ├── config.js # Site configuration
40
- ├── blog/ # Blog posts (Markdown)
41
- ├── notes/ # Documentation (Markdown)
42
- ├── static/ # Static assets (images, files)
43
- └── package.json # Dependencies
44
- ```
45
-
46
- ## Configuration
47
-
48
- Edit `config.js` to customize your site. See the [Portosaurus documentation](https://github.com/soymadip/portosaurus) for all available options.
49
-
50
- ## Deployment
51
-
52
- ### GitHub Pages
53
-
54
- 1. Push your project to GitHub
55
- 2. Go to Settings > Pages
56
- 3. Set Source to "GitHub Actions"
57
- 4. The site will deploy automatically on push
58
-
59
- ### Other Platforms
60
-
61
- The `build/` directory contains a static site that can be deployed to:
62
-
63
- - Vercel
64
- - Netlify
65
- - Cloudflare Pages
66
- - Any static hosting service
67
-
68
- ---
69
-
70
- Made with [Portosaurus](https://github.com/soymadip/portosaurus)
@@ -1,5 +0,0 @@
1
- soymadip:
2
- name: soymadip
3
- title: Maintainer
4
- url: https://github.com/soymadip
5
- image_url: https://github.com/soymadip.png
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes