Skip to content

Commit

Permalink
fix: Fix some merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
kgilpin committed Mar 18, 2023
1 parent 37e9cc1 commit 9cd3308
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 73 deletions.
1 change: 1 addition & 0 deletions packages/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
63 changes: 0 additions & 63 deletions packages/cli/src/cmds/archive/archive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -46,21 +39,6 @@ export const DefaultFilters = {
javascript: [],
};

<<<<<<< HEAD
=======
export type Metadata = {
versions: Record<string, string>;
workingDirectory: string;
appMapDir: string;
commandArguments: Record<string, string | string[]>;
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';

Expand Down Expand Up @@ -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/<type>.`,
=======
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 <revision>.tar',
type: 'string',
=======
describe: 'output file name',
type: 'string',
default: 'appmap_archive.tar',
>>>>>>> 4492c39c (wip: Archive)
alias: 'f',
});

Expand All @@ -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<string | undefined> {
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);

Expand All @@ -151,7 +106,6 @@ export const handler = async (argv: any) => {
const {
concurrency,
maxSize,
<<<<<<< HEAD
type: typeArg,
revision: defaultRevision,
outputFile: outputFileNameArg,
Expand All @@ -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 };
Expand Down
17 changes: 7 additions & 10 deletions packages/cli/src/cmds/describeChange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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 {}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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}`);
Expand All @@ -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}`);
Expand Down

0 comments on commit 9cd3308

Please sign in to comment.