@lambdatest/smartui-cli 4.1.38-beta.0 → 4.1.38-beta.1
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.cjs +75 -61
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5,9 +5,9 @@ var commander = require('commander');
|
|
|
5
5
|
var which = require('which');
|
|
6
6
|
var listr2 = require('listr2');
|
|
7
7
|
var chalk = require('chalk');
|
|
8
|
-
var
|
|
8
|
+
var path3 = require('path');
|
|
9
9
|
var fastify = require('fastify');
|
|
10
|
-
var
|
|
10
|
+
var fs6 = require('fs');
|
|
11
11
|
var Ajv = require('ajv');
|
|
12
12
|
var addErrors = require('ajv-errors');
|
|
13
13
|
var test = require('@playwright/test');
|
|
@@ -46,9 +46,9 @@ function _interopNamespace(e) {
|
|
|
46
46
|
|
|
47
47
|
var which__default = /*#__PURE__*/_interopDefault(which);
|
|
48
48
|
var chalk__default = /*#__PURE__*/_interopDefault(chalk);
|
|
49
|
-
var
|
|
49
|
+
var path3__default = /*#__PURE__*/_interopDefault(path3);
|
|
50
50
|
var fastify__default = /*#__PURE__*/_interopDefault(fastify);
|
|
51
|
-
var
|
|
51
|
+
var fs6__default = /*#__PURE__*/_interopDefault(fs6);
|
|
52
52
|
var Ajv__default = /*#__PURE__*/_interopDefault(Ajv);
|
|
53
53
|
var addErrors__default = /*#__PURE__*/_interopDefault(addErrors);
|
|
54
54
|
var stringify__default = /*#__PURE__*/_interopDefault(stringify);
|
|
@@ -1487,8 +1487,8 @@ var lambdaTunnel = __require("@lambdatest/node-tunnel");
|
|
|
1487
1487
|
util$1.promisify(setTimeout);
|
|
1488
1488
|
var tunnelInstance;
|
|
1489
1489
|
function delDir(dir) {
|
|
1490
|
-
if (
|
|
1491
|
-
|
|
1490
|
+
if (fs6__default.default.existsSync(dir)) {
|
|
1491
|
+
fs6__default.default.rmSync(dir, { recursive: true });
|
|
1492
1492
|
}
|
|
1493
1493
|
}
|
|
1494
1494
|
function scrollToBottomAndBackToTop({
|
|
@@ -1689,7 +1689,7 @@ function startPolling(ctx, build_id, baseline, projectToken) {
|
|
|
1689
1689
|
if (ctx.options.fetchResults && ctx.options.fetchResultsFileName && ctx.build && ctx.build.id && resp.build.build_id === ctx.build.id) {
|
|
1690
1690
|
fileName = `${ctx.options.fetchResultsFileName}`;
|
|
1691
1691
|
}
|
|
1692
|
-
|
|
1692
|
+
fs6__default.default.writeFileSync(`${fileName}`, JSON.stringify(resp, null, 2));
|
|
1693
1693
|
ctx.log.debug(`Updated results in ${fileName}`);
|
|
1694
1694
|
if (resp.build.build_status_ind === constants_default.BUILD_COMPLETE || resp.build.build_status_ind === constants_default.BUILD_ERROR) {
|
|
1695
1695
|
clearInterval(intervalId);
|
|
@@ -1957,7 +1957,7 @@ function startPdfPolling(ctx) {
|
|
|
1957
1957
|
};
|
|
1958
1958
|
if (ctx.options.fetchResults && ctx.options.fetchResultsFileName) {
|
|
1959
1959
|
const filename = ctx.options.fetchResultsFileName !== "" ? ctx.options.fetchResultsFileName : "pdf-results.json";
|
|
1960
|
-
|
|
1960
|
+
fs6__default.default.writeFileSync(filename, JSON.stringify(formattedResults, null, 2));
|
|
1961
1961
|
console.log(chalk__default.default.green(`
|
|
1962
1962
|
Results saved to ${filename}`));
|
|
1963
1963
|
}
|
|
@@ -2240,7 +2240,7 @@ var server_default = (ctx) => __async(void 0, null, function* () {
|
|
|
2240
2240
|
bodyLimit: 3e7
|
|
2241
2241
|
});
|
|
2242
2242
|
const opts = {};
|
|
2243
|
-
const SMARTUI_DOM =
|
|
2243
|
+
const SMARTUI_DOM = fs6.readFileSync(path3__default.default.resolve(__dirname, "dom-serializer.js"), "utf-8");
|
|
2244
2244
|
server.get("/healthcheck", opts, (_, reply) => {
|
|
2245
2245
|
reply.code(200).send({ cliVersion: ctx.cliVersion });
|
|
2246
2246
|
});
|
|
@@ -2650,7 +2650,7 @@ var authExec_default = (ctx) => {
|
|
|
2650
2650
|
};
|
|
2651
2651
|
|
|
2652
2652
|
// package.json
|
|
2653
|
-
var version = "4.1.38-beta.
|
|
2653
|
+
var version = "4.1.38-beta.1";
|
|
2654
2654
|
var package_default = {
|
|
2655
2655
|
name: "@lambdatest/smartui-cli",
|
|
2656
2656
|
version,
|
|
@@ -3108,7 +3108,7 @@ var httpClient = class {
|
|
|
3108
3108
|
}
|
|
3109
3109
|
uploadScreenshot({ id: buildId, name: buildName, baseline }, ssPath, ssName, browserName, viewport, url = "", log2) {
|
|
3110
3110
|
browserName = browserName === constants_default.SAFARI ? constants_default.WEBKIT : browserName;
|
|
3111
|
-
const file =
|
|
3111
|
+
const file = fs6__default.default.readFileSync(ssPath);
|
|
3112
3112
|
const form = new FormData__default.default();
|
|
3113
3113
|
form.append("screenshot", file, { filename: `${ssName}.png`, contentType: "image/png" });
|
|
3114
3114
|
form.append("browser", browserName);
|
|
@@ -3234,8 +3234,8 @@ var httpClient = class {
|
|
|
3234
3234
|
}, ctx.log);
|
|
3235
3235
|
}
|
|
3236
3236
|
uploadLogs(ctx, uploadURL) {
|
|
3237
|
-
const fileStream =
|
|
3238
|
-
const { size } =
|
|
3237
|
+
const fileStream = fs6__default.default.createReadStream(constants_default.LOG_FILE_PATH);
|
|
3238
|
+
const { size } = fs6__default.default.statSync(constants_default.LOG_FILE_PATH);
|
|
3239
3239
|
return this.request({
|
|
3240
3240
|
url: uploadURL,
|
|
3241
3241
|
method: "PUT",
|
|
@@ -3251,7 +3251,7 @@ var httpClient = class {
|
|
|
3251
3251
|
}, ctx.log);
|
|
3252
3252
|
}
|
|
3253
3253
|
sendCliLogsToLSRS(ctx) {
|
|
3254
|
-
const logContent =
|
|
3254
|
+
const logContent = fs6__default.default.readFileSync(constants_default.LOG_FILE_PATH, "utf-8");
|
|
3255
3255
|
return this.request({
|
|
3256
3256
|
url: `/upload/logs`,
|
|
3257
3257
|
method: "POST",
|
|
@@ -3418,7 +3418,7 @@ var ctx_default = (options) => {
|
|
|
3418
3418
|
let loadDomContent = false;
|
|
3419
3419
|
try {
|
|
3420
3420
|
if (options.config) {
|
|
3421
|
-
config = JSON.parse(
|
|
3421
|
+
config = JSON.parse(fs6__default.default.readFileSync(options.config, "utf-8"));
|
|
3422
3422
|
if ((_a = config.web) == null ? void 0 : _a.resolutions) {
|
|
3423
3423
|
config.web.viewports = config.web.resolutions;
|
|
3424
3424
|
delete config.web.resolutions;
|
|
@@ -3625,7 +3625,7 @@ var git_default = (ctx) => {
|
|
|
3625
3625
|
githubURL = ctx.options.githubURL;
|
|
3626
3626
|
}
|
|
3627
3627
|
if (ctx.env.SMARTUI_GIT_INFO_FILEPATH) {
|
|
3628
|
-
let gitInfo = JSON.parse(
|
|
3628
|
+
let gitInfo = JSON.parse(fs6__default.default.readFileSync(ctx.env.SMARTUI_GIT_INFO_FILEPATH, "utf-8"));
|
|
3629
3629
|
if (ctx.options.markBaseline) {
|
|
3630
3630
|
ctx.env.BASELINE_BRANCH = ctx.env.CURRENT_BRANCH || gitInfo.branch || "";
|
|
3631
3631
|
ctx.env.SMART_GIT = false;
|
|
@@ -3807,7 +3807,7 @@ var exec_default = (ctx) => {
|
|
|
3807
3807
|
}
|
|
3808
3808
|
updateLogContext({ task: "exec" });
|
|
3809
3809
|
return new Promise((resolve, reject) => {
|
|
3810
|
-
var _a2, _b, _c;
|
|
3810
|
+
var _a2, _b, _c, _d, _e;
|
|
3811
3811
|
const childProcess = spawn__default.default(ctx2.args.execCommand[0], (_a2 = ctx2.args.execCommand) == null ? void 0 : _a2.slice(1));
|
|
3812
3812
|
let totalOutput = "";
|
|
3813
3813
|
if (!ctx2.env.LT_SDK_SKIP_EXECUTION_LOGS) {
|
|
@@ -3817,6 +3817,20 @@ var exec_default = (ctx) => {
|
|
|
3817
3817
|
});
|
|
3818
3818
|
(_b = childProcess.stdout) == null ? void 0 : _b.pipe(output);
|
|
3819
3819
|
(_c = childProcess.stderr) == null ? void 0 : _c.pipe(output);
|
|
3820
|
+
} else {
|
|
3821
|
+
const logFileName = `execution-logs.log`;
|
|
3822
|
+
const logFilePath = path3__default.default.join(process.cwd(), logFileName);
|
|
3823
|
+
const logStream = fs6__default.default.createWriteStream(logFilePath, { flags: "a" });
|
|
3824
|
+
task.output = chalk__default.default.gray(`Execution logs being written to: ${logFileName}`);
|
|
3825
|
+
(_d = childProcess.stdout) == null ? void 0 : _d.on("data", (data) => {
|
|
3826
|
+
logStream.write(data);
|
|
3827
|
+
});
|
|
3828
|
+
(_e = childProcess.stderr) == null ? void 0 : _e.on("data", (data) => {
|
|
3829
|
+
logStream.write(data);
|
|
3830
|
+
});
|
|
3831
|
+
childProcess.on("close", () => {
|
|
3832
|
+
logStream.end();
|
|
3833
|
+
});
|
|
3820
3834
|
}
|
|
3821
3835
|
childProcess.on("error", (error) => {
|
|
3822
3836
|
var _a3;
|
|
@@ -5263,66 +5277,66 @@ command.name("exec").description("Run test commands around SmartUI").argument("<
|
|
|
5263
5277
|
var exec_default2 = command;
|
|
5264
5278
|
function createConfig(filepath) {
|
|
5265
5279
|
filepath = filepath || ".smartui.json";
|
|
5266
|
-
let filetype =
|
|
5280
|
+
let filetype = path3__default.default.extname(filepath);
|
|
5267
5281
|
if (filetype != ".json") {
|
|
5268
5282
|
console.log("Error: Config file must have .json extension");
|
|
5269
5283
|
return;
|
|
5270
5284
|
}
|
|
5271
|
-
if (
|
|
5285
|
+
if (fs6__default.default.existsSync(filepath)) {
|
|
5272
5286
|
console.log(`Error: SmartUI Config already exists: ${filepath}`);
|
|
5273
5287
|
console.log(`To create a new file, please specify the file name like: 'smartui config:create .smartui-config.json'`);
|
|
5274
5288
|
return;
|
|
5275
5289
|
}
|
|
5276
|
-
|
|
5277
|
-
|
|
5290
|
+
fs6__default.default.mkdirSync(path3__default.default.dirname(filepath), { recursive: true });
|
|
5291
|
+
fs6__default.default.writeFileSync(filepath, JSON.stringify(constants_default.DEFAULT_CONFIG, null, 2) + "\n");
|
|
5278
5292
|
console.log(`Created SmartUI Config: ${filepath}`);
|
|
5279
5293
|
}
|
|
5280
5294
|
function createWebStaticConfig(filepath) {
|
|
5281
5295
|
filepath = filepath || "url.json";
|
|
5282
|
-
let filetype =
|
|
5296
|
+
let filetype = path3__default.default.extname(filepath);
|
|
5283
5297
|
if (filetype != ".json") {
|
|
5284
5298
|
console.log("Error: Config file must have .json extension");
|
|
5285
5299
|
return;
|
|
5286
5300
|
}
|
|
5287
|
-
if (
|
|
5301
|
+
if (fs6__default.default.existsSync(filepath)) {
|
|
5288
5302
|
console.log(`Error: web-static config already exists: ${filepath}`);
|
|
5289
5303
|
console.log(`To create a new file, please specify the file name like: 'smartui config:create-web-static links.json'`);
|
|
5290
5304
|
return;
|
|
5291
5305
|
}
|
|
5292
|
-
|
|
5293
|
-
|
|
5306
|
+
fs6__default.default.mkdirSync(path3__default.default.dirname(filepath), { recursive: true });
|
|
5307
|
+
fs6__default.default.writeFileSync(filepath, JSON.stringify(constants_default.DEFAULT_WEB_STATIC_CONFIG, null, 2) + "\n");
|
|
5294
5308
|
console.log(`Created web-static config: ${filepath}`);
|
|
5295
5309
|
}
|
|
5296
5310
|
function createFigmaConfig(filepath) {
|
|
5297
5311
|
filepath = filepath || "designs.json";
|
|
5298
|
-
let filetype =
|
|
5312
|
+
let filetype = path3__default.default.extname(filepath);
|
|
5299
5313
|
if (filetype != ".json") {
|
|
5300
5314
|
console.log("Error: designs config file must have .json extension");
|
|
5301
5315
|
return;
|
|
5302
5316
|
}
|
|
5303
|
-
if (
|
|
5317
|
+
if (fs6__default.default.existsSync(filepath)) {
|
|
5304
5318
|
console.log(`Error: designs config already exists: ${filepath}`);
|
|
5305
5319
|
console.log(`To create a new file, please specify the file name like: 'smartui config:figma-config designs.json'`);
|
|
5306
5320
|
return;
|
|
5307
5321
|
}
|
|
5308
|
-
|
|
5309
|
-
|
|
5322
|
+
fs6__default.default.mkdirSync(path3__default.default.dirname(filepath), { recursive: true });
|
|
5323
|
+
fs6__default.default.writeFileSync(filepath, JSON.stringify(constants_default.DEFAULT_FIGMA_CONFIG, null, 2) + "\n");
|
|
5310
5324
|
console.log(`Created designs config: ${filepath}`);
|
|
5311
5325
|
}
|
|
5312
5326
|
function createWebFigmaConfig(filepath) {
|
|
5313
5327
|
filepath = filepath || ".smartui.json";
|
|
5314
|
-
let filetype =
|
|
5328
|
+
let filetype = path3__default.default.extname(filepath);
|
|
5315
5329
|
if (filetype != ".json") {
|
|
5316
5330
|
console.log("Error: figma config file must have .json extension");
|
|
5317
5331
|
return;
|
|
5318
5332
|
}
|
|
5319
|
-
if (
|
|
5333
|
+
if (fs6__default.default.existsSync(filepath)) {
|
|
5320
5334
|
console.log(`Error: figma config already exists: ${filepath}`);
|
|
5321
5335
|
console.log(`To create a new file, please specify the file name like: 'smartui config:create-figma-web <fileName>.json'`);
|
|
5322
5336
|
return;
|
|
5323
5337
|
}
|
|
5324
|
-
|
|
5325
|
-
|
|
5338
|
+
fs6__default.default.mkdirSync(path3__default.default.dirname(filepath), { recursive: true });
|
|
5339
|
+
fs6__default.default.writeFileSync(filepath, JSON.stringify(constants_default.WEB_FIGMA_CONFIG, null, 2) + "\n");
|
|
5326
5340
|
console.log(`Created figma web config: ${filepath}`);
|
|
5327
5341
|
}
|
|
5328
5342
|
function verifyFigmaWebConfig(ctx) {
|
|
@@ -5368,18 +5382,18 @@ function isValidArray(input) {
|
|
|
5368
5382
|
}
|
|
5369
5383
|
function createAppFigmaConfig(filepath) {
|
|
5370
5384
|
filepath = filepath || ".smartui.json";
|
|
5371
|
-
let filetype =
|
|
5385
|
+
let filetype = path3__default.default.extname(filepath);
|
|
5372
5386
|
if (filetype != ".json") {
|
|
5373
5387
|
console.log("Error: figma app config file must have .json extension");
|
|
5374
5388
|
return;
|
|
5375
5389
|
}
|
|
5376
|
-
if (
|
|
5390
|
+
if (fs6__default.default.existsSync(filepath)) {
|
|
5377
5391
|
console.log(`Error: figma app config already exists: ${filepath}`);
|
|
5378
5392
|
console.log(`To create a new figma app config, please specify the file name like: 'smartui config:create-figma-app <fileName>.json'`);
|
|
5379
5393
|
return;
|
|
5380
5394
|
}
|
|
5381
|
-
|
|
5382
|
-
|
|
5395
|
+
fs6__default.default.mkdirSync(path3__default.default.dirname(filepath), { recursive: true });
|
|
5396
|
+
fs6__default.default.writeFileSync(filepath, JSON.stringify(constants_default.APP_FIGMA_CONFIG, null, 2) + "\n");
|
|
5383
5397
|
console.log(`Created figma app config: ${filepath}`);
|
|
5384
5398
|
}
|
|
5385
5399
|
|
|
@@ -5623,7 +5637,7 @@ function captureScreenshots(ctx) {
|
|
|
5623
5637
|
});
|
|
5624
5638
|
}
|
|
5625
5639
|
function getImageDimensions(filePath) {
|
|
5626
|
-
const buffer =
|
|
5640
|
+
const buffer = fs6__default.default.readFileSync(filePath);
|
|
5627
5641
|
let width, height;
|
|
5628
5642
|
if (buffer.toString("hex", 0, 2) === "ffd8") {
|
|
5629
5643
|
let offset = 2;
|
|
@@ -5648,7 +5662,7 @@ function getImageDimensions(filePath) {
|
|
|
5648
5662
|
function isAllowedImage(filePath) {
|
|
5649
5663
|
return __async(this, null, function* () {
|
|
5650
5664
|
try {
|
|
5651
|
-
const fileBuffer =
|
|
5665
|
+
const fileBuffer = fs6__default.default.readFileSync(filePath);
|
|
5652
5666
|
const isMagicValid = constants_default.MAGIC_NUMBERS.some((magic) => fileBuffer.slice(0, magic.magic.length).equals(magic.magic));
|
|
5653
5667
|
const metadata = yield sharp__default.default(filePath).metadata();
|
|
5654
5668
|
if (metadata.format === constants_default.FILE_EXTENSION_GIFS) {
|
|
@@ -5672,11 +5686,11 @@ function uploadScreenshots(ctx) {
|
|
|
5672
5686
|
let noOfScreenshots = 0;
|
|
5673
5687
|
function processDirectory(directory, relativePath = "") {
|
|
5674
5688
|
return __async(this, null, function* () {
|
|
5675
|
-
const files =
|
|
5689
|
+
const files = fs6__default.default.readdirSync(directory);
|
|
5676
5690
|
for (let file of files) {
|
|
5677
|
-
const filePath =
|
|
5678
|
-
const stat =
|
|
5679
|
-
const relativeFilePath =
|
|
5691
|
+
const filePath = path3__default.default.join(directory, file);
|
|
5692
|
+
const stat = fs6__default.default.statSync(filePath);
|
|
5693
|
+
const relativeFilePath = path3__default.default.join(relativePath, file);
|
|
5680
5694
|
if (stat.isDirectory() && ctx.options.ignorePattern.includes(relativeFilePath)) {
|
|
5681
5695
|
ctx.log.info(`Ignoring Directory ${relativeFilePath}`);
|
|
5682
5696
|
continue;
|
|
@@ -5684,7 +5698,7 @@ function uploadScreenshots(ctx) {
|
|
|
5684
5698
|
if (stat.isDirectory()) {
|
|
5685
5699
|
yield processDirectory(filePath, relativeFilePath);
|
|
5686
5700
|
} else {
|
|
5687
|
-
let fileExtension =
|
|
5701
|
+
let fileExtension = path3__default.default.extname(file).toLowerCase();
|
|
5688
5702
|
if (allowedExtensions.includes(fileExtension)) {
|
|
5689
5703
|
const isValid = yield isAllowedImage(filePath);
|
|
5690
5704
|
if (!isValid) {
|
|
@@ -5693,7 +5707,7 @@ function uploadScreenshots(ctx) {
|
|
|
5693
5707
|
}
|
|
5694
5708
|
let ssId = relativeFilePath;
|
|
5695
5709
|
if (ctx.options.stripExtension) {
|
|
5696
|
-
ssId =
|
|
5710
|
+
ssId = path3__default.default.join(relativePath, path3__default.default.basename(file, fileExtension));
|
|
5697
5711
|
}
|
|
5698
5712
|
let viewport = "default";
|
|
5699
5713
|
if (!ctx.options.ignoreResolutions) {
|
|
@@ -5868,12 +5882,12 @@ command2.name("capture").description("Capture screenshots of static sites").argu
|
|
|
5868
5882
|
}
|
|
5869
5883
|
let ctx = ctx_default(command11.optsWithGlobals());
|
|
5870
5884
|
ctx.isSnapshotCaptured = true;
|
|
5871
|
-
if (!
|
|
5885
|
+
if (!fs6__default.default.existsSync(file)) {
|
|
5872
5886
|
ctx.log.error(`Web Static Config file ${file} not found.`);
|
|
5873
5887
|
return;
|
|
5874
5888
|
}
|
|
5875
5889
|
try {
|
|
5876
|
-
ctx.webStaticConfig = JSON.parse(
|
|
5890
|
+
ctx.webStaticConfig = JSON.parse(fs6__default.default.readFileSync(file, "utf8"));
|
|
5877
5891
|
if (!validateWebStaticConfig(ctx.webStaticConfig)) {
|
|
5878
5892
|
ctx.log.debug(JSON.stringify(validateWebStaticConfig.errors, null, 2));
|
|
5879
5893
|
(_a = validateWebStaticConfig.errors) == null ? void 0 : _a.forEach((error) => {
|
|
@@ -5963,11 +5977,11 @@ command3.name("upload").description("Upload screenshots from given directory").a
|
|
|
5963
5977
|
}
|
|
5964
5978
|
let ctx = ctx_default(command11.optsWithGlobals());
|
|
5965
5979
|
ctx.isSnapshotCaptured = true;
|
|
5966
|
-
if (!
|
|
5980
|
+
if (!fs6__default.default.existsSync(directory)) {
|
|
5967
5981
|
console.log(`Error: The provided directory ${directory} not found.`);
|
|
5968
5982
|
return;
|
|
5969
5983
|
}
|
|
5970
|
-
if (
|
|
5984
|
+
if (path3__default.default.extname(directory).toLowerCase() === constants_default.FILE_EXTENSION_ZIP) {
|
|
5971
5985
|
ctx.log.debug(`Error: The provided directory ${directory} is a zip file. Zips are not accepted.`);
|
|
5972
5986
|
return;
|
|
5973
5987
|
}
|
|
@@ -6246,12 +6260,12 @@ uploadFigma.name("upload-figma").description("Capture screenshots of static site
|
|
|
6246
6260
|
var _a, _b;
|
|
6247
6261
|
let ctx = ctx_default(command11.optsWithGlobals());
|
|
6248
6262
|
ctx.isSnapshotCaptured = true;
|
|
6249
|
-
if (!
|
|
6263
|
+
if (!fs6__default.default.existsSync(file)) {
|
|
6250
6264
|
console.log(`Error: Figma Config file ${file} not found.`);
|
|
6251
6265
|
return;
|
|
6252
6266
|
}
|
|
6253
6267
|
try {
|
|
6254
|
-
ctx.figmaDesignConfig = JSON.parse(
|
|
6268
|
+
ctx.figmaDesignConfig = JSON.parse(fs6__default.default.readFileSync(file, "utf8"));
|
|
6255
6269
|
if (!validateFigmaDesignConfig(ctx.figmaDesignConfig)) {
|
|
6256
6270
|
const validationError = (_b = (_a = validateFigmaDesignConfig.errors) == null ? void 0 : _a[0]) == null ? void 0 : _b.message;
|
|
6257
6271
|
throw new Error(validationError || "Invalid figma design Config");
|
|
@@ -6287,12 +6301,12 @@ uploadWebFigmaCommand.name("upload-figma-web").description("Capture figma screen
|
|
|
6287
6301
|
return __async(this, null, function* () {
|
|
6288
6302
|
var _a;
|
|
6289
6303
|
let ctx = ctx_default(command11.optsWithGlobals());
|
|
6290
|
-
if (!
|
|
6304
|
+
if (!fs6__default.default.existsSync(file)) {
|
|
6291
6305
|
console.log(`Error: figma-web config file ${file} not found.`);
|
|
6292
6306
|
return;
|
|
6293
6307
|
}
|
|
6294
6308
|
try {
|
|
6295
|
-
ctx.config = JSON.parse(
|
|
6309
|
+
ctx.config = JSON.parse(fs6__default.default.readFileSync(file, "utf8"));
|
|
6296
6310
|
ctx.log.info(JSON.stringify(ctx.config));
|
|
6297
6311
|
if (!validateWebFigmaConfig(ctx.config)) {
|
|
6298
6312
|
ctx.log.debug(JSON.stringify(validateWebFigmaConfig.errors, null, 2));
|
|
@@ -6340,12 +6354,12 @@ uploadAppFigmaCommand.name("upload-figma-app").description("Capture figma screen
|
|
|
6340
6354
|
return __async(this, null, function* () {
|
|
6341
6355
|
var _a;
|
|
6342
6356
|
let ctx = ctx_default(command11.optsWithGlobals());
|
|
6343
|
-
if (!
|
|
6357
|
+
if (!fs6__default.default.existsSync(file)) {
|
|
6344
6358
|
console.log(`Error: figma-app config file ${file} not found.`);
|
|
6345
6359
|
return;
|
|
6346
6360
|
}
|
|
6347
6361
|
try {
|
|
6348
|
-
ctx.config = JSON.parse(
|
|
6362
|
+
ctx.config = JSON.parse(fs6__default.default.readFileSync(file, "utf8"));
|
|
6349
6363
|
ctx.log.info(JSON.stringify(ctx.config));
|
|
6350
6364
|
if (!validateAppFigmaConfig(ctx.config)) {
|
|
6351
6365
|
ctx.log.debug(JSON.stringify(validateAppFigmaConfig.errors, null, 2));
|
|
@@ -6815,13 +6829,13 @@ function uploadPdfs(ctx, pdfPath) {
|
|
|
6815
6829
|
return __async(this, null, function* () {
|
|
6816
6830
|
const formData = new FormData__default.default();
|
|
6817
6831
|
if (pdfPath.endsWith(".pdf")) {
|
|
6818
|
-
formData.append("pathToFiles",
|
|
6832
|
+
formData.append("pathToFiles", fs6__default.default.createReadStream(pdfPath));
|
|
6819
6833
|
} else {
|
|
6820
|
-
const files =
|
|
6834
|
+
const files = fs6__default.default.readdirSync(pdfPath);
|
|
6821
6835
|
const pdfFiles = files.filter((file) => file.endsWith(".pdf"));
|
|
6822
6836
|
pdfFiles.forEach((pdf) => {
|
|
6823
|
-
const filePath =
|
|
6824
|
-
formData.append("pathToFiles",
|
|
6837
|
+
const filePath = path3__default.default.join(pdfPath, pdf);
|
|
6838
|
+
formData.append("pathToFiles", fs6__default.default.createReadStream(filePath));
|
|
6825
6839
|
});
|
|
6826
6840
|
}
|
|
6827
6841
|
const buildName = ctx.options.buildName;
|
|
@@ -6853,7 +6867,7 @@ command10.name("upload-pdf").description("Upload PDFs for visual comparison").ar
|
|
|
6853
6867
|
process.exit(1);
|
|
6854
6868
|
}
|
|
6855
6869
|
let ctx = ctx_default(command11.optsWithGlobals());
|
|
6856
|
-
if (!
|
|
6870
|
+
if (!fs6__default.default.existsSync(directory)) {
|
|
6857
6871
|
console.log(`Error: The provided directory ${directory} not found.`);
|
|
6858
6872
|
process.exit(1);
|
|
6859
6873
|
}
|
|
@@ -6896,7 +6910,7 @@ var commander_default = program2;
|
|
|
6896
6910
|
let client = new httpClient(env_default());
|
|
6897
6911
|
let log2 = logger_default;
|
|
6898
6912
|
try {
|
|
6899
|
-
|
|
6913
|
+
fs6__default.default.unlinkSync(constants_default.LOG_FILE_PATH);
|
|
6900
6914
|
let { data: { latestVersion, deprecated, additionalDescription } } = yield client.checkUpdate(log2);
|
|
6901
6915
|
log2.info(`
|
|
6902
6916
|
LambdaTest SmartUI CLI v${package_default.version}`);
|