Skip to content

Commit

Permalink
Revert "remove all"
Browse files Browse the repository at this point in the history
This reverts commit 78e9a85.
  • Loading branch information
PolyProgrammist committed Jan 11, 2024
1 parent 78e9a85 commit c66e974
Show file tree
Hide file tree
Showing 26 changed files with 25,410 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/jest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Typescript Generator Tests
run-name: ${{ github.actor }} is testing out tlbgenerator for typescript
on: [push]
jobs:
Explore-GitHub-Actions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm install
- run: npm install -g ts-node
- run: sed -i 's/"+", "Type"/"#", "Type"/g' "node_modules/@igorivaniuk/tlb-parser/dist/ast/nodes.d.ts"
- run: ts-node generate_all.ts
- run: npm run test
67 changes: 67 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next


## Custom
## ======

dist/
24 changes: 24 additions & 0 deletions generate_all.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import fs from 'fs'
import path from 'path'
import util from 'util'

import { parse, ast } from '@igorivaniuk/tlb-parser'
import { generate } from './src/main'


const fixturesDir = path.resolve(__dirname, 'test')

function generateCode(filename: string) {
const input = fs.readFileSync(
path.resolve(fixturesDir, 'tlb', filename + '.tlb'),
'utf-8',
)
const parsed = parse(input)

const tree = ast(input)

fs.writeFile('test/generated_files/generated_' + filename + '.ts', generate(tree, input), () => { });
}

generateCode('block')
generateCode('test')
1 change: 1 addition & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("Hi")
5 changes: 5 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
Loading

0 comments on commit c66e974

Please sign in to comment.