Skip to content

Commit

Permalink
Iterating
Browse files Browse the repository at this point in the history
  • Loading branch information
bvaughn committed Jun 27, 2024
1 parent 40d5728 commit 44c0df3
Show file tree
Hide file tree
Showing 23 changed files with 57 additions and 49 deletions.
2 changes: 2 additions & 0 deletions packages/replayio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
"table": "^6.8.2",
"undici": "^5.28.4",
"uuid": "^8.3.2",
"winston": "^3.13.0",
"winston-loki": "^6.1.2",
"ws": "^7.5.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/replayio/src/commands/info.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { exitProcess } from "@replay-cli/shared/process/exitProcess";
import { parseBuildId } from "@replay-cli/shared/runtime/parseBuildId";
import { highlight } from "@replay-cli/shared/theme";
import { name as packageName, version as packageVersion } from "../../package.json";
import { registerCommand } from "../utils/commander/registerCommand";
import { getCurrentRuntimeMetadata } from "../utils/initialization/getCurrentRuntimeMetadata";
import { highlight } from "../utils/theme";

registerCommand("info", {
checkForNpmUpdate: false,
Expand Down
4 changes: 2 additions & 2 deletions packages/replayio/src/commands/logout.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { exitProcess } from "@replay-cli/shared/process/exitProcess";
import { getAccessToken } from "@replay-cli/shared/authentication/getAccessToken";
import { logoutIfAuthenticated } from "@replay-cli/shared/authentication/logoutIfAuthenticated";
import { exitProcess } from "@replay-cli/shared/process/exitProcess";
import { highlight } from "@replay-cli/shared/theme";
import { registerCommand } from "../utils/commander/registerCommand";
import { highlight } from "../utils/theme";

registerCommand("logout").description("Log out of your Replay account").action(logout);

Expand Down
16 changes: 8 additions & 8 deletions packages/replayio/src/commands/record.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { ProcessError } from "@replay-cli/shared/ProcessError";
import { trackEvent } from "@replay-cli/shared/mixpanel/trackEvent";
import { exitProcess } from "@replay-cli/shared/process/exitProcess";
import { canUpload } from "@replay-cli/shared/recording/canUpload";
import { getRecordings } from "@replay-cli/shared/recording/getRecordings";
import { printRecordings } from "@replay-cli/shared/recording/printRecordings";
import { selectRecordings } from "@replay-cli/shared/recording/selectRecordings";
import { LocalRecording } from "@replay-cli/shared/recording/types";
import { uploadRecordings } from "@replay-cli/shared/recording/upload/uploadRecordings";
import { dim, statusFailed } from "@replay-cli/shared/theme";
import debug from "debug";
import { v4 as uuid } from "uuid";
import { logAsyncOperation } from "../utils/async/logAsyncOperation";
Expand All @@ -8,14 +16,6 @@ import { launchBrowser } from "../utils/browser/launchBrowser";
import { reportBrowserCrash } from "../utils/browser/reportBrowserCrash";
import { registerCommand } from "../utils/commander/registerCommand";
import { confirm } from "../utils/confirm";
import { trackEvent } from "@replay-cli/shared/mixpanel/trackEvent";
import { canUpload } from "@replay-cli/shared/recording/canUpload";
import { getRecordings } from "@replay-cli/shared/recording/getRecordings";
import { printRecordings } from "@replay-cli/shared/recording/printRecordings";
import { selectRecordings } from "@replay-cli/shared/recording/selectRecordings";
import { LocalRecording } from "@replay-cli/shared/recording/types";
import { uploadRecordings } from "@replay-cli/shared/recording/upload/uploadRecordings";
import { dim, statusFailed } from "../utils/theme";

registerCommand("record", { checkForRuntimeUpdate: true, requireAuthentication: true })
.argument("[url]", `URL to open (default: "about:blank")`)
Expand Down
4 changes: 2 additions & 2 deletions packages/replayio/src/commands/remove.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { exitProcess } from "@replay-cli/shared/process/exitProcess";
import { registerCommand } from "../utils/commander/registerCommand";
import { findRecordingsWithShortIds } from "@replay-cli/shared/recording/findRecordingsWithShortIds";
import { getRecordings } from "@replay-cli/shared/recording/getRecordings";
import { printRecordings } from "@replay-cli/shared/recording/printRecordings";
import { removeAllFromDisk, removeFromDisk } from "@replay-cli/shared/recording/removeFromDisk";
import { selectRecordings } from "@replay-cli/shared/recording/selectRecordings";
import { LocalRecording } from "@replay-cli/shared/recording/types";
import { dim } from "../utils/theme";
import { dim } from "@replay-cli/shared/theme";
import { registerCommand } from "../utils/commander/registerCommand";

registerCommand("remove")
.argument("[ids...]", `Recording ids ${dim("(comma-separated)")}`, value => value.split(","))
Expand Down
2 changes: 1 addition & 1 deletion packages/replayio/src/commands/update.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { exitProcess } from "@replay-cli/shared/process/exitProcess";
import { statusSuccess } from "@replay-cli/shared/theme";
import { registerCommand } from "../utils/commander/registerCommand";
import { checkForNpmUpdate } from "../utils/initialization/checkForNpmUpdate";
import { checkForRuntimeUpdate } from "../utils/initialization/checkForRuntimeUpdate";
import { promptForNpmUpdate } from "../utils/initialization/promptForNpmUpdate";
import { installLatestRelease } from "../utils/installation/installLatestRelease";
import { statusSuccess } from "../utils/theme";

registerCommand("update", {
checkForRuntimeUpdate: false,
Expand Down
4 changes: 2 additions & 2 deletions packages/replayio/src/commands/upload-source-maps.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { getAccessToken } from "@replay-cli/shared/authentication/getAccessToken";
import { exitProcess } from "@replay-cli/shared/process/exitProcess";
import { dim } from "@replay-cli/shared/theme";
import { uploadSourceMaps as uploadSourceMapsExternal } from "@replayio/sourcemap-upload";
import { replayApiServer } from "../config";
import { logPromise } from "../utils/async/logPromise";
import { getAccessToken } from "@replay-cli/shared/authentication/getAccessToken";
import { registerCommand } from "../utils/commander/registerCommand";
import { dim } from "../utils/theme";

registerCommand("upload-source-maps <paths...>", { requireAuthentication: true })
.description("Upload source-maps for a Workspace")
Expand Down
2 changes: 1 addition & 1 deletion packages/replayio/src/utils/async/logAsyncOperation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import {
STATUS_RESOLVED,
Status,
} from "@replay-cli/shared/async/createDeferred";
import { statusFailed, statusPending, statusSuccess } from "@replay-cli/shared/theme";
import { dots } from "cli-spinners";
import { logUpdate } from "../../../../shared/src/logUpdate";
import { disableAnimatedLog } from "../../config";
import { statusFailed, statusPending, statusSuccess } from "../theme";

export type LogProgressOptions = { delayBeforeLoggingMs?: number };

Expand Down
2 changes: 1 addition & 1 deletion packages/replayio/src/utils/browser/getRunningProcess.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { logger } from "@replay-cli/shared/logger";
import { highlight } from "@replay-cli/shared/theme";
import findProcess from "find-process";
import { highlight } from "../theme";
import { getBrowserPath } from "./getBrowserPath";

export async function getRunningProcess() {
Expand Down
2 changes: 1 addition & 1 deletion packages/replayio/src/utils/browser/launchBrowser.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { getReplayPath } from "@replay-cli/shared/getReplayPath";
import { logger } from "@replay-cli/shared/logger";
import { dim, stderrPrefix, stdoutPrefix } from "@replay-cli/shared/theme";
import { ensureDirSync, existsSync } from "fs-extra";
import { join } from "path";
import { spawnProcess } from "../../../../shared/src/spawnProcess";
import { runtimeMetadata, runtimePath } from "../installation/config";
import { prompt } from "../prompt/prompt";
import { dim, stderrPrefix, stdoutPrefix } from "../theme";
import { getBrowserPath } from "./getBrowserPath";

export async function launchBrowser(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { dim, highlight, highlightAlternate } from "../theme";
import { dim, highlight, highlightAlternate } from "@replay-cli/shared/theme";

export function formatCommandOrOptionLine(line: string): string {
// drop aliases
Expand Down
2 changes: 1 addition & 1 deletion packages/replayio/src/utils/commander/formatOutput.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { highlight, highlightAlternate } from "@replay-cli/shared/theme";
import { drawBoxAroundText } from "../formatting";
import { highlight, highlightAlternate } from "../theme";
import { formatCommandOrOptionLine } from "./formatCommandOrOptionLine";
import { Block } from "./types";

Expand Down
2 changes: 1 addition & 1 deletion packages/replayio/src/utils/formatting.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { dim } from "@replay-cli/shared/theme";
import strip from "strip-ansi";
import { dim } from "./theme";

export function drawBoxAroundText(
text: string,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { highlight } from "@replay-cli/shared/theme";
import { name as packageName } from "../../../package.json";
import { prompt } from "../prompt/prompt";
import { updateCachedPromptData } from "../prompt/updateCachedPromptData";
import { highlight } from "../theme";
import { UpdateCheckResult } from "./types";

const PROMPT_ID = "npm-update";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { trackEvent } from "@replay-cli/shared/mixpanel/trackEvent";
import { emphasize } from "@replay-cli/shared/theme";
import { name as packageName } from "../../../package.json";
import { installLatestRelease } from "../installation/installLatestRelease";
import { prompt } from "../prompt/prompt";
import { updateCachedPromptData } from "../prompt/updateCachedPromptData";
import { emphasize } from "../theme";
import { Version } from "./checkForRuntimeUpdate";
import { UpdateCheckResult } from "./types";

Expand Down
4 changes: 2 additions & 2 deletions packages/replayio/src/utils/installation/config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// TODO [PRO-720] Consolidate with code in @replay-cli/shared/src/runtime

import { getReplayPath } from "@replay-cli/shared/getReplayPath";
import { emphasize } from "@replay-cli/shared/theme";
import { homedir } from "os";
import { join } from "path";
import { getReplayPath } from "@replay-cli/shared/getReplayPath";
import { emphasize } from "../theme";
import { Architecture, Platform, Runtime } from "./types";

type Metadata = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { writeToCache } from "@replay-cli/shared/cache";
import { getReplayPath } from "@replay-cli/shared/getReplayPath";
import { logger } from "@replay-cli/shared/logger";
import { withTrackAsyncEvent } from "@replay-cli/shared/mixpanel/withTrackAsyncEvent";
import { dim, link } from "@replay-cli/shared/theme";
import { spawnSync } from "child_process";
import { ensureDirSync, renameSync, rmSync, unlinkSync, writeFileSync } from "fs-extra";
import { get } from "https";
import { join } from "path";
import { logAsyncOperation } from "../async/logAsyncOperation";
import { dim, link } from "../theme";
import { metadataPath, runtimeMetadata } from "./config";
import { getLatestRelease } from "./getLatestReleases";
import { MetadataJSON } from "./types";
Expand Down
14 changes: 0 additions & 14 deletions packages/replayio/src/utils/theme.ts

This file was deleted.

11 changes: 10 additions & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,25 @@
"test": "jest --ci"
},
"dependencies": {
"bvaughn-enquirer": "2.4.2",
"chalk": "^4.1.2",
"cli-spinners": "^2.9.2",
"date-fns": "^2.28.0",
"debug": "^4.3.4",
"find-process": "^1.4.7",
"fs-extra": "^11.2.0",
"launchdarkly-node-client-sdk": "^3.2.1",
"log-update": "^4",
"mixpanel": "^0.18.0",
"open": "^8.4.2",
"pretty-ms": "^7.0.1",
"strip-ansi": "^6.0.1",
"superstruct": "^1.0.4",
"table": "^6.8.2",
"undici": "^5.28.4",
"winston": "^3.13.0",
"winston-loki": "^6.1.2"
"winston-loki": "^6.1.2",
"ws": "^7.5.0"
},
"devDependencies": {
"@replay-cli/pkg-build": "workspace:^",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { printTable } from "@replay-cli/shared/printTable";
import { formatRecording } from "@replay-cli/shared/recording/formatRecording";
import { LocalRecording } from "@replay-cli/shared/recording/types";
import { printTable } from "../printTable";
import { formatRecording } from "./formatRecording";
import { LocalRecording } from "./types";

export function printRecordings(
recordings: LocalRecording[],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// @ts-ignore TS types are busted; see github.com/enquirer/enquirer/issues/212
import { canUpload } from "@replay-cli/shared/recording/canUpload";
import { LocalRecording } from "@replay-cli/shared/recording/types";
import { dim, select, transparent } from "@replay-cli/shared/theme";
import { MultiSelect } from "bvaughn-enquirer";

import { dim, select, transparent } from "../theme";
import { canUpload } from "./canUpload";
import { printRecordings } from "./printRecordings";
import { LocalRecording } from "./types";

export async function selectRecordings(
recordings: LocalRecording[],
Expand Down
2 changes: 1 addition & 1 deletion packages/test-utils/src/reporter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { retryWithExponentialBackoff } from "@replay-cli/shared/async/retryOnFailure";
import { AuthInfo, getAuthInfo } from "@replay-cli/shared/graphql/getAuthInfo";
import { getAuthInfo } from "@replay-cli/shared/graphql/getAuthInfo";
import { queryGraphQL } from "@replay-cli/shared/graphql/queryGraphQL";
import { initLogger, logger } from "@replay-cli/shared/logger";
import { RecordingEntry } from "@replay-cli/shared/recording/types";
Expand Down
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3441,18 +3441,27 @@ __metadata:
dependencies:
"@replay-cli/pkg-build": "workspace:^"
"@types/jest": "npm:^28.1.5"
bvaughn-enquirer: "npm:2.4.2"
chalk: "npm:^4.1.2"
cli-spinners: "npm:^2.9.2"
date-fns: "npm:^2.28.0"
debug: "npm:^4.3.4"
find-process: "npm:^1.4.7"
fs-extra: "npm:^11.2.0"
jest: "npm:^28.1.3"
launchdarkly-node-client-sdk: "npm:^3.2.1"
log-update: "npm:^4"
mixpanel: "npm:^0.18.0"
open: "npm:^8.4.2"
pretty-ms: "npm:^7.0.1"
strip-ansi: "npm:^6.0.1"
superstruct: "npm:^1.0.4"
table: "npm:^6.8.2"
typescript: "npm:^5.5.2"
undici: "npm:^5.28.4"
winston: "npm:^3.13.0"
winston-loki: "npm:^6.1.2"
ws: "npm:^7.5.0"
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -15729,6 +15738,7 @@ __metadata:
typescript: "npm:^5.5.2"
undici: "npm:^5.28.4"
uuid: "npm:^8.3.2"
winston: "npm:^3.13.0"
ws: "npm:^7.5.0"
bin:
replayio: ./bin.js
Expand Down

0 comments on commit 44c0df3

Please sign in to comment.