Skip to content

Refactor register, create, and config loading so they can be composed manually by consumers #1429

Description

@cspotcode

Partially implemented by #1474

Motivation: to support ts-node-esm, plus improve the API in general.

Should be able to read configuration without creating a Service nor loading any extra dependencies.

While we're at it, we should allow create()ing a service and then passing it to register(). Should not be forced to create and register at once.

import*astsNodefrom'ts-node';// Not to be confused with current, internal readConfig, which is narrower in scopeconstconfig=tsNode.readConfig(/*ReadConfigOptions, similar to CreateOptions*/);constservice=createFromConfig(config);register(service);// Can we do this with overload? Do we need new `registerService()` function?

Will allow ts-node-esm to read config, determine it needs to spawn child process, spawn child, and then for child to skip the config parsing step and call create and register.

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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions