@alwaysmeticulous/cli
Advanced tools
Comparing version 1.3.5 to 1.3.6
@@ -10,4 +10,5 @@ import { CommandModule } from "yargs"; | ||
incognito?: boolean | null | undefined; | ||
trace?: boolean | null | undefined; | ||
} | ||
export declare const record: CommandModule<unknown, Options>; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.record = void 0; | ||
const common_1 = require("@alwaysmeticulous/common"); | ||
const path_1 = require("path"); | ||
@@ -8,7 +9,18 @@ const client_1 = require("../../api/client"); | ||
const session_api_1 = require("../../api/session.api"); | ||
const local_data_1 = require("../../local-data/local-data"); | ||
const replay_assets_1 = require("../../local-data/replay-assets"); | ||
const commit_sha_utils_1 = require("../../utils/commit-sha.utils"); | ||
const sentry_utils_1 = require("../../utils/sentry.utils"); | ||
const handler = async ({ apiToken, commitSha: commitSha_, devTools, width, height, uploadIntervalMs, incognito, }) => { | ||
const handler = async ({ apiToken, commitSha: commitSha_, devTools, width, height, uploadIntervalMs, incognito, trace, }) => { | ||
const logger = trace ? await common_1.DebugLogger.create() : null; | ||
logger === null || logger === void 0 ? void 0 : logger.log("Record options:"); | ||
logger === null || logger === void 0 ? void 0 : logger.logObject({ | ||
apiToken, | ||
commitSha: commitSha_, | ||
devTools, | ||
width, | ||
height, | ||
uploadIntervalMs, | ||
incognito, | ||
trace, | ||
}); | ||
// 1. Fetch the recording token | ||
@@ -19,2 +31,3 @@ const client = (0, client_1.createClient)({ apiToken }); | ||
console.error("Could not retrieve project data. Is the API token correct?"); | ||
logger === null || logger === void 0 ? void 0 : logger.log("Could not retrieve project data. Is the API token correct?"); | ||
process.exit(1); | ||
@@ -25,2 +38,3 @@ } | ||
console.error("Could not retrieve recording token."); | ||
logger === null || logger === void 0 ? void 0 : logger.log("Could not retrieve recording token."); | ||
process.exit(1); | ||
@@ -43,5 +57,7 @@ } | ||
console.error(error); | ||
logger === null || logger === void 0 ? void 0 : logger.log("Error: could not import @alwaysmeticulous/record"); | ||
logger === null || logger === void 0 ? void 0 : logger.log(`${error}`); | ||
process.exit(1); | ||
} | ||
const cookieDir = (0, path_1.join)((0, local_data_1.getMeticulousLocalDataDir)(), "cookies"); | ||
const cookieDir = (0, path_1.join)((0, common_1.getMeticulousLocalDataDir)(), "cookies"); | ||
// Report recording start | ||
@@ -62,2 +78,3 @@ const recordingCommandId = await (0, session_api_1.getRecordingCommandId)(client); | ||
cookieDir, | ||
logger, | ||
onDetectedSession: (sessionId) => { | ||
@@ -67,4 +84,9 @@ (0, session_api_1.postSessionIdNotification)(client, sessionId, recordingCommandId).catch((error) => { | ||
console.error(error); | ||
logger === null || logger === void 0 ? void 0 : logger.log(`Warning: error while notifying session recording ${sessionId}`); | ||
logger === null || logger === void 0 ? void 0 : logger.log(`${error}`); | ||
}); | ||
}, | ||
}).catch((error) => { | ||
logger === null || logger === void 0 ? void 0 : logger.log(`${error}`); | ||
throw error; | ||
}); | ||
@@ -102,4 +124,8 @@ }; | ||
}, | ||
trace: { | ||
boolean: true, | ||
description: "Enable verbose logging", | ||
}, | ||
}, | ||
handler: (0, sentry_utils_1.wrapHandler)(handler), | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.replay = exports.replayCommandHandler = void 0; | ||
const common_1 = require("@alwaysmeticulous/common"); | ||
const promises_1 = require("fs/promises"); | ||
@@ -12,3 +13,2 @@ const luxon_1 = require("luxon"); | ||
const config_1 = require("../../config/config"); | ||
const local_data_1 = require("../../local-data/local-data"); | ||
const local_data_utils_1 = require("../../local-data/local-data.utils"); | ||
@@ -50,7 +50,7 @@ const replay_assets_1 = require("../../local-data/replay-assets"); | ||
// 5. Create replay directory | ||
await (0, promises_1.mkdir)((0, path_1.join)((0, local_data_1.getMeticulousLocalDataDir)(), "replays"), { | ||
await (0, promises_1.mkdir)((0, path_1.join)((0, common_1.getMeticulousLocalDataDir)(), "replays"), { | ||
recursive: true, | ||
}); | ||
const tempDirName = (0, local_data_utils_1.sanitizeFilename)(`${new Date().toISOString()}-`); | ||
const tempDir = await (0, promises_1.mkdtemp)((0, path_1.join)((0, local_data_1.getMeticulousLocalDataDir)(), "replays", tempDirName)); | ||
const tempDir = await (0, promises_1.mkdtemp)((0, path_1.join)((0, common_1.getMeticulousLocalDataDir)(), "replays", tempDirName)); | ||
// 6. Create and save replay parameters | ||
@@ -57,0 +57,0 @@ const replayEventsParams = { |
@@ -7,8 +7,8 @@ "use strict"; | ||
exports.fetchAsset = exports.saveAssetMetadata = exports.loadAssetMetadata = void 0; | ||
const common_1 = require("@alwaysmeticulous/common"); | ||
const axios_1 = __importDefault(require("axios")); | ||
const promises_1 = require("fs/promises"); | ||
const path_1 = require("path"); | ||
const local_data_1 = require("./local-data"); | ||
const loadAssetMetadata = async () => { | ||
const assetsDir = (0, path_1.join)((0, local_data_1.getMeticulousLocalDataDir)(), "assets"); | ||
const assetsDir = (0, path_1.join)((0, common_1.getMeticulousLocalDataDir)(), "assets"); | ||
await (0, promises_1.mkdir)(assetsDir, { recursive: true }); | ||
@@ -26,3 +26,3 @@ const assetsFile = (0, path_1.join)(assetsDir, `assets.json`); | ||
const saveAssetMetadata = async (assetMetadata) => { | ||
const assetsDir = (0, path_1.join)((0, local_data_1.getMeticulousLocalDataDir)(), "assets"); | ||
const assetsDir = (0, path_1.join)((0, common_1.getMeticulousLocalDataDir)(), "assets"); | ||
await (0, promises_1.mkdir)(assetsDir, { recursive: true }); | ||
@@ -34,3 +34,3 @@ const assetsFile = (0, path_1.join)(assetsDir, `assets.json`); | ||
const fetchAsset = async (fetchUrl) => { | ||
const assetsDir = (0, path_1.join)((0, local_data_1.getMeticulousLocalDataDir)(), "assets"); | ||
const assetsDir = (0, path_1.join)((0, common_1.getMeticulousLocalDataDir)(), "assets"); | ||
const assetMetadata = await (0, exports.loadAssetMetadata)(); | ||
@@ -37,0 +37,0 @@ const etag = (await axios_1.default.head(fetchUrl)).headers["etag"] || ""; |
@@ -7,2 +7,3 @@ "use strict"; | ||
exports.readLocalReplayScreenshot = exports.readReplayScreenshot = exports.getOrFetchReplayArchive = exports.getOrFetchReplay = void 0; | ||
const common_1 = require("@alwaysmeticulous/common"); | ||
const adm_zip_1 = __importDefault(require("adm-zip")); | ||
@@ -14,5 +15,4 @@ const promises_1 = require("fs/promises"); | ||
const io_utils_1 = require("../image/io.utils"); | ||
const local_data_1 = require("./local-data"); | ||
const getOrFetchReplay = async (client, replayId) => { | ||
const replayDir = (0, path_1.join)((0, local_data_1.getMeticulousLocalDataDir)(), "replays", replayId); | ||
const replayDir = (0, path_1.join)((0, common_1.getMeticulousLocalDataDir)(), "replays", replayId); | ||
await (0, promises_1.mkdir)(replayDir, { recursive: true }); | ||
@@ -38,3 +38,3 @@ const replayFile = (0, path_1.join)(replayDir, `${replayId}.json`); | ||
const getOrFetchReplayArchive = async (client, replayId) => { | ||
const replayDir = (0, path_1.join)((0, local_data_1.getMeticulousLocalDataDir)(), "replays", replayId); | ||
const replayDir = (0, path_1.join)((0, common_1.getMeticulousLocalDataDir)(), "replays", replayId); | ||
await (0, promises_1.mkdir)(replayDir, { recursive: true }); | ||
@@ -65,3 +65,3 @@ const replayArchiveFile = (0, path_1.join)(replayDir, `${replayId}.zip`); | ||
const readReplayScreenshot = async (replayId) => { | ||
const replayDir = (0, path_1.join)((0, local_data_1.getMeticulousLocalDataDir)(), "replays", replayId); | ||
const replayDir = (0, path_1.join)((0, common_1.getMeticulousLocalDataDir)(), "replays", replayId); | ||
const screenshotFile = (0, path_1.join)(replayDir, "screenshots", "final-state.png"); | ||
@@ -68,0 +68,0 @@ const png = await (0, io_utils_1.readPng)(screenshotFile); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.writeScreenshotDiff = void 0; | ||
const common_1 = require("@alwaysmeticulous/common"); | ||
const promises_1 = require("fs/promises"); | ||
const path_1 = require("path"); | ||
const io_utils_1 = require("../image/io.utils"); | ||
const local_data_1 = require("./local-data"); | ||
const writeScreenshotDiff = async ({ baseReplayId, headReplayId, diff }) => { | ||
const diffDir = (0, path_1.join)((0, local_data_1.getMeticulousLocalDataDir)(), "screenshot-diffs"); | ||
const diffDir = (0, path_1.join)((0, common_1.getMeticulousLocalDataDir)(), "screenshot-diffs"); | ||
await (0, promises_1.mkdir)(diffDir, { recursive: true }); | ||
@@ -11,0 +11,0 @@ const diffFile = (0, path_1.join)(diffDir, `${baseReplayId}+${headReplayId}.png`); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getOrFetchRecordedSessionData = exports.getOrFetchRecordedSession = void 0; | ||
const common_1 = require("@alwaysmeticulous/common"); | ||
const promises_1 = require("fs/promises"); | ||
const path_1 = require("path"); | ||
const session_api_1 = require("../api/session.api"); | ||
const local_data_1 = require("./local-data"); | ||
const local_data_utils_1 = require("./local-data.utils"); | ||
const getOrFetchRecordedSession = async (client, sessionId) => { | ||
const sessionsDir = (0, path_1.join)((0, local_data_1.getMeticulousLocalDataDir)(), "sessions"); | ||
const sessionsDir = (0, path_1.join)((0, common_1.getMeticulousLocalDataDir)(), "sessions"); | ||
await (0, promises_1.mkdir)(sessionsDir, { recursive: true }); | ||
@@ -31,3 +31,3 @@ const sessionFile = (0, path_1.join)(sessionsDir, `${(0, local_data_utils_1.sanitizeFilename)(sessionId)}.json`); | ||
const getOrFetchRecordedSessionData = async (client, sessionId) => { | ||
const sessionsDir = (0, path_1.join)((0, local_data_1.getMeticulousLocalDataDir)(), "sessions"); | ||
const sessionsDir = (0, path_1.join)((0, common_1.getMeticulousLocalDataDir)(), "sessions"); | ||
await (0, promises_1.mkdir)(sessionsDir, { recursive: true }); | ||
@@ -34,0 +34,0 @@ const sessionDataFile = (0, path_1.join)(sessionsDir, `${(0, local_data_utils_1.sanitizeFilename)(sessionId)}_data.json`); |
@@ -7,2 +7,3 @@ "use strict"; | ||
exports.main = void 0; | ||
const common_1 = require("@alwaysmeticulous/common"); | ||
const yargs_1 = __importDefault(require("yargs")); | ||
@@ -18,6 +19,5 @@ const debug_replay_command_1 = require("./commands/debug-replay/debug-replay.command"); | ||
const upload_build_command_1 = require("./commands/upload-build/upload-build.command"); | ||
const local_data_1 = require("./local-data/local-data"); | ||
const sentry_utils_1 = require("./utils/sentry.utils"); | ||
const handleDataDir = (dataDir) => { | ||
(0, local_data_1.getMeticulousLocalDataDir)(dataDir); | ||
(0, common_1.getMeticulousLocalDataDir)(dataDir); | ||
}; | ||
@@ -24,0 +24,0 @@ const main = () => { |
{ | ||
"name": "@alwaysmeticulous/cli", | ||
"version": "1.3.5", | ||
"version": "1.3.6", | ||
"description": "The Meticulous CLI", | ||
@@ -27,2 +27,3 @@ "license": "ISC", | ||
"dependencies": { | ||
"@alwaysmeticulous/common": "^1.3.6", | ||
"@sentry/node": "^6.19.7", | ||
@@ -29,0 +30,0 @@ "adm-zip": "^0.5.9", |
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
134102
2050
13
13
73