https://github.com/kris701/autoconst
A small tool to convert cs files with consts to other languages
https://github.com/kris701/autoconst
converter csharp
Last synced: about 1 year ago
JSON representation
A small tool to convert cs files with consts to other languages
- Host: GitHub
- URL: https://github.com/kris701/autoconst
- Owner: kris701
- License: mit
- Created: 2025-02-14T07:10:50.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-14T07:43:22.000Z (over 1 year ago)
- Last Synced: 2025-02-14T08:31:26.159Z (over 1 year ago)
- Topics: converter, csharp
- Language: C#
- Homepage:
- Size: 22.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[](https://github.com/kris701/AutoConst/actions/workflows/dotnet-desktop.yml)







# AutoConst
This is a small tool to automatically convert files with constant properties over to other language equivalents.
Say you have this following `example.cs` file:
```csharp
namespace Something
{
public static class ImportantStatics
{
public const string SomeStatic1 = "abc";
public const string SomeStatic2 = 1111;
}
}
```
`autoconst -t example.cs -p TypeScriptProducer`
It will output a generated TS file with the static names as follows:
```ts
// This document is auto generated!
export const ImportantStatics = {
SomeStatic1: "abc",
SomeStatic2: 1111,
}
```
The currently available producers are:
* `TypeScriptProducer`, to make TS code
You can also use the flag `-m` to "merge" several const files that has the same class name into a single output file.
This is useful if you need to have some sort of common reference table on the output side.
This package is available as a tool on the [NuGet Package Manager](https://www.nuget.org/packages/AutoConst/), so you can install it by writing `dotnet tool install AutoConst` in a terminal.