codeverter 1.0.0
Install from the command line:
Learn more about npm packages
$ npm install @southworks/codeverter@1.0.0
Install via package.json:
"@southworks/codeverter": "1.0.0"
About this version
Codeverter is a tool to convert a TypeScript source file (*.ts) into different languages (go or c# by the moment).
If you want to try it, click here!
npm install -g @southworks/codeverter
cd ./path-to-codeverter
npm run build:prod
npm install -g
- Install Node.js which includes Node Package Manager
In order to build the project you must install the required dependencies by running the following command npm install
The project is written in TypeScript so you need to call the tsc compiler. To start the compilation process use the command npm run build
once finished you will have all the final JavaScript files at ./out folder.
For production use the command npm run build:prod
To run the available test suites run the command npm test
- The test framework is Jest so you can use any flag you want. For example:
npm test -- -t "constant"
cdv
is the command to execute the tool
For example:
cdv --src xxx --lang zzz --dest yyy <path>
--src
: Path to the source file or directory.
- Default value: .
--lang
: Target language.
- Values: csharp | go
- Default value: go
--dest
: Destination
- Values: console | file
-
- file has an extra parameter <destination path>
- Default value: console
TS | C# | GO |
---|---|---|
const CONST_VALUE: string = "THIS IS A CONSTANT"; |
public const string CONST_VALUE = "THIS IS A CONSTANT"; |
const CONST_VALUE string = "THIS IS A CONSTANT" |
let foo: number = 50; |
public static int Foo = 50; |
var Foo int = 50 |
var foo: number = 50; |
public static int Foo = 50; |
var Foo int = 50 |
- In C# those are wrapped into a static class
namespace xxx
{
public static class Helper
{
public static int Foo = 50;
}
}
C# | GO | |
---|---|---|
Global | Y | Y |
Function/Constructor body | Y | Y |
TS | C# | GO |
---|---|---|
|
|
|
|
|
|
|
|
|
C# | GO | |
---|---|---|
Numeric | Y | Y |
String | Y | Y |
Implicit | Y | Y |
TS | C# | GO |
---|---|---|
|
|
|
C# | GO | |
---|---|---|
Members | Y | N |
Method/Functions | Y | Y |
Inheritance | Y | N |
Implementation | Y | Y |
C# | GO | |
---|---|---|
Inheritance | Y | Y* |
Interfaces | Y | Y |
Visibility | Y | Y** |
Static | P | P |
*In a go way, using composition **Using naming conventions
Consider a class named Cat
TS | C# | GO |
---|---|---|
|
|
|
C# | GO | |
---|---|---|
Visibility | Y | N |
Parameters | Y | Y |
Body | AS COMMENT | AS COMMENT |
TS | C# | GO |
---|---|---|
public name: string; |
public string Name { get; set; } |
Name string |
protected name: string; |
protected string Name { get; set; } |
name string |
private name: string; |
private string Name { get; set; } |
name string |
C# | GO | |
---|---|---|
Visibility | Y | Y* |
*Naming convention for pubic or private, protected is considered private
TS | C# | GO |
---|---|---|
|
|
|
C# | GO | |
---|---|---|
Visibility | Y | Y* |
Parameters | Y | Y |
Return type | Y | Y |
Default return value | Y | Y |
*Naming convention for pubic or private, protected is considered private
Details
- codeverter
- southworks
- over 2 years ago
- MIT
- 5 dependencies
Assets
- codeverter-1.0.0.tgz
Download activity
- Total downloads 0
- Last 30 days 0
- Last week 0
- Today 0