Skip to content

Commit d4aa656

Browse files
committed
chore: refactor exports
1 parent b0882f7 commit d4aa656

12 files changed

Lines changed: 120 additions & 119 deletions

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## [2.0.0-beta.3] – 2025-08-25
4+
5+
- Make export friendly use in web
6+
37
## [2.0.0-beta.2] – 2025-08-25
48

59
- Make friendly for use in web

README.md

Lines changed: 0 additions & 89 deletions
This file was deleted.

index.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

jest.config.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

jest.config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import type { Config } from 'jest';
2+
3+
const config: Config = {
4+
verbose: true,
5+
testEnvironment: 'node',
6+
testMatch: ['**/*.spec.ts'],
7+
preset: 'ts-jest',
8+
};
9+
10+
export default config;

package-build.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"name": "@ton-community/tlb-codegen",
3+
"version": "2.0.0-beta.3",
4+
"description": "TLB code generator",
5+
"author": "TON Tech",
6+
"license": "MIT",
7+
"keywords": [
8+
"ton",
9+
"tlb",
10+
"tl-b",
11+
"codegen",
12+
"react-native",
13+
"browser"
14+
],
15+
"sideEffects": false,
16+
"main": "index.js",
17+
"module": "index.js",
18+
"types": "index.d.ts",
19+
"exports": {
20+
".": {
21+
"types": "./index.js",
22+
"import": "./index.js",
23+
"require": "./index.js",
24+
"default": "./index.js"
25+
},
26+
"./node": {
27+
"types": "./node.js",
28+
"import": "./node.js",
29+
"require": "./node.js",
30+
"default": "./node.js"
31+
}
32+
},
33+
"typesVersions": {
34+
"*": {
35+
"*": ["*"]
36+
}
37+
},
38+
"bin": {
39+
"tlb": "cli.ts"
40+
},
41+
"dependencies": {
42+
"@ton-community/tlb-parser": "^0.1.5",
43+
"@ton/core": "^0.61.0",
44+
"meow": "^9.0.0"
45+
}
46+
}

package.json

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,59 @@
11
{
22
"name": "@ton-community/tlb-codegen",
3-
"version": "2.0.0-beta.2",
4-
"description": "",
5-
"main": "build/index.js",
3+
"version": "2.0.0-beta.3",
4+
"description": "TLB code generator",
5+
"sideEffects": false,
6+
"main": "src/index.ts",
7+
"module": "src/index.ts",
8+
"types": "src/index.ts",
9+
"exports": {
10+
".": {
11+
"types": "./src/index.ts",
12+
"import": "./src/index.ts",
13+
"require": "./src/index.ts",
14+
"default": "./src/index.ts"
15+
},
16+
"./node": {
17+
"types": "./src/node.ts",
18+
"import": "./src/node.ts",
19+
"require": "./src/node.ts",
20+
"default": "./src/node.ts"
21+
}
22+
},
23+
"typesVersions": {
24+
"*": {
25+
"*": ["src/*"]
26+
}
27+
},
28+
"files": [
29+
"build/**/*"
30+
],
31+
"publishConfig": {
32+
"access": "public"
33+
},
634
"prettier": "@ton/toolchain/prettier",
735
"scripts": {
836
"lint": "eslint . --max-warnings 0",
937
"lint:fix": "eslint . --max-warnings 0 --fix",
38+
"test:gen": "ts-node test/generate.ts",
1039
"test": "jest",
11-
"build": "npm run compile",
40+
"build": "npm run compile && cp package-build.json build/package.json",
41+
"prepublishOnly": "npm run build",
1242
"compile": "tsc"
1343
},
1444
"bin": {
15-
"tlb": "build/main.js"
45+
"tlb": "src/cli.ts"
1646
},
17-
"keywords": [],
18-
"author": "",
19-
"license": "ISC",
47+
"keywords": [
48+
"ton",
49+
"tlb",
50+
"tl-b",
51+
"codegen",
52+
"react-native",
53+
"browser"
54+
],
55+
"author": "TON Tech",
56+
"license": "MIT",
2057
"devDependencies": {
2158
"@jest/globals": "^29.7.0",
2259
"@ton/toolchain": "github:the-ton-tech/toolchain#v1.4.0",

main.ts renamed to src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env node
22
import meow from 'meow';
33

4-
import { generateCode } from './src/node';
4+
import { generateCode } from './node';
55

66
const cli = meow(
77
`

src/main.ts renamed to src/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@ import { CodeBuilder } from './generators/CodeBuilder';
88
import { CodeGenerator, CommonGenDeclaration } from './generators/generator';
99
import { TypescriptGenerator } from './generators/typescript/generator';
1010

11-
export function getTLBCodeByAST(tree: Program, input: string) {
11+
export function getTLBCodeByAST(tree: Program, input: string): TLBCode {
1212
let oldTlbCode: TLBCodeBuild = { types: new Map<string, TLBTypeBuild>() };
1313
let splittedInput = input.split('\n');
1414
fillConstructors(tree.declarations, oldTlbCode, splittedInput);
15-
let tlbCode: TLBCode = convertCodeToReadonly(oldTlbCode);
16-
17-
return tlbCode;
15+
return convertCodeToReadonly(oldTlbCode);
1816
}
1917

2018
export function generateCodeByAST(tree: Program, input: string, getGenerator: (tlbCode: TLBCode) => CodeGenerator) {

src/node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ast } from '@ton-community/tlb-parser';
44

55
import { TLBCode } from './ast';
66
import { CodeGenerator } from './generators/generator';
7-
import { generateCodeByAST, getGenerator, getTLBCodeByAST } from './main';
7+
import { generateCodeByAST, getGenerator, getTLBCodeByAST } from './index';
88

99
export async function getTLBCode(inputPath: string) {
1010
const input = await fs.readFile(inputPath, 'utf-8');

0 commit comments

Comments
 (0)