@portosaur/cli 0.5.0 → 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 +4 -4
- package/src/utils/runner.mjs +25 -31
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@portosaur/cli",
|
|
3
|
-
"version": "0.
|
|
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.
|
|
30
|
-
"@portosaur/logger": "^0.
|
|
31
|
-
"@portosaur/wizard": "^0.
|
|
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
|
}
|
package/src/utils/runner.mjs
CHANGED
|
@@ -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
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
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 ${
|
|
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(
|
|
193
|
+
const child = spawn(runtime, args, {
|
|
200
194
|
stdio: "inherit",
|
|
201
195
|
cwd: UserRoot,
|
|
202
196
|
env: childEnv,
|