Package Exports
- dotfile-types
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dotfile-types) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
dotfile-types
Generates TypeScript interfaces from .env
, .properties
, .ini
, and other key-value
pair files,
including nested types.
Currently uses json-ts, and could technically work with flow.
Usage Example
Check out /test/fixtures/expected for more example outputs.
CLI simple usage: $ dotfile-types <file_path> <out_path>
$ dotfile-types l10n.properties interfaces.d.ts
Tranforms this:
# l10n.properties
# What ever happened to the good ol days when it was yesterday
universe.attribution.wikimediaLink=<a href="{0}">Photo</a>
#{2} - I'm a little comment, short and stout.
universe.attribution.wikimediaAlt=Photo "{0}" by {1} ({2}) / Whatchamacalit
#{0} Knock knock. Who's there? Comment. Comment Who?
# Commentary 🥁... 😭
hats.color=Color for {0}
hats.imageAlt=123
hats.expensive=日期已停
hats.buyMe=See all {0} properties in {1}
Into this:
// interface.d.ts
interface IRootObject {
universe: IUniverse;
hats: IHats;
}
interface IUniverse {
attribution: IAttribution;
}
interface IAttribution {
wikimediaLink: string;
wikimediaAlt: string;
}
interface IHats {
color: string;
imageAlt: string;
expensive: string;
buyMe: string;
}