Skip to content

Commit

Permalink
Package as a Lua module and update packages (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
cipherxof authored May 12, 2023
1 parent f3f1647 commit 8642d5a
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"camelcase": ["error", {"allow": ["((bj_)\\w+[A-Z]$)"]}], //exclude bj_CAPITAL_LETTER
"eqeqeq": ["error", "always", {"null": "never"}],
"@typescript-eslint/no-implicit-any-catch": "error",
"@typescript-eslint/strict-boolean-expressions": ["error"],
"@typescript-eslint/strict-boolean-expressions": ["warn"],
"no-underscore-dangle": ["error", { "allowAfterThis": true, "allowAfterSuper": true }],
"no-throw-literal": 0, //Maybe one day if wc3 gets a polyfill for the debug library
"no-cond-assign": 0,
Expand Down
6 changes: 5 additions & 1 deletion hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ export function hookedConfig() {
main = hookedMain;
config = hookedConfig;

type W3tsHookType = "main::before" | "main::after" | "config::before" | "config::after";
type W3tsHookType =
| "main::before"
| "main::after"
| "config::before"
| "config::after";

export enum W3TS_HOOK {
MAIN_BEFORE = "main::before",
Expand Down
26 changes: 17 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
{
"name": "w3ts",
"version": "2.4.0",
"version": "3.0.2",
"description": "TypeScript API for Warcraft III custom maps.",
"author": "TriggerHappy",
"license": "MIT",
"main": "./index.ts",
"scripts": {
"build": "tsc --noEmit && eslint . --ext js,ts,json --quiet --fix"
"build": "tstl -p tsconfig.json",
"prepublish": "npm run build && cp package.json ./dist/"
},
"dependencies": {
"war3-types-strict": "^0.1.3"
},
"peerDependencies": {
"lua-types": "^2.11.0",
"typescript": "^4.4.4"
"lua-types": "^2.13.1",
"typescript": "^5.0.4"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^5.1.0",
"@typescript-to-lua/language-extensions": "^1.0.0",
"eslint": "^7.32.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-prettier": "^4.0.0",
"prettier": "^2.4.1"
"prettier": "^2.4.1",
"typescript-to-lua": "^1.15.1"
},
"repository": {
"type": "git",
Expand All @@ -30,7 +36,9 @@
"url": "https://github.com/cipherxof/w3ts/issues"
},
"homepage": "https://github.com/cipherxof/w3ts#readme",
"dependencies": {
"war3-types-strict": "github:Z-Machine/war3-types-strict"
}
}
"files": [
"./**/*.lua",
"./**/*.d.ts"
],
"types": "./index.d.ts"
}
15 changes: 12 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
"target": "ESNext",
"lib": ["ESNext"],
"moduleResolution": "Classic",
"outDir": "./dist",
"types": [
"typescript-to-lua/language-extensions",
"@typescript-to-lua/language-extensions",
"lua-types/core/coroutine",
"lua-types/core/global",
"lua-types/core/math",
Expand All @@ -14,8 +15,9 @@
"lua-types/core/table",
"lua-types/core/os",
"lua-types/special/5.3",
"war3-types-strict/1.32.10"
"war3-types-strict/1.33.0"
],
"declaration": true,
"allowJs": false,
"strict": true,
"forceConsistentCasingInFileNames": true,
Expand All @@ -34,5 +36,12 @@
"hooks",
"system"
],
"exclude": []
"exclude": [],
"tstl": {
"buildMode": "library",
"luaTarget": "5.3",
"noHeader": true,
"noImplicitSelf": true,
"sourceMapTraceback": false,
}
}
2 changes: 1 addition & 1 deletion utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Timer } from "../handles/timer";
export * from "./color";

export async function sleep(howMuch: number): Promise<null> {
return await new Promise((resolve, reject) => {
return new Promise((resolve, reject) => {
const t = Timer.create();
t.start(howMuch, false, () => {
t.destroy();
Expand Down

0 comments on commit 8642d5a

Please sign in to comment.