From 9cd330888725548aca24e7f7c363fd30e342bb12 Mon Sep 17 00:00:00 2001 From: Kevin Gilpin Date: Sat, 18 Mar 2023 17:25:19 -0400 Subject: [PATCH] fix: Fix some merge conflicts --- packages/cli/src/cli.ts | 1 + packages/cli/src/cmds/archive/archive.ts | 63 ------------------------ packages/cli/src/cmds/describeChange.ts | 17 +++---- 3 files changed, 8 insertions(+), 73 deletions(-) diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index 540e76a352..36e5f2d0eb 100755 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -32,6 +32,7 @@ const InspectCommand = require('./cmds/inspect/inspect'); const SequenceDiagramCommand = require('./cmds/sequenceDiagram'); const SequenceDiagramDiffCommand = require('./cmds/sequenceDiagramDiff'); const StatsCommand = require('./cmds/stats/stats'); +import UploadCommand from './cmds/upload'; const BuildArchive = require('./cmds/archive/archive'); const RestoreArchive = require('./cmds/archive/restore'); const UpdateAppMaps = require('./cmds/update'); diff --git a/packages/cli/src/cmds/archive/archive.ts b/packages/cli/src/cmds/archive/archive.ts index f9b24fe010..44c5a44697 100644 --- a/packages/cli/src/cmds/archive/archive.ts +++ b/packages/cli/src/cmds/archive/archive.ts @@ -18,19 +18,12 @@ import { } from '@appland/sequence-diagram'; import { queue } from 'async'; import { AppMapFilter, buildAppMap, Filter } from '@appland/models'; -<<<<<<< HEAD import { DefaultMaxAppMapSizeInMB } from '../../lib/fileSizeFilter'; import loadAppMapConfig from '../../lib/loadAppMapConfig'; import { VERSION as IndexVersion } from '../../fingerprint/fingerprinter'; import chalk from 'chalk'; import gitRevision from './gitRevision'; import { Metadata } from './Metadata'; -======= -import { DefaultMaxAppMapSizeInMB } from '../../openapi/fileSizeFilter'; -import loadAppMapConfig, { AppMapConfig } from '../../lib/loadAppMapConfig'; -import { VERSION as IndexVersion } from '../../fingerprint/fingerprinter'; -import chalk from 'chalk'; ->>>>>>> 4492c39c (wip: Archive) const ArchiveVersion = '1.0'; const { name: ApplandAppMapPackageName, version: ApplandAppMapPackageVersion } = PackageConfig; @@ -46,21 +39,6 @@ export const DefaultFilters = { javascript: [], }; -<<<<<<< HEAD -======= -export type Metadata = { - versions: Record; - workingDirectory: string; - appMapDir: string; - commandArguments: Record; - baseRevision?: string; - revision: string; - timestamp: string; - oversizedAppMaps: string[]; - config: AppMapConfig; -}; - ->>>>>>> 4492c39c (wip: Archive) export const command = 'archive'; export const describe = 'Build an AppMap archive from a directory containing AppMaps'; @@ -90,23 +68,13 @@ commit of the current git revision may not be the one that triggered the build.` }); args.option('output-dir', { -<<<<<<< HEAD describe: `directory in which to save the output file. By default, it's .appmap/archive/.`, -======= - describe: 'directory in which to save the output file', ->>>>>>> 4492c39c (wip: Archive) type: 'string', }); args.option('output-file', { -<<<<<<< HEAD describe: 'output file name. Default output name is .tar', type: 'string', -======= - describe: 'output file name', - type: 'string', - default: 'appmap_archive.tar', ->>>>>>> 4492c39c (wip: Archive) alias: 'f', }); @@ -124,19 +92,6 @@ commit of the current git revision may not be the one that triggered the build.` return args.strict(); }; -<<<<<<< HEAD -======= -async function gitRevision(): Promise { - return new Promise((resolve) => { - exec('git rev-parse HEAD', (error, stdout) => { - if (error) resolve(undefined); - - resolve(stdout.trim()); - }); - }); -} - ->>>>>>> 4492c39c (wip: Archive) export const handler = async (argv: any) => { verbose(argv.verbose); @@ -151,7 +106,6 @@ export const handler = async (argv: any) => { const { concurrency, maxSize, -<<<<<<< HEAD type: typeArg, revision: defaultRevision, outputFile: outputFileNameArg, @@ -163,23 +117,6 @@ export const handler = async (argv: any) => { console.log(`Building '${typeArg}' archive from ${appMapDir}`); const revision = await gitRevision(defaultRevision); -======= - type, - revision: defaultRevision, - outputFile: outputFileName, - } = argv; - const { outputDir } = argv || '.'; - - const maxAppMapSizeInBytes = Math.round(parseFloat(maxSize) * 1024 * 1024); - - console.log(`Building '${type}' archive from ${appMapDir}`); - - const revision = defaultRevision || (await gitRevision()); - if (!revision) - throw new Error( - `Unable to determine revision. Use --revision to specify it, or run this command in a Git repo.` - ); ->>>>>>> 4492c39c (wip: Archive) console.log(`Building archive of revision ${revision}`); const versions = { archive: ArchiveVersion, index: IndexVersion }; diff --git a/packages/cli/src/cmds/describeChange.ts b/packages/cli/src/cmds/describeChange.ts index 8cac72a5e9..be0605ddaf 100644 --- a/packages/cli/src/cmds/describeChange.ts +++ b/packages/cli/src/cmds/describeChange.ts @@ -7,14 +7,7 @@ import { handleWorkingDirectory } from '../lib/handleWorkingDirectory'; import { locateAppMapDir } from '../lib/locateAppMapDir'; import { exists, verbose } from '../utils'; import { isAbsolute, join, relative } from 'path'; -import { - Action, - actionActors, - Diagram, - format, - FormatType, - ServerRPC, -} from '@appland/sequence-diagram'; +import { Diagram, format, FormatType, ServerRPC } from '@appland/sequence-diagram'; import { glob } from 'glob'; import { promisify } from 'util'; import { DiffDiagrams } from '../sequenceDiagramDiff/DiffDiagrams'; @@ -30,6 +23,7 @@ import { OperationReference } from '../describeChange/OperationReference'; import { Operation } from '../describeChange/types'; import puppeteer from 'puppeteer'; import { renderSequenceDiagramPNG } from '../sequenceDiagram/renderSequenceDiagramPNG'; +import BrowserRenderer from './sequenceDiagram/browserRenderer'; export class ValidationError extends Error {} @@ -245,7 +239,7 @@ export const handler = async (argv: any) => { [operation.method.toUpperCase(), operation.path, `(${operation.status})`].join(' '); if (verbose()) console.warn(`Preparing browser for PNG rendering`); - const browser = await puppeteer.launch({ timeout: 120 * 1000, headless: !argv.showBrowser }); + const browserRender = new BrowserRenderer(argv.showBrowser); async function saveSequenceDiagram(subdir: string, diagram: Diagram, name?: string) { if (!name) { @@ -279,7 +273,7 @@ export const handler = async (argv: any) => { await renderSequenceDiagramPNG( join(operationDir, [name, 'sequence.png'].join('.')), join(operationDir, [name, 'sequence.json'].join('.')), - browser + browserRender ); } catch (e) { console.warn(`Failed to render sequence diagram for ${operationDir}: ${e}`); @@ -298,6 +292,9 @@ export const handler = async (argv: any) => { } }) ); + + await browserRender.close(); + changeReport.routeChanges.removed.forEach((change) => { console.log(`Removed route: ${operationUrl(change.operation)}`); if (change.sourceDiff) console.log(`Source diff: ${change.sourceDiff}`);