Skip to content

Commit

Permalink
feat(utils): move parts from utils into core (#81)
Browse files Browse the repository at this point in the history
closes #78

---------

Co-authored-by: Matěj Chalk <34691111+matejchalk@users.noreply.github.com>
  • Loading branch information
BioPhoton and matejchalk authored Oct 2, 2023
1 parent 0c915f0 commit dd0a180
Show file tree
Hide file tree
Showing 27 changed files with 92 additions and 377 deletions.
315 changes: 0 additions & 315 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"bundle-require": "^4.0.1",
"chalk": "^5.3.0",
"yargs": "^17.7.2",
"@quality-metrics/models": "^0.0.1",
"@quality-metrics/utils": "^0.0.1",
"zod": "^3.22.1"
"@quality-metrics/models": "*",
"zod": "^3.22.1",
"@quality-metrics-cli/core": "*"
}
}
4 changes: 2 additions & 2 deletions packages/cli/src/lib/cli.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { describe, expect, it } from 'vitest';
import { yargsCli } from './cli';
import { middlewares } from './middlewares';
import { options as defaultOptions } from './options';
import { CollectOptions } from '@quality-metrics/utils';
import { GlobalOptions } from './model';
import { CollectOptions } from '@quality-metrics/core';
import { getDirname } from './implementation/helper.mock';
import { GlobalOptions } from './model';

const __dirname = getDirname(import.meta.url);
const withDirName = (path: string) => join(__dirname, path);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/lib/collect/command-object.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Report } from '@quality-metrics/models';
import { dummyConfig } from '@quality-metrics/models/testing';
import { CollectOptions } from '@quality-metrics/utils';
import { CollectOptions } from '@quality-metrics/core';
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import { yargsCli } from '../cli';
Expand Down
5 changes: 2 additions & 3 deletions packages/cli/src/lib/implementation/collect-and-persist.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import {
collect,
CollectOptions,
CollectOutputError,
logPersistedResults,
persistReport,
} from '@quality-metrics/utils';
} from '@quality-metrics/core';
import { pluginOutputSchema, Report } from '@quality-metrics/models';
import * as packageJson from '../../../package.json';

Expand All @@ -29,7 +28,7 @@ export async function collectAndPersistReports(
// Running checks after persisting helps while debugging as you can check the invalid output after the error
pluginOutputSchema.parse(plugin);
} catch (e) {
throw new CollectOutputError(plugin.slug, e as Error);
throw new Error(`${plugin.slug} - ${(e as Error).message}`);
}
});
}
2 changes: 1 addition & 1 deletion packages/cli/src/lib/implementation/config-middleware.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GlobalOptions, globalOptionsSchema } from '../model';
import { GlobalOptions, globalOptionsSchema } from '@quality-metrics/models';
import { readCodePushupConfig } from './read-code-pushup-config';

export class ConfigParseError extends Error {
Expand Down
Loading

0 comments on commit dd0a180

Please sign in to comment.