isaacscript 1.2.40 → 1.2.43
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 +8 -8
- package/dist/src/checkForWindowsTerminalBugs.js +2 -2
- package/dist/src/checkForWindowsTerminalBugs.js.map +1 -1
- package/dist/src/commands/copy/copy.js +1 -1
- package/dist/src/commands/copy/copy.js.map +1 -1
- package/dist/src/commands/init/getModsDir.js +2 -2
- package/dist/src/commands/init/getModsDir.js.map +1 -1
- package/dist/src/commands/init/getProjectPath.js +2 -3
- package/dist/src/commands/init/getProjectPath.js.map +1 -1
- package/dist/src/commands/init/git.js +9 -4
- package/dist/src/commands/init/git.js.map +1 -1
- package/dist/src/commands/init/init.js +6 -6
- package/dist/src/commands/init/init.js.map +1 -1
- package/dist/src/commands/init/promptSaveSlot.js +3 -2
- package/dist/src/commands/init/promptSaveSlot.js.map +1 -1
- 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 +29 -7
- 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/commands/publish/publish.js +7 -7
- package/dist/src/commands/publish/publish.js.map +1 -1
- package/dist/src/configFile.js +2 -2
- package/dist/src/configFile.js.map +1 -1
- package/dist/src/exec.js +5 -6
- package/dist/src/exec.js.map +1 -1
- package/dist/src/main.js +2 -2
- package/dist/src/main.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/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 +8 -8
- package/src/checkForWindowsTerminalBugs.ts +2 -2
- package/src/commands/copy/copy.ts +1 -1
- package/src/commands/init/getModsDir.ts +2 -2
- package/src/commands/init/getProjectPath.ts +2 -3
- package/src/commands/init/git.ts +11 -10
- package/src/commands/init/init.ts +6 -6
- package/src/commands/init/promptSaveSlot.ts +3 -2
- package/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.ts +15 -5
- package/src/commands/monitor/monitor.ts +46 -7
- package/src/commands/monitor/saveDatWriter/saveDatWriter.ts +7 -6
- package/src/commands/publish/publish.ts +7 -7
- package/src/configFile.ts +2 -2
- package/src/exec.ts +7 -8
- package/src/main.ts +2 -2
- 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
|
@@ -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,29 +8,29 @@ 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";
|
|
19
20
|
|
|
20
21
|
export function monitor(argv: Record<string, unknown>, config: Config): void {
|
|
21
|
-
const verbose = argv
|
|
22
|
+
const verbose = argv["verbose"] === true;
|
|
22
23
|
|
|
23
24
|
// If they specified some command-line flags, override the values found in the config file
|
|
24
|
-
if (argv
|
|
25
|
-
config.modsDirectory = argv
|
|
25
|
+
if (argv["modsDirectory"] !== undefined) {
|
|
26
|
+
config.modsDirectory = argv["modsDirectory"] as string; // eslint-disable-line no-param-reassign
|
|
26
27
|
}
|
|
27
|
-
if (argv
|
|
28
|
-
config.saveSlot = argv
|
|
28
|
+
if (argv["saveSlot"] !== undefined) {
|
|
29
|
+
config.saveSlot = argv["saveSlot"] as number; // eslint-disable-line no-param-reassign
|
|
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
|
|
@@ -22,11 +22,11 @@ import { gitCommitIfChanges, isGitDirty } from "../init/git";
|
|
|
22
22
|
const UPDATE_SCRIPT_NAME = "update.sh";
|
|
23
23
|
|
|
24
24
|
export function publish(argv: Record<string, unknown>, config: Config): void {
|
|
25
|
-
const skipVersionIncrement = argv
|
|
26
|
-
const setVersion = argv
|
|
27
|
-
const dryRun = argv
|
|
28
|
-
const onlyUpload = argv
|
|
29
|
-
const verbose = argv
|
|
25
|
+
const skipVersionIncrement = argv["skip"] === true;
|
|
26
|
+
const setVersion = argv["setVersion"] as string | undefined;
|
|
27
|
+
const dryRun = argv["dryRun"] === true;
|
|
28
|
+
const onlyUpload = argv["onlyUpload"] === true;
|
|
29
|
+
const verbose = argv["verbose"] === true;
|
|
30
30
|
|
|
31
31
|
const modTargetDirectoryName = getModTargetDirectoryName(config);
|
|
32
32
|
const modTargetPath = path.join(config.modsDirectory, modTargetDirectoryName);
|
|
@@ -168,7 +168,7 @@ function getVersionFromPackageJSON(verbose: boolean) {
|
|
|
168
168
|
);
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
if (typeof packageJSON
|
|
171
|
+
if (typeof packageJSON["version"] !== "string") {
|
|
172
172
|
error(
|
|
173
173
|
`The "${chalk.green(
|
|
174
174
|
PACKAGE_JSON_PATH,
|
|
@@ -176,7 +176,7 @@ function getVersionFromPackageJSON(verbose: boolean) {
|
|
|
176
176
|
);
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
return packageJSON
|
|
179
|
+
return packageJSON["version"];
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
function bumpVersionInPackageJSON(version: string, verbose: boolean): string {
|
package/src/configFile.ts
CHANGED
|
@@ -9,8 +9,8 @@ import { Config } from "./types/Config";
|
|
|
9
9
|
import { error } from "./utils";
|
|
10
10
|
|
|
11
11
|
export async function get(argv: Record<string, unknown>): Promise<Config> {
|
|
12
|
-
const verbose = argv
|
|
13
|
-
const yes = argv
|
|
12
|
+
const verbose = argv["verbose"] === true;
|
|
13
|
+
const yes = argv["yes"] === true;
|
|
14
14
|
|
|
15
15
|
const existingConfig = readExistingConfig(verbose);
|
|
16
16
|
if (existingConfig !== undefined) {
|
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/main.ts
CHANGED
|
@@ -37,7 +37,7 @@ async function main(): Promise<void> {
|
|
|
37
37
|
|
|
38
38
|
// Get command line arguments
|
|
39
39
|
const argv = parseArgs();
|
|
40
|
-
const verbose = argv
|
|
40
|
+
const verbose = argv["verbose"] === true;
|
|
41
41
|
|
|
42
42
|
printBanner();
|
|
43
43
|
|
|
@@ -65,7 +65,7 @@ function printBanner() {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
async function handleCommands(argv: Record<string, unknown>, verbose: boolean) {
|
|
68
|
-
const positionalArgs = argv
|
|
68
|
+
const positionalArgs = argv["_"] as string[];
|
|
69
69
|
let command: Command;
|
|
70
70
|
if (positionalArgs.length > 0) {
|
|
71
71
|
command = positionalArgs[0] as Command;
|
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
|
-
}
|