@saeroon/cli 0.2.8 → 0.2.9
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/dist/index.js +22 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3926,9 +3926,18 @@ import { resolve as resolve13, join as join2 } from "path";
|
|
|
3926
3926
|
import { mkdir as mkdir4, writeFile as writeFile8 } from "fs/promises";
|
|
3927
3927
|
|
|
3928
3928
|
// src/scripts/analyze-reference.ts
|
|
3929
|
-
import { spawnSync } from "child_process";
|
|
3929
|
+
import { spawnSync, execSync } from "child_process";
|
|
3930
3930
|
import { writeFile as writeFile7, mkdir as mkdir3 } from "fs/promises";
|
|
3931
3931
|
import { join } from "path";
|
|
3932
|
+
function getNodeEnvWithGlobalModules() {
|
|
3933
|
+
try {
|
|
3934
|
+
const globalRoot = execSync("npm root -g", { encoding: "utf-8" }).trim();
|
|
3935
|
+
const existing = process.env.NODE_PATH || "";
|
|
3936
|
+
return { ...process.env, NODE_PATH: existing ? `${existing}:${globalRoot}` : globalRoot };
|
|
3937
|
+
} catch {
|
|
3938
|
+
return { ...process.env };
|
|
3939
|
+
}
|
|
3940
|
+
}
|
|
3932
3941
|
var VIEWPORTS = [
|
|
3933
3942
|
{ name: "mobile", width: 375, height: 812 },
|
|
3934
3943
|
{ name: "tablet", width: 768, height: 1024 },
|
|
@@ -4720,7 +4729,7 @@ function captureScreenshot(url, outputPath, width, height, timeout) {
|
|
|
4720
4729
|
const result = spawnSync("node", ["-e", scriptContent], {
|
|
4721
4730
|
stdio: "pipe",
|
|
4722
4731
|
timeout: timeout + 3e4,
|
|
4723
|
-
env:
|
|
4732
|
+
env: getNodeEnvWithGlobalModules()
|
|
4724
4733
|
});
|
|
4725
4734
|
if (result.status !== 0) {
|
|
4726
4735
|
const stderr = result.stderr?.toString() ?? "";
|
|
@@ -4789,7 +4798,7 @@ async function extractPageData(url, timeout) {
|
|
|
4789
4798
|
const result = spawnSync("node", ["-e", scriptContent], {
|
|
4790
4799
|
stdio: "pipe",
|
|
4791
4800
|
timeout: timeout + 3e4,
|
|
4792
|
-
env:
|
|
4801
|
+
env: getNodeEnvWithGlobalModules()
|
|
4793
4802
|
});
|
|
4794
4803
|
if (result.status !== 0) {
|
|
4795
4804
|
const stderr = result.stderr?.toString() ?? "";
|
|
@@ -5177,6 +5186,15 @@ import chalk16 from "chalk";
|
|
|
5177
5186
|
import { writeFile as writeFile9, mkdir as mkdir5 } from "fs/promises";
|
|
5178
5187
|
import { resolve as resolve14, join as join3 } from "path";
|
|
5179
5188
|
import { execSync as execSync2, spawnSync as spawnSync2 } from "child_process";
|
|
5189
|
+
function getNodeEnvWithGlobalModules2() {
|
|
5190
|
+
try {
|
|
5191
|
+
const globalRoot = execSync2("npm root -g", { encoding: "utf-8" }).trim();
|
|
5192
|
+
const existing = process.env.NODE_PATH || "";
|
|
5193
|
+
return { ...process.env, NODE_PATH: existing ? `${existing}:${globalRoot}` : globalRoot };
|
|
5194
|
+
} catch {
|
|
5195
|
+
return { ...process.env };
|
|
5196
|
+
}
|
|
5197
|
+
}
|
|
5180
5198
|
async function commandCompare(options) {
|
|
5181
5199
|
console.log(chalk16.bold("\n\uC2DC\uAC01 \uBE44\uAD50 (Visual Diff)\n"));
|
|
5182
5200
|
if (!options.ref || !options.preview) {
|
|
@@ -5461,7 +5479,7 @@ function captureScreenshot2(url, outputPath, width, height) {
|
|
|
5461
5479
|
const result = spawnSync2("node", ["-e", scriptContent], {
|
|
5462
5480
|
stdio: "pipe",
|
|
5463
5481
|
timeout: 9e4,
|
|
5464
|
-
env:
|
|
5482
|
+
env: getNodeEnvWithGlobalModules2()
|
|
5465
5483
|
});
|
|
5466
5484
|
if (result.status !== 0) {
|
|
5467
5485
|
const stderr = result.stderr?.toString() ?? "";
|