isaacscript 1.1.23 → 1.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/.cspell.json +2 -2
  2. package/.vscode/settings.json +4 -0
  3. package/README.md +1 -1
  4. package/dist/package.json +8 -9
  5. package/dist/src/checkForWindowsTerminalBugs.js +6 -6
  6. package/dist/src/commands/copy/copy.js +4 -3
  7. package/dist/src/commands/copy/copy.js.map +1 -1
  8. package/dist/src/commands/init/checkIfProjectPathExists.js +2 -2
  9. package/dist/src/commands/init/checkModTargetDirectory.js +2 -2
  10. package/dist/src/commands/init/createMod.js +4 -4
  11. package/dist/src/commands/init/getModsDir.js +6 -6
  12. package/dist/src/commands/init/getProjectPath.js +3 -3
  13. package/dist/src/commands/init/installVSCodeExtensions.js +3 -3
  14. package/dist/src/commands/init/promptSaveSlot.js +2 -2
  15. package/dist/src/commands/init/promptVSCode.js +2 -2
  16. package/dist/src/commands/monitor/copyWatcherMod.js +11 -0
  17. package/dist/src/commands/monitor/copyWatcherMod.js.map +1 -1
  18. package/dist/src/commands/monitor/getTSConfigInclude.js +4 -4
  19. package/dist/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.js +6 -4
  20. package/dist/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.js.map +1 -1
  21. package/dist/src/commands/monitor/monitor.js +13 -12
  22. package/dist/src/commands/monitor/monitor.js.map +1 -1
  23. package/dist/src/commands/monitor/notifyGame.js +2 -2
  24. package/dist/src/commands/monitor/saveDatWriter/saveDatWriter.js +3 -3
  25. package/dist/src/commands/monitor/spawnSaveDatWriter.js +3 -3
  26. package/dist/src/commands/monitor/spawnSaveDatWriter.js.map +1 -1
  27. package/dist/src/commands/monitor/{touchSaveDatFiles.js → touchWatcherSaveDatFiles.js} +3 -3
  28. package/dist/src/commands/monitor/touchWatcherSaveDatFiles.js.map +1 -0
  29. package/dist/src/commands/publish/publish.js +27 -26
  30. package/dist/src/commands/publish/publish.js.map +1 -1
  31. package/dist/src/configFile.js +3 -3
  32. package/dist/src/configFile.js.map +1 -1
  33. package/dist/src/file.js +11 -11
  34. package/dist/src/main.js +3 -3
  35. package/dist/src/main.js.map +1 -1
  36. package/dist/src/types/Config.js.map +1 -1
  37. package/dist/src/{misc.js → util.js} +8 -2
  38. package/dist/src/{misc.js.map → util.js.map} +1 -1
  39. package/dist/src/validateNodeVersion.js +5 -5
  40. package/dist/src/validateOS.js +1 -2
  41. package/dist/src/validateOS.js.map +1 -1
  42. package/file-templates/dynamic/README.md +1 -1
  43. package/file-templates/dynamic/package.json +1 -1
  44. package/isaacscript-watcher/main.lua +17 -12
  45. package/isaacscript-watcher/resources/gfx/{emoji-eyes.anm2 → logo.anm2} +27 -27
  46. package/isaacscript-watcher/resources/gfx/logo.png +0 -0
  47. package/package.json +8 -9
  48. package/src/checkForWindowsTerminalBugs.ts +1 -1
  49. package/src/commands/copy/copy.ts +4 -3
  50. package/src/commands/init/checkIfProjectPathExists.ts +1 -1
  51. package/src/commands/init/checkModTargetDirectory.ts +1 -1
  52. package/src/commands/init/createMod.ts +1 -1
  53. package/src/commands/init/getModsDir.ts +1 -1
  54. package/src/commands/init/getProjectPath.ts +1 -1
  55. package/src/commands/init/installVSCodeExtensions.ts +1 -1
  56. package/src/commands/init/promptSaveSlot.ts +1 -1
  57. package/src/commands/init/promptVSCode.ts +1 -1
  58. package/src/commands/monitor/copyWatcherMod.ts +19 -0
  59. package/src/commands/monitor/getTSConfigInclude.ts +1 -1
  60. package/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.ts +12 -4
  61. package/src/commands/monitor/monitor.ts +9 -10
  62. package/src/commands/monitor/notifyGame.ts +1 -1
  63. package/src/commands/monitor/saveDatWriter/saveDatWriter.ts +1 -1
  64. package/src/commands/monitor/spawnSaveDatWriter.ts +1 -1
  65. package/src/commands/monitor/{touchSaveDatFiles.ts → touchWatcherSaveDatFiles.ts} +1 -1
  66. package/src/commands/publish/publish.ts +8 -3
  67. package/src/configFile.ts +1 -1
  68. package/src/file.ts +1 -1
  69. package/src/main.ts +1 -1
  70. package/src/types/Config.ts +12 -0
  71. package/src/{misc.ts → util.ts} +8 -1
  72. package/src/validateNodeVersion.ts +1 -1
  73. package/src/validateOS.ts +1 -4
  74. package/dist/src/commands/monitor/touchSaveDatFiles.js.map +0 -1
  75. package/isaacscript-watcher/resources/gfx/emoji-eyes.png +0 -0
