Skip to content

Commit

Permalink
fix: refactor after core package intro (#83)
Browse files Browse the repository at this point in the history
Co-authored-by: Matěj Chalk <34691111+matejchalk@users.noreply.github.com>
  • Loading branch information
BioPhoton and matejchalk authored Oct 3, 2023
1 parent 8b16a35 commit aa39d09
Show file tree
Hide file tree
Showing 38 changed files with 36 additions and 38 deletions.
8 changes: 4 additions & 4 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "@quality-metrics/cli",
"name": "@code-pushup/cli",
"version": "0.0.1",
"bin": {
"code-pushup": "src/bin.js"
},
"dependencies": {
"bundle-require": "^4.0.1",
"chalk": "^5.3.0",
"yargs": "^17.7.2",
"@quality-metrics/models": "*",
"zod": "^3.22.1",
"@quality-metrics-cli/core": "*"
"@code-pushup/models": "*",
"@code-pushup/core": "*",
"@code-pushup/utils": "*"
}
}
2 changes: 1 addition & 1 deletion packages/cli/src/lib/collect/command-object.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CommandModule } from 'yargs';
import { collectAndPersistReports } from '../implementation/collect-and-persist';
import { collectAndPersistReports } from '@quality-metrics/core';

export function yargsCollectCommandObject() {
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CoreConfig, coreConfigSchema } from '@quality-metrics/models';
import { stat } from 'fs/promises';
import { importModule } from './load-file';
import { importModule } from '@quality-metrics/utils';
import { ConfigParseError } from './config-middleware';

// @TODO [73] move into core
Expand Down
8 changes: 4 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@quality-metrics-cli/core",
"name": "@code-pushup/core",
"version": "0.0.1",
"dependencies": {
"@quality-metrics/models": "*",
"@quality-metrics/utils": "*",
"chalk": "^5.3.0"
"chalk": "^5.3.0",
"@code-pushup/models": "*",
"@code-pushup/utils": "*"
},
"type": "commonjs",
"main": "./index.cjs"
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { logPersistedResults, persistReport } from './lib/persist';
export { executePlugins } from './lib/execute-plugin';
export { collect, CollectOptions } from './lib/collect';
export { collectAndPersistReports } from './lib/collect-and-persist';
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
import {
collect,
CollectOptions,
logPersistedResults,
persistReport,
} from '@quality-metrics/core';
import { collect, CollectOptions } from './collect';
import { name, version } from '../../package.json';

import { pluginOutputSchema, Report } from '@quality-metrics/models';
import * as packageJson from '../../../package.json';
import { logPersistedResults, persistReport } from './persist';

// @TODO [73] move into core
export async function collectAndPersistReports(
config: CollectOptions,
): Promise<void> {
const collectReport = await collect(config);
const report: Report = {
...collectReport,
packageName: packageJson.name,
version: packageJson.version,
packageName: name,
version: version,
};

const persistResults = await persistReport(report, config);
Expand Down
2 changes: 1 addition & 1 deletion packages/models/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@quality-metrics/models",
"name": "@code-pushup/models",
"version": "0.0.1",
"dependencies": {
"@code-pushup/portal-client": "^0.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/nx-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@quality-metrics/nx-plugin",
"name": "@code-pushup/nx-plugin",
"version": "0.0.1",
"dependencies": {
"@nx/devkit": "^16.8.1",
Expand Down
8 changes: 4 additions & 4 deletions packages/plugin-eslint/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@quality-metrics/eslint-plugin",
"name": "@code-pushup/eslint-plugin",
"version": "0.0.1",
"dependencies": {
"@quality-metrics/models": "*",
"@quality-metrics/utils": "*",
"eslint": "~8.46.0"
"eslint": "~8.46.0",
"@code-pushup/models": "*",
"@code-pushup/utils": "*"
}
}
8 changes: 4 additions & 4 deletions packages/plugin-lighthouse/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@quality-metrics/lighthouse-plugin",
"name": "@code-pushup/lighthouse-plugin",
"version": "0.0.1",
"dependencies": {
"@quality-metrics/models": "*",
"@quality-metrics/utils": "*",
"lighthouse": "^11.0.0"
"lighthouse": "^11.0.0",
"@code-pushup/models": "*",
"@code-pushup/utils": "*"
}
}
7 changes: 4 additions & 3 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "@quality-metrics/utils",
"name": "@code-pushup/utils",
"version": "0.0.1",
"dependencies": {
"@quality-metrics/models": "*",
"chalk": "^5.3.0",
"cliui": "^8.0.1"
"cliui": "^8.0.1",
"bundle-require": "^4.0.1",
"@code-pushup/models": "*"
}
}
9 changes: 5 additions & 4 deletions packages/utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ export {
ProcessObserver,
ProcessError,
objectToCliArgs,
} from './lib/collect/implementation/execute-process';
export { calcDuration, formatBytes } from './lib/collect/implementation/utils';
export { reportToStdout } from './lib/collect/implementation/report-to-stdout';
export { reportToMd } from './lib/collect/implementation/report-to-md';
} from './lib/execute-process';
export { calcDuration, formatBytes } from './lib/utils';
export { reportToStdout } from './lib/report-to-stdout';
export { reportToMd } from './lib/report-to-md';
export { importModule } from './lib/load-file';
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { bundleRequire, Options } from 'bundle-require';

// @TODO [73] move into utils
export async function importModule<T = unknown>(
options: Options,
parse?: (d: unknown) => T,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit aa39d09

Please sign in to comment.