isaacscript 1.2.4 → 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 +5 -5
- 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 +22 -22
- 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/constants.js +6 -1
- package/dist/src/constants.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/file-templates/static/build.sh +1 -1
- package/package.json +5 -5
- package/src/checkForWindowsTerminalBugs.ts +1 -1
- package/src/commands/copy/copy.ts +3 -2
- package/src/commands/init/checkIfProjectPathExists.ts +1 -1
- package/src/commands/init/checkModTargetDirectory.ts +1 -1
- package/src/commands/init/createMod.ts +42 -42
- 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 -43
- 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/constants.ts +6 -0
- 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
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.parseSemVer = exports.parseIntSafe = exports.hasWhiteSpace = exports.getTime = exports.getModTargetDirectoryName = exports.error = exports.ensureAllCases = void 0;
|
|
6
|
+
exports.parseSemVer = exports.parseIntSafe = exports.hasWhiteSpace = exports.getTSTLArgs = exports.getTime = exports.getModTargetDirectoryName = exports.error = exports.ensureAllCases = void 0;
|
|
7
7
|
const moment_1 = __importDefault(require("moment"));
|
|
8
8
|
const constants_1 = require("./constants");
|
|
9
9
|
const ensureAllCases = (obj) => obj;
|
|
@@ -23,6 +23,19 @@ function getTime() {
|
|
|
23
23
|
return (0, moment_1.default)().format("h:mm:ss A"); // e.g. "1:23:45 AM"
|
|
24
24
|
}
|
|
25
25
|
exports.getTime = getTime;
|
|
26
|
+
function getTSTLArgs(watch) {
|
|
27
|
+
// We cannot pass the "--stack-size" flag to the "npx" command
|
|
28
|
+
// Thus, we must execute node directly with the following arguments
|
|
29
|
+
const tstlArgs = [
|
|
30
|
+
`--stack-size=${constants_1.CUSTOM_NODE_JS_STACK_SIZE}`,
|
|
31
|
+
"node_modules/@zamiell/typescript-to-lua/dist/tstl.js",
|
|
32
|
+
];
|
|
33
|
+
if (watch) {
|
|
34
|
+
tstlArgs.push("--watch", "--preserveWatchOutput");
|
|
35
|
+
}
|
|
36
|
+
return tstlArgs;
|
|
37
|
+
}
|
|
38
|
+
exports.getTSTLArgs = getTSTLArgs;
|
|
26
39
|
// From: https://stackoverflow.com/questions/1731190/check-if-a-string-has-white-space
|
|
27
40
|
function hasWhiteSpace(s) {
|
|
28
41
|
return /\s/g.test(s);
|
|
@@ -75,4 +88,4 @@ function parseSemVer(versionString) {
|
|
|
75
88
|
return [majorVersion, minorVersion, patchVersion];
|
|
76
89
|
}
|
|
77
90
|
exports.parseSemVer = parseSemVer;
|
|
78
|
-
//# sourceMappingURL=
|
|
91
|
+
//# sour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tD,IAAI,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE;QAC9B,KAAK,CAAC,kDAAkD,aAAa,EAAE,CAAC,CAAC;KAC1E;IAED,OAAO,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;AACpD,CAAC;AA1BD,kCA0BC"}
|
|
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.validateNodeVersion = void 0;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const constants_1 = require("./constants");
|
|
9
|
-
const
|
|
9
|
+
const utils_1 = require("./utils");
|
|
10
10
|
const REQUIRED_NODE_JS_MAJOR_VERSION = 16;
|
|
11
11
|
// This program requires Node to be at least v16.0.0,
|
|
12
12
|
// since that is the version that added the "fs.rmSync()" function
|
|
13
13
|
// (I tested on Node v15.0.0 and it failed)
|
|
14
14
|
function validateNodeVersion() {
|
|
15
15
|
const nodeJSVersionString = process.version;
|
|
16
|
-
const [majorVersion] = (0,
|
|
16
|
+
const [majorVersion] = (0, utils_1.parseSemVer)(nodeJSVersionString);
|
|
17
17
|
if (majorVersion >= REQUIRED_NODE_JS_MAJOR_VERSION) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateNodeVersion.js","sourceRoot":"","sources":["../../src/validateNodeVersion.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,2CAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"validateNodeVersion.js","sourceRoot":"","sources":["../../src/validateNodeVersion.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,2CAA2C;AAC3C,mCAAsC;AAEtC,MAAM,8BAA8B,GAAG,EAAE,CAAC;AAE1C,qDAAqD;AACrD,kEAAkE;AAClE,2CAA2C;AAC3C,SAAgB,mBAAmB;IACjC,MAAM,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;IAC5C,MAAM,CAAC,YAAY,CAAC,GAAG,IAAA,mBAAW,EAAC,mBAAmB,CAAC,CAAC;IAExD,IAAI,YAAY,IAAI,8BAA8B,EAAE;QAClD,OAAO;KACR;IAED,OAAO,CAAC,KAAK,CAAC,4BAA4B,eAAK,CAAC,GAAG,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;IAC5E,OAAO,CAAC,KAAK,CACX,GAAG,wBAAY,kCAAkC,eAAK,CAAC,GAAG,CACxD,GAAG,8BAA8B,MAAM,CACxC,cAAc,CAChB,CAAC;IACF,OAAO,CAAC,KAAK,CACX,uDAAuD,wBAAY,GAAG,CACvE,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAlBD,kDAkBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"description": "A command line tool for managing Isaac mods written in TypeScript",
|
|
5
5
|
"homepage": "https://isaacscript.github.io/",
|
|
6
6
|
"bugs": {
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"command-exists": "^1.2.9",
|
|
22
22
|
"dotenv": "^16.0.0",
|
|
23
23
|
"figlet": "^1.5.2",
|
|
24
|
-
"fs-extra": "^10.0.
|
|
24
|
+
"fs-extra": "^10.0.1",
|
|
25
25
|
"isaacscript-tsconfig": "^1.1.8",
|
|
26
26
|
"jsonc-parser": "^3.0.0",
|
|
27
27
|
"moment": "^2.29.1",
|
|
28
|
-
"npm-check-updates": "^12.
|
|
28
|
+
"npm-check-updates": "^12.5.0",
|
|
29
29
|
"prompt": "^1.2.2",
|
|
30
30
|
"source-map": "^0.7.3",
|
|
31
31
|
"source-map-support": "^0.5.21",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"@types/command-exists": "^1.2.0",
|
|
40
40
|
"@types/figlet": "^1.5.4",
|
|
41
41
|
"@types/fs-extra": "^9.0.13",
|
|
42
|
-
"@types/node": "^17.0.
|
|
42
|
+
"@types/node": "^17.0.21",
|
|
43
43
|
"@types/prompt": "^1.1.2",
|
|
44
44
|
"@types/source-map-support": "^0.5.4",
|
|
45
45
|
"@types/update-notifier": "^5.1.0",
|
|
46
46
|
"@types/yargs": "^17.0.8",
|
|
47
|
-
"isaacscript-lint": "^1.0.
|
|
47
|
+
"isaacscript-lint": "^1.0.83"
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -4,7 +4,7 @@ import path from "path";
|
|
|
4
4
|
import { HOME_DIR, PROJECT_NAME } from "./constants";
|
|
5
5
|
import * as file from "./file";
|
|
6
6
|
import { getInputYesNo } from "./prompt";
|
|
7
|
-
import { error } from "./
|
|
7
|
+
import { error } from "./utils";
|
|
8
8
|
|
|
9
9
|
const BASH_PROFILE_PATH = path.join(HOME_DIR, ".bash_profile");
|
|
10
10
|
|
|
@@ -3,7 +3,7 @@ import { MOD_SOURCE_PATH } from "../../constants";
|
|
|
3
3
|
import { execShell } from "../../exec";
|
|
4
4
|
import * as file from "../../file";
|
|
5
5
|
import { Config } from "../../types/Config";
|
|
6
|
-
import { getModTargetDirectoryName } from "../../
|
|
6
|
+
import { getModTargetDirectoryName, getTSTLArgs } from "../../utils";
|
|
7
7
|
|
|
8
8
|
export function copy(argv: Record<string, unknown>, config: Config): void {
|
|
9
9
|
const verbose = argv.verbose === true;
|
|
@@ -25,7 +25,8 @@ export function compileAndCopy(
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
function compile(verbose: boolean) {
|
|
28
|
-
|
|
28
|
+
const tstlArgs = getTSTLArgs(false);
|
|
29
|
+
execShell("node", tstlArgs, verbose);
|
|
29
30
|
console.log("Mod compiled successfully.");
|
|
30
31
|
}
|
|
31
32
|
|
|
@@ -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;
|
|
@@ -45,16 +45,56 @@ export async function createMod(
|
|
|
45
45
|
configFile.createFile(projectPath, config, verbose);
|
|
46
46
|
const targetModDirectory = path.join(config.modsDirectory, projectName);
|
|
47
47
|
|
|
48
|
+
await initGitRepository(projectPath, projectName, verbose);
|
|
48
49
|
makeSubdirectories(projectPath, verbose);
|
|
49
50
|
copyStaticFiles(projectPath, verbose);
|
|
50
51
|
copyDynamicFiles(projectName, projectPath, targetModDirectory, verbose);
|
|
51
52
|
updateNodeModules(projectPath, verbose);
|
|
52
|
-
await initGitRepository(projectPath, projectName, verbose);
|
|
53
53
|
installNodeModules(projectPath, skipNPMInstall, verbose);
|
|
54
54
|
|
|
55
55
|
console.log(`Successfully created mod: ${chalk.green(projectName)}`);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
async function initGitRepository(
|
|
59
|
+
projectPath: string,
|
|
60
|
+
projectName: string,
|
|
61
|
+
verbose: boolean,
|
|
62
|
+
) {
|
|
63
|
+
if (!commandExists.sync("git")) {
|
|
64
|
+
console.log(
|
|
65
|
+
'Git does not seem to be installed. (The "git" command is not in the path.) Skipping Git-related things.',
|
|
66
|
+
);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
checkOldGitVersion(verbose);
|
|
71
|
+
|
|
72
|
+
const remoteURL = await getGitRemoteURL(projectName);
|
|
73
|
+
if (remoteURL === "") {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
execShell("git", ["init"], verbose, false, projectPath);
|
|
78
|
+
execShell("git", ["branch", "-M", "main"], verbose, false, projectPath);
|
|
79
|
+
execShell(
|
|
80
|
+
"git",
|
|
81
|
+
["remote", "add", "origin", remoteURL],
|
|
82
|
+
verbose,
|
|
83
|
+
false,
|
|
84
|
+
projectPath,
|
|
85
|
+
);
|
|
86
|
+
if (isGitNameAndEmailConfigured(verbose)) {
|
|
87
|
+
execShell("git", ["add", "--all"], verbose, false, projectPath);
|
|
88
|
+
execShell(
|
|
89
|
+
"git",
|
|
90
|
+
["commit", "--message", `${PROJECT_NAME} template`],
|
|
91
|
+
verbose,
|
|
92
|
+
false,
|
|
93
|
+
projectPath,
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
58
98
|
function makeSubdirectories(projectPath: string, verbose: boolean) {
|
|
59
99
|
// The "src" directory is created during copying of static files
|
|
60
100
|
for (const subdirectory of ["mod"]) {
|
|
@@ -169,46 +209,6 @@ function updateNodeModules(projectPath: string, verbose: boolean) {
|
|
|
169
209
|
);
|
|
170
210
|
}
|
|
171
211
|
|
|
172
|
-
async function initGitRepository(
|
|
173
|
-
projectPath: string,
|
|
174
|
-
projectName: string,
|
|
175
|
-
verbose: boolean,
|
|
176
|
-
) {
|
|
177
|
-
if (!commandExists.sync("git")) {
|
|
178
|
-
console.log(
|
|
179
|
-
'Git does not seem to be installed. (The "git" command is not in the path.) Skipping Git-related things.',
|
|
180
|
-
);
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
checkOldGitVersion(verbose);
|
|
185
|
-
|
|
186
|
-
const remoteURL = await getGitRemoteURL(projectName);
|
|
187
|
-
if (remoteURL === "") {
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
execShell("git", ["init"], verbose, false, projectPath);
|
|
192
|
-
execShell("git", ["branch", "-M", "main"], verbose, false, projectPath);
|
|
193
|
-
execShell(
|
|
194
|
-
"git",
|
|
195
|
-
["remote", "add", "origin", remoteURL],
|
|
196
|
-
verbose,
|
|
197
|
-
false,
|
|
198
|
-
projectPath,
|
|
199
|
-
);
|
|
200
|
-
if (isGitNameAndEmailConfigured(verbose)) {
|
|
201
|
-
execShell("git", ["add", "--all"], verbose, false, projectPath);
|
|
202
|
-
execShell(
|
|
203
|
-
"git",
|
|
204
|
-
["commit", "--message", `${PROJECT_NAME} template`],
|
|
205
|
-
verbose,
|
|
206
|
-
false,
|
|
207
|
-
projectPath,
|
|
208
|
-
);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
212
|
async function getGitRemoteURL(projectName: string) {
|
|
213
213
|
const guessedRemoteURL = guessRemoteURL(projectName);
|
|
214
214
|
if (guessedRemoteURL !== undefined) {
|
|
@@ -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,17 +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
5
|
CWD,
|
|
6
6
|
FILE_SYNCED_MESSAGE,
|
|
7
7
|
MAIN_LUA,
|
|
8
8
|
MOD_SOURCE_PATH,
|
|
9
|
-
PACKAGE_JSON,
|
|
10
9
|
PROJECT_NAME,
|
|
11
10
|
} from "../../constants";
|
|
12
11
|
import * as file from "../../file";
|
|
13
12
|
import { Config } from "../../types/Config";
|
|
14
|
-
import { error, getModTargetDirectoryName } from "../../
|
|
13
|
+
import { error, getModTargetDirectoryName, getTSTLArgs } from "../../utils";
|
|
15
14
|
import { copyWatcherMod } from "./copyWatcherMod";
|
|
16
15
|
import { getTSConfigInclude } from "./getTSConfigInclude";
|
|
17
16
|
import * as notifyGame from "./notifyGame";
|
|
@@ -52,7 +51,7 @@ export function monitor(argv: Record<string, unknown>, config: Config): void {
|
|
|
52
51
|
spawnModDirectorySyncer(config);
|
|
53
52
|
|
|
54
53
|
// Subprocess #3 - tstl --watch (to automatically convert TypeScript to Lua)
|
|
55
|
-
spawnTSTLWatcher(
|
|
54
|
+
spawnTSTLWatcher();
|
|
56
55
|
|
|
57
56
|
// Also, start constantly pinging the watcher mod
|
|
58
57
|
setInterval(() => {
|
|
@@ -100,38 +99,12 @@ function spawnModDirectorySyncer(config: Config) {
|
|
|
100
99
|
});
|
|
101
100
|
}
|
|
102
101
|
|
|
103
|
-
function spawnTSTLWatcher(
|
|
102
|
+
function spawnTSTLWatcher() {
|
|
104
103
|
const processDescription = "tstl";
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
tstlArgs.push("--luaPlugins");
|
|
110
|
-
tstlArgs.push(
|
|
111
|
-
'\'{ "name": "./node_modules/isaacscript/src/plugins/addCrashDebugStatements.ts" }\'',
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
let tstl: ChildProcessWithoutNullStreams;
|
|
116
|
-
if (runningFromLocalPath()) {
|
|
117
|
-
const tstlPath = path.join(
|
|
118
|
-
CWD,
|
|
119
|
-
"..",
|
|
120
|
-
"isaacscript",
|
|
121
|
-
"node_modules",
|
|
122
|
-
"typescript-to-lua",
|
|
123
|
-
"dist",
|
|
124
|
-
"tstl.js",
|
|
125
|
-
);
|
|
126
|
-
tstl = spawn("node", [tstlPath, ...tstlArgs], {
|
|
127
|
-
shell: true,
|
|
128
|
-
cwd: CWD,
|
|
129
|
-
});
|
|
130
|
-
} else {
|
|
131
|
-
tstl = spawn("npx", ["tstl", ...tstlArgs], {
|
|
132
|
-
shell: true,
|
|
133
|
-
});
|
|
134
|
-
}
|
|
104
|
+
const tstlArgs = getTSTLArgs(true);
|
|
105
|
+
const tstl = spawn("node", tstlArgs, {
|
|
106
|
+
shell: true,
|
|
107
|
+
});
|
|
135
108
|
|
|
136
109
|
tstl.stdout.on("data", (data: Buffer[]) => {
|
|
137
110
|
const msg = data.toString().trim();
|
|
@@ -168,11 +141,3 @@ function spawnTSTLWatcher(argv: Record<string, unknown>) {
|
|
|
168
141
|
error(`Error: ${processDescription} subprocess exited with code: ${code}`);
|
|
169
142
|
});
|
|
170
143
|
}
|
|
171
|
-
|
|
172
|
-
// Returns whether or not IsaacScript is a local path in "package.json"
|
|
173
|
-
// e.g. "isaacscript": "../isaacscript"
|
|
174
|
-
function runningFromLocalPath() {
|
|
175
|
-
const packageJSONPath = path.join(CWD, PACKAGE_JSON);
|
|
176
|
-
const packageJSON = file.read(packageJSONPath);
|
|
177
|
-
return packageJSON.includes('"isaacscript": "file:../isaacscript"');
|
|
178
|
-
}
|
|
@@ -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/constants.ts
CHANGED
|
@@ -15,6 +15,12 @@ export const MOD_UPLOADER_PATH =
|
|
|
15
15
|
"C:\\Program Files (x86)\\Steam\\steamapps\\common\\The Binding of Isaac Rebirth\\tools\\ModUploader\\ModUploader.exe";
|
|
16
16
|
export const PROJECT_NAME = "IsaacScript";
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* The default Node.js stack size is 984 kilobytes, but this is not large enough to compile the
|
|
20
|
+
* biggest mods, resulting in an error of "RangeError: Maximum call stack size exceeded".
|
|
21
|
+
*/
|
|
22
|
+
export const CUSTOM_NODE_JS_STACK_SIZE = 2048;
|
|
23
|
+
|
|
18
24
|
// isaacscript
|
|
19
25
|
const REPO_ROOT = path.join(__dirname, "..", "..");
|
|
20
26
|
|
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.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,2CAAqD;AAG9C,MAAM,cAAc,GAAG,CAAC,GAAU,EAAS,EAAE,CAAC,GAAG,CAAC;AAA5C,QAAA,cAAc,kBAA8B;AAEzD,SAAgB,KAAK,CAAC,GAAG,IAAe;IACtC,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;IACvB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAHD,sBAGC;AAED,SAAgB,yBAAyB,CAAC,MAAc;IACtD,OAAO,MAAM,CAAC,4BAA4B,KAAK,SAAS;QACtD,CAAC,CAAC,kCAAsB;QACxB,CAAC,CAAC,MAAM,CAAC,4BAA4B,CAAC;AAC1C,CAAC;AAJD,8DAIC;AAED,SAAgB,OAAO;IACrB,OAAO,IAAA,gBAAM,GAAE,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,oBAAoB;AAC3D,CAAC;AAFD,0BAEC;AAED,sFAAsF;AAC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