Skip to content

Commit 8ef5e25

Browse files
authored
Development (#1)
* feat(hmm): all tests passing with new lexer setup * fix(git): fixed the workflows? * fix(git): fixed the workflows?? * feat(update): passing tests list
1 parent 18e03a1 commit 8ef5e25

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+3935
-2051
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
name: Test & Build
1+
name: Test
22

33
on:
44
push:
5-
branches: [main, master]
5+
branches: [main, master, development]
66
pull_request:
7-
branches: [main, master]
7+
branches: [main, master, development]
88

99
jobs:
1010
test-build:

.github/workflows/publish.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Publish to NPM
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'Version type (patch, minor, major)'
10+
required: true
11+
default: 'patch'
12+
type: choice
13+
options:
14+
- patch
15+
- minor
16+
- major
17+
18+
jobs:
19+
test:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- uses: oven-sh/setup-bun@v1
25+
with:
26+
bun-version: latest
27+
28+
- name: Install dependencies
29+
run: bun install
30+
31+
- name: Run tests
32+
run: bun test
33+
34+
- name: Build
35+
run: bun run build
36+
37+
publish:
38+
needs: test
39+
runs-on: ubuntu-latest
40+
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
41+
42+
steps:
43+
- uses: actions/checkout@v4
44+
with:
45+
token: ${{ secrets.GIT_TOKEN }}
46+
47+
- uses: oven-sh/setup-bun@v1
48+
with:
49+
bun-version: latest
50+
51+
- name: Install dependencies
52+
run: bun install
53+
54+
- name: Build package
55+
run: bun run build
56+
57+
- name: Setup NPM auth
58+
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
59+
60+
- name: Bump version (manual trigger)
61+
if: github.event_name == 'workflow_dispatch'
62+
id: version
63+
run: |
64+
git config --local user.email "action@github.com"
65+
git config --local user.name "GitHub Action"
66+
NEW_VERSION=$(npm version ${{ github.event.inputs.version }} --no-git-tag-version)
67+
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
68+
git add package.json
69+
git commit -m "Bump version to $NEW_VERSION"
70+
git tag $NEW_VERSION
71+
git push --follow-tags
72+
73+
- name: Get version for release triggers
74+
if: github.event_name == 'release'
75+
id: release_version
76+
run: |
77+
VERSION=$(node -p "require('./package.json').version")
78+
echo "version=v$VERSION" >> $GITHUB_OUTPUT
79+
80+
- name: Publish to NPM
81+
run: npm publish --access public
82+
env:
83+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
84+
85+
- name: Create GitHub Release (manual trigger)
86+
if: github.event_name == 'workflow_dispatch'
87+
uses: actions/create-release@v1
88+
env:
89+
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
90+
with:
91+
tag_name: ${{ steps.version.outputs.new_version }}
92+
release_name: Release ${{ steps.version.outputs.new_version }}
93+
body: |
94+
## Changes in this Release
95+
96+
This release was auto-generated from a workflow dispatch.
97+
98+
📋 **For a detailed list of changes, please see [CHANGELOG.md](https://github.com/CodeMeAPixel/luats/blob/master/CHANGELOG.md)**
99+
100+
### Quick Info
101+
- Version: ${{ steps.version.outputs.new_version }}
102+
- Generated: ${{ github.run_id }}
103+
- Commit: ${{ github.sha }}
104+
draft: false
105+
prerelease: false

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ ignored/
6060

6161
# Build output
6262
node_modules/
63-
dist/
63+
scripts/**/*
6464
scripts/
65-
test/junit.xml
65+
test/junit.xml
66+
dist/

.npmignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ examples/
66
docs/
77
.github/
88
coverage/
9-
test/
9+
.todo/
1010
.vscode/
1111
.idea/
1212
.git/

TODO.md renamed to .todo/additional.md

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,3 @@
1-
# TODO Checklist
2-
3-
- [x] **Fix all TypeScript build errors and warnings**
4-
- [x] Remove duplicate/unused functions and variables
5-
- [x] Correct all type/interface issues (especially optional properties)
6-
- [x] Ensure all imports are correct and used
7-
- [x] **Implement real Lua/Luau parsing in `generateTypeScript`**
8-
- [x] Integrate or stub a parser for Lua/Luau AST generation
9-
- [x] **Add proper plugin loading and application in CLI processor**
10-
- [x] Remove duplicate `applyPlugins` and implement dynamic plugin loading
11-
- [x] **Expand CLI validation logic beyond placeholder**
12-
- [x] Add real validation for Lua/Luau files
13-
- [ ] **Write unit tests for CLI and processor modules**
14-
- [ ] Cover CLI commands and processor logic
15-
- [ ] **Improve error handling and user feedback in CLI**
16-
- [ ] Make CLI output clear and actionable
17-
- [x] **Document configuration options and CLI usage**
18-
- [x] Add README and CLI help improvements
19-
- [ ] **Add support for more CLI commands (e.g., format, lint)**
20-
- [ ] **Ensure cross-platform compatibility (Windows, Linux, macOS)**
21-
- [ ] Replace `rm -rf` with cross-platform alternatives (e.g., `rimraf`)
22-
- [ ] **Set up CI for automated builds and tests**
23-
- [ ] Add GitHub Actions or similar workflow
24-
25-
---
26-
271
## Additional Ideas & Improvements
282

293
- [ ] **Publish TypeScript declaration files (`.d.ts`) for all public APIs**

.todo/basics.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## Basic Features/Functionality
2+
- [x] **Fix all TypeScript build errors and warnings**
3+
- [x] Remove duplicate/unused functions and variables
4+
- [x] Correct all type/interface issues (especially optional properties)
5+
- [x] Ensure all imports are correct and used
6+
- [x] **Implement real Lua/Luau parsing in `generateTypeScript`**
7+
- [x] Integrate or stub a parser for Lua/Luau AST generation
8+
- [x] **Add proper plugin loading and application in CLI processor**
9+
- [x] Remove duplicate `applyPlugins` and implement dynamic plugin loading
10+
- [x] **Expand CLI validation logic beyond placeholder**
11+
- [x] Add real validation for Lua/Luau files
12+
- [ ] **Write unit tests for CLI and processor modules**
13+
- [ ] Cover CLI commands and processor logic
14+
- [ ] **Improve error handling and user feedback in CLI**
15+
- [ ] Make CLI output clear and actionable
16+
- [x] **Document configuration options and CLI usage**
17+
- [x] Add README and CLI help improvements
18+
- [ ] **Add support for more CLI commands (e.g., format, lint)**
19+
- [ ] **Ensure cross-platform compatibility (Windows, Linux, macOS)**
20+
- [ ] Replace `rm -rf` with cross-platform alternatives (e.g., `rimraf`)
21+
- [ ] **Set up CI for automated builds and tests**
22+
- [ ] Add GitHub Actions or similar workflow

CHANGELOG.md

Lines changed: 93 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,96 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [0.1.0] - 2025-07-11
9-
10-
### Added
11-
- Initial release of LuaTS
12-
- Support for parsing Lua and Luau code
13-
- AST generation and manipulation
14-
- TypeScript interface generation from Luau types
15-
- Type conversion between Lua/Luau and TypeScript
16-
- Support for optional types (foo: string? → foo?: string)
17-
- Support for table types ({string} → string[] or Record)
18-
- Conversion of Luau function types to TS arrow functions
19-
- Comment preservation and JSDoc formatting
20-
- CLI tool with file watching capabilities
21-
- Configuration file support
22-
- Plugin system for custom transformations
23-
- Basic inference for inline tables
24-
- Type definitions for exported API
25-
- Comprehensive test suite
8+
## [0.1.0] - 2025-08-02
9+
10+
### 🎉 Initial Release
11+
12+
#### Core Parsing & Generation
13+
- **Complete Lua parser** with full AST generation supporting all Lua 5.1+ syntax
14+
- **Advanced Luau parser** with type annotations, generics, and modern syntax features
15+
- **TypeScript code generation** from Luau type definitions with intelligent mapping
16+
- **Lua code formatting** with customizable styling options and pretty-printing
17+
- **AST manipulation utilities** with comprehensive type definitions
18+
19+
#### Advanced Type System
20+
- **Primitive type mapping**: `string`, `number`, `boolean`, `nil``null`
21+
- **Optional types**: `foo: string?``foo?: string`
22+
- **Array types**: `{string}``string[]` with proper element type detection
23+
- **Record types**: `{[string]: any}``Record<string, any>` and index signatures
24+
- **Union types**: `"GET" | "POST" | "PUT"` with string literal preservation
25+
- **Intersection types**: `A & B` with proper parenthesization
26+
- **Function types**: `(x: number) -> string``(x: number) => string`
27+
- **Method types**: Automatic `self` parameter removal for class methods
28+
- **Generic types**: Support for parameterized types and type variables
29+
- **Table types**: Complex nested object structures with property signatures
30+
31+
#### Language Features
32+
- **Template string interpolation**: Full backtick string support with `${var}` and `{var}` syntax
33+
- **Continue statements**: Proper parsing with loop context validation
34+
- **Reserved keywords as properties**: Handle `type`, `export`, `function`, `local` as object keys
35+
- **Comment preservation**: Single-line (`--`) and multi-line (`--[[ ]]`) comment handling
36+
- **JSDoc conversion**: Transform Lua comments to TypeScript JSDoc format
37+
- **Export statements**: Support for `export type` declarations
38+
- **String literals**: Proper handling of quoted strings in union types
39+
40+
#### Modular Architecture
41+
- **Component-based lexer**: Specialized tokenizers for numbers, strings, identifiers, comments
42+
- **Pluggable tokenizer system**: Easy extension with new language constructs
43+
- **Operator precedence handling**: Correct parsing of complex expressions
44+
- **Error recovery**: Graceful handling of syntax errors with detailed diagnostics
45+
- **Memory efficient**: Streaming parsing for large files
46+
47+
#### Plugin System
48+
- **File-based plugins**: Load plugins from JavaScript/TypeScript files
49+
- **Inline plugin objects**: Direct plugin integration in code
50+
- **Type transformation hooks**: Customize how Luau types map to TypeScript
51+
- **Interface modification**: Add, remove, or modify generated interface properties
52+
- **Post-processing**: Transform final generated TypeScript code
53+
- **Plugin registry**: Manage multiple plugins with validation
54+
- **Hot reloading**: Plugin cache management for development
55+
56+
#### CLI Tools
57+
- **File conversion**: `luats convert file.lua -o file.d.ts`
58+
- **Directory processing**: `luats convert-dir src/lua -o src/types`
59+
- **Watch mode**: Auto-regeneration on file changes with `--watch`
60+
- **Syntax validation**: `luats validate` for error checking
61+
- **Configuration files**: Support for `luats.config.json` with rich options
62+
- **Glob patterns**: Include/exclude file patterns for batch processing
63+
64+
#### Developer Experience
65+
- **Comprehensive TypeScript definitions**: Full type safety for all APIs
66+
- **Error handling**: Detailed error messages with line/column information
67+
- **Snapshot testing**: Fixture-based testing for regression prevention
68+
- **Performance optimizations**: Efficient parsing and generation algorithms
69+
- **Documentation generation**: Generate docs from parsed code structures
70+
71+
#### Configuration Options
72+
- **Type generation**: `useUnknown`, `interfacePrefix`, `includeSemicolons`
73+
- **Comment handling**: `preserveComments`, `commentStyle` (jsdoc/inline)
74+
- **Code formatting**: Indentation, spacing, and style preferences
75+
- **Plugin configuration**: File paths and plugin-specific options
76+
- **Include/exclude patterns**: Fine-grained control over processed files
77+
78+
#### Testing & Quality
79+
- **47 comprehensive tests** covering all major functionality
80+
- **100% test pass rate** with robust edge case handling
81+
- **Snapshot testing** for generated TypeScript output validation
82+
- **Plugin system testing** with both file and object-based plugins
83+
- **CLI integration tests** with temporary file handling
84+
- **Error scenario testing** for graceful failure handling
85+
86+
#### Examples & Documentation
87+
- **Plugin examples**: ReadonlyPlugin, CustomNumberPlugin, TypeMapperPlugin
88+
- **CLI usage examples**: Common workflows and configuration patterns
89+
- **API examples**: Programmatic usage for all major features
90+
- **Roblox integration**: Specific examples for game development workflows
91+
92+
### Technical Details
93+
- **Lexer**: 4 specialized tokenizers (Number, String, Identifier, Comment)
94+
- **Parser**: Recursive descent with operator precedence and error recovery
95+
- **Type System**: 15+ AST node types with full TypeScript definitions
96+
- **Plugin Architecture**: 4 transformation hooks (transformType, transformInterface, process, postProcess)
97+
- **CLI**: 4 main commands with configuration file support
98+
- **Exports**: Modular imports for tree-shaking and selective usage
99+
100+
This release establishes LuaTS as a production-ready tool for Lua/Luau to TypeScript workflows, with particular strength in Roblox development, legacy code integration, and type-safe API definitions.

0 commit comments

Comments
 (0)