Skip to content

Commit

Permalink
Fix entry point
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Feb 6, 2022
1 parent fd14d4b commit db5cc5e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/config/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { loadConfig } from './load/main.js'
import { DEFINITIONS } from './normalize/definitions.js'
import { normalizeUserConfig } from './normalize/main.js'
import { addPlugins } from './plugin/lib/add.js'
import { normalizePluginsConfig } from './plugin/main.js'

// Retrieve configuration
export const getConfig = async function (
Expand All @@ -16,7 +16,7 @@ export const getConfig = async function (
opts: { context },
configInfos,
})
const configB = await addPlugins({
const configB = await normalizePluginsConfig({
config: configA,
command,
context,
Expand Down
13 changes: 5 additions & 8 deletions src/config/plugin/lib/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ import { getPluginTypes, getTopConfig, removeTopProps } from './extract.js'
import { loadPlugins } from './load.js'
import { normalizeMainProps } from './main_props.js'

// Several configuration properties (`runner`, `reporter`)
// can be customized with custom modules. This loads them. Each type can specify
// builtin modules too.
// Most plugin types need only a single plugin per benchmark, but they still
// allow several for some use cases. Since the most common case is a single
// plugin, selecting plugins:
// - can be either a string or an array of strings
// - uses a singular property name
// Generic utility to add plugins which can be selected and configured by users.
// This is optimized for the common use cases, while still allowing complex ones
// - Plugins without configuration
// - Single plugin per type, as opposed to multiple
// - Single configuration per plugin
export const addPlugins = async function ({
config,
command,
Expand Down
16 changes: 16 additions & 0 deletions src/config/plugin/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { addPlugins } from './lib/add.js'

// Handle the configuration all spyd-specific plugins: reporters and runners
export const normalizePluginsConfig = async function ({
config,
command,
context,
configInfos,
}) {
return await addPlugins({
config,
command,
context,
configInfos,
})
}

0 comments on commit db5cc5e

Please sign in to comment.