Skip to content

Commit f85bd78

Browse files
chore: remove yarn.lock, update tsconfig, and refactor entry point
Removed yarn.lock to resolve a package manager conflict with package-lock.json. Updated tsconfig.json for correct extends/luaPlugins paths and fixed luaBundle and luaBundleEntry fields. Added src/bundleEntry.ts and refactored main.ts to use a main function.
1 parent ec6e2fe commit f85bd78

File tree

4 files changed

+32
-6015
lines changed

4 files changed

+32
-6015
lines changed

src/bundleEntry.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// This is the entry point for the TypeScriptToLua bundler, which is set in the "tsconfig.json"
2+
// file. All this file does is immediately execute the "main()" function in the "main.ts" file. (We
3+
// don't want to point the TypeScriptToLua bundler at the "main.ts" file directly, because this can
4+
// cause bugs relating to the temporal dead zone.)
5+
6+
import { main } from "./main";
7+
8+
main();
9+
10+
// Do not add any code to this file! Edit the "main.ts" file instead.

src/main.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
import { LevelStage } from "isaac-typescript-definitions";
1+
import { LevelStage, ModCallback } from "isaac-typescript-definitions";
22
import { ModCallbackCustom } from "isaacscript-common";
33
import { mod } from "./mod";
44

55
const TOP_LEFT_CORNER_GRID_INDEX = 32;
66

7-
mod.AddCallbackCustom(
8-
ModCallbackCustom.POST_GAME_STARTED_REORDERED,
9-
postGameStartedReorderedFalse,
10-
false,
11-
);
7+
export function main(): void {
8+
Isaac.DebugString("Initiated mod: isaacscript-mod-example\n");
9+
10+
mod.AddCallbackCustom(
11+
ModCallbackCustom.POST_GAME_STARTED_REORDERED,
12+
postGameStartedReorderedFalse,
13+
false,
14+
);
15+
}
1216

1317
function postGameStartedReorderedFalse() {
1418
mod.spawnCustomTrapdoor(
@@ -17,5 +21,3 @@ function postGameStartedReorderedFalse() {
1721
LevelStage.BASEMENT_1,
1822
);
1923
}
20-
21-
Isaac.DebugString("Initiated mod: isaacscript-mod-example");

tsconfig.json

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,34 @@
44
"$schema": "https://raw.githubusercontent.com/IsaacScript/isaacscript/main/packages/isaacscript-cli/schemas/tsconfig-isaacscript-schema.json",
55

66
// We extend the standard IsaacScript config:
7-
// https://github.com/IsaacScript/isaacscript/blob/main/packages/isaacscript-tsconfig/configs/tsconfig.mod.json
8-
"extends": "isaacscript-tsconfig/tsconfig.mod.json",
7+
// We extend the standard IsaacScript configs.
8+
"extends": [
9+
// https://github.com/complete-ts/complete/blob/main/packages/complete-tsconfig/tsconfig.base.json
10+
"complete-tsconfig/tsconfig.base.json",
11+
// https://github.com/IsaacScript/isaacscript/blob/main/packages/isaacscript-tsconfig/tsconfig.mod.json
12+
"isaacscript-tsconfig/tsconfig.mod.json",
13+
],
914

1015
// A list of the TypeScript files to compile.
1116
"include": ["./src/**/*.ts"],
1217

1318
// TypeScriptToLua settings
1419
"tstl": {
1520
"luaTarget": "5.3",
16-
"luaBundle": "./mod/main.lua", // Will bundle all output Lua files into a single file.
17-
"luaBundleEntry": "./src/main.ts",
21+
"luaBundle": "main.lua", // Will bundle all output Lua files into a single file.
22+
"luaBundleEntry": "./src/bundleEntry.ts",
1823
"luaPlugins": [
1924
// A plugin to add an explanatory comment at the top of the compiled "main.lua" file.
20-
{ "name": "isaacscript/src/plugins/addIsaacScriptCommentHeader.js" },
25+
{ "name": "isaacscript/plugins/addIsaacScriptCommentHeader.cjs" },
2126

2227
// A plugin to make enums safe from global variables.
23-
{ "name": "isaacscript/src/plugins/noExtendedEnums.js" },
28+
{ "name": "isaacscript/plugins/noExtendedEnums.cjs" },
2429

2530
// Uncomment this and recompile the mod to enable crash debugging, which will tell you the
2631
// exact line of the mod that is causing the crash. For more information, read the comment at
2732
// the top of the file:
2833
// https://github.com/IsaacScript/isaacscript/blob/main/packages/isaacscript-cli/src/plugins/addCrashDebugStatements.ts
29-
// { "name": "isaacscript/src/plugins/addCrashDebugStatements.js" },
34+
// { "name": "isaacscript/plugins/addCrashDebugStatements.cjs" },
3035
],
3136
"noHeader": true,
3237
"noImplicitGlobalVariables": true,

0 commit comments

Comments
 (0)