@@ -1,27 +1,27 @@
1
- <AnimatedActor>
2
- <Info CreatedBy="Unknown" CreatedOn="2/1/2017 6:09:20 AM" Version="2" Fps="30"/>
3
- <Content>
4
- <Spritesheets>
5
- <Spritesheet Path="emoji-eyes.png" Id="0"/>
6
- </Spritesheets>
7
- <Layers>
8
- <Layer Name="Layer 0" Id="0" SpritesheetId="0"/>
9
- </Layers>
10
- <Nulls/>
11
- <Events/>
12
- </Content>
13
- <Animations DefaultAnimation="Default">
14
- <Animation Name="Default" FrameNum="2" Loop="true">
15
- <RootAnimation>
16
- <Frame XPosition="0" YPosition="0" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
17
- </RootAnimation>
18
- <LayerAnimations>
19
- <LayerAnimation LayerId="0" Visible="true">
20
- <Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="0" YCrop="0" Width="120" Height="120" XScale="15" YScale="15" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
21
- </LayerAnimation>
22
- </LayerAnimations>
23
- <NullAnimations/>
24
- <Triggers/>
25
- </Animation>
26
- </Animations>
27
- </AnimatedActor>
1
+ <AnimatedActor>
2
+ <Info CreatedBy="Unknown" CreatedOn="2/1/2017 6:09:20 AM" Version="2" Fps="30"/>
3
+ <Content>
4
+ <Spritesheets>
5
+ <Spritesheet Path="logo.png" Id="0"/>
6
+ </Spritesheets>
7
+ <Layers>
8
+ <Layer Name="Layer 0" Id="0" SpritesheetId="0"/>
9
+ </Layers>
10
+ <Nulls/>
11
+ <Events/>
12
+ </Content>
13
+ <Animations DefaultAnimation="Default">
14
+ <Animation Name="Default" FrameNum="1" Loop="true">
15
+ <RootAnimation>
16
+ <Frame XPosition="0" YPosition="0" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
17
+ </RootAnimation>
18
+ <LayerAnimations>
19
+ <LayerAnimation LayerId="0" Visible="true">
20
+ <Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="0" YCrop="0" Width="44" Height="28" XScale="66" YScale="66" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
21
+ </LayerAnimation>
22
+ </LayerAnimations>
23
+ <NullAnimations/>
24
+ <Triggers/>
25
+ </Animation>
26
+ </Animations>
27
+ </AnimatedActor>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript",
3
- "version": "1.1.23",
3
+ "version": "1.1.27",
4
4
  "description": "A command line tool for managing Isaac mods written in TypeScript",
5
5
  "homepage": "https://isaacscript.github.io/",
6
6
  "bugs": {
@@ -24,11 +24,11 @@
24
24
  "jsonc-parser": "^3.0.0",
25
25
  "moment": "^2.29.1",
26
26
  "npm-check-updates": "^11.8.5",
27
- "prompts": "^2.4.1",
27
+ "prompts": "^2.4.2",
28
28
  "source-map-support": "^0.5.20",
29
- "sync-directory": "^2.2.22",
30
- "typescript": "4.4.3",
31
- "typescript-to-lua": "^1.0.1",
29
+ "sync-directory": "^4.0.5",
30
+ "typescript": "4.4.4",
31
+ "typescript-to-lua": "^1.1.0",
32
32
  "update-notifier": "^5.1.0",
33
33
  "yargs": "^17.2.1"
34
34
  },
