@portosaur/cli 0.6.2 → 0.8.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.
- package/package.json +4 -4
- package/src/templates/config.yml +17 -10
- package/src/utils/runner.mjs +31 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@portosaur/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "CLI for Portosaur - The static Personal portfolio site generator.",
|
|
5
5
|
"license": "GPL-3.0-only",
|
|
6
6
|
"author": "soymadip",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
},
|
|
27
27
|
"types": "./src/index.d.ts",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@portosaur/core": "^0.
|
|
30
|
-
"@portosaur/logger": "^0.
|
|
31
|
-
"@portosaur/wizard": "^0.
|
|
29
|
+
"@portosaur/core": "^0.8.0",
|
|
30
|
+
"@portosaur/logger": "^0.8.0",
|
|
31
|
+
"@portosaur/wizard": "^0.8.0",
|
|
32
32
|
"commander": "^13.1.0",
|
|
33
33
|
"js-yaml": "^4.1.1"
|
|
34
34
|
}
|
package/src/templates/config.yml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# yaml-language-server: $schema=https://soymadip.github.io/portosaur/conf-schema.json
|
|
2
|
+
#
|
|
2
3
|
# Portosaur Project Configuration
|
|
3
|
-
# This file is filled with example values
|
|
4
4
|
# Check Config Docs: https://soymadip.is-a.dev/portosaur/guide/config
|
|
5
5
|
|
|
6
6
|
# Site Metadata & SEO
|
|
7
7
|
site:
|
|
8
|
-
title:
|
|
9
|
-
tagline:
|
|
8
|
+
title: null # Defaults to {{homepage.hero.title}}
|
|
9
|
+
tagline: null # Defaults to {{homepage.hero.desc}}
|
|
10
10
|
|
|
11
|
-
favicon:
|
|
12
|
-
social_card: "{{portoRoot}}/assets/img/social-card.jpeg"
|
|
11
|
+
favicon: null # By default, generates from {{home_page.hero.profile_pic}}
|
|
12
|
+
# social_card: "{{portoRoot}}/assets/img/social-card.jpeg"
|
|
13
13
|
|
|
14
14
|
# Auto set if deploying in Github/GitLab Pages
|
|
15
15
|
url: "auto"
|
|
@@ -18,20 +18,27 @@ site:
|
|
|
18
18
|
# UI/UX & Theme Behavior
|
|
19
19
|
theme:
|
|
20
20
|
appearance:
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
default_theme: dark # dark | light
|
|
22
|
+
show_theme_switch: true
|
|
23
|
+
disable_project_link: false
|
|
24
|
+
|
|
25
|
+
footer:
|
|
26
|
+
enable: true
|
|
27
|
+
message: null
|
|
28
|
+
disable_project_link: false
|
|
23
29
|
|
|
24
30
|
navigation:
|
|
31
|
+
breadcrumbs: true
|
|
25
32
|
collapsable_sidebar: true
|
|
26
33
|
hide_navbar_on_scroll: true
|
|
27
34
|
|
|
28
35
|
# Page Content & Sections
|
|
29
36
|
home_page:
|
|
30
37
|
hero:
|
|
31
|
-
title:
|
|
38
|
+
title: "{{fullName}}"
|
|
32
39
|
profession: "Your Profession"
|
|
33
|
-
desc:
|
|
34
|
-
profile_pic:
|
|
40
|
+
desc: "Short description about you, your passion, your goals etc."
|
|
41
|
+
profile_pic: "{{portoRoot}}/assets/img/svg/icon.svg"
|
|
35
42
|
|
|
36
43
|
social:
|
|
37
44
|
- name: "LinkedIn"
|
package/src/utils/runner.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import fs from "fs";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { spawn } from "child_process";
|
|
4
4
|
import { createRequire } from "module";
|
|
5
|
+
import { hasCommand, getPortoDotDir } from "@portosaur/core";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Generates a static Docusaurus config file by evaluating the Portosaur config
|
|
@@ -14,7 +15,7 @@ import { createRequire } from "module";
|
|
|
14
15
|
* @returns {string} The path to the generated config file.
|
|
15
16
|
*/
|
|
16
17
|
export function writeConfigShim(UserRoot, portoPaths, context = {}) {
|
|
17
|
-
const dotDir =
|
|
18
|
+
const dotDir = getPortoDotDir(UserRoot);
|
|
18
19
|
|
|
19
20
|
if (!fs.existsSync(dotDir)) {
|
|
20
21
|
fs.mkdirSync(dotDir, { recursive: true });
|
|
@@ -173,8 +174,36 @@ export async function runDocusaurus(
|
|
|
173
174
|
|
|
174
175
|
args.push(...extraArgs);
|
|
175
176
|
|
|
177
|
+
// Strip the hardcoded Docusaurus generator tag from its internal HTML templates
|
|
178
|
+
// so that only the Portosaur metadata tag is rendered in the final output.
|
|
179
|
+
try {
|
|
180
|
+
const coreLibDir = path.resolve(path.dirname(docusaurusBin), "../lib");
|
|
181
|
+
const templates = [
|
|
182
|
+
path.join(coreLibDir, "webpack/templates/dev.html.template.ejs"),
|
|
183
|
+
path.join(coreLibDir, "ssg/ssgTemplate.html.js"),
|
|
184
|
+
];
|
|
185
|
+
for (const tpl of templates) {
|
|
186
|
+
if (fs.existsSync(tpl)) {
|
|
187
|
+
let content = fs.readFileSync(tpl, "utf8");
|
|
188
|
+
const newContent = content.replace(
|
|
189
|
+
/<meta name="generator" content="Docusaurus[^"]*">\n?/g,
|
|
190
|
+
"",
|
|
191
|
+
);
|
|
192
|
+
if (content !== newContent) {
|
|
193
|
+
fs.writeFileSync(tpl, newContent, "utf8");
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
} catch (err) {
|
|
198
|
+
// Ignore permissions or missing file errors
|
|
199
|
+
}
|
|
200
|
+
|
|
176
201
|
// Use bun when available for faster builds, fall back to node.
|
|
177
|
-
|
|
202
|
+
// If node isn't installed, fallback to bun gracefully.
|
|
203
|
+
let runtime = "node";
|
|
204
|
+
if (typeof Bun !== "undefined" || !hasCommand("node")) {
|
|
205
|
+
runtime = "bun";
|
|
206
|
+
}
|
|
178
207
|
|
|
179
208
|
// Skip actual execution in test mode
|
|
180
209
|
if (process.env.PORTO_TEST_MODE === "true") {
|
|
@@ -186,10 +215,6 @@ export async function runDocusaurus(
|
|
|
186
215
|
|
|
187
216
|
const childEnv = { ...process.env, FORCE_COLOR: "true" };
|
|
188
217
|
|
|
189
|
-
if (command === "build") {
|
|
190
|
-
childEnv.CI = "true";
|
|
191
|
-
}
|
|
192
|
-
|
|
193
218
|
const child = spawn(runtime, args, {
|
|
194
219
|
stdio: "inherit",
|
|
195
220
|
cwd: UserRoot,
|