@portosaur/cli 0.5.1 → 0.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portosaur/cli",
3
- "version": "0.5.1",
3
+ "version": "0.6.2",
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.5.1",
30
- "@portosaur/logger": "^0.5.1",
31
- "@portosaur/wizard": "^0.5.1",
29
+ "@portosaur/core": "^0.6.2",
30
+ "@portosaur/logger": "^0.6.2",
31
+ "@portosaur/wizard": "^0.6.2",
32
32
  "commander": "^13.1.0",
33
33
  "js-yaml": "^4.1.1"
34
34
  }
@@ -134,6 +134,7 @@ export function warnIfRepoNameMismatch(
134
134
 
135
135
  /**
136
136
  * Executes a Docusaurus command.
137
+ *
137
138
  * @param {string} command - Docusaurus command to run (e.g., 'start', 'build').
138
139
  * @param {string} UserRoot - The project directory.
139
140
  * @param {string} configPath - Path to the docusaurus.config.js shim.
@@ -146,57 +147,50 @@ export async function runDocusaurus(
146
147
  configPath,
147
148
  extraArgs = [],
148
149
  ) {
149
- const isBun =
150
- typeof process !== "undefined" &&
151
- process.versions &&
152
- process.versions.bun !== undefined;
153
-
154
- let bin;
155
- let args;
156
-
157
- if (isBun) {
158
- bin = "bun";
159
- args = ["run", "--bun", "docusaurus", command, UserRoot];
160
- } else {
161
- bin = "node";
162
- let docusaurusBin;
163
- try {
164
- const require = createRequire(import.meta.url);
165
- docusaurusBin = require.resolve("docusaurus/bin/docusaurus.mjs", {
166
- paths: [UserRoot],
167
- });
168
- } catch (e) {
169
- docusaurusBin = path.join(
170
- UserRoot,
171
- "node_modules",
172
- "docusaurus",
173
- "bin",
174
- "docusaurus.mjs",
175
- );
176
- }
177
- args = [docusaurusBin, command, UserRoot];
150
+ const require = createRequire(import.meta.url);
151
+ let docusaurusBin;
152
+
153
+ try {
154
+ docusaurusBin = require.resolve("@docusaurus/core/bin/docusaurus.mjs", {
155
+ paths: [UserRoot],
156
+ });
157
+ } catch {
158
+ docusaurusBin = path.join(
159
+ UserRoot,
160
+ "node_modules",
161
+ "@docusaurus",
162
+ "core",
163
+ "bin",
164
+ "docusaurus.mjs",
165
+ );
178
166
  }
179
167
 
168
+ const args = [docusaurusBin, command, UserRoot];
169
+
180
170
  if (configPath) {
181
171
  args.push("--config", configPath);
182
172
  }
183
173
 
184
174
  args.push(...extraArgs);
185
175
 
176
+ // Use bun when available for faster builds, fall back to node.
177
+ const runtime = typeof Bun !== "undefined" ? "bun" : "node";
178
+
186
179
  // Skip actual execution in test mode
187
180
  if (process.env.PORTO_TEST_MODE === "true") {
188
181
  console.log(
189
- `[TEST_MODE] Would run docusaurus ${command} in ${UserRoot} using ${bin}`,
182
+ `[TEST_MODE] Would run docusaurus ${command} in ${UserRoot} using ${runtime}`,
190
183
  );
191
184
  return Promise.resolve();
192
185
  }
193
186
 
194
187
  const childEnv = { ...process.env, FORCE_COLOR: "true" };
188
+
195
189
  if (command === "build") {
196
190
  childEnv.CI = "true";
197
191
  }
198
192
 
199
- const child = spawn(bin, args, {
193
+ const child = spawn(runtime, args, {
200
194
  stdio: "inherit",
201
195
  cwd: UserRoot,
202
196
  env: childEnv,