@@ -36,12 +36,11 @@
36
36
  "@types/command-exists": "^1.2.0",
37
37
  "@types/figlet": "^1.5.4",
38
38
  "@types/fs-extra": "^9.0.13",
39
- "@types/node": "^16.10.1",
39
+ "@types/node": "^16.11.6",
40
40
  "@types/prompts": "^2.0.14",
41
41
  "@types/source-map-support": "^0.5.4",
42
42
  "@types/update-notifier": "^5.1.0",
43
- "@types/yargs": "^17.0.3",
44
- "isaacscript-lint": "^1.0.61",
45
- "ts-prune": "^0.10.0"
43
+ "@types/yargs": "^17.0.4",
44
+ "isaacscript-lint": "^1.0.63"
46
45
  }
47
46
  }
@@ -4,7 +4,7 @@ import os from "os";
4
4
  import path from "path";
5
5
  import prompts from "prompts";
6
6
  import * as file from "./file";
7
- import { error, execExe } from "./misc";
7
+ import { error, execExe } from "./util";
8
8
 
9
9
  // https://stackoverflow.com/questions/9080085/node-js-find-home-directory-in-platform-agnostic-way
10
10
  const homeDir = os.homedir();
@@ -1,12 +1,13 @@
1
1
  import path from "path";
2
- import { CURRENT_DIRECTORY_NAME, MOD_SOURCE_PATH } from "../../constants";
2
+ import { MOD_SOURCE_PATH } from "../../constants";
3
3
  import * as file from "../../file";
4
- import { execShell } from "../../misc";
5
4
  import { monkeyPatchMainLua } from "../../monkeyPatch";
6
5
  import { Config } from "../../types/Config";
6
+ import { execShell, getModTargetDirectoryName } from "../../util";
7
7
 
8
8
  export default function copy(config: Config): void {
9
- const modTargetPath = path.join(config.modsDirectory, CURRENT_DIRECTORY_NAME);
9
+ const modTargetDirectoryName = getModTargetDirectoryName(config);
10
+ const modTargetPath = path.join(config.modsDirectory, modTargetDirectoryName);
10
11
  compileAndCopy(MOD_SOURCE_PATH, modTargetPath);
11
12
  }
12
13
 
@@ -2,7 +2,7 @@ import chalk from "chalk";
2
2
  import prompts from "prompts";
3
3
  import { CWD } from "../../constants";
4
4
  import * as file from "../../file";
5
- import { error } from "../../misc";
5
+ import { error } from "../../util";
6
6
 
