Skip to content

Commit

Permalink
chore: remove componentregistry, fix broken test paths
Browse files Browse the repository at this point in the history
  • Loading branch information
boneskull committed May 18, 2024
1 parent 835e643 commit 1dc4031
Show file tree
Hide file tree
Showing 34 changed files with 361 additions and 987 deletions.
2 changes: 0 additions & 2 deletions packages/midnight-smoker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,6 @@
"@types/yargs": "17.0.32",
"memfs": "4.6.0",
"strip-ansi": "5.2.0",
"tsconfig-paths": "4.2.0",
"unexpected-eventemitter": "2.4.0",
"zod-to-json-schema": "3.22.3"
},
"overrides": {
Expand Down
127 changes: 0 additions & 127 deletions packages/midnight-smoker/src/component/component/component-registry.ts

This file was deleted.

86 changes: 0 additions & 86 deletions packages/midnight-smoker/src/component/component/component.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/midnight-smoker/src/component/component/index.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/midnight-smoker/src/component/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* @packageDocumentation
*/

export * from './component';

export * from './executor';

export * from './pkg-manager';
Expand Down
3 changes: 1 addition & 2 deletions packages/midnight-smoker/src/component/pkg-manager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* @module midnight-smoker/pkg-manager
*/

// export * from '#schema/pkg-manager';
export * from '#error/pkg-manager';

export type {ExecResult} from '#schema/exec-result';
Expand All @@ -23,7 +22,7 @@ export * from '#schema/pkg-manager-spec';

export * from '#schema/static-pkg-manager-spec';

export * as Util from 'midnight-smoker/util';
export * as Util from '#util';

export {SemVer} from 'semver';

Expand Down
2 changes: 0 additions & 2 deletions packages/midnight-smoker/src/component/rule/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,3 @@ export * from '#schema/rule-static';
export * from './context';

export * from './issue';

export * from './rule';
8 changes: 3 additions & 5 deletions packages/midnight-smoker/src/error/invalid-component-error.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import type {ComponentKind} from '#constants';
import {BaseSmokerError} from './base-error';

export class InvalidComponentError extends BaseSmokerError<{
id: string;
kind: ComponentKind;
def: unknown;
}> {
public readonly id = 'InvalidComponentError';

constructor(message: string, kind: ComponentKind, id: string) {
super(message, {id, kind});
constructor(message: string, def: unknown) {
super(message, {def});
}
}
6 changes: 3 additions & 3 deletions packages/midnight-smoker/src/machine/loader/loader-machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export const LoaderMachine = setup({
params: ({event: {output}}) => output,
},
],
target: '#LoaderMachine.materializing.selectPkgManagers.done',
target: '#LoaderMachine.selecting.selectPkgManagers.done',
},
onError: {
actions: [
Expand Down Expand Up @@ -345,12 +345,12 @@ export const LoaderMachine = setup({
{
guard: not('hasError'),
target: 'done',
actions: log('materializing complete'),
actions: log('selecting complete'),
},
{
guard: 'hasError',
target: 'errored',
actions: log('materializing errored'),
actions: log('selecting errored'),
},
],
},
Expand Down
6 changes: 5 additions & 1 deletion packages/midnight-smoker/src/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"name": "midnight-smoker",
"engines": {
"node": "^16.20.0 || ^18.0.0 || ^20.0.0",
"npm": ">=7.0.0"
},
"imports": {
"#cli": "./cli/index.ts",
"#cli/*": "./cli/*.ts",
Expand Down Expand Up @@ -69,7 +73,7 @@
"./script-runner": {
"default": "./component/script-runner/index.ts"
},
"./package.json": "./package.kson",
"./package.json": "./package.json",
"./constants": {
"default": "./constants.ts"
},
Expand Down
32 changes: 32 additions & 0 deletions packages/midnight-smoker/src/plugin/component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import {type ComponentKind, type ComponentKinds} from '#constants';
import {type Executor} from '#schema/executor';
import {type PkgManagerDef} from '#schema/pkg-manager-def';
import {type SomeReporterDef} from '#schema/reporter-def';
import {type SomeRuleDef} from '#schema/rule-def';
import {type StaticPluginMetadata} from '#schema/static-plugin-metadata';
// import Debug from 'debug';

// const debug = Debug('midnight-smoker:component');
export type ComponentObject<T extends ComponentKind> =
T extends typeof ComponentKinds.RuleDef
? SomeRuleDef
: T extends typeof ComponentKinds.PkgManagerDef
? PkgManagerDef
: T extends typeof ComponentKinds.ReporterDef
? SomeReporterDef
: T extends typeof ComponentKinds.Executor
? Executor
: never;

export interface Component<T extends ComponentKind = ComponentKind> {
readonly id: string;
readonly kind: T;
readonly pluginName: string;
readonly componentName: string;
readonly isBlessed: boolean;
readonly plugin: StaticPluginMetadata;
}

export type SomeComponentObject = ComponentObject<any>;

export type SomeComponent = Component<any>;
2 changes: 1 addition & 1 deletion packages/midnight-smoker/src/plugin/create-plugin-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const createPluginAPI = (
name = DEFAULT_COMPONENT_ID,
) => {
metadata.addExecutor(name, ExecutorSchema.parse(executor));
registerComponent(ComponentKinds.Executor, executor, name);
registerComponent(ComponentKinds.Executor, executor, name); //?
return pluginApi;
};

Expand Down
Loading

0 comments on commit 1dc4031

Please sign in to comment.