Skip to content

Support nested config splitting in .config/ dir #137

@pi0

Description

@pi0

As a followup to .config/ dir supports #136 for config-dir proposal.

When configuration file size increases (and there is no way to keep it minimal!!), users might prefer to split the configuration into smaller files.

One way is that we just let this task to the users to use manual imports:

// .config/name.ts
import longConf from './name/key.ts'

export default {
 key: longConf
}

This method is clear and also can leave the details up to the end-users on how to split.

Another way is that c12 can allow a conventional way to allow splitting with nested directories:

export default { /* long config */ }

It can be in:
a. .config/name/key.ts
b. .config/name.key.ts

This gives a conventional way of splitting longer configs into smaller files. The main downside is perf. We need at least one readdir call in the case of (b) or one stat in the case of (a).

types support for sub-types

it is probably more something that authors have to support but still worth to mention complexities in this dicussion.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions