isaacscript 1.2.6 → 1.2.7
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.
- package/dist/package.json +2 -2
- package/dist/src/checkForWindowsTerminalBugs.js +2 -2
- package/dist/src/checkForWindowsTerminalBugs.js.map +1 -1
- package/dist/src/commands/copy/copy.js +4 -3
- package/dist/src/commands/copy/copy.js.map +1 -1
- package/dist/src/commands/init/checkIfProjectPathExists.js +2 -2
- package/dist/src/commands/init/checkIfProjectPathExists.js.map +1 -1
- package/dist/src/commands/init/checkModTargetDirectory.js +2 -2
- package/dist/src/commands/init/checkModTargetDirectory.js.map +1 -1
- package/dist/src/commands/init/createMod.js +3 -3
- package/dist/src/commands/init/createMod.js.map +1 -1
- package/dist/src/commands/init/getModsDir.js +6 -6
- package/dist/src/commands/init/getModsDir.js.map +1 -1
- package/dist/src/commands/init/getProjectPath.js +2 -2
- package/dist/src/commands/init/getProjectPath.js.map +1 -1
- package/dist/src/commands/init/installVSCodeExtensions.js +2 -2
- package/dist/src/commands/init/installVSCodeExtensions.js.map +1 -1
- package/dist/src/commands/init/promptSaveSlot.js +2 -2
- package/dist/src/commands/init/promptSaveSlot.js.map +1 -1
- package/dist/src/commands/monitor/getTSConfigInclude.js +4 -4
- package/dist/src/commands/monitor/getTSConfigInclude.js.map +1 -1
- package/dist/src/commands/monitor/monitor.js +13 -35
- package/dist/src/commands/monitor/monitor.js.map +1 -1
- package/dist/src/commands/monitor/notifyGame.js +2 -2
- package/dist/src/commands/monitor/notifyGame.js.map +1 -1
- package/dist/src/commands/monitor/saveDatWriter/saveDatWriter.js +3 -3
- package/dist/src/commands/monitor/saveDatWriter/saveDatWriter.js.map +1 -1
- package/dist/src/commands/monitor/spawnSaveDatWriter.js +3 -3
- package/dist/src/commands/monitor/spawnSaveDatWriter.js.map +1 -1
- package/dist/src/commands/publish/publish.js +17 -17
- package/dist/src/commands/publish/publish.js.map +1 -1
- package/dist/src/configFile.js +3 -3
- package/dist/src/configFile.js.map +1 -1
- package/dist/src/exec.js +6 -6
- package/dist/src/exec.js.map +1 -1
- package/dist/src/file.js +10 -10
- package/dist/src/file.js.map +1 -1
- package/dist/src/main.js +3 -3
- package/dist/src/main.js.map +1 -1
- package/dist/src/parseArgs.js +0 -5
- package/dist/src/parseArgs.js.map +1 -1
- package/dist/src/prompt.js +6 -6
- package/dist/src/prompt.js.map +1 -1
- package/dist/src/{util.js → utils.js} +15 -2
- package/dist/src/utils.js.map +1 -0
- package/dist/src/validateNodeVersion.js +2 -2
- package/dist/src/validateNodeVersion.js.map +1 -1
- package/package.json +2 -2
- package/src/checkForWindowsTerminalBugs.ts +1 -1
- package/src/commands/copy/copy.ts +4 -7
- package/src/commands/init/checkIfProjectPathExists.ts +1 -1
- package/src/commands/init/checkModTargetDirectory.ts +1 -1
- package/src/commands/init/createMod.ts +1 -1
- package/src/commands/init/getModsDir.ts +1 -1
- package/src/commands/init/getProjectPath.ts +1 -1
- package/src/commands/init/installVSCodeExtensions.ts +1 -1
- package/src/commands/init/promptSaveSlot.ts +1 -1
- package/src/commands/monitor/getTSConfigInclude.ts +1 -1
- package/src/commands/monitor/monitor.ts +8 -48
- package/src/commands/monitor/notifyGame.ts +1 -1
- package/src/commands/monitor/saveDatWriter/saveDatWriter.ts +1 -1
- package/src/commands/monitor/spawnSaveDatWriter.ts +1 -1
- package/src/commands/publish/publish.ts +1 -1
- package/src/configFile.ts +1 -1
- package/src/exec.ts +1 -1
- package/src/file.ts +1 -1
- package/src/main.ts +1 -1
- package/src/parseArgs.ts +0 -5
- package/src/prompt.ts +1 -1
- package/src/{util.ts → utils.ts} +16 -1
- package/src/validateNodeVersion.ts +1 -1
- package/dist/src/util.js.map +0 -1
|
@@ -2,7 +2,7 @@ import chalk from "chalk";
|
|
|
2
2
|
import { CWD } from "../../constants";
|
|
3
3
|
import * as file from "../../file";
|
|
4
4
|
import { getInputYesNo } from "../../prompt";
|
|
5
|
-
import { error } from "../../
|
|
5
|
+
import { error } from "../../utils";
|
|
6
6
|
|
|
7
7
|
export async function checkIfProjectPathExists(
|
|
8
8
|
projectPath: string,
|
|
@@ -3,7 +3,7 @@ import path from "path";
|
|
|
3
3
|
import { PROJECT_NAME } from "../../constants";
|
|
4
4
|
import * as file from "../../file";
|
|
5
5
|
import { getInputYesNo } from "../../prompt";
|
|
6
|
-
import { error } from "../../
|
|
6
|
+
import { error } from "../../utils";
|
|
7
7
|
|
|
8
8
|
export async function checkModTargetDirectory(
|
|
9
9
|
modsDirectory: string,
|
|
@@ -23,7 +23,7 @@ import { execShell } from "../../exec";
|
|
|
23
23
|
import * as file from "../../file";
|
|
24
24
|
import { getInputString, getInputYesNo } from "../../prompt";
|
|
25
25
|
import { GitHubCLIHostsYAML } from "../../types/GitHubCLIHostsYAML";
|
|
26
|
-
import { error, parseSemVer } from "../../
|
|
26
|
+
import { error, parseSemVer } from "../../utils";
|
|
27
27
|
|
|
28
28
|
const REQUIRED_GIT_MAJOR_VERSION = 2;
|
|
29
29
|
const REQUIRED_GIT_MINOR_VERSION = 30;
|
|
@@ -2,7 +2,7 @@ import chalk from "chalk";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { CURRENT_DIRECTORY_NAME, CWD } from "../../constants";
|
|
4
4
|
import { getInputString, getInputYesNo } from "../../prompt";
|
|
5
|
-
import { hasWhiteSpace } from "../../
|
|
5
|
+
import { hasWhiteSpace } from "../../utils";
|
|
6
6
|
|
|
7
7
|
// From: https://gist.github.com/doctaphred/d01d05291546186941e1b7ddc02034d3
|
|
8
8
|
const ILLEGAL_CHARACTERS_FOR_WINDOWS_FILENAMES = [
|
|
@@ -3,7 +3,7 @@ import * as JSONC from "jsonc-parser";
|
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { execShell } from "../../exec";
|
|
5
5
|
import * as file from "../../file";
|
|
6
|
-
import { error } from "../../
|
|
6
|
+
import { error } from "../../utils";
|
|
7
7
|
|
|
8
8
|
export function installVSCodeExtensions(
|
|
9
9
|
projectPath: string,
|
|
@@ -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 "../../
|
|
5
|
+
import { error } from "../../utils";
|
|
6
6
|
|
|
7
7
|
export function getTSConfigInclude(): string {
|
|
8
8
|
const tsConfigRaw = file.read(TSCONFIG_PATH);
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
|
-
import {
|
|
2
|
+
import { fork, spawn } from "child_process";
|
|
3
3
|
import path from "path";
|
|
4
4
|
import {
|
|
5
|
-
CUSTOM_NODE_JS_STACK_SIZE,
|
|
6
5
|
CWD,
|
|
7
6
|
FILE_SYNCED_MESSAGE,
|
|
8
7
|
MAIN_LUA,
|
|
9
8
|
MOD_SOURCE_PATH,
|
|
10
|
-
PACKAGE_JSON,
|
|
11
9
|
PROJECT_NAME,
|
|
12
10
|
} from "../../constants";
|
|
13
11
|
import * as file from "../../file";
|
|
14
12
|
import { Config } from "../../types/Config";
|
|
15
|
-
import { error, getModTargetDirectoryName } from "../../
|
|
13
|
+
import { error, getModTargetDirectoryName, getTSTLArgs } from "../../utils";
|
|
16
14
|
import { copyWatcherMod } from "./copyWatcherMod";
|
|
17
15
|
import { getTSConfigInclude } from "./getTSConfigInclude";
|
|
18
16
|
import * as notifyGame from "./notifyGame";
|
|
@@ -53,7 +51,7 @@ export function monitor(argv: Record<string, unknown>, config: Config): void {
|
|
|
53
51
|
spawnModDirectorySyncer(config);
|
|
54
52
|
|
|
55
53
|
// Subprocess #3 - tstl --watch (to automatically convert TypeScript to Lua)
|
|
56
|
-
spawnTSTLWatcher(
|
|
54
|
+
spawnTSTLWatcher();
|
|
57
55
|
|
|
58
56
|
// Also, start constantly pinging the watcher mod
|
|
59
57
|
setInterval(() => {
|
|
@@ -101,42 +99,12 @@ function spawnModDirectorySyncer(config: Config) {
|
|
|
101
99
|
});
|
|
102
100
|
}
|
|
103
101
|
|
|
104
|
-
function spawnTSTLWatcher(
|
|
102
|
+
function spawnTSTLWatcher() {
|
|
105
103
|
const processDescription = "tstl";
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
tstlArgs.push("--luaPlugins");
|
|
111
|
-
tstlArgs.push(
|
|
112
|
-
'\'{ "name": "./node_modules/isaacscript/src/plugins/addCrashDebugStatements.ts" }\'',
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
let tstl: ChildProcessWithoutNullStreams;
|
|
117
|
-
if (runningFromLocalPath()) {
|
|
118
|
-
const tstlPath = path.join(
|
|
119
|
-
CWD,
|
|
120
|
-
"..",
|
|
121
|
-
"isaacscript",
|
|
122
|
-
"node_modules",
|
|
123
|
-
"typescript-to-lua",
|
|
124
|
-
"dist",
|
|
125
|
-
"tstl.js",
|
|
126
|
-
);
|
|
127
|
-
tstl = spawn("node", [tstlPath, ...tstlArgs], {
|
|
128
|
-
shell: true,
|
|
129
|
-
cwd: CWD,
|
|
130
|
-
});
|
|
131
|
-
} else {
|
|
132
|
-
tstl = spawn(
|
|
133
|
-
"npx",
|
|
134
|
-
[`--stack-size=${CUSTOM_NODE_JS_STACK_SIZE}`, "tstl", ...tstlArgs],
|
|
135
|
-
{
|
|
136
|
-
shell: true,
|
|
137
|
-
},
|
|
138
|
-
);
|
|
139
|
-
}
|
|
104
|
+
const tstlArgs = getTSTLArgs(true);
|
|
105
|
+
const tstl = spawn("node", tstlArgs, {
|
|
106
|
+
shell: true,
|
|
107
|
+
});
|
|
140
108
|
|
|
141
109
|
tstl.stdout.on("data", (data: Buffer[]) => {
|
|
142
110
|
const msg = data.toString().trim();
|
|
@@ -173,11 +141,3 @@ function spawnTSTLWatcher(argv: Record<string, unknown>) {
|
|
|
173
141
|
error(`Error: ${processDescription} subprocess exited with code: ${code}`);
|
|
174
142
|
});
|
|
175
143
|
}
|
|
176
|
-
|
|
177
|
-
// Returns whether or not IsaacScript is a local path in "package.json"
|
|
178
|
-
// e.g. "isaacscript": "../isaacscript"
|
|
179
|
-
function runningFromLocalPath() {
|
|
180
|
-
const packageJSONPath = path.join(CWD, PACKAGE_JSON);
|
|
181
|
-
const packageJSON = file.read(packageJSONPath);
|
|
182
|
-
return packageJSON.includes('"isaacscript": "file:../isaacscript"');
|
|
183
|
-
}
|
|
@@ -3,7 +3,7 @@ import * as JSONC from "jsonc-parser";
|
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { PROJECT_NAME } from "../../../constants";
|
|
5
5
|
import * as file from "../../../file";
|
|
6
|
-
import { ensureAllCases, error } from "../../../
|
|
6
|
+
import { ensureAllCases, error } from "../../../utils";
|
|
7
7
|
import { SaveDatMessage, SaveDatMessageType } from "./types";
|
|
8
8
|
|
|
9
9
|
const MAX_MESSAGES = 100;
|
|
@@ -2,7 +2,7 @@ import { ChildProcess, fork } from "child_process";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { WATCHER_MOD_NAME } from "../../constants";
|
|
4
4
|
import { Config } from "../../types/Config";
|
|
5
|
-
import { error } from "../../
|
|
5
|
+
import { error } from "../../utils";
|
|
6
6
|
import { SaveDatMessage } from "./saveDatWriter/types";
|
|
7
7
|
|
|
8
8
|
let saveDatWriter: ChildProcess | null = null;
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import { execExe, execShell } from "../../exec";
|
|
16
16
|
import * as file from "../../file";
|
|
17
17
|
import { Config } from "../../types/Config";
|
|
18
|
-
import { error, getModTargetDirectoryName, parseIntSafe } from "../../
|
|
18
|
+
import { error, getModTargetDirectoryName, parseIntSafe } from "../../utils";
|
|
19
19
|
import { compileAndCopy } from "../copy/copy";
|
|
20
20
|
|
|
21
21
|
const UPDATE_SCRIPT_NAME = "update.sh";
|
package/src/configFile.ts
CHANGED
|
@@ -6,7 +6,7 @@ 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
8
|
import { Config } from "./types/Config";
|
|
9
|
-
import { error } from "./
|
|
9
|
+
import { error } from "./utils";
|
|
10
10
|
|
|
11
11
|
export async function get(argv: Record<string, unknown>): Promise<Config> {
|
|
12
12
|
const verbose = argv.verbose === true;
|
package/src/exec.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import { execSync, spawnSync, SpawnSyncReturns } from "child_process";
|
|
3
3
|
import { CWD } from "./constants";
|
|
4
|
-
import { error } from "./
|
|
4
|
+
import { error } from "./utils";
|
|
5
5
|
|
|
6
6
|
export function execExe(path: string, verbose = false, cwd = CWD): string {
|
|
7
7
|
if (verbose) {
|
package/src/file.ts
CHANGED
package/src/main.ts
CHANGED
|
@@ -18,7 +18,7 @@ import { parseArgs } from "./parseArgs";
|
|
|
18
18
|
import { promptInit } from "./prompt";
|
|
19
19
|
import { Command, DEFAULT_COMMAND } from "./types/Command";
|
|
20
20
|
import { Config } from "./types/Config";
|
|
21
|
-
import { ensureAllCases, error } from "./
|
|
21
|
+
import { ensureAllCases, error } from "./utils";
|
|
22
22
|
import { validateInIsaacScriptProject } from "./validateInIsaacScriptProject";
|
|
23
23
|
import { validateNodeVersion } from "./validateNodeVersion";
|
|
24
24
|
import { validateOS } from "./validateOS";
|
package/src/parseArgs.ts
CHANGED
|
@@ -20,11 +20,6 @@ export function parseArgs() {
|
|
|
20
20
|
choices: [1, 2, 3],
|
|
21
21
|
description: "The save slot in-game that you use",
|
|
22
22
|
})
|
|
23
|
-
.option("crash-debug", {
|
|
24
|
-
alias: "c",
|
|
25
|
-
type: "boolean",
|
|
26
|
-
description: "Enable crash debugging",
|
|
27
|
-
})
|
|
28
23
|
.option("verbose", {
|
|
29
24
|
alias: "v",
|
|
30
25
|
type: "boolean",
|
package/src/prompt.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import chalk from "chalk";
|
|
6
6
|
import prompt from "prompt";
|
|
7
|
-
import { error, parseIntSafe } from "./
|
|
7
|
+
import { error, parseIntSafe } from "./utils";
|
|
8
8
|
|
|
9
9
|
const VALID_YES_RESPONSES = new Set(["yes", "ye", "y"]);
|
|
10
10
|
const VALID_NO_RESPONSES = new Set(["no", "n"]);
|
package/src/{util.ts → utils.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import moment from "moment";
|
|
2
|
-
import { CURRENT_DIRECTORY_NAME } from "./constants";
|
|
2
|
+
import { CURRENT_DIRECTORY_NAME, CUSTOM_NODE_JS_STACK_SIZE } from "./constants";
|
|
3
3
|
import { Config } from "./types/Config";
|
|
4
4
|
|
|
5
5
|
export const ensureAllCases = (obj: never): never => obj;
|
|
@@ -19,6 +19,21 @@ export function getTime(): string {
|
|
|
19
19
|
return moment().format("h:mm:ss A"); // e.g. "1:23:45 AM"
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
export function getTSTLArgs(watch: boolean): string[] {
|
|
23
|
+
// We cannot pass the "--stack-size" flag to the "npx" command
|
|
24
|
+
// Thus, we must execute node directly with the following arguments
|
|
25
|
+
const tstlArgs = [
|
|
26
|
+
`--stack-size=${CUSTOM_NODE_JS_STACK_SIZE}`,
|
|
27
|
+
"node_modules/@zamiell/typescript-to-lua/dist/tstl.js",
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
if (watch) {
|
|
31
|
+
tstlArgs.push("--watch", "--preserveWatchOutput");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return tstlArgs;
|
|
35
|
+
}
|
|
36
|
+
|
|
22
37
|
// From: https://stackoverflow.com/questions/1731190/check-if-a-string-has-white-space
|
|
23
38
|
export function hasWhiteSpace(s: string): boolean {
|
|
24
39
|
return /\s/g.test(s);
|
package/dist/src/util.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"util.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