7
7
  export default async function checkIfProjectPathExists(
8
8
  projectPath: string,
@@ -2,7 +2,7 @@ import chalk from "chalk";
2
2
  import path from "path";
3
3
  import prompts from "prompts";
4
4
  import * as file from "../../file";
5
- import { error } from "../../misc";
5
+ import { error } from "../../util";
6
6
 
7
7
  export default async function checkModTargetDirectory(
8
8
  modsDirectory: string,
@@ -16,7 +16,7 @@ import {
16
16
  TEMPLATES_STATIC_DIR,
17
17
  } from "../../constants";
18
18
  import * as file from "../../file";
19
- import { execShell, snakeKebabToCamel } from "../../misc";
19
+ import { execShell, snakeKebabToCamel } from "../../util";
20
20
 
21
21
  export default function createMod(
22
22
  projectName: string,
@@ -3,7 +3,7 @@ import os from "os";
3
3
  import path from "path";
4
4
  import prompts from "prompts";
5
5
  import * as file from "../../file";
6
- import { error } from "../../misc";
6
+ import { error } from "../../util";
7
7
 
8
8
  // https://stackoverflow.com/questions/9080085/node-js-find-home-directory-in-platform-agnostic-way
9
9
  const homeDir = os.homedir();
@@ -2,7 +2,7 @@ import chalk from "chalk";
2
2
  import path from "path";
3
3
  import prompts from "prompts";
4
4
  import { CURRENT_DIRECTORY_NAME, CWD } from "../../constants";
5
- import { error, hasWhiteSpace } from "../../misc";
5
+ import { error, hasWhiteSpace } from "../../util";
6
6
 
7
7
  // From: https://gist.github.com/doctaphred/d01d05291546186941e1b7ddc02034d3
8
8
  const ILLEGAL_CHARACTERS_FOR_WINDOWS_FILENAMES = [
@@ -2,7 +2,7 @@ import chalk from "chalk";
2
2
  import * as JSONC from "jsonc-parser";
3
3
  import path from "path";
4
4
  import * as file from "../../file";
5
- import { error, execShell } from "../../misc";
5
+ import { error, execShell } from "../../util";
6
6
 
7
7
  export default function installVSCodeExtensions(projectPath: string): void {
8
8
  const extensions = getExtensionsFromJSON(projectPath);
@@ -1,5 +1,5 @@
1
1
  import prompts from "prompts";
2
- import { error } from "../../misc";
2
+ import { error } from "../../util";
3
3
 
4
4
  export default async function promptSaveSlot(
5
5
  argv: Record<string, unknown>,
@@ -1,7 +1,7 @@
1
1
  import path from "path";
2
2
  import prompts from "prompts";
3
3
  import { MAIN_TS } from "../../constants";
4
- import { execShell } from "../../misc";
4
+ import { execShell } from "../../util";
5
5
 
6
6
  export default async function promptVSCode(
7
7
  projectPath: string,
@@ -1,6 +1,7 @@
1
1
  import path from "path";
2
2
  import {
3
3
  DISABLE_IT_FILE,
4
+ MAIN_LUA,
4
5
  WATCHER_MOD_NAME,
5
6
  WATCHER_MOD_SOURCE_PATH,
6
7
  } from "../../constants";
@@ -27,8 +28,26 @@ export default function copyWatcherMod(config: Config): void {
27
28
  file.write(disableItPath, "");
28
29
  }
29
30
 
31
+ // By default, the IsaacScript watcher mod automatically restarts the game,
32
+ // so we only need to disable it if the config option is explicitly set to false
33
+ if (config.enableIsaacScriptWatcherAutoRestart === false) {
34
+ disableIsaacScriptWatcherAutomaticRestart(watcherModPath);
35
+ }
36
+
30
37
  // If we copied a new version of the watcher mod into place,
31
38
  // but the user currently has the game open, then the old version will stay loaded
32
39
  // However, if the watcher mod reloads itself, the game will crash,
33
40
  // so there is no automated solution for this
34
41
  }
42
+
43
+ function disableIsaacScriptWatcherAutomaticRestart(watcherModPath: string) {
44
+ const mainLuaPath = path.join(watcherModPath, MAIN_LUA);
45
+ const mainLua = file.read(mainLuaPath);
46
+
47
+ const modifiedMainLua = mainLua.replace(
48
+ "local RESTART_GAME_ON_RECOMPILATION = true",
49
+ "local RESTART_GAME_ON_RECOMPILATION = false",
50
+ );
51
+
52
+ file.write(mainLuaPath, modifiedMainLua);
53
+ }
@@ -2,7 +2,7 @@ import chalk from "chalk";
2
2
  import * as JSONC from "jsonc-parser";
3
3
  import { TSCONFIG_PATH } from "../../constants";
4
4
  import * as file from "../../file";
5
- import { error } from "../../misc";
5
+ import { error } from "../../util";
6
6
 
7
7
  export default function getTSConfigInclude(): string {
8
8
  const tsConfigRaw = file.read(TSCONFIG_PATH);
@@ -24,7 +24,7 @@ function init() {
24
24
  syncDirectory(modSourcePath, modTargetPath, {
25
25
  watch: true,
26
26
  type: "copy",
27
- afterSync,
27
+ afterEachSync,
28
28
  onError,
29
29
  chokidarWatchOptions: {
30
30
  awaitWriteFinish: {
@@ -34,8 +34,14 @@ function init() {
34
34
  });
35
35
  }
36
36
 
37
- function afterSync(params: { type: string; relativePath: string }) {
38
- if (params.type === "init:copy") {
37
+ function afterEachSync(params?: {
38
+ eventType: string;
39
+ nodeType: string;
40
+ relativePath: string;
41
+ srcPath: string;
42
+ targetPath: string;
43
+ }) {
44
+ if (params === undefined) {
39
45
  return;
40
46
  }
41
47
 
@@ -43,7 +49,9 @@ function afterSync(params: { type: string; relativePath: string }) {
43
49
  monkeyPatchMainLua(modTargetPath);
44
50
  }
45
51
 
46
- send(`${FILE_SYNCED_MESSAGE} ${params.relativePath}`);
52
+ if (params.eventType !== "init:copy") {
53
+ send(`${FILE_SYNCED_MESSAGE} ${params.relativePath}`);
54
+ }
47
55
  }
48
56
 
49
57
  function onError(err: Error) {
@@ -2,7 +2,6 @@ import chalk from "chalk";
2
2
  import { ChildProcessWithoutNullStreams, fork, spawn } from "child_process";
3
3
  import path from "path";
4
4
  import {
5
- CURRENT_DIRECTORY_NAME,
6
5
  CWD,
7
6
  FILE_SYNCED_MESSAGE,
8
7
  MAIN_LUA,
@@ -10,13 +9,13 @@ import {
10
9
  PACKAGE_JSON,
11
10
  } from "../../constants";
12
11
  import * as file from "../../file";
13
- import { error } from "../../misc";
14
12
  import { Config } from "../../types/Config";
13
+ import { error, getModTargetDirectoryName } from "../../util";
15
14
  import copyWatcherMod from "./copyWatcherMod";
16
15
  import getTSConfigInclude from "./getTSConfigInclude";
17
16
  import * as notifyGame from "./notifyGame";
18
17
  import { spawnSaveDatWriter } from "./spawnSaveDatWriter";
19
- import touchSaveDatFiles from "./touchSaveDatFiles";
18
+ import touchWatcherSaveDatFiles from "./touchWatcherSaveDatFiles";
20
19
 
21
20
  export default function monitor(
22
21
  argv: Record<string, unknown>,
@@ -30,11 +29,9 @@ export default function monitor(
30
29
  config.saveSlot = argv.saveSlot as number; // eslint-disable-line no-param-reassign
31
30
  }
32
31
 
33
- // Prepare the watcher mod
32
+ // Prepare the IsaacScript watcher mod
34
33
  copyWatcherMod(config);
35
-
36
- // Ensure that the "save#.dat" file exists
37
- touchSaveDatFiles(config);
34
+ touchWatcherSaveDatFiles(config);
38
35
 
39
36
  // Subprocess #1 - The "save#.dat" file writer
40
37
  spawnSaveDatWriter(config);
@@ -53,7 +50,8 @@ export default function monitor(
53
50
  // Read the "tsconfig.json" file
54
51
  const tsConfigInclude = getTSConfigInclude();
55
52
  const resolvedIncludePath = path.resolve(CWD, tsConfigInclude);
56
- const modTargetPath = path.join(config.modsDirectory, CURRENT_DIRECTORY_NAME);
53
+ const modTargetDirectoryName = getModTargetDirectoryName(config);
54
+ const modTargetPath = path.join(config.modsDirectory, modTargetDirectoryName);
57
55
 
58
56
  console.log("Automatically monitoring the following for changes:");
59
57
  console.log(
@@ -70,7 +68,8 @@ function spawnModDirectorySyncer(config: Config) {
70
68
  const processName = "modDirectorySyncer";
71
69
  const processDescription = "Directory syncer";
72
70
  const processPath = path.join(__dirname, processName, processName);
73
- const modTargetPath = path.join(config.modsDirectory, CURRENT_DIRECTORY_NAME);
71
+ const modTargetName = getModTargetDirectoryName(config);
72
+ const modTargetPath = path.join(config.modsDirectory, modTargetName);
74
73
  const directorySycner = fork(processPath, [MOD_SOURCE_PATH, modTargetPath]);
75
74
 
76
75
  directorySycner.on("message", (msg: string) => {
@@ -80,7 +79,7 @@ function spawnModDirectorySyncer(config: Config) {
80
79
  // to reload the mod
81
80
  // Look for something like: "File synced: \main.lua"
82
81
  if (msg === `${FILE_SYNCED_MESSAGE} ${path.sep}${MAIN_LUA}`) {
83
- notifyGame.command(`luamod ${CURRENT_DIRECTORY_NAME}`);
82
+ notifyGame.command(`luamod ${modTargetName}`);
84
83
  notifyGame.command("restart");
85
84
  notifyGame.msg("Reloaded the mod.");
86
85
  }
@@ -1,5 +1,5 @@
1
1
  import chalk from "chalk";
2
- import { getTime } from "../../misc";
2
+ import { getTime } from "../../util";
3
3
  import { sendMsgToSaveDatWriter } from "./spawnSaveDatWriter";
4
4
 
5
5
  export function msg(data: string): void {
@@ -4,7 +4,7 @@ import chalk from "chalk";
4
4
  import * as JSONC from "jsonc-parser";
5
5
  import path from "path";
6
6
  import * as file from "../../../file";
7
- import { ensureAllCases, error } from "../../../misc";
7
+ import { ensureAllCases, error } from "../../../util";
8
8
  import { SaveDatMessage, SaveDatMessageType } from "./types";
9
9
 
10
10
  const MAX_MESSAGES = 100;
@@ -1,8 +1,8 @@
1
1
  import { ChildProcess, fork } from "child_process";
2
2
  import path from "path";
3
3
  import { WATCHER_MOD_NAME } from "../../constants";
4
- import { error } from "../../misc";
5
4
  import { Config } from "../../types/Config";
5
+ import { error } from "../../util";
6
6
  import { SaveDatMessage } from "./saveDatWriter/types";
7
7
 
8
8
  let saveDatWriter: ChildProcess | null = null;
@@ -3,7 +3,7 @@ import { WATCHER_MOD_NAME } from "../../constants";
3
3
  import * as file from "../../file";
4
4
  import { Config } from "../../types/Config";
5
5
 
6
- export default function touchSaveDatFiles(config: Config): void {
6
+ export default function touchWatcherSaveDatFiles(config: Config): void {
7
7
  const modsDataPath = path.join(config.modsDirectory, "..", "data");
8
8
  const watcherModDataPath = path.join(modsDataPath, WATCHER_MOD_NAME);
9
9
  if (!file.exists(watcherModDataPath)) {
@@ -3,7 +3,6 @@ import path from "path";
3
3
  import {
4
4
  CONFIG_FILE_NAME,
5
5
  CONSTANTS_TS_PATH,
6
- CURRENT_DIRECTORY_NAME,
7
6
  METADATA_XML_PATH,
8
7
  MOD_SOURCE_PATH,
9
8
  PACKAGE_JSON_PATH,
@@ -12,9 +11,14 @@ import {
12
11
  VERSION_TXT_PATH,
13
12
  } from "../../constants";
14
13
  import * as file from "../../file";
15
- import { error, execShell, parseIntSafe } from "../../misc";
16
14
  import { monkeyPatchMainLua } from "../../monkeyPatch";
17
15
  import { Config } from "../../types/Config";
16
+ import {
17
+ error,
18
+ execShell,
19
+ getModTargetDirectoryName,
20
+ parseIntSafe,
21
+ } from "../../util";
18
22
  import { compileAndCopy } from "../copy/copy";
19
23
 
20
24
  export default function publish(
@@ -23,7 +27,8 @@ export default function publish(
23
27
  ): void {
24
28
  const skip = argv.skip === true;
25
29
  const setVersion = argv.setversion as string | undefined;
26
- const modTargetPath = path.join(config.modsDirectory, CURRENT_DIRECTORY_NAME);
30
+ const modTargetDirectoryName = getModTargetDirectoryName(config);
31
+ const modTargetPath = path.join(config.modsDirectory, modTargetDirectoryName);
27
32
 
28
33
  if (setVersion !== undefined && /^\d+\.\d+\.\d+$/.exec(setVersion) === null) {
29
34
  error(
package/src/configFile.ts CHANGED
@@ -5,8 +5,8 @@ import getModsDir from "./commands/init/getModsDir";
5
5
  import promptSaveSlot from "./commands/init/promptSaveSlot";
6
6
  import { CONFIG_FILE_NAME, CONFIG_FILE_PATH, CWD } from "./constants";
7
7
  import * as file from "./file";
8
- import { error } from "./misc";
9
8
  import { Config } from "./types/Config";
9
+ import { error } from "./util";
10
10
 
11
11
  export async function get(argv: Record<string, unknown>): Promise<Config> {
12
12
  const existingConfig = readExistingConfig();
package/src/file.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import chalk from "chalk";
2
2
  import fs from "fs-extra";
3
3
  import path from "path";
4
- import { error } from "./misc";
4
+ import { error } from "./util";
5
5
 
6
6
  export function copy(srcPath: string, dstPath: string): void {
7
7
  try {
package/src/main.ts CHANGED
@@ -14,10 +14,10 @@ import monitor from "./commands/monitor/monitor";
14
14
  import publish from "./commands/publish/publish";
15
15
  import * as configFile from "./configFile";
16
16
  import { CWD } from "./constants";
17
- import { ensureAllCases, error } from "./misc";
18
17
  import parseArgs from "./parseArgs";
19
18
  import Command, { DEFAULT_COMMAND } from "./types/Command";
20
19
  import { Config } from "./types/Config";
20
+ import { ensureAllCases, error } from "./util";
21
21
  import validateInIsaacScriptProject from "./validateInIsaacScriptProject";
22
22
  import validateNodeVersion from "./validateNodeVersion";
23
23
  import { validateOS } from "./validateOS";
@@ -6,6 +6,18 @@ export class Config {
6
6
  /** The save slot that you test your mod on. */
7
7
  saveSlot = 1;
8
8
 
9
+ /**
10
+ * By default, the target mod directory name will be the same as the project directory name. This
11
+ * setting allows you to customize it.
12
+ */
13
+ customTargetModDirectoryName?: string;
14
+
9
15
  /** The path to "steamcmd.exe". This is optional and only needed for automating publishing. */
10
16
  steamCmdPath?: string;
17
+
18
+ /**
19
+ * When your code is recompiled, IsaacScript watcher can restart the game to ensure that any
20
+ * run-related variables are properly reset. This is set to true by default.
21
+ */
22
+ enableIsaacScriptWatcherAutoRestart?: boolean;
11
23
  }
@@ -1,7 +1,8 @@
1
1
  import chalk from "chalk";
2
2
  import { execSync, spawnSync, SpawnSyncReturns } from "child_process";
3
3
  import moment from "moment";
4
- import { CWD } from "./constants";
4
+ import { CURRENT_DIRECTORY_NAME, CWD } from "./constants";
5
+ import { Config } from "./types/Config";
5
6
 
6
7
  // Use this on a switch statement's default case to get
7
8
  // the linter to complain if a case was not predicted
@@ -76,6 +77,12 @@ export function execShell(
76
77
  return [exitStatus, stdout];
77
78
  }
78
79
 
80
+ export function getModTargetDirectoryName(config: Config): string {
81
+ return config.customTargetModDirectoryName === undefined
82
+ ? CURRENT_DIRECTORY_NAME
83
+ : config.customTargetModDirectoryName;
84
+ }
85
+
79
86
  export function getTime(): string {
80
87
  return moment().format("h:mm:ss A"); // e.g. "1:23:45 AM"
81
88
  }
@@ -1,5 +1,5 @@
1
1
  import chalk from "chalk";
2
- import { error } from "./misc";
2
+ import { error } from "./util";
3
3
 
4
4
  const REQUIRED_MAJOR_VERSION = 16;
5
5
 
package/src/validateOS.ts CHANGED
@@ -13,10 +13,7 @@ export function validateOS(): void {
13
13
  )} and ${chalk.green("Linux")}.`,
14
14
  );
15
15
  console.error(
16
- "If you use another operating system and you want to use IsaacScript, contact Zamiel and let him know.",
17
- );
18
- console.error(
19
- "(Since the program is written in TypeScript, porting to a new operating system should be easy, but is untested.)",
16
+ "If you use another operating system and you want to use IsaacScript, make a request in the community Discord server.",
20
17
  );
21
18
  process.exit(1);
22
19
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"touchSaveDatFiles.js","sourceRoot":"","sources":["../../../../src/commands/monitor/touchSaveDatFiles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAwB;AACxB,+CAAmD;AACnD,iDAAmC;AAGnC,SAAwB,iBAAiB,CAAC,MAAc;IACtD,MAAM,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IACnE,MAAM,kBAAkB,GAAG,cAAI,CAAC,IAAI,CAAC,YAAY,EAAE,4BAAgB,CAAC,CAAC;IACrE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE;QACpC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;KAClC;IACD,MAAM,eAAe,GAAG,OAAO,MAAM,CAAC,QAAQ,MAAM,CAAC;IACrD,MAAM,WAAW,GAAG,cAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC;IACnE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE;QAC7B,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;KACzB;AACH,CAAC;AAXD,oCAWC"}