portosaurus 2.0.1 → 2.0.3

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.
@@ -89,7 +89,7 @@ function ensureContentDirs(projectRoot) {
89
89
  if (!fs.existsSync(notesIndex)) {
90
90
  fs.writeFileSync(
91
91
  notesIndex,
92
- `---\nhide_table_of_contents: true\n---\n\nimport NoteCards from "@site/src/components/NoteIndex";\n\n# Notes\n\n<NoteCards />\n`,
92
+ `---\nhide_table_of_contents: true\n---\n\nimport NoteCards from "portosaurus/src/components/NoteIndex/index.js";\n\n# Notes\n\n<NoteCards />\n`,
93
93
  );
94
94
  logger.debug("Created default notes/index.mdx");
95
95
  }
@@ -212,6 +212,11 @@ program
212
212
  // Git init
213
213
  try {
214
214
  execSync("git init", { cwd: projectPath, stdio: "ignore" });
215
+ execSync("git add .", { cwd: projectPath, stdio: "ignore" });
216
+ execSync('git commit -m "Initialize Portosaurus project"', {
217
+ cwd: projectPath,
218
+ stdio: "ignore",
219
+ });
215
220
  } catch {
216
221
  logger.warn("Failed to initialize git repository.");
217
222
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "portosaurus",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "private": false,
5
5
  "bin": {
6
6
  "portosaurus": "bin/portosaurus.mjs"
@@ -115,7 +115,12 @@ function getVersion() {
115
115
  function useEnabled(items) {
116
116
  if (!Array.isArray(items)) return [];
117
117
  return items.flatMap((item) => {
118
- if (item && typeof item === "object" && "enable" in item && "value" in item) {
118
+ if (
119
+ item &&
120
+ typeof item === "object" &&
121
+ "enable" in item &&
122
+ "value" in item
123
+ ) {
119
124
  return item.enable === true ? [item.value] : [];
120
125
  }
121
126
  return [item];
@@ -169,7 +174,9 @@ export function createDocuConf(rawUserConfig, projectRoot) {
169
174
  // Meta tags
170
175
  let metaTags = [];
171
176
  try {
172
- const meta = require(path.resolve(portosaurusRoot, "src/config/metaTags.js"));
177
+ const meta = require(
178
+ path.resolve(portosaurusRoot, "src/config/metaTags.js"),
179
+ );
173
180
  metaTags = meta.metaTags || [];
174
181
  } catch {
175
182
  // OK — no meta tags
@@ -183,7 +190,7 @@ export function createDocuConf(rawUserConfig, projectRoot) {
183
190
  const userStaticDir = path.resolve(projectRoot, "static");
184
191
  const internalImgDir = path.resolve(portosaurusRoot, "src/assets");
185
192
  const staticDirectories = [userStaticDir, internalImgDir].filter((d) =>
186
- fs.existsSync(d)
193
+ fs.existsSync(d),
187
194
  );
188
195
 
189
196
  // Pages — served from the portosaurus package
@@ -242,7 +249,8 @@ export function createDocuConf(rawUserConfig, projectRoot) {
242
249
  usrConf.about_me?.image ||
243
250
  usrConf.hero_section?.profile_pic ||
244
251
  "img/icon.png",
245
- description: usrConf.about_me?.description || defaults.about_me.description,
252
+ description:
253
+ usrConf.about_me?.description || defaults.about_me.description,
246
254
  skills: usrConf.about_me?.skills || defaults.about_me.skills,
247
255
  resumeLink: usrConf.about_me?.resume_link || "",
248
256
  },
@@ -285,7 +293,14 @@ export function createDocuConf(rawUserConfig, projectRoot) {
285
293
  path: notesPath,
286
294
  sidebarPath,
287
295
  admonitions: {
288
- keywords: ["note", "tip", "info", "warning", "danger", "question"],
296
+ keywords: [
297
+ "note",
298
+ "tip",
299
+ "info",
300
+ "warning",
301
+ "danger",
302
+ "question",
303
+ ],
289
304
  extendDefaults: true,
290
305
  },
291
306
  },
@@ -309,16 +324,14 @@ export function createDocuConf(rawUserConfig, projectRoot) {
309
324
  ],
310
325
  ],
311
326
 
312
- // Register portosaurus's src/theme/ as a theme directory
313
- // so Root.js, MDXComponents.js etc. are picked up
314
- /*
327
+ // Register portosaurus's src/ as a theme directory
328
+ // so Root.js, components, and pages are all natively transpiled by Docusaurus.
315
329
  themes: [
316
330
  [
317
331
  path.resolve(portosaurusRoot, "src/core/themePlugin.mjs"),
318
- { themeDir: internalThemeDir },
332
+ { themeDir: path.resolve(portosaurusRoot, "src") },
319
333
  ],
320
334
  ],
321
- */
322
335
 
323
336
  markdown: {
324
337
  mermaid: true,
@@ -431,7 +444,10 @@ export function createDocuConf(rawUserConfig, projectRoot) {
431
444
 
432
445
  plugins: [
433
446
  path.resolve(portosaurusRoot, "src/core/build-utils/generateFavicon.mjs"),
434
- path.resolve(portosaurusRoot, "src/core/build-utils/generateRobotsTxt.mjs"),
447
+ path.resolve(
448
+ portosaurusRoot,
449
+ "src/core/build-utils/generateRobotsTxt.mjs",
450
+ ),
435
451
  [
436
452
  require.resolve("@easyops-cn/docusaurus-search-local"),
437
453
  {
@@ -23,7 +23,12 @@ export function detectPackageManager(projectRoot) {
23
23
  if (process.env.npm_config_user_agent.includes("pnpm")) return "pnpm";
24
24
  if (process.env.npm_config_user_agent.includes("yarn")) return "yarn";
25
25
  }
26
- if (typeof process !== "undefined" && process.versions && process.versions.bun) return "bun";
26
+ if (
27
+ typeof process !== "undefined" &&
28
+ process.versions &&
29
+ process.versions.bun
30
+ )
31
+ return "bun";
27
32
 
28
33
  return "npm";
29
34
  }