{"id":15649657,"url":"https://github.com/thelartians/typescriptxx","last_synced_at":"2025-04-30T16:28:13.673Z","repository":{"id":47898826,"uuid":"200824909","full_name":"TheLartians/TypeScriptXX","owner":"TheLartians","description":"🧷 Stay safe! Type-safe scripting for C++ using TypeScriptToLua and CMake with auto-generated declarations.","archived":false,"fork":false,"pushed_at":"2021-08-12T01:21:52.000Z","size":150,"stargazers_count":43,"open_issues_count":4,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-30T17:51:14.279Z","etag":null,"topics":["asmjs","bindings","browser","c","cmake","cpp","embedded","embind","emscripten","javascript","live-reload","lua","lua-binding","nodejs","scripting","scripting-language","typescript","typescripttolua","wasm","webassembly"],"latest_commit_sha":null,"homepage":"","language":"CMake","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheLartians.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-06T09:57:31.000Z","updated_at":"2025-03-25T04:22:34.000Z","dependencies_parsed_at":"2022-09-11T01:21:38.747Z","dependency_job_id":null,"html_url":"https://github.com/TheLartians/TypeScriptXX","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheLartians%2FTypeScriptXX","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheLartians%2FTypeScriptXX/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheLartians%2FTypeScriptXX/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheLartians%2FTypeScriptXX/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheLartians","download_url":"https://codeload.github.com/TheLartians/TypeScriptXX/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251741759,"owners_count":21636319,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asmjs","bindings","browser","c","cmake","cpp","embedded","embind","emscripten","javascript","live-reload","lua","lua-binding","nodejs","scripting","scripting-language","typescript","typescripttolua","wasm","webassembly"],"created_at":"2024-10-03T12:30:45.991Z","updated_at":"2025-04-30T16:28:13.214Z","avatar_url":"https://github.com/TheLartians.png","language":"CMake","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Actions Status](https://github.com/TheLartians/TypeScriptXX/workflows/Lua/badge.svg)](https://github.com/TheLartians/TypeScriptXX/actions)\n[![Actions Status](https://github.com/TheLartians/TypeScriptXX/workflows/JavaScript/badge.svg)](https://github.com/TheLartians/TypeScriptXX/actions)\n[![Actions Status](https://github.com/TheLartians/TypeScriptXX/workflows/Test/badge.svg)](https://github.com/TheLartians/TypeScriptXX/actions)\n[![Actions Status](https://github.com/TheLartians/TypeScriptXX/workflows/Check%20style/badge.svg)](https://github.com/TheLartians/TypeScriptXX/actions)\n[![codecov](https://codecov.io/gh/TheLartians/TypeScriptXX/branch/master/graph/badge.svg)](https://codecov.io/gh/TheLartians/TypeScriptXX)\n\n# TypeScriptXX\n\n## About\n\nThis is a template project that uses the [Glue](https://github.com/TheLartians/Glue) library to add type-safe scripting capability to a C++ project.\nScrips are coded in [TypeScript](https://www.typescriptlang.org), transpiled using [tsc](https://www.typescriptlang.org/docs/handbook/compiler-options.html) or [TSTL](https://typescripttolua.github.io) and run in by [node.js](https://nodejs.org) or an an embedded [Lua](https://www.lua.org) engine.\nThe built JavaScript target can also be run in a browser and used on a website.\nThe TypeScript declarations are automatically generated and updated by CMake. \n\n## Usage\n\n### Transpile to Lua and run natively\n\nThe following commands build the project and run the [typescript script](typescript/index.ts).\n\n```bash\ncmake -HstandaloneLua -Bbuild/lua\n\n # Compiles C++ code, updates the declarations and transpiles TypeScript\ncmake --build build/lua -j8\n\n# runs the transpiled lua script at dist/lua/index.lua\n./build/lua/TypeScriptXX --script dist/lua \n```\n\nIs is also possible to enable watch mode for hot reloading.\nThis way any code changes to the TypeScript source will be transpiled and run automatically.\n\n```bash\nnpx concurrently \"npm run watch:lua\" \"./build/lua/TypeScriptXX -s dist/lua --watch\"\n```\n\n### Transpile to JavaScript and run in node.js\n\nFirst, [install and activate](https://emscripten.org/docs/getting_started/downloads.html) the emsdk.\nThe following commands build the project and run the [typescript script](typescript/index.ts).\n\n```bash\nemcmake cmake -HstandaloneJS -Bbuild/js\n\n # Compiles C++ code, updates the declarations and transpiles TypeScript\ncmake --build build/js -j8\n\n# runs the transpiled lua script at dist/js/index.js\nnode ./build/js/TypeScriptXX.js --script dist/js \n```\n\n### How it works\n\nThe example C++ [library](include/greeter/greeter.h) is exposed to TypeScript using [Glue bindings](source/glue.cpp).\n\nThe projects contains four standalone subprojects:\n\n- [test](test), that check the library code\n- [declarations](declarations), that simply prints the declarations\n- [standaloneLua](standaloneLua), that uses [LuaGlue](https://github.com/TheLartians/LuaGlue) to bind and run lua code.\n- [standaloneJS](standaloneJS), that uses [EmGlue](https://github.com/TheLartians/EmGlue) to bind to a JavaScript runtime such as node.js.\n\nAfter building, CMake will use the latter to ensure that the declarations at `typescript/cpplib.d.ts` are up-to-date and then transpile the TypeScript code to Lua or JavaScript.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthelartians%2Ftypescriptxx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthelartians%2Ftypescriptxx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthelartians%2Ftypescriptxx/lists"}