reinforced / Reinforced.Typings

Converts C# classes to TypeScript interfaces (and many more) within project build. 0-dependency, minimal, gluten-free
MIT License
506 stars 81 forks source link

Migrate configuration file settings to code #167

Open natanielcz opened 4 years ago

natanielcz commented 4 years ago

Hi,

What do you think about defining configuration by default in a class which implements i.e. interface IReinforcedTypingsConfiguration? In this class, we could define settings which we are setting currently but also everything that is currently in Reinforced.Typings.settings.xml. And additionally, we would have all assemblies used in the current project.

pavel-b-novikov commented 4 years ago

Well, Reinforced.Typings.settings.xml controls MSBuild flow. I have already moved everything that I could into code, so in Reinforced.Typings.settings.xml there are only options that are required for build process and are tightly integrated into it. E.g. RtDisable bypasses RT on MSBuild level. I can move target file/target directory to code, but I think it will ruin CI/CD processes of many people that are using RT.

natanielcz commented 4 years ago

We could keep compatibility:

  1. use env variable and as a fallback use RtDisable from file
  2. use output directory/filename from code and as a fallback read those values from xml

What do You think about that? :)

pavel-b-novikov commented 4 years ago
  1. Env variable? So if you are building several projects with RT on same CI/CD server?... Then what? Or you suggest to specify env variables for MSBuild directly? Then.. meh.. how would you do that in Visual Studio?

  2. Am I right that you suggest intentionally to add configuration file for every setup? Well, it will negatively affect learning curve. Now you just install package, add attributes, press "rebuild" and it works. After suggested change - you will have to create configuration file somewhere. From another point it may work, yup, because you anyway have to create .xml manually. But we cannot discard XML (see 1), therefore user will have to create 2 files. I think it is too much. RT already has not so much users - let's at least do not scare them :)

At least for now

pavel-b-novikov commented 4 years ago

P.S: Moreover, if you are using files separation (aka RtDivideTypesAmongFiles) now - files locations are already being read from code de-facto

natanielcz commented 4 years ago

What do You mean by locations are being read from code?