This commit is contained in:
2025-05-28 23:08:36 +09:00
commit d659e60899
6 changed files with 1292 additions and 0 deletions

17
eslint.config.mjs Normal file
View File

@@ -0,0 +1,17 @@
import js from "@eslint/js";
import globals from "globals";
import tseslint from "typescript-eslint";
import { defineConfig } from "eslint/config";
export default defineConfig([
{
files: ["**/*.{js,mjs,cjs,ts,mts,cts}"],
plugins: { js },
extends: ["js/recommended"],
},
{
files: ["**/*.{js,mjs,cjs,ts,mts,cts}"],
languageOptions: { globals: globals.browser },
},
tseslint.configs.recommended,
]);

24
package.json Normal file
View File

@@ -0,0 +1,24 @@
{
"name": "computercraft-ts",
"version": "1.0.0",
"description": "",
"license": "ISC",
"author": "",
"type": "commonjs",
"main": "index.js",
"scripts": {
"build": "tstl",
"postbuild": "node scripts/postbuild.js"
},
"devDependencies": {
"@eslint/js": "^9.27.0",
"eslint": "^9.27.0",
"globals": "^16.2.0",
"luamin": "^1.0.4",
"typescript": "^5.8.3",
"typescript-eslint": "^8.33.0",
"typescript-to-lua": "^1.31.1",
"typescript-tstl-plugin": "^0.3.2"
},
"packageManager": "pnpm@10.11.0+sha512.6540583f41cc5f628eb3d9773ecee802f4f9ef9923cc45b69890fb47991d4b092964694ec3a4f738a420c918a333062c8b925d312f42e4f0c263eb603551f977"
}

7
scripts/postbuild.js Normal file
View File

@@ -0,0 +1,7 @@
const luamin = require('luamin');
const fs = require("fs");
const Path = require("path")
const c = fs.readFileSync(Path.resolve(__dirname, "../dist/bundle.lua"), "utf8");
const min = luamin.minify(c)
fs.writeFileSync(Path.resolve(__dirname, "../dist/bundle.min.lua"), min, "utf8");

1
src/main.ts Normal file
View File

@@ -0,0 +1 @@
term.write("Hello, world!");

20
tsconfig.json Normal file
View File

@@ -0,0 +1,20 @@
{
"$schema": "https://raw.githubusercontent.com/TypeScriptToLua/TypeScriptToLua/master/tsconfig-schema.json",
"compilerOptions": {
"target": "ESNext",
"lib": ["ESNext"],
"moduleResolution": "Node",
"strict": true,
"plugins": [{ "name": "typescript-tstl-plugin" }],
"outDir": "dist",
"types": ["./types/index"],
"noImplicitAny": false
},
"tstl": {
"luaTarget": "5.4",
"noHeader": true,
"luaBundle": "bundle.lua",
"luaBundleEntry": "src/main.ts"
},
"include": ["src/**/*"]
}

1223
types/index.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff