@portosaur/cli 0.3.0 → 0.4.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portosaur/cli",
3
- "version": "0.3.0",
3
+ "version": "0.4.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.3.0",
30
- "@portosaur/logger": "^0.3.0",
31
- "@portosaur/wizard": "^0.3.0",
29
+ "@portosaur/core": "^0.4.0",
30
+ "@portosaur/logger": "^0.4.0",
31
+ "@portosaur/wizard": "^0.4.0",
32
32
  "commander": "^13.1.0",
33
33
  "js-yaml": "^4.1.1"
34
34
  }
@@ -2,7 +2,6 @@ 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 { loadUserConfig, buildDocuConfig } from "@portosaur/core";
6
5
 
7
6
  /**
8
7
  * Generates a static Docusaurus config file by evaluating the Portosaur config
@@ -21,18 +20,21 @@ export function writeConfigShim(UserRoot, portoPaths, context = {}) {
21
20
  fs.mkdirSync(dotDir, { recursive: true });
22
21
  }
23
22
 
24
- // Load the user's YAML config and evaluate the full Docusaurus config object now.
25
- const rawConf = loadUserConfig(UserRoot);
23
+ // Serialize the config as a dynamic export so Docusaurus can evaluate it at runtime,
24
+ // preserving any functions, regexes, and plugin module imports.
25
+ const shimContent = `// Auto-generated by portosaur — do not edit
26
+ import { loadUserConfig, buildDocuConfig } from "@portosaur/core";
26
27
 
27
- const docuConfig = buildDocuConfig(rawConf, UserRoot, {
28
- portoPaths,
29
- portoRoot: path.resolve(portoPaths.root),
30
- ...context,
28
+ export default async function createConfig() {
29
+ const UserRoot = ${JSON.stringify(UserRoot)};
30
+ const rawConf = loadUserConfig(UserRoot);
31
+ return buildDocuConfig(rawConf, UserRoot, {
32
+ portoPaths: ${JSON.stringify(portoPaths)},
33
+ portoRoot: ${JSON.stringify(path.resolve(portoPaths.root))},
34
+ ...${JSON.stringify(context)}
31
35
  });
32
-
33
- // Serialize the config as a static export so Docusaurus never needs to
34
- // dynamically import @portosaur/core during its own build or serve run.
35
- const shimContent = `// Auto-generated by portosaur — do not edit\nexport default ${JSON.stringify(docuConfig, null, 2)};\n`;
36
+ }
37
+ `;
36
38
 
37
39
  const shimPath = path.join(dotDir, "docusaurus.config.js");
38
40
  fs.writeFileSync(shimPath, shimContent);