isaacscript 1.2.39 → 1.2.42
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/.cspell.json +0 -3
- package/.prettierrc.js +1 -1
- package/.vscode/settings.json +8 -3
- package/dist/package.json +7 -7
- package/dist/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.js +11 -5
- package/dist/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.js.map +1 -1
- package/dist/src/commands/monitor/monitor.js +24 -2
- package/dist/src/commands/monitor/monitor.js.map +1 -1
- package/dist/src/commands/monitor/saveDatWriter/saveDatWriter.js +6 -5
- package/dist/src/commands/monitor/saveDatWriter/saveDatWriter.js.map +1 -1
- package/dist/src/exec.js +5 -6
- package/dist/src/exec.js.map +1 -1
- package/dist/src/utils.js +2 -2
- package/dist/src/utils.js.map +1 -1
- package/dist/src/validateNodeVersion.js +3 -3
- package/dist/src/validateNodeVersion.js.map +1 -1
- package/eslint-debug.sh +3 -0
- package/file-templates/dynamic/gitignore +19 -5
- package/file-templates/static/.prettierrc.js +1 -1
- package/file-templates/static/.vscode/settings.json +5 -0
- package/file-templates/static/lint.sh +1 -1
- package/file-templates/static/nuke.sh +1 -1
- package/file-templates/static/plugins/addCrashDebugStatements.ts +12 -0
- package/file-templates/static/plugins/addIsaacScriptCommentHeader.ts +2 -0
- package/file-templates/static/plugins/noExtendedEnums.ts +70 -0
- package/file-templates/static/tsconfig.eslint.json +2 -2
- package/file-templates/static/tsconfig.json +4 -1
- package/file-templates/static/update.sh +5 -1
- package/lint.sh +6 -0
- package/nuke.sh +1 -1
- package/package.json +7 -7
- package/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.ts +15 -5
- package/src/commands/monitor/monitor.ts +41 -2
- package/src/commands/monitor/saveDatWriter/saveDatWriter.ts +7 -6
- package/src/exec.ts +7 -8
- package/src/utils.ts +4 -4
- package/src/validateNodeVersion.ts +3 -3
- package/tsconfig.eslint.json +0 -2
- package/update.sh +5 -1
- package/dist/src/commands/monitor/getTSConfigInclude.js +0 -53
- package/dist/src/commands/monitor/getTSConfigInclude.js.map +0 -1
- package/src/commands/monitor/getTSConfigInclude.ts +0 -32
package/.cspell.json
CHANGED
package/.prettierrc.js
CHANGED
|
@@ -7,7 +7,7 @@ module.exports = {
|
|
|
7
7
|
// The Airbnb style guide agrees:
|
|
8
8
|
// https://github.com/airbnb/javascript#commas--dangling
|
|
9
9
|
// Prettier itself also acknowledges Nik Graf's blog in their official blog:
|
|
10
|
-
// https://prettier.io/blog/2020/03/21/2.0.0.html
|
|
10
|
+
// https://prettier.io/blog/2020/03/21/2.0.0.html
|
|
11
11
|
// https://medium.com/@nikgraf/why-you-should-enforce-dangling-commas-for-multiline-statements-d034c98e36f8
|
|
12
12
|
// Prettier will change the default in the future:
|
|
13
13
|
// https://github.com/prettier/prettier/issues/9369
|
package/.vscode/settings.json
CHANGED
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"dist/**": true,
|
|
25
25
|
},
|
|
26
26
|
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
//
|
|
27
|
+
// -----------------
|
|
28
|
+
// Language settings
|
|
29
|
+
// -----------------
|
|
30
30
|
|
|
31
31
|
// By default, VSCode will not automatically fill-in function arguments
|
|
32
32
|
"javascript.suggest.completeFunctionCalls": true,
|
|
@@ -49,6 +49,11 @@
|
|
|
49
49
|
"editor.formatOnSave": true,
|
|
50
50
|
"editor.tabSize": 2,
|
|
51
51
|
},
|
|
52
|
+
"[markdown]": {
|
|
53
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
54
|
+
"editor.formatOnSave": true,
|
|
55
|
+
"editor.tabSize": 2
|
|
56
|
+
},
|
|
52
57
|
"[xml]": {
|
|
53
58
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
54
59
|
"editor.formatOnSave": true,
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.42",
|
|
4
4
|
"description": "A command line tool for managing Isaac mods written in TypeScript",
|
|
5
5
|
"homepage": "https://isaacscript.github.io/",
|
|
6
6
|
"bugs": {
|
|
@@ -16,22 +16,22 @@
|
|
|
16
16
|
"isaacscript": "./dist/src/main.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@types/node": "^17.0.
|
|
19
|
+
"@types/node": "^17.0.31",
|
|
20
20
|
"chalk": "4.1.2",
|
|
21
21
|
"command-exists": "^1.2.9",
|
|
22
22
|
"dotenv": "^16.0.0",
|
|
23
23
|
"figlet": "^1.5.2",
|
|
24
24
|
"fs-extra": "^10.1.0",
|
|
25
|
-
"isaacscript-tsconfig": "^1.1.
|
|
25
|
+
"isaacscript-tsconfig": "^1.1.12",
|
|
26
26
|
"jsonc-parser": "^3.0.0",
|
|
27
27
|
"moment": "^2.29.3",
|
|
28
|
-
"npm-check-updates": "^12.5.
|
|
28
|
+
"npm-check-updates": "^12.5.11",
|
|
29
29
|
"prompt": "^1.3.0",
|
|
30
30
|
"source-map": "^0.7.3",
|
|
31
31
|
"source-map-support": "^0.5.21",
|
|
32
|
-
"sync-directory": "^
|
|
32
|
+
"sync-directory": "^5.0.5",
|
|
33
33
|
"ts-node": "^10.7.0",
|
|
34
|
-
"typescript": "^4.6.
|
|
34
|
+
"typescript": "^4.6.4",
|
|
35
35
|
"typescript-to-lua": "^1.4.3",
|
|
36
36
|
"update-notifier": "^5.1.0",
|
|
37
37
|
"yaml": "^2.0.1",
|
|
@@ -45,6 +45,6 @@
|
|
|
45
45
|
"@types/source-map-support": "^0.5.4",
|
|
46
46
|
"@types/update-notifier": "^5.1.0",
|
|
47
47
|
"@types/yargs": "^17.0.10",
|
|
48
|
-
"isaacscript-lint": "^1.0.
|
|
48
|
+
"isaacscript-lint": "^1.0.104"
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -5,16 +5,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const sync_directory_1 = __importDefault(require("sync-directory"));
|
|
7
7
|
const constants_1 = require("../../../constants");
|
|
8
|
+
const SUBPROCESS_NAME = "directory syncer";
|
|
9
|
+
const BASE_ARGV_LENGTH = 2;
|
|
8
10
|
let modSourcePath;
|
|
9
11
|
let modTargetPath;
|
|
10
12
|
init();
|
|
11
13
|
function init() {
|
|
12
|
-
const
|
|
13
|
-
if (
|
|
14
|
-
throw new Error(
|
|
14
|
+
const firstArg = process.argv[BASE_ARGV_LENGTH];
|
|
15
|
+
if (firstArg === undefined) {
|
|
16
|
+
throw new Error(`The ${SUBPROCESS_NAME} process did not get a valid first argument.`);
|
|
15
17
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
const secondArg = process.argv[BASE_ARGV_LENGTH + 1];
|
|
19
|
+
if (secondArg === undefined) {
|
|
20
|
+
throw new Error(`The ${SUBPROCESS_NAME} process did not get the right amount of arguments.`);
|
|
21
|
+
}
|
|
22
|
+
modSourcePath = firstArg;
|
|
23
|
+
modTargetPath = secondArg;
|
|
18
24
|
(0, sync_directory_1.default)(modSourcePath, modTargetPath, {
|
|
19
25
|
watch: true,
|
|
20
26
|
type: "copy",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modDirectorySyncer.js","sourceRoot":"","sources":["../../../../../src/commands/monitor/modDirectorySyncer/modDirectorySyncer.ts"],"names":[],"mappings":";;;;;AAAA,oEAA2C;AAC3C,kDAAyD;AAEzD,IAAI,aAAqB,CAAC;AAC1B,IAAI,aAAqB,CAAC;AAE1B,IAAI,EAAE,CAAC;AAEP,SAAS,IAAI;IACX,MAAM,
|
|
1
|
+
{"version":3,"file":"modDirectorySyncer.js","sourceRoot":"","sources":["../../../../../src/commands/monitor/modDirectorySyncer/modDirectorySyncer.ts"],"names":[],"mappings":";;;;;AAAA,oEAA2C;AAC3C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,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACnB;AACH,CAAC"}
|
|
@@ -29,12 +29,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.monitor = void 0;
|
|
30
30
|
const chalk_1 = __importDefault(require("chalk"));
|
|
31
31
|
const child_process_1 = require("child_process");
|
|
32
|
+
const JSONC = __importStar(require("jsonc-parser"));
|
|
32
33
|
const path_1 = __importDefault(require("path"));
|
|
33
34
|
const constants_1 = require("../../constants");
|
|
34
35
|
const file = __importStar(require("../../file"));
|
|
35
36
|
const utils_1 = require("../../utils");
|
|
36
37
|
const copyWatcherMod_1 = require("./copyWatcherMod");
|
|
37
|
-
const getTSConfigInclude_1 = require("./getTSConfigInclude");
|
|
38
38
|
const notifyGame = __importStar(require("./notifyGame"));
|
|
39
39
|
const spawnSaveDatWriter_1 = require("./spawnSaveDatWriter");
|
|
40
40
|
const touchWatcherSaveDatFiles_1 = require("./touchWatcherSaveDatFiles");
|
|
@@ -48,7 +48,7 @@ function monitor(argv, config) {
|
|
|
48
48
|
config.saveSlot = argv.saveSlot; // eslint-disable-line no-param-reassign
|
|
49
49
|
}
|
|
50
50
|
// Read the "tsconfig.json" file
|
|
51
|
-
const tsConfigInclude = (
|
|
51
|
+
const tsConfigInclude = getFirstTSConfigIncludePath(verbose);
|
|
52
52
|
const resolvedIncludePath = path_1.default.resolve(constants_1.CWD, tsConfigInclude);
|
|
53
53
|
const modTargetDirectoryName = (0, utils_1.getModTargetDirectoryName)(config);
|
|
54
54
|
const modTargetPath = path_1.default.join(config.modsDirectory, modTargetDirectoryName);
|
|
@@ -142,4 +142,26 @@ function spawnTSTLWatcher() {
|
|
|
142
142
|
(0, utils_1.error)(`Error: ${processDescription} subprocess exited with code: ${code}`);
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
|
+
function getFirstTSConfigIncludePath(verbose) {
|
|
146
|
+
const tsConfigRaw = file.read(constants_1.TSCONFIG_PATH, verbose);
|
|
147
|
+
let tsConfig;
|
|
148
|
+
try {
|
|
149
|
+
tsConfig = JSONC.parse(tsConfigRaw);
|
|
150
|
+
}
|
|
151
|
+
catch (err) {
|
|
152
|
+
(0, utils_1.error)(`Failed to parse "${chalk_1.default.green(constants_1.TSCONFIG_PATH)}":`, err);
|
|
153
|
+
}
|
|
154
|
+
const include = tsConfig.include;
|
|
155
|
+
if (include === undefined) {
|
|
156
|
+
(0, utils_1.error)(`Your "${chalk_1.default.green(constants_1.TSCONFIG_PATH)}" file does not have an "include" property, which is surely a mistake. Delete the file and re-run ${constants_1.PROJECT_NAME}.`);
|
|
157
|
+
}
|
|
158
|
+
if (!Array.isArray(include)) {
|
|
159
|
+
(0, utils_1.error)(`Your "${chalk_1.default.green(constants_1.TSCONFIG_PATH)}" file has an "include" property that is not an array, which is surely a mistake. Delete the file and re-run ${constants_1.PROJECT_NAME}.`);
|
|
160
|
+
}
|
|
161
|
+
const firstInclude = include[0];
|
|
162
|
+
if (firstInclude === undefined) {
|
|
163
|
+
(0, utils_1.error)(`Your "${chalk_1.default.green(constants_1.TSCONFIG_PATH)}" file has an empty "include" property, which is surely a mistake. Delete the file and re-run ${constants_1.PROJECT_NAME}.`);
|
|
164
|
+
}
|
|
165
|
+
return firstInclude;
|
|
166
|
+
}
|
|
145
167
|
//# sourceMappingURL=monitor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monitor.js","sourceRoot":"","sources":["../../../../src/commands/monitor/monitor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,iDAA4C;AAC5C,gDAAwB;AACxB,+
|
|
1
|
+
{"version":3,"file":"monitor.js","sourceRoot":"","sources":["../../../../src/commands/monitor/monitor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,iDAA4C;AAC5C,oDAAsC;AACtC,gDAAwB;AACxB,+CAOyB;AACzB,iDAAmC;AAEnC,u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AED,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;IACjC,IAAI,OAAO,KAAK,SAAS,EAAE;QACzB,IAAA,aAAK,EACH,SAAS,eAAK,CAAC,KAAK,CAClB,yBAAa,CACd,qGAAqG,wBAAY,GAAG,CACtH,CAAC;KACH;IAED,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC3B,IAAA,aAAK,EACH,SAAS,eAAK,CAAC,KAAK,CAClB,yBAAa,CACd,gHAAgH,wBAAY,GAAG,CACjI,CAAC;KACH;IAED,MAAM,YAAY,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAChC,IAAI,YAAY,KAAK,SAAS,EAAE;QAC9B,IAAA,aAAK,EACH,SAAS,eAAK,CAAC,KAAK,CAClB,yBAAa,CACd,iGAAiG,wBAAY,GAAG,CAClH,CAAC;KACH;IAED,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
|
@@ -31,18 +31,19 @@ const path_1 = __importDefault(require("path"));
|
|
|
31
31
|
const constants_1 = require("../../../constants");
|
|
32
32
|
const file = __importStar(require("../../../file"));
|
|
33
33
|
const utils_1 = require("../../../utils");
|
|
34
|
+
const SUBPROCESS_NAME = "save#.dat writer";
|
|
35
|
+
const BASE_ARGV_LENGTH = 2;
|
|
34
36
|
const MAX_MESSAGES = 100;
|
|
35
37
|
const VERBOSE = false;
|
|
36
38
|
let saveDatPath;
|
|
37
39
|
let saveDatFileName;
|
|
38
40
|
init(VERBOSE);
|
|
39
41
|
function init(verbose) {
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
process.exit(1);
|
|
42
|
+
const firstArg = process.argv[BASE_ARGV_LENGTH];
|
|
43
|
+
if (firstArg === undefined) {
|
|
44
|
+
throw new Error(`The ${SUBPROCESS_NAME} process did not get a valid first argument.`);
|
|
44
45
|
}
|
|
45
|
-
saveDatPath =
|
|
46
|
+
saveDatPath = firstArg;
|
|
46
47
|
saveDatFileName = path_1.default.basename(saveDatPath);
|
|
47
48
|
// Check to see if the data directory exists
|
|
48
49
|
const watcherModDataPath = path_1.default.dirname(saveDatPath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saveDatWriter.js","sourceRoot":"","sources":["../../../../../src/commands/monitor/saveDatWriter/saveDatWriter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AACtC,gDAAwB;AACxB,kDAAkD;AAClD,oDAAsC;AACtC,0CAAgD;AAGhD,MAAM,YAAY,GAAG,GAAG,CAAC;AACzB,MAAM,OAAO,GAAG,KAAK,CAAC;AAEtB,IAAI,WAAmB,CAAC;AACxB,IAAI,eAAuB,CAAC;AAE5B,IAAI,CAAC,OAAO,CAAC,CAAC;AAEd,SAAS,IAAI,CAAC,OAAgB;IAC5B,MAAM,
|
|
1
|
+
{"version":3,"file":"saveDatWriter.js","sourceRoot":"","sources":["../../../../../src/commands/monitor/saveDatWriter/saveDatWriter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AACtC,gDAAwB;AACxB,kDAAkD;AAClD,oDAAsC;AACtC,0CAAgD;AAGhD,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAC3C,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,MAAM,YAAY,GAAG,GAAG,CAAC;AACzB,MAAM,OAAO,GAAG,KAAK,CAAC;AAEtB,IAAI,WAAmB,CAAC;AACxB,IAAI,eAAuB,CAAC;AAE5B,IAAI,CAAC,OAAO,CAAC,CAAC;AAEd,SAAS,IAAI,CAAC,OAAgB;IAC5B,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAChD,IAAI,QAAQ,KAAK,SAAS,EAAE;QAC1B,MAAM,IAAI,KAAK,CACb,OAAO,eAAe,8CAA8C,CACrE,CAAC;KACH;IAED,WAAW,GAAG,QAAQ,CAAC;IACvB,eAAe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F,0BAA0B,eAAe,6DAA6D,wBAAY,iBAAiB,CACpI,CAAC;YACF,IAAI,CAAC,oCAAoC,GAAG,EAAE,CAAC,CAAC;YAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACjB;QAED,IAAI,CACF,eAAe,eAAe,8CAA8C,UAAU,mCAAmC,CAC1H,CAAC;QACF,UAAU,CAAC,GAAG,EAAE;YACd,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,GAAG,CAAC,CAAC,CAAC;QACxC,CAAC,EAAE,GAAG,CAAC,CAAC;KACT;AACH,CAAC;AAED,SAAS,IAAI,CAAC,GAAW;IACvB,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE;QAC9B,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACnB;AACH,CAAC"}
|
package/dist/src/exec.js
CHANGED
|
@@ -57,13 +57,12 @@ function execShell(command, args = [], verbose = false, allowFailure = false, cw
|
|
|
57
57
|
if (command.includes('"')) {
|
|
58
58
|
(0, utils_1.error)("execShell cannot execute commands with double quotes in the command.");
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
args[i] = `"${args[i]}"`; // eslint-disable-line no-param-reassign
|
|
60
|
+
const argsHasDoubleQuotes = args.some((arg) => arg.includes('"'));
|
|
61
|
+
if (argsHasDoubleQuotes) {
|
|
62
|
+
(0, utils_1.error)("execShell cannot execute commands with double quotes in the arguments.");
|
|
65
63
|
}
|
|
66
|
-
const
|
|
64
|
+
const quotedArgs = args.map((arg) => `"${arg}"`);
|
|
65
|
+
const commandDescription = `${command} ${quotedArgs.join(" ")}`.trim();
|
|
67
66
|
if (verbose) {
|
|
68
67
|
console.log(`Executing command: ${commandDescription}`);
|
|
69
68
|
}
|
package/dist/src/exec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../../src/exec.ts"],"names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AC,CAAC;AAC9B,CAAC;AAtED,8BAsEC"}
|
package/dist/src/utils.js
CHANGED
|
@@ -70,11 +70,11 @@ function parseSemVer(versionString) {
|
|
|
70
70
|
if (Number.isNaN(majorVersion)) {
|
|
71
71
|
error(`Failed to parse the major version number from: ${versionString}`);
|
|
72
72
|
}
|
|
73
|
-
const minorVersion =
|
|
73
|
+
const minorVersion = parseIntSafe(minorVersionString);
|
|
74
74
|
if (Number.isNaN(minorVersion)) {
|
|
75
75
|
error(`Failed to parse the minor version number from: ${versionString}`);
|
|
76
76
|
}
|
|
77
|
-
const patchVersion =
|
|
77
|
+
const patchVersion = parseIntSafe(patchVersionString);
|
|
78
78
|
if (Number.isNaN(patchVersion)) {
|
|
79
79
|
error(`Failed to parse the patch version number from: ${versionString}`);
|
|
80
80
|
}
|
package/dist/src/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,2CAAqD;AAGrD,mFAAmF;AACnF,MAAM,gBAAgB,GACpB,uEAAuE,CAAC;AAEnE,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,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AAY,CAAC,EAAE;QAC9B,KAAK,CAAC,kDAAkD,aAAa,EAAE,CAAC,CAAC;KAC1E;IAED,MAAM,YAAY,GAAG,YAAY,CAAC,kBAAkB,CAAC,CAAC;IACtD,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"}
|
|
@@ -12,12 +12,12 @@ const REQUIRED_NODE_JS_MAJOR_VERSION = 16;
|
|
|
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
|
-
const
|
|
16
|
-
const [majorVersion] = (0, utils_1.parseSemVer)(
|
|
15
|
+
const { version } = process;
|
|
16
|
+
const [majorVersion] = (0, utils_1.parseSemVer)(version);
|
|
17
17
|
if (majorVersion >= REQUIRED_NODE_JS_MAJOR_VERSION) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
console.error(`Your Node.js version is: ${chalk_1.default.red(
|
|
20
|
+
console.error(`Your Node.js version is: ${chalk_1.default.red(version)}`);
|
|
21
21
|
console.error(`${constants_1.PROJECT_NAME} requires a Node.js version of ${chalk_1.default.red(`${REQUIRED_NODE_JS_MAJOR_VERSION}.0.0`)} or greater.`);
|
|
22
22
|
console.error(`Please upgrade your version of Node.js before using ${constants_1.PROJECT_NAME}.`);
|
|
23
23
|
process.exit(1);
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC5B,MAAM,CAAC,YAAY,CAAC,GAAG,IAAA,mBAAW,EAAC,OAAO,CAAC,CAAC;IAE5C,IAAI,YAAY,IAAI,8BAA8B,EAAE;QAClD,OAAO;KACR;IAED,OAAO,CAAC,KAAK,CAAC,4BAA4B,eAAK,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAChE,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/eslint-debug.sh
ADDED
|
@@ -7,10 +7,10 @@ mod/main.lua
|
|
|
7
7
|
# MacOS artifacts
|
|
8
8
|
.DS_Store
|
|
9
9
|
|
|
10
|
-
#
|
|
10
|
+
# ------------------------------
|
|
11
11
|
# GitHub Node.gitignore template
|
|
12
|
-
# https://
|
|
13
|
-
#
|
|
12
|
+
# https://raw.githubusercontent.com/github/gitignore/master/Node.gitignore
|
|
13
|
+
# ------------------------------
|
|
14
14
|
|
|
15
15
|
# Logs
|
|
16
16
|
logs
|
|
@@ -19,6 +19,7 @@ npm-debug.log*
|
|
|
19
19
|
yarn-debug.log*
|
|
20
20
|
yarn-error.log*
|
|
21
21
|
lerna-debug.log*
|
|
22
|
+
.pnpm-debug.log*
|
|
22
23
|
|
|
23
24
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
24
25
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
@@ -67,6 +68,9 @@ web_modules/
|
|
|
67
68
|
# Optional eslint cache
|
|
68
69
|
.eslintcache
|
|
69
70
|
|
|
71
|
+
# Optional stylelint cache
|
|
72
|
+
.stylelintcache
|
|
73
|
+
|
|
70
74
|
# Microbundle cache
|
|
71
75
|
.rpt2_cache/
|
|
72
76
|
.rts2_cache_cjs/
|
|
@@ -82,9 +86,12 @@ web_modules/
|
|
|
82
86
|
# Yarn Integrity file
|
|
83
87
|
.yarn-integrity
|
|
84
88
|
|
|
85
|
-
# dotenv environment
|
|
89
|
+
# dotenv environment variable files
|
|
86
90
|
.env
|
|
87
|
-
.env.
|
|
91
|
+
.env.development.local
|
|
92
|
+
.env.test.local
|
|
93
|
+
.env.production.local
|
|
94
|
+
.env.local
|
|
88
95
|
|
|
89
96
|
# parcel-bundler cache (https://parceljs.org/)
|
|
90
97
|
.cache
|
|
@@ -107,6 +114,13 @@ dist
|
|
|
107
114
|
# vuepress build output
|
|
108
115
|
.vuepress/dist
|
|
109
116
|
|
|
117
|
+
# vuepress v2.x temp and cache directory
|
|
118
|
+
.temp
|
|
119
|
+
.cache
|
|
120
|
+
|
|
121
|
+
# Docusaurus cache and generated files
|
|
122
|
+
.docusaurus
|
|
123
|
+
|
|
110
124
|
# Serverless directories
|
|
111
125
|
.serverless/
|
|
112
126
|
|
|
@@ -7,7 +7,7 @@ module.exports = {
|
|
|
7
7
|
// The Airbnb style guide agrees:
|
|
8
8
|
// https://github.com/airbnb/javascript#commas--dangling
|
|
9
9
|
// Prettier itself also acknowledges Nik Graf's blog in their official blog:
|
|
10
|
-
// https://prettier.io/blog/2020/03/21/2.0.0.html
|
|
10
|
+
// https://prettier.io/blog/2020/03/21/2.0.0.html
|
|
11
11
|
// https://medium.com/@nikgraf/why-you-should-enforce-dangling-commas-for-multiline-statements-d034c98e36f8
|
|
12
12
|
// Prettier will change the default in the future:
|
|
13
13
|
// https://github.com/prettier/prettier/issues/9369
|
|
@@ -51,6 +51,11 @@
|
|
|
51
51
|
"editor.formatOnSave": true,
|
|
52
52
|
"editor.tabSize": 2,
|
|
53
53
|
},
|
|
54
|
+
"[markdown]": {
|
|
55
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
56
|
+
"editor.formatOnSave": true,
|
|
57
|
+
"editor.tabSize": 2
|
|
58
|
+
},
|
|
54
59
|
"[xml]": {
|
|
55
60
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
56
61
|
"editor.formatOnSave": true,
|
|
@@ -26,7 +26,7 @@ npx cspell --no-progress --no-summary "mod/metadata.xml"
|
|
|
26
26
|
|
|
27
27
|
# Step 4 - Use xmllint to lint XML files
|
|
28
28
|
# (and skip this step if xmllint is not currently installed for whatever reason)
|
|
29
|
-
if
|
|
29
|
+
if command -v xmllint &> /dev/null; then
|
|
30
30
|
find "$DIR/mod" -name "*.xml" -print0 | xargs -0 xmllint --noout
|
|
31
31
|
fi
|
|
32
32
|
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* When you write code that causes the game to crash, it can be difficult to find the exact line of
|
|
3
|
+
* code that is causing the crash.
|
|
4
|
+
*
|
|
5
|
+
* In these situations, you can enable this plugin, which will add a log statement in between every
|
|
6
|
+
* line of Lua code with a randomly-generated UUID. That way, you can cause the crash, and then look
|
|
7
|
+
* at the bottom of the "log.txt" for the final UUID that shows up.
|
|
8
|
+
*
|
|
9
|
+
* Next, you can Ctrl + f in the "main.lua" file for the matching UUID, which will bring you to the
|
|
10
|
+
* exact point in the code where the crash happened.
|
|
11
|
+
*/
|
|
12
|
+
|
|
1
13
|
import * as crypto from "crypto";
|
|
2
14
|
import { SourceNode } from "source-map";
|
|
3
15
|
import * as ts from "typescript";
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This plugin prevents transpiled enums from using global variables as a base (if present).
|
|
3
|
+
*
|
|
4
|
+
* For example, by default, the following enum:
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* export enum Foo {
|
|
8
|
+
* Value1,
|
|
9
|
+
* Value2,
|
|
10
|
+
* }
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Will be transpiled to this:
|
|
14
|
+
*
|
|
15
|
+
* ```lua
|
|
16
|
+
* local ____exports = {}
|
|
17
|
+
* ____exports.Foo = Foo or ({})
|
|
18
|
+
* ____exports.Foo.Value1 = 0
|
|
19
|
+
* ____exports.Foo[____exports.Foo.Value1] = "Value1"
|
|
20
|
+
* ____exports.Foo.Value2 = 1
|
|
21
|
+
* ____exports.Foo[____exports.Foo.Value2] = "Value2"
|
|
22
|
+
* return ____exports
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* As we can see, the first line uses the existing global variable of "Foo" as a base, if present.
|
|
26
|
+
* The reason it does this is because TSTL needs to support the TypeScript feature of combining
|
|
27
|
+
* enums, like this:
|
|
28
|
+
*
|
|
29
|
+
* ```ts
|
|
30
|
+
* enum Foo {
|
|
31
|
+
* Value1,
|
|
32
|
+
* }
|
|
33
|
+
* enum Foo {
|
|
34
|
+
* Value2,
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* Unfortunately, this design decision means that local enums will essentially turn into global
|
|
39
|
+
* variables. This plugin removes this behavior, always making enums local variables.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
import * as ts from "typescript";
|
|
43
|
+
import * as tstl from "typescript-to-lua";
|
|
44
|
+
|
|
45
|
+
const plugin: tstl.Plugin = {
|
|
46
|
+
visitors: {
|
|
47
|
+
[ts.SyntaxKind.EnumDeclaration]: (node, context) => {
|
|
48
|
+
// Call the normal TSTL enum transpilation method
|
|
49
|
+
const statements = context.superTransformStatements(node);
|
|
50
|
+
|
|
51
|
+
// Create a new element, which will be equal to:
|
|
52
|
+
// local ____exports.Foo = {}
|
|
53
|
+
const name = node.name.escapedText as string;
|
|
54
|
+
const identifier = tstl.createIdentifier(name, node.name);
|
|
55
|
+
const table = tstl.createTableExpression();
|
|
56
|
+
const declaration = tstl.createVariableDeclarationStatement(
|
|
57
|
+
identifier,
|
|
58
|
+
table,
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
// Swap the old first element, which will be equal to:
|
|
62
|
+
// local ____exports.Foo = Foo or ({})
|
|
63
|
+
statements[0] = declaration;
|
|
64
|
+
|
|
65
|
+
return statements;
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export default plugin;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// A special TypeScript
|
|
1
|
+
// A special TypeScript configuration file, used by ESLint only
|
|
2
2
|
{
|
|
3
3
|
"extends": "./tsconfig.json",
|
|
4
4
|
"include": [
|
|
5
|
-
//
|
|
5
|
+
// This must match the "include" setting in the "tsconfig.json" file
|
|
6
6
|
"./src/**/*.ts",
|
|
7
7
|
|
|
8
8
|
// These are ESLint-only inclusions
|
|
@@ -21,9 +21,12 @@
|
|
|
21
21
|
"luaBundle": "./mod/main.lua", // Will bundle all output Lua files into a single file
|
|
22
22
|
"luaBundleEntry": "./src/bundleEntry.ts", // This invokes the "main.ts" file
|
|
23
23
|
"luaPlugins": [
|
|
24
|
-
// A plugin to
|
|
24
|
+
// A plugin to add an explanatory comment at the top of the compiled "main.lua" file
|
|
25
25
|
{ "name": "./plugins/addIsaacScriptCommentHeader.ts" },
|
|
26
26
|
|
|
27
|
+
// A plugin to make enums safe from global variables
|
|
28
|
+
{ "name": "./plugins/noExtendedEnums.ts" },
|
|
29
|
+
|
|
27
30
|
// Uncomment this and recompile the mod to enable crash debugging, which will tell you the
|
|
28
31
|
// exact line of the mod that is causing the crash
|
|
29
32
|
// { "name": "./plugins/addCrashDebugStatements.ts" },
|
|
@@ -13,5 +13,9 @@ OLD_HASH=$(md5sum "$PACKAGE_JSON")
|
|
|
13
13
|
npx npm-check-updates --upgrade --packageFile "$PACKAGE_JSON"
|
|
14
14
|
NEW_HASH=$(md5sum "$PACKAGE_JSON")
|
|
15
15
|
if [[ $OLD_HASH != $NEW_HASH ]]; then
|
|
16
|
-
|
|
16
|
+
if test -f "$DIR/yarn.lock"; then
|
|
17
|
+
yarn
|
|
18
|
+
else
|
|
19
|
+
npm install
|
|
20
|
+
fi
|
|
17
21
|
fi
|
package/lint.sh
CHANGED
|
@@ -26,4 +26,10 @@ npx cspell --no-progress --no-summary "src/**/*.ts"
|
|
|
26
26
|
# The "--error" flag makes it return an error code of 1 if unused exports are found
|
|
27
27
|
npx ts-prune --error
|
|
28
28
|
|
|
29
|
+
# Step 5 - Check for gitignore updates from GitHub
|
|
30
|
+
tail -n +6 .gitignore > gitignore-template-local
|
|
31
|
+
curl https://raw.githubusercontent.com/github/gitignore/master/Node.gitignore --output gitignore-template-github --silent
|
|
32
|
+
diff gitignore-template-local gitignore-template-github
|
|
33
|
+
rm -f gitignore-template-local gitignore-template-github
|
|
34
|
+
|
|
29
35
|
echo "Successfully linted in $SECONDS seconds."
|
package/nuke.sh
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.42",
|
|
4
4
|
"description": "A command line tool for managing Isaac mods written in TypeScript",
|
|
5
5
|
"homepage": "https://isaacscript.github.io/",
|
|
6
6
|
"bugs": {
|
|
@@ -16,22 +16,22 @@
|
|
|
16
16
|
"isaacscript": "./dist/src/main.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@types/node": "^17.0.
|
|
19
|
+
"@types/node": "^17.0.31",
|
|
20
20
|
"chalk": "4.1.2",
|
|
21
21
|
"command-exists": "^1.2.9",
|
|
22
22
|
"dotenv": "^16.0.0",
|
|
23
23
|
"figlet": "^1.5.2",
|
|
24
24
|
"fs-extra": "^10.1.0",
|
|
25
|
-
"isaacscript-tsconfig": "^1.1.
|
|
25
|
+
"isaacscript-tsconfig": "^1.1.12",
|
|
26
26
|
"jsonc-parser": "^3.0.0",
|
|
27
27
|
"moment": "^2.29.3",
|
|
28
|
-
"npm-check-updates": "^12.5.
|
|
28
|
+
"npm-check-updates": "^12.5.11",
|
|
29
29
|
"prompt": "^1.3.0",
|
|
30
30
|
"source-map": "^0.7.3",
|
|
31
31
|
"source-map-support": "^0.5.21",
|
|
32
|
-
"sync-directory": "^
|
|
32
|
+
"sync-directory": "^5.0.5",
|
|
33
33
|
"ts-node": "^10.7.0",
|
|
34
|
-
"typescript": "^4.6.
|
|
34
|
+
"typescript": "^4.6.4",
|
|
35
35
|
"typescript-to-lua": "^1.4.3",
|
|
36
36
|
"update-notifier": "^5.1.0",
|
|
37
37
|
"yaml": "^2.0.1",
|
|
@@ -45,6 +45,6 @@
|
|
|
45
45
|
"@types/source-map-support": "^0.5.4",
|
|
46
46
|
"@types/update-notifier": "^5.1.0",
|
|
47
47
|
"@types/yargs": "^17.0.10",
|
|
48
|
-
"isaacscript-lint": "^1.0.
|
|
48
|
+
"isaacscript-lint": "^1.0.104"
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
import syncDirectory from "sync-directory";
|
|
2
2
|
import { FILE_SYNCED_MESSAGE } from "../../../constants";
|
|
3
3
|
|
|
4
|
+
const SUBPROCESS_NAME = "directory syncer";
|
|
5
|
+
const BASE_ARGV_LENGTH = 2;
|
|
6
|
+
|
|
4
7
|
let modSourcePath: string;
|
|
5
8
|
let modTargetPath: string;
|
|
6
9
|
|
|
7
10
|
init();
|
|
8
11
|
|
|
9
12
|
function init() {
|
|
10
|
-
const
|
|
11
|
-
if (
|
|
13
|
+
const firstArg = process.argv[BASE_ARGV_LENGTH];
|
|
14
|
+
if (firstArg === undefined) {
|
|
15
|
+
throw new Error(
|
|
16
|
+
`The ${SUBPROCESS_NAME} process did not get a valid first argument.`,
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const secondArg = process.argv[BASE_ARGV_LENGTH + 1];
|
|
21
|
+
if (secondArg === undefined) {
|
|
12
22
|
throw new Error(
|
|
13
|
-
|
|
23
|
+
`The ${SUBPROCESS_NAME} process did not get the right amount of arguments.`,
|
|
14
24
|
);
|
|
15
25
|
}
|
|
16
26
|
|
|
17
|
-
modSourcePath =
|
|
18
|
-
modTargetPath =
|
|
27
|
+
modSourcePath = firstArg;
|
|
28
|
+
modTargetPath = secondArg;
|
|
19
29
|
|
|
20
30
|
syncDirectory(modSourcePath, modTargetPath, {
|
|
21
31
|
watch: true,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import { fork, spawn } from "child_process";
|
|
3
|
+
import * as JSONC from "jsonc-parser";
|
|
3
4
|
import path from "path";
|
|
4
5
|
import {
|
|
5
6
|
CWD,
|
|
@@ -7,12 +8,12 @@ import {
|
|
|
7
8
|
MAIN_LUA,
|
|
8
9
|
MOD_SOURCE_PATH,
|
|
9
10
|
PROJECT_NAME,
|
|
11
|
+
TSCONFIG_PATH,
|
|
10
12
|
} from "../../constants";
|
|
11
13
|
import * as file from "../../file";
|
|
12
14
|
import { Config } from "../../types/Config";
|
|
13
15
|
import { error, getModTargetDirectoryName } from "../../utils";
|
|
14
16
|
import { copyWatcherMod } from "./copyWatcherMod";
|
|
15
|
-
import { getTSConfigInclude } from "./getTSConfigInclude";
|
|
16
17
|
import * as notifyGame from "./notifyGame";
|
|
17
18
|
import { spawnSaveDatWriter } from "./spawnSaveDatWriter";
|
|
18
19
|
import { touchWatcherSaveDatFiles } from "./touchWatcherSaveDatFiles";
|
|
@@ -29,7 +30,7 @@ export function monitor(argv: Record<string, unknown>, config: Config): void {
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
// Read the "tsconfig.json" file
|
|
32
|
-
const tsConfigInclude =
|
|
33
|
+
const tsConfigInclude = getFirstTSConfigIncludePath(verbose);
|
|
33
34
|
const resolvedIncludePath = path.resolve(CWD, tsConfigInclude);
|
|
34
35
|
const modTargetDirectoryName = getModTargetDirectoryName(config);
|
|
35
36
|
const modTargetPath = path.join(config.modsDirectory, modTargetDirectoryName);
|
|
@@ -140,3 +141,41 @@ function spawnTSTLWatcher() {
|
|
|
140
141
|
error(`Error: ${processDescription} subprocess exited with code: ${code}`);
|
|
141
142
|
});
|
|
142
143
|
}
|
|
144
|
+
|
|
145
|
+
function getFirstTSConfigIncludePath(verbose: boolean): string {
|
|
146
|
+
const tsConfigRaw = file.read(TSCONFIG_PATH, verbose);
|
|
147
|
+
let tsConfig: Record<string, string[]>;
|
|
148
|
+
try {
|
|
149
|
+
tsConfig = JSONC.parse(tsConfigRaw) as Record<string, string[]>;
|
|
150
|
+
} catch (err) {
|
|
151
|
+
error(`Failed to parse "${chalk.green(TSCONFIG_PATH)}":`, err);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const include = tsConfig.include;
|
|
155
|
+
if (include === undefined) {
|
|
156
|
+
error(
|
|
157
|
+
`Your "${chalk.green(
|
|
158
|
+
TSCONFIG_PATH,
|
|
159
|
+
)}" file does not have an "include" property, which is surely a mistake. Delete the file and re-run ${PROJECT_NAME}.`,
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (!Array.isArray(include)) {
|
|
164
|
+
error(
|
|
165
|
+
`Your "${chalk.green(
|
|
166
|
+
TSCONFIG_PATH,
|
|
167
|
+
)}" file has an "include" property that is not an array, which is surely a mistake. Delete the file and re-run ${PROJECT_NAME}.`,
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const firstInclude = include[0];
|
|
172
|
+
if (firstInclude === undefined) {
|
|
173
|
+
error(
|
|
174
|
+
`Your "${chalk.green(
|
|
175
|
+
TSCONFIG_PATH,
|
|
176
|
+
)}" file has an empty "include" property, which is surely a mistake. Delete the file and re-run ${PROJECT_NAME}.`,
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return firstInclude;
|
|
181
|
+
}
|
|
@@ -5,6 +5,8 @@ import * as file from "../../../file";
|
|
|
5
5
|
import { ensureAllCases } from "../../../utils";
|
|
6
6
|
import { SaveDatMessage, SaveDatMessageType } from "./types";
|
|
7
7
|
|
|
8
|
+
const SUBPROCESS_NAME = "save#.dat writer";
|
|
9
|
+
const BASE_ARGV_LENGTH = 2;
|
|
8
10
|
const MAX_MESSAGES = 100;
|
|
9
11
|
const VERBOSE = false;
|
|
10
12
|
|
|
@@ -14,15 +16,14 @@ let saveDatFileName: string;
|
|
|
14
16
|
init(VERBOSE);
|
|
15
17
|
|
|
16
18
|
function init(verbose: boolean) {
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const firstArg = process.argv[BASE_ARGV_LENGTH];
|
|
20
|
+
if (firstArg === undefined) {
|
|
21
|
+
throw new Error(
|
|
22
|
+
`The ${SUBPROCESS_NAME} process did not get a valid first argument.`,
|
|
21
23
|
);
|
|
22
|
-
process.exit(1);
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
saveDatPath =
|
|
26
|
+
saveDatPath = firstArg;
|
|
26
27
|
saveDatFileName = path.basename(saveDatPath);
|
|
27
28
|
|
|
28
29
|
// Check to see if the data directory exists
|
package/src/exec.ts
CHANGED
|
@@ -68,17 +68,16 @@ export function execShell(
|
|
|
68
68
|
"execShell cannot execute commands with double quotes in the command.",
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
|
-
for (let i = 0; i < args.length; i++) {
|
|
72
|
-
if (args[i].includes('"')) {
|
|
73
|
-
error(
|
|
74
|
-
"execShell cannot execute commands with double quotes in the arguments.",
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
71
|
|
|
78
|
-
|
|
72
|
+
const argsHasDoubleQuotes = args.some((arg) => arg.includes('"'));
|
|
73
|
+
if (argsHasDoubleQuotes) {
|
|
74
|
+
error(
|
|
75
|
+
"execShell cannot execute commands with double quotes in the arguments.",
|
|
76
|
+
);
|
|
79
77
|
}
|
|
80
78
|
|
|
81
|
-
const
|
|
79
|
+
const quotedArgs = args.map((arg) => `"${arg}"`);
|
|
80
|
+
const commandDescription = `${command} ${quotedArgs.join(" ")}`.trim();
|
|
82
81
|
|
|
83
82
|
if (verbose) {
|
|
84
83
|
console.log(`Executing command: ${commandDescription}`);
|
package/src/utils.ts
CHANGED
|
@@ -36,7 +36,7 @@ export function isKebabCase(s: string): boolean {
|
|
|
36
36
|
* parseIntSafe is a more reliable version of parseInt. By default, "parseInt('1a')" will return
|
|
37
37
|
* "1", which is unexpected. This returns either an integer or NaN.
|
|
38
38
|
*/
|
|
39
|
-
export function parseIntSafe(input:
|
|
39
|
+
export function parseIntSafe(input: unknown): number {
|
|
40
40
|
if (typeof input !== "string") {
|
|
41
41
|
return NaN;
|
|
42
42
|
}
|
|
@@ -65,7 +65,7 @@ export function parseIntSafe(input: string): number {
|
|
|
65
65
|
|
|
66
66
|
export function parseSemVer(
|
|
67
67
|
versionString: string,
|
|
68
|
-
): [
|
|
68
|
+
): [majorVersion: number, minorVersion: number, patchVersion: number] {
|
|
69
69
|
const match = /^v*(\d+)\.(\d+)\.(\d+)/g.exec(versionString);
|
|
70
70
|
if (match === null) {
|
|
71
71
|
error(`Failed to parse the version string of: ${versionString}`);
|
|
@@ -78,12 +78,12 @@ export function parseSemVer(
|
|
|
78
78
|
error(`Failed to parse the major version number from: ${versionString}`);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
const minorVersion =
|
|
81
|
+
const minorVersion = parseIntSafe(minorVersionString);
|
|
82
82
|
if (Number.isNaN(minorVersion)) {
|
|
83
83
|
error(`Failed to parse the minor version number from: ${versionString}`);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
const patchVersion =
|
|
86
|
+
const patchVersion = parseIntSafe(patchVersionString);
|
|
87
87
|
if (Number.isNaN(patchVersion)) {
|
|
88
88
|
error(`Failed to parse the patch version number from: ${versionString}`);
|
|
89
89
|
}
|
|
@@ -8,14 +8,14 @@ const REQUIRED_NODE_JS_MAJOR_VERSION = 16;
|
|
|
8
8
|
// since that is the version that added the "fs.rmSync()" function
|
|
9
9
|
// (I tested on Node v15.0.0 and it failed)
|
|
10
10
|
export function validateNodeVersion(): void {
|
|
11
|
-
const
|
|
12
|
-
const [majorVersion] = parseSemVer(
|
|
11
|
+
const { version } = process;
|
|
12
|
+
const [majorVersion] = parseSemVer(version);
|
|
13
13
|
|
|
14
14
|
if (majorVersion >= REQUIRED_NODE_JS_MAJOR_VERSION) {
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
console.error(`Your Node.js version is: ${chalk.red(
|
|
18
|
+
console.error(`Your Node.js version is: ${chalk.red(version)}`);
|
|
19
19
|
console.error(
|
|
20
20
|
`${PROJECT_NAME} requires a Node.js version of ${chalk.red(
|
|
21
21
|
`${REQUIRED_NODE_JS_MAJOR_VERSION}.0.0`,
|
package/tsconfig.eslint.json
CHANGED
package/update.sh
CHANGED
|
@@ -13,5 +13,9 @@ OLD_HASH=$(md5sum "$PACKAGE_JSON")
|
|
|
13
13
|
npx npm-check-updates --upgrade --packageFile "$PACKAGE_JSON" --reject chalk
|
|
14
14
|
NEW_HASH=$(md5sum "$PACKAGE_JSON")
|
|
15
15
|
if [[ $OLD_HASH != $NEW_HASH ]]; then
|
|
16
|
-
|
|
16
|
+
if test -f "$DIR/yarn.lock"; then
|
|
17
|
+
yarn
|
|
18
|
+
else
|
|
19
|
+
npm install
|
|
20
|
+
fi
|
|
17
21
|
fi
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.getTSConfigInclude = void 0;
|
|
30
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
31
|
-
const JSONC = __importStar(require("jsonc-parser"));
|
|
32
|
-
const constants_1 = require("../../constants");
|
|
33
|
-
const file = __importStar(require("../../file"));
|
|
34
|
-
const utils_1 = require("../../utils");
|
|
35
|
-
function getTSConfigInclude(verbose) {
|
|
36
|
-
const tsConfigRaw = file.read(constants_1.TSCONFIG_PATH, verbose);
|
|
37
|
-
let tsConfig;
|
|
38
|
-
try {
|
|
39
|
-
tsConfig = JSONC.parse(tsConfigRaw);
|
|
40
|
-
}
|
|
41
|
-
catch (err) {
|
|
42
|
-
(0, utils_1.error)(`Failed to parse "${chalk_1.default.green(constants_1.TSCONFIG_PATH)}":`, err);
|
|
43
|
-
}
|
|
44
|
-
if (!Object.prototype.hasOwnProperty.call(tsConfig, "include")) {
|
|
45
|
-
(0, utils_1.error)(`Your "${chalk_1.default.green(constants_1.TSCONFIG_PATH)}" file does not have an include directive, which is surely a mistake. Delete the file and re-run isaacscript.`);
|
|
46
|
-
}
|
|
47
|
-
if (tsConfig.include.length === 0) {
|
|
48
|
-
(0, utils_1.error)(`Your "${chalk_1.default.green(constants_1.TSCONFIG_PATH)}" file has an empty include directive, which is surely a mistake. Delete the file and re-run isaacscript.`);
|
|
49
|
-
}
|
|
50
|
-
return tsConfig.include[0];
|
|
51
|
-
}
|
|
52
|
-
exports.getTSConfigInclude = getTSConfigInclude;
|
|
53
|
-
//# sourceMappingURL=getTSConfigInclude.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getTSConfigInclude.js","sourceRoot":"","sources":["../../../../src/commands/monitor/getTSConfigInclude.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,oDAAsC;AACtC,+CAAgD;AAChD,iDAAmC;AACnC,uCAAoC;AAEpC,SAAgB,kBAAkB,CAAC,OAAgB;IACjD,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,yBAAa,EAAE,OAAO,CAAC,CAAC;IACtD,IAAI,QAAkC,CAAC;IACvC,IAAI;QACF,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAA6B,CAAC;KACjE;IAAC,OAAO,GAAG,EAAE;QACZ,IAAA,aAAK,EAAC,oBAAoB,eAAK,CAAC,KAAK,CAAC,yBAAa,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;KAChE;IAED,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE;QAC9D,IAAA,aAAK,EACH,SAAS,eAAK,CAAC,KAAK,CAClB,yBAAa,CACd,+GAA+G,CACjH,CAAC;KACH;IACD,IAAI,QAAQ,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;QACjC,IAAA,aAAK,EACH,SAAS,eAAK,CAAC,KAAK,CAClB,yBAAa,CACd,2GAA2G,CAC7G,CAAC;KACH;IAED,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC7B,CAAC;AAzBD,gDAyBC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
import * as JSONC from "jsonc-parser";
|
|
3
|
-
import { TSCONFIG_PATH } from "../../constants";
|
|
4
|
-
import * as file from "../../file";
|
|
5
|
-
import { error } from "../../utils";
|
|
6
|
-
|
|
7
|
-
export function getTSConfigInclude(verbose: boolean): string {
|
|
8
|
-
const tsConfigRaw = file.read(TSCONFIG_PATH, verbose);
|
|
9
|
-
let tsConfig: Record<string, string[]>;
|
|
10
|
-
try {
|
|
11
|
-
tsConfig = JSONC.parse(tsConfigRaw) as Record<string, string[]>;
|
|
12
|
-
} catch (err) {
|
|
13
|
-
error(`Failed to parse "${chalk.green(TSCONFIG_PATH)}":`, err);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (!Object.prototype.hasOwnProperty.call(tsConfig, "include")) {
|
|
17
|
-
error(
|
|
18
|
-
`Your "${chalk.green(
|
|
19
|
-
TSCONFIG_PATH,
|
|
20
|
-
)}" file does not have an include directive, which is surely a mistake. Delete the file and re-run isaacscript.`,
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
if (tsConfig.include.length === 0) {
|
|
24
|
-
error(
|
|
25
|
-
`Your "${chalk.green(
|
|
26
|
-
TSCONFIG_PATH,
|
|
27
|
-
)}" file has an empty include directive, which is surely a mistake. Delete the file and re-run isaacscript.`,
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return tsConfig.include[0];
|
|
32
|
-
}
|