portosaurus 1.16.1 → 1.16.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/bin/portosaurus.js
CHANGED
|
@@ -62,29 +62,20 @@ async function prepareDocusaurusRun(projectRoot) {
|
|
|
62
62
|
// Ensure .portosaurus exists and is clean
|
|
63
63
|
fs.emptyDirSync(runtimeDir);
|
|
64
64
|
|
|
65
|
-
// Ensure user has essential folders in project root
|
|
66
|
-
fs.ensureDirSync(path.join(projectRoot, "notes"));
|
|
67
|
-
fs.ensureDirSync(path.join(projectRoot, "blog"));
|
|
68
|
-
fs.ensureDirSync(path.join(projectRoot, "static"));
|
|
69
|
-
|
|
70
65
|
// 1. Copy everything from internal to .portosaurus
|
|
71
66
|
fs.copySync(internalDir, runtimeDir);
|
|
72
67
|
|
|
73
68
|
// 2. Overwrite with user files if they exist in project root
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const userFile = path.resolve(projectRoot, file);
|
|
79
|
-
const destFile = path.resolve(runtimeDir, file);
|
|
69
|
+
const internalFiles = readdirSync(internalDir);
|
|
70
|
+
|
|
71
|
+
for (const file of internalFiles) {
|
|
72
|
+
const userFile = path.join(projectRoot, file);
|
|
80
73
|
|
|
81
74
|
if (existsSync(userFile)) {
|
|
82
|
-
|
|
83
|
-
fs.ensureDirSync(destFile);
|
|
84
|
-
}
|
|
85
|
-
fs.copySync(userFile, destFile, {
|
|
75
|
+
fs.copySync(userFile, path.join(runtimeDir, file), {
|
|
86
76
|
overwrite: true,
|
|
87
77
|
filter: (src) => {
|
|
78
|
+
// Ignore notes/index.md
|
|
88
79
|
if (src.endsWith(path.join("notes", "index.md"))) {
|
|
89
80
|
return false;
|
|
90
81
|
}
|
|
@@ -94,6 +85,15 @@ async function prepareDocusaurusRun(projectRoot) {
|
|
|
94
85
|
}
|
|
95
86
|
}
|
|
96
87
|
|
|
88
|
+
// Ensure user has essential folders
|
|
89
|
+
const userRootNotes = path.join(projectRoot, "notes");
|
|
90
|
+
const userRootBlog = path.join(projectRoot, "blog");
|
|
91
|
+
const userRootStatic = path.join(projectRoot, "static");
|
|
92
|
+
|
|
93
|
+
fs.ensureDirSync(userRootNotes);
|
|
94
|
+
fs.ensureDirSync(userRootBlog);
|
|
95
|
+
fs.ensureDirSync(userRootStatic);
|
|
96
|
+
|
|
97
97
|
// Load user config
|
|
98
98
|
const require = createRequire(import.meta.url);
|
|
99
99
|
|
|
@@ -302,6 +302,8 @@ program
|
|
|
302
302
|
}
|
|
303
303
|
});
|
|
304
304
|
|
|
305
|
+
|
|
306
|
+
|
|
305
307
|
// --- START COMMAND ---
|
|
306
308
|
|
|
307
309
|
program
|
package/package.json
CHANGED
|
@@ -5,10 +5,8 @@ import { fileURLToPath } from "url";
|
|
|
5
5
|
|
|
6
6
|
const require = createRequire(import.meta.url);
|
|
7
7
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
8
|
-
const internalUtils = path.resolve(__dirname, "../internal/src/utils");
|
|
9
|
-
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
const internalUtils = path.resolve(__dirname, "../internal/src/utils");
|
|
12
10
|
|
|
13
11
|
/**
|
|
14
12
|
* Resolves the site URL based on config value and environment.
|
|
@@ -45,15 +43,12 @@ function resolveBasePath(configValue) {
|
|
|
45
43
|
return configValue;
|
|
46
44
|
}
|
|
47
45
|
|
|
48
|
-
//--------------------- Config Creation ---------------------
|
|
49
|
-
|
|
50
46
|
/**
|
|
51
47
|
* Creates a Docusaurus config from the Portosaurus user config.
|
|
52
48
|
* @param {Object} userConfig - The user configuration object (export of config.js).
|
|
53
49
|
* @returns {Object} Docusaurus configuration object.
|
|
54
50
|
**/
|
|
55
51
|
export function createConfig(userConfig, projectRoot = process.cwd()) {
|
|
56
|
-
|
|
57
52
|
const usrConf = userConfig.usrConf || {};
|
|
58
53
|
|
|
59
54
|
//------------- Basic mapping -------------
|
|
@@ -212,8 +207,8 @@ export function createConfig(userConfig, projectRoot = process.cwd()) {
|
|
|
212
207
|
{
|
|
213
208
|
hashed: true,
|
|
214
209
|
indexDocs: true,
|
|
215
|
-
docsDir:
|
|
216
|
-
blogDir:
|
|
210
|
+
docsDir: notesPath,
|
|
211
|
+
blogDir: blogPath,
|
|
217
212
|
docsRouteBasePath: "notes",
|
|
218
213
|
highlightSearchTermsOnTargetPage: true,
|
|
219
214
|
explicitSearchResultPath: true,
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
// Import the config
|
|
3
|
-
const rawConfig = require('../../config.js');
|
|
4
|
-
|
|
5
|
-
function resolvePath(obj, path) {
|
|
6
|
-
const parts = path.split('.');
|
|
7
|
-
let current = obj;
|
|
8
|
-
|
|
9
|
-
for (const part of parts) {
|
|
10
|
-
if (current === null || current === undefined || typeof current !== 'object') {
|
|
11
|
-
return undefined;
|
|
12
|
-
}
|
|
13
|
-
current = current[part];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return current;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function parseStringValue(value, config) {
|
|
20
|
-
|
|
21
|
-
if (typeof value !== 'string') {
|
|
22
|
-
return value;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Find all ${...} references
|
|
26
|
-
return value.replace(/\${([^}]+)}/g, (match, path) => {
|
|
27
|
-
const resolvedValue = resolvePath(config, path);
|
|
28
|
-
|
|
29
|
-
if (resolvedValue === undefined) {
|
|
30
|
-
console.warn(`Warning: Could not resolve reference "${path}" in config value "${value}"`);
|
|
31
|
-
return match;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (typeof resolvedValue === 'string' && resolvedValue.includes('${')) {
|
|
35
|
-
return parseStringValue(resolvedValue, config);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return resolvedValue;
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
function parseConfigObject(obj, config) {
|
|
44
|
-
|
|
45
|
-
if (Array.isArray(obj)) {
|
|
46
|
-
return obj.map(item => parseConfigObject(item, config));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (obj !== null && typeof obj === 'object') {
|
|
50
|
-
const result = {};
|
|
51
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
52
|
-
result[key] = parseConfigObject(value, config);
|
|
53
|
-
}
|
|
54
|
-
return result;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (typeof obj === 'string') {
|
|
58
|
-
return parseStringValue(obj, config);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return obj;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
function parseConfig(config) {
|
|
66
|
-
|
|
67
|
-
const parsedConfig = JSON.parse(JSON.stringify(config));
|
|
68
|
-
return parseConfigObject(parsedConfig, config);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Parse the raw config
|
|
72
|
-
const parsedExports = {};
|
|
73
|
-
for (const key in rawConfig) {
|
|
74
|
-
parsedExports[key] = parseConfig(rawConfig[key]);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
module.exports = {
|
|
78
|
-
...parsedExports,
|
|
79
|
-
parseConfig,
|
|
80
|
-
parseStringValue,
|
|
81
|
-
resolvePath,
|
|
82
|
-
}
|
package/src/utils/ss.js
DELETED
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
import { catppuccinMocha, catppuccinLatte } from "./src/config/prism.js";
|
|
2
|
-
import { appVersion } from "./src/utils/appVersion.js";
|
|
3
|
-
import { metaTags } from "./src/config/metaTags.js";
|
|
4
|
-
import { usrConf } from "./src/utils/compileConfig.js";
|
|
5
|
-
import { useEnabled } from "./src/utils/filterEnabledItems.js";
|
|
6
|
-
|
|
7
|
-
const projectName = "Portosaurus";
|
|
8
|
-
const projectVersion = appVersion();
|
|
9
|
-
const faviconPath = 'favicon/favicon.ico';
|
|
10
|
-
const iconPicPath = 'static/img/icon.png';
|
|
11
|
-
|
|
12
|
-
const config = {
|
|
13
|
-
|
|
14
|
-
projectName: `${projectName}`,
|
|
15
|
-
|
|
16
|
-
title: usrConf.hero_section.title || `${projectName}`,
|
|
17
|
-
|
|
18
|
-
tagline: usrConf.hero_section.tagline || "Your complete portfolio solution",
|
|
19
|
-
|
|
20
|
-
favicon: usrConf.favicon || `${faviconPath}`,
|
|
21
|
-
|
|
22
|
-
url: usrConf.site_url,
|
|
23
|
-
baseUrl: usrConf.site_path || "/",
|
|
24
|
-
|
|
25
|
-
// GH Pages config
|
|
26
|
-
organizationName: usrConf.hero_section.title || `${projectName} `,
|
|
27
|
-
deploymentBranch: "gh-pages",
|
|
28
|
-
|
|
29
|
-
onBrokenAnchors: "ignore",
|
|
30
|
-
onBrokenLinks: "warn",
|
|
31
|
-
// onBrokenMarkdownLinks: "warn",
|
|
32
|
-
|
|
33
|
-
i18n: {
|
|
34
|
-
defaultLocale: "en",
|
|
35
|
-
locales: ["en"],
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
headTags: metaTags,
|
|
39
|
-
|
|
40
|
-
customFields: {
|
|
41
|
-
version: `${projectVersion}`,
|
|
42
|
-
|
|
43
|
-
heroSection: {
|
|
44
|
-
profilePic: usrConf.hero_section.profile_pic || `${iconPicPath}`,
|
|
45
|
-
intro: usrConf.hero_section.intro || "Hello there, I'm",
|
|
46
|
-
title: usrConf.hero_section.title || "Your Name",
|
|
47
|
-
subtitle: usrConf.hero_section.subtitle || 'I am a',
|
|
48
|
-
profession: usrConf.hero_section.profession || 'Your Profession',
|
|
49
|
-
description: usrConf.hero_section.description || "Short description about your profession, passion, goals.",
|
|
50
|
-
learnMoreButtonTxt: usrConf.hero_section.learn__more_button_txt || "Learn More",
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
aboutMe: {
|
|
54
|
-
enable: usrConf.about_me.enable || true,
|
|
55
|
-
|
|
56
|
-
image: usrConf.about_me.image || `${iconPicPath}`,
|
|
57
|
-
description: usrConf.about_me.description || [
|
|
58
|
-
"I'm a passionate FOSS developer with expertise in designing and building solutions for real-world problems.",
|
|
59
|
-
"My journey in software development started with a simple desire to automate repetitive tasks, specially in my PC.",
|
|
60
|
-
],
|
|
61
|
-
skills: usrConf.about_me.skills || ["skill 1", "Skill 2"],
|
|
62
|
-
resumeLink: usrConf.about_me.resume_link || "https://example.com/resume",
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
projects: usrConf.project_shelf,
|
|
66
|
-
|
|
67
|
-
experience: usrConf.experience,
|
|
68
|
-
|
|
69
|
-
socialLinks: {
|
|
70
|
-
enable: usrConf.social_links.enable || true,
|
|
71
|
-
|
|
72
|
-
links: usrConf.social_links.links || [
|
|
73
|
-
{
|
|
74
|
-
name: "Your Instagram",
|
|
75
|
-
icon: "instagram",
|
|
76
|
-
desc: "Your Instagram profile link",
|
|
77
|
-
url: "https://instagram.com/yourprofile",
|
|
78
|
-
},
|
|
79
|
-
],
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
robotsTxt: {
|
|
83
|
-
enable: usrConf.robots_txt || true,
|
|
84
|
-
rules: [
|
|
85
|
-
{
|
|
86
|
-
disallow: ["/notes/", "/tasks/"],
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
|
-
customLines: [],
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
tasksPage: {
|
|
93
|
-
enable: usrConf.tasks_page.enable || true,
|
|
94
|
-
title: usrConf.tasks_page.title || "Tasks",
|
|
95
|
-
description: usrConf.tasks_page.description || "Track your tasks and projects here.",
|
|
96
|
-
taskList: usrConf.tasks_page.tasks || [
|
|
97
|
-
{
|
|
98
|
-
title: "Example Tasks",
|
|
99
|
-
description: "Description of the task",
|
|
100
|
-
status: "active",
|
|
101
|
-
priority: "high",
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
presets: [
|
|
108
|
-
[
|
|
109
|
-
"classic",
|
|
110
|
-
{
|
|
111
|
-
docs: {
|
|
112
|
-
routeBasePath: "notes",
|
|
113
|
-
path: "notes",
|
|
114
|
-
sidebarPath: "./src/config/sidebar.js",
|
|
115
|
-
|
|
116
|
-
admonitions: {
|
|
117
|
-
keywords: ["note", "tip", "info", "warning", "danger", "question"],
|
|
118
|
-
extendDefaults: true,
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
blog: {
|
|
123
|
-
|
|
124
|
-
feedOptions: usrConf.rss
|
|
125
|
-
? {
|
|
126
|
-
type: ["rss", "atom"],
|
|
127
|
-
xslt: true,
|
|
128
|
-
}
|
|
129
|
-
: undefined,
|
|
130
|
-
|
|
131
|
-
showReadingTime: false,
|
|
132
|
-
|
|
133
|
-
onInlineTags: "warn",
|
|
134
|
-
onInlineAuthors: "warn",
|
|
135
|
-
onUntruncatedBlogPosts: "warn",
|
|
136
|
-
},
|
|
137
|
-
|
|
138
|
-
theme: {
|
|
139
|
-
customCss: "./src/css/custom.css",
|
|
140
|
-
},
|
|
141
|
-
|
|
142
|
-
},
|
|
143
|
-
],
|
|
144
|
-
],
|
|
145
|
-
|
|
146
|
-
// themes: ['@docusaurus/theme-mermaid'],
|
|
147
|
-
markdown: {
|
|
148
|
-
mermaid: true,
|
|
149
|
-
hooks: {
|
|
150
|
-
onBrokenMarkdownLinks: "warn"
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
themeConfig: {
|
|
155
|
-
// Social card
|
|
156
|
-
image: usrConf.social_card || "img/social-card.jpeg",
|
|
157
|
-
|
|
158
|
-
docs: {
|
|
159
|
-
sidebar: {
|
|
160
|
-
hideable: usrConf.collapsable_sidebar || true,
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
|
|
164
|
-
imageZoom: {
|
|
165
|
-
options: {
|
|
166
|
-
margin: 2,
|
|
167
|
-
background: "rgba(var(--ifm-background-color-rgb), 0.9)",
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
|
|
171
|
-
// Default: Dark mode
|
|
172
|
-
colorMode: {
|
|
173
|
-
defaultMode: usrConf.dark_mode ? "dark" : "light",
|
|
174
|
-
disableSwitch: usrConf.disable_theme_switch || false,
|
|
175
|
-
},
|
|
176
|
-
|
|
177
|
-
navbar: {
|
|
178
|
-
title: usrConf.hero_section.title || `${projectName} `,
|
|
179
|
-
hideOnScroll: usrConf.hide_navbar_on_scroll || true,
|
|
180
|
-
|
|
181
|
-
logo: {
|
|
182
|
-
alt: "Site Logo",
|
|
183
|
-
src: usrConf.favicon || `${faviconPath}`,
|
|
184
|
-
},
|
|
185
|
-
|
|
186
|
-
items: useEnabled([
|
|
187
|
-
{
|
|
188
|
-
type: "search",
|
|
189
|
-
position: "right",
|
|
190
|
-
className: "navbar-search-bar",
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
enable: usrConf.about_me?.enable || true,
|
|
194
|
-
value: {
|
|
195
|
-
label: "About Me",
|
|
196
|
-
to: "/#about",
|
|
197
|
-
position: "right",
|
|
198
|
-
activeBaseRegex: "^/#about",
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
enable: usrConf.project_shelf?.enable || true,
|
|
203
|
-
value: {
|
|
204
|
-
label: "Projects",
|
|
205
|
-
to: "/#projects",
|
|
206
|
-
position: "right",
|
|
207
|
-
activeBaseRegex: "^/#projects",
|
|
208
|
-
},
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
enable: usrConf.experience?.enable || false,
|
|
212
|
-
value: {
|
|
213
|
-
label: "Experience",
|
|
214
|
-
to: "/#experience",
|
|
215
|
-
position: "right",
|
|
216
|
-
activeBaseRegex: "^/#experience",
|
|
217
|
-
},
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
enable: usrConf.social_links?.enable || true,
|
|
221
|
-
value: {
|
|
222
|
-
label: "Contact",
|
|
223
|
-
to: "/#contact",
|
|
224
|
-
position: "right",
|
|
225
|
-
activeBaseRegex: "^/$contact",
|
|
226
|
-
},
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
type: "dropdown",
|
|
230
|
-
label: "More",
|
|
231
|
-
position: "right",
|
|
232
|
-
className: "_navbar-more-items",
|
|
233
|
-
items: useEnabled([
|
|
234
|
-
{ label: "Notes", to: "/notes" },
|
|
235
|
-
{ label: "Blog", to: "/blog" },
|
|
236
|
-
{ label: "Tasks", to: "/tasks" },
|
|
237
|
-
{
|
|
238
|
-
enable: usrConf.disable_branding ? false : true,
|
|
239
|
-
value: {
|
|
240
|
-
label: `Portosaurus v${projectVersion}`,
|
|
241
|
-
className: "_nav-protosaurus-version",
|
|
242
|
-
to: "https://github.com/soymadip/portosaurus",
|
|
243
|
-
},
|
|
244
|
-
},
|
|
245
|
-
]),
|
|
246
|
-
}
|
|
247
|
-
]),
|
|
248
|
-
},
|
|
249
|
-
|
|
250
|
-
tableOfContents: {
|
|
251
|
-
minHeadingLevel: 2,
|
|
252
|
-
maxHeadingLevel: 4,
|
|
253
|
-
},
|
|
254
|
-
|
|
255
|
-
prism: {
|
|
256
|
-
theme: catppuccinLatte,
|
|
257
|
-
darkTheme: catppuccinMocha,
|
|
258
|
-
additionalLanguages: ["java", "php", "bash"],
|
|
259
|
-
},
|
|
260
|
-
|
|
261
|
-
footer: {
|
|
262
|
-
/* links: [
|
|
263
|
-
{
|
|
264
|
-
label: 'GitHub',
|
|
265
|
-
href: 'https://github.com/',
|
|
266
|
-
}
|
|
267
|
-
],
|
|
268
|
-
copyright: `Copyright © ${new Date().getFullYear()} ` + ownerName,
|
|
269
|
-
*/
|
|
270
|
-
},
|
|
271
|
-
},
|
|
272
|
-
|
|
273
|
-
plugins: [
|
|
274
|
-
require.resolve("./src/utils/generateFavicon"),
|
|
275
|
-
require.resolve("./src/utils/generateRobotsTxt"),
|
|
276
|
-
[
|
|
277
|
-
require.resolve("@easyops-cn/docusaurus-search-local"),
|
|
278
|
-
{
|
|
279
|
-
hashed: true,
|
|
280
|
-
indexDocs: true,
|
|
281
|
-
docsDir: "notes",
|
|
282
|
-
docsRouteBasePath: "notes",
|
|
283
|
-
highlightSearchTermsOnTargetPage: true,
|
|
284
|
-
explicitSearchResultPath: true,
|
|
285
|
-
hideSearchBarWithNoSearchContext: true,
|
|
286
|
-
searchContextByPaths: ["notes", "blog"],
|
|
287
|
-
language: ["en"],
|
|
288
|
-
},
|
|
289
|
-
],
|
|
290
|
-
"plugin-image-zoom",
|
|
291
|
-
],
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
export default config;
|
|
File without changes
|