Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.
This repository was archived by the owner on Nov 9, 2022. It is now read-only.

Allow custom Drivers to be defined in the scope of the provider#144

Description

@niieani

Hi Miles! First of all, amazing work on the package, loving the work so far - thank you! 馃檱

Since writing drivers isn't documented, after a lot of trial and error I've kinda reverse engineered how they work. I understand the limitation is that drivers need to be external packages. This is a huge pain, especially when trying out stuff.

It would be great if we could write Drivers locally scoped to the provider, the same way we can do it for Scripts, i.e. by creating a directory drivers under the provider root.

I've worked around this personally by manually loading the local driver in the bootstrap of my provider (src/index.ts):

export default async function bootstrap(tool: Tool) {
  const {vite} = tool.config.settings
  if (vite) {
    await tool.driverRegistry.load(
      require.resolve('../drivers/Vite.ts'),
      undefined,
      {tool},
    )
  }
}

Unfortunately that this means my consumer can't define the driver in the driver array like:

  drivers: ['eslint', 'jest', 'prettier', 'typescript', 'vite'],

But instead I need to provide the configuration options in the settings:

export default {
  module: '@niieani/beemo-build-tools',
  drivers: ['babel', 'eslint', 'jest', 'prettier', 'typescript'],
  settings: {
    vite: {},
  },
} as BeemoConfig

It would be great if this module-scoped driver resolution was supported out-of-the-box!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions