dotfile-types
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

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;
}

Package Sidebar

Install

npm i dotfile-types

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

7.2 kB

Total Files

9

Last publish

Collaborators

  • sirmerr