Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
cspotcode opened this issue Aug 11, 2021 · 0 comments · Fixed by #1655
Closed
Milestone

Comments

@cspotcode
Copy link
Collaborator

cspotcode commented Aug 11, 2021

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 * as tsNode from 'ts-node';
// Not to be confused with current, internal readConfig, which is narrower in scope
const config = tsNode.readConfig(/*ReadConfigOptions, similar to CreateOptions*/);
const service = 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant