isaacscript 2.0.4 → 2.0.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.
Files changed (150) hide show
  1. package/dist/src/commands/init/createMod.js +9 -9
  2. package/dist/src/commands/init/git.js +3 -3
  3. package/dist/src/commands/init/init.js +2 -2
  4. package/dist/src/commands/monitor/monitor.js +13 -13
  5. package/dist/src/commands/monitor/saveDatWriter/saveDatWriter.js +2 -2
  6. package/dist/src/configFile.js +1 -1
  7. package/dist/src/constants.js +12 -9
  8. package/dist/src/file.js +1 -1
  9. package/dist/src/main.js +3 -3
  10. package/dist/src/utils.js +5 -5
  11. package/dist/src/validateInIsaacScriptProject.js +1 -1
  12. package/package.json +11 -6
  13. package/.cspell-base.json +0 -38
  14. package/.cspell-check-unused.json +0 -7
  15. package/.cspell.json +0 -53
  16. package/.eslintrc.js +0 -28
  17. package/.gitattributes +0 -9
  18. package/.github/workflows/ci.yml +0 -47
  19. package/.prettierignore +0 -5
  20. package/.prettierrc.js +0 -42
  21. package/.vscode/extensions.json +0 -9
  22. package/.vscode/settings.json +0 -73
  23. package/build.sh +0 -30
  24. package/check-file-updates.sh +0 -57
  25. package/check-gitignore.sh +0 -26
  26. package/check-orphaned-words.sh +0 -53
  27. package/dist/package.json +0 -50
  28. package/dist/src/checkForWindowsTerminalBugs.js.map +0 -1
  29. package/dist/src/commands/copy/copy.js.map +0 -1
  30. package/dist/src/commands/init/checkIfProjectPathExists.js.map +0 -1
  31. package/dist/src/commands/init/checkModSubdirectory.js.map +0 -1
  32. package/dist/src/commands/init/checkModTargetDirectory.js.map +0 -1
  33. package/dist/src/commands/init/createMod.js.map +0 -1
  34. package/dist/src/commands/init/getModsDir.js.map +0 -1
  35. package/dist/src/commands/init/getProjectPath.js.map +0 -1
  36. package/dist/src/commands/init/git.js.map +0 -1
  37. package/dist/src/commands/init/init.js.map +0 -1
  38. package/dist/src/commands/init/installVSCodeExtensions.js.map +0 -1
  39. package/dist/src/commands/init/promptSaveSlot.js.map +0 -1
  40. package/dist/src/commands/init/promptVSCode.js.map +0 -1
  41. package/dist/src/commands/monitor/copyWatcherMod.js.map +0 -1
  42. package/dist/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.js.map +0 -1
  43. package/dist/src/commands/monitor/monitor.js.map +0 -1
  44. package/dist/src/commands/monitor/notifyGame.js.map +0 -1
  45. package/dist/src/commands/monitor/saveDatWriter/saveDatWriter.js.map +0 -1
  46. package/dist/src/commands/monitor/saveDatWriter/types.js.map +0 -1
  47. package/dist/src/commands/monitor/spawnSaveDatWriter.js.map +0 -1
  48. package/dist/src/commands/monitor/touchWatcherSaveDatFiles.js.map +0 -1
  49. package/dist/src/commands/publish/publish.js.map +0 -1
  50. package/dist/src/configFile.js.map +0 -1
  51. package/dist/src/constants.js.map +0 -1
  52. package/dist/src/exec.js.map +0 -1
  53. package/dist/src/file.js.map +0 -1
  54. package/dist/src/main.js.map +0 -1
  55. package/dist/src/parseArgs.js.map +0 -1
  56. package/dist/src/prompt.js.map +0 -1
  57. package/dist/src/types/Command.js.map +0 -1
  58. package/dist/src/types/Config.js.map +0 -1
  59. package/dist/src/types/GitHubCLIHostsYAML.js.map +0 -1
  60. package/dist/src/utils.js.map +0 -1
  61. package/dist/src/validateInIsaacScriptProject.js.map +0 -1
  62. package/dist/src/validateNodeVersion.js.map +0 -1
  63. package/dist/src/validateOS.js.map +0 -1
  64. package/eslint-debug.sh +0 -11
  65. package/file-templates/dynamic/README.md +0 -3
  66. package/file-templates/dynamic/gitignore +0 -144
  67. package/file-templates/dynamic/main.ts +0 -19
  68. package/file-templates/dynamic/metadata.vdf +0 -6
  69. package/file-templates/dynamic/metadata.xml +0 -10
  70. package/file-templates/dynamic/package.json +0 -19
  71. package/file-templates/static/.cspell-check-unused.json +0 -9
  72. package/file-templates/static/.cspell.json.template +0 -9
  73. package/file-templates/static/.env_template +0 -2
  74. package/file-templates/static/.eslintrc.js +0 -24
  75. package/file-templates/static/.gitattributes +0 -9
  76. package/file-templates/static/.github/workflows/ci.yml +0 -53
  77. package/file-templates/static/.prettierignore +0 -14
  78. package/file-templates/static/.prettierrc.js +0 -42
  79. package/file-templates/static/.vscode/extensions.json +0 -10
  80. package/file-templates/static/.vscode/settings.json +0 -76
  81. package/file-templates/static/LICENSE +0 -674
  82. package/file-templates/static/build.sh +0 -15
  83. package/file-templates/static/check-orphaned-words.sh +0 -53
  84. package/file-templates/static/lint.sh +0 -39
  85. package/file-templates/static/nuke.sh +0 -18
  86. package/file-templates/static/plugins/addCrashDebugStatements.ts +0 -40
  87. package/file-templates/static/plugins/addIsaacScriptCommentHeader.ts +0 -37
  88. package/file-templates/static/plugins/noExtendedEnums.ts +0 -66
  89. package/file-templates/static/publish.sh +0 -10
  90. package/file-templates/static/run.sh +0 -10
  91. package/file-templates/static/src/bundleEntry.ts +0 -10
  92. package/file-templates/static/tsconfig.eslint.json +0 -11
  93. package/file-templates/static/tsconfig.json +0 -33
  94. package/file-templates/static/update.sh +0 -21
  95. package/file-templates/static-alt/.cspell-base.json +0 -38
  96. package/file-templates/static-alt/.cspell-check-unused-base.json +0 -7
  97. package/file-templates/static-alt/.prettierignore-base +0 -5
  98. package/file-templates/static-alt/.prettierrc-base.js +0 -30
  99. package/file-templates/static-alt/.vscode/extensions-typescript.json +0 -9
  100. package/file-templates/static-alt/.vscode/settings-typescript.json +0 -63
  101. package/isaacscript-watcher/.luacheckrc +0 -96
  102. package/isaacscript-watcher/README.md +0 -8
  103. package/isaacscript-watcher/main.lua +0 -270
  104. package/isaacscript-watcher/metadata.xml +0 -7
  105. package/isaacscript-watcher/resources/gfx/logo.anm2 +0 -27
  106. package/isaacscript-watcher/resources/gfx/logo.png +0 -0
  107. package/lint.sh +0 -38
  108. package/misc/logo.png +0 -0
  109. package/misc/mouseover.png +0 -0
  110. package/nuke.sh +0 -18
  111. package/publish.sh +0 -11
  112. package/src/checkForWindowsTerminalBugs.ts +0 -106
  113. package/src/commands/copy/copy.ts +0 -41
  114. package/src/commands/init/checkIfProjectPathExists.ts +0 -34
  115. package/src/commands/init/checkModSubdirectory.ts +0 -20
  116. package/src/commands/init/checkModTargetDirectory.ts +0 -42
  117. package/src/commands/init/createMod.ts +0 -196
  118. package/src/commands/init/getModsDir.ts +0 -107
  119. package/src/commands/init/getProjectPath.ts +0 -111
  120. package/src/commands/init/git.ts +0 -249
  121. package/src/commands/init/init.ts +0 -93
  122. package/src/commands/init/installVSCodeExtensions.ts +0 -47
  123. package/src/commands/init/promptSaveSlot.ts +0 -27
  124. package/src/commands/init/promptVSCode.ts +0 -33
  125. package/src/commands/monitor/copyWatcherMod.ts +0 -54
  126. package/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.ts +0 -67
  127. package/src/commands/monitor/monitor.ts +0 -180
  128. package/src/commands/monitor/notifyGame.ts +0 -59
  129. package/src/commands/monitor/saveDatWriter/saveDatWriter.ts +0 -145
  130. package/src/commands/monitor/saveDatWriter/types.ts +0 -6
  131. package/src/commands/monitor/spawnSaveDatWriter.ts +0 -36
  132. package/src/commands/monitor/touchWatcherSaveDatFiles.ts +0 -20
  133. package/src/commands/publish/publish.ts +0 -392
  134. package/src/configFile.ts +0 -80
  135. package/src/constants.ts +0 -85
  136. package/src/exec.ts +0 -125
  137. package/src/file.ts +0 -235
  138. package/src/main.ts +0 -131
  139. package/src/parseArgs.ts +0 -127
  140. package/src/prompt.ts +0 -109
  141. package/src/types/Command.ts +0 -3
  142. package/src/types/Config.ts +0 -23
  143. package/src/types/GitHubCLIHostsYAML.ts +0 -7
  144. package/src/utils.ts +0 -92
  145. package/src/validateInIsaacScriptProject.ts +0 -35
  146. package/src/validateNodeVersion.ts +0 -29
  147. package/src/validateOS.ts +0 -20
  148. package/tsconfig.eslint.json +0 -11
  149. package/tsconfig.json +0 -21
  150. package/update.sh +0 -21
package/src/prompt.ts DELETED
@@ -1,109 +0,0 @@
1
- // Both the Inquirer.js library and the Prompts library have a bug where text is duplicated in a Git
2
- // Bash terminal. Thus, we revert to using the simpler Prompt library.
3
-
4
- import chalk from "chalk";
5
- import prompt from "prompt";
6
- import { error, parseIntSafe } from "./utils";
7
-
8
- const VALID_YES_RESPONSES = new Set(["yes", "ye", "y"]);
9
- const VALID_NO_RESPONSES = new Set(["no", "n"]);
10
-
11
- export function promptInit(): void {
12
- // Override some of the prompt library's default values:
13
- // https://github.com/flatiron/prompt#customizing-your-prompt
14
- prompt.message = chalk.green("?");
15
- prompt.delimiter = " ";
16
- prompt.colors = false;
17
- }
18
-
19
- export async function getInputYesNo(
20
- msg: string,
21
- defaultValue = true,
22
- ): Promise<boolean> {
23
- prompt.start();
24
-
25
- // Capitalize the letter that represents the default option.
26
- const y = defaultValue ? "Y" : "y";
27
- const n = defaultValue ? "n" : "N";
28
-
29
- const questionSuffix = `(${y}\\${n})`;
30
- const description = `${chalk.bold(msg)} ${chalk.gray(questionSuffix)}`;
31
-
32
- const { response } = await prompt.get({
33
- properties: {
34
- response: {
35
- type: "string",
36
- description,
37
- },
38
- },
39
- });
40
-
41
- if (typeof response !== "string") {
42
- console.log(typeof response);
43
- error("Failed to get a proper response from the prompt library.");
44
- }
45
-
46
- const cleanedResponse = response.toLowerCase().trim();
47
-
48
- // Default to true.
49
- if (cleanedResponse === "") {
50
- return defaultValue;
51
- }
52
-
53
- if (VALID_YES_RESPONSES.has(cleanedResponse)) {
54
- return true;
55
- }
56
-
57
- if (VALID_NO_RESPONSES.has(cleanedResponse)) {
58
- return false;
59
- }
60
-
61
- return error('Invalid response; must answer "yes" or "no".');
62
- }
63
-
64
- /** Returns trimmed input. */
65
- export async function getInputString(
66
- msg: string,
67
- defaultValue?: string,
68
- ): Promise<string> {
69
- prompt.start();
70
-
71
- let description = `${chalk.bold(msg)}`;
72
- if (defaultValue !== undefined) {
73
- description += ` ${chalk.gray(`(${defaultValue})`)}`;
74
- }
75
-
76
- const { response } = await prompt.get({
77
- properties: {
78
- response: {
79
- type: "string",
80
- description,
81
- },
82
- },
83
- });
84
-
85
- if (typeof response !== "string") {
86
- error("Failed to get a proper response from the prompt library.");
87
- }
88
-
89
- if (response === "" && defaultValue !== undefined) {
90
- return defaultValue;
91
- }
92
-
93
- return response.trim();
94
- }
95
-
96
- export async function getInputInt(
97
- msg: string,
98
- defaultValue = 1,
99
- ): Promise<number> {
100
- const defaultValueString = defaultValue.toString();
101
- const string = await getInputString(msg, defaultValueString);
102
- const int = parseIntSafe(string);
103
-
104
- if (Number.isNaN(int)) {
105
- error("Error: You must enter an integer.");
106
- }
107
-
108
- return int;
109
- }
@@ -1,3 +0,0 @@
1
- export type Command = "monitor" | "init" | "copy" | "publish";
2
-
3
- export const DEFAULT_COMMAND = "monitor";
@@ -1,23 +0,0 @@
1
- export class Config {
2
- /** The "mods" directory that lives next to the "isaac-ng.exe" program. */
3
- modsDirectory =
4
- "C:\\Program Files (x86)\\Steam\\steamapps\\common\\The Binding of Isaac Rebirth\\mods";
5
-
6
- /** The save slot that you test your mod on. */
7
- saveSlot = 1;
8
-
9
- /**
10
- * By default, the target mod directory name will be the same as the project directory name. This
11
- * setting allows you to customize it.
12
- */
13
- customTargetModDirectoryName?: string;
14
-
15
- /** The path to "steamcmd.exe". This is optional and only needed for automating publishing. */
16
- steamCmdPath?: string;
17
-
18
- /**
19
- * When your code is recompiled, IsaacScript watcher can restart the game to ensure that any
20
- * run-related variables are properly reset. This is set to true by default.
21
- */
22
- enableIsaacScriptWatcherAutoRestart?: boolean;
23
- }
@@ -1,7 +0,0 @@
1
- export interface GitHubCLIHostsYAML {
2
- "github.com": {
3
- user: string;
4
- oauth_token: string;
5
- git_protocol: string;
6
- };
7
- }
package/src/utils.ts DELETED
@@ -1,92 +0,0 @@
1
- import moment from "moment";
2
- import { CURRENT_DIRECTORY_NAME } from "./constants";
3
- import { Config } from "./types/Config";
4
-
5
- /** From: https://github.com/expandjs/expandjs/blob/master/lib/kebabCaseRegex.js */
6
- const KEBAB_CASE_REGEX =
7
- /^([a-z](?![\d])|[\d](?![a-z]))+(-?([a-z](?![\d])|[\d](?![a-z])))*$|^$/;
8
-
9
- export const ensureAllCases = (obj: never): never => obj;
10
-
11
- export function error(...args: unknown[]): never {
12
- console.error(...args);
13
- process.exit(1);
14
- }
15
-
16
- export function getModTargetDirectoryName(config: Config): string {
17
- return config.customTargetModDirectoryName === undefined
18
- ? CURRENT_DIRECTORY_NAME
19
- : config.customTargetModDirectoryName;
20
- }
21
-
22
- export function getTime(): string {
23
- return moment().format("h:mm:ss A"); // e.g. "1:23:45 AM"
24
- }
25
-
26
- // From: https://stackoverflow.com/questions/1731190/check-if-a-string-has-white-space
27
- export function hasWhiteSpace(s: string): boolean {
28
- return /\s/g.test(s);
29
- }
30
-
31
- export function isKebabCase(s: string): boolean {
32
- return KEBAB_CASE_REGEX.test(s);
33
- }
34
-
35
- /**
36
- * `parseIntSafe` is a more reliable version of `parseInt`. By default, "parseInt('1a')" will return
37
- * "1", which is unexpected. This returns either an integer or NaN.
38
- */
39
- export function parseIntSafe(input: unknown): number {
40
- if (typeof input !== "string") {
41
- return NaN;
42
- }
43
-
44
- // Remove all leading and trailing whitespace
45
- let trimmedInput = input.trim();
46
-
47
- const isNegativeNumber = trimmedInput.startsWith("-");
48
- if (isNegativeNumber) {
49
- // Remove the leading minus sign before we match the regular expression
50
- trimmedInput = trimmedInput.substring(1);
51
- }
52
-
53
- if (/^\d+$/.exec(trimmedInput) === null) {
54
- // "\d" matches any digit (same as "[0-9]")
55
- return NaN;
56
- }
57
-
58
- if (isNegativeNumber) {
59
- // Add the leading minus sign back
60
- trimmedInput = `-${trimmedInput}`;
61
- }
62
-
63
- return parseInt(trimmedInput, 10);
64
- }
65
-
66
- export function parseSemVer(
67
- versionString: string,
68
- ): [majorVersion: number, minorVersion: number, patchVersion: number] {
69
- const match = /^v*(\d+)\.(\d+)\.(\d+)/g.exec(versionString);
70
- if (match === null) {
71
- error(`Failed to parse the version string of: ${versionString}`);
72
- }
73
-
74
- const [, majorVersionString, minorVersionString, patchVersionString] = match;
75
-
76
- const majorVersion = parseIntSafe(majorVersionString);
77
- if (Number.isNaN(majorVersion)) {
78
- error(`Failed to parse the major version number from: ${versionString}`);
79
- }
80
-
81
- const minorVersion = parseIntSafe(minorVersionString);
82
- if (Number.isNaN(minorVersion)) {
83
- error(`Failed to parse the minor version number from: ${versionString}`);
84
- }
85
-
86
- const patchVersion = parseIntSafe(patchVersionString);
87
- if (Number.isNaN(patchVersion)) {
88
- error(`Failed to parse the patch version number from: ${versionString}`);
89
- }
90
-
91
- return [majorVersion, minorVersion, patchVersion];
92
- }
@@ -1,35 +0,0 @@
1
- import chalk from "chalk";
2
- import path from "path";
3
- import { CWD, PROJECT_NAME } from "./constants";
4
- import * as file from "./file";
5
-
6
- // Validate that we are in a directory that looks like an IsaacScript project
7
- export function validateInIsaacScriptProject(verbose: boolean): void {
8
- const subdirectoriesToCheck = ["src", "mod", "node_modules"];
9
- for (const subdirectoryName of subdirectoriesToCheck) {
10
- const subdirectoryPath = path.join(CWD, subdirectoryName);
11
- if (
12
- !file.exists(subdirectoryPath, verbose) ||
13
- !file.isDir(subdirectoryPath, verbose)
14
- ) {
15
- errorNotExists(subdirectoryPath);
16
- }
17
- }
18
- }
19
-
20
- function errorNotExists(dirName: string) {
21
- console.error(
22
- chalk.red(
23
- `It looks like the current working directory is not an ${PROJECT_NAME} project. (There is no "${dirName}" subdirectory here.)`,
24
- ),
25
- );
26
- console.error(
27
- `Did you mean to create a new ${PROJECT_NAME} project with "${chalk.green(
28
- "npx isaacscript init",
29
- )}"?`,
30
- );
31
- console.error(
32
- `If not, then change the current working directory to an ${PROJECT_NAME} project.`,
33
- );
34
- process.exit(1);
35
- }
@@ -1,29 +0,0 @@
1
- import chalk from "chalk";
2
- import { PROJECT_NAME } from "./constants";
3
- import { parseSemVer } from "./utils";
4
-
5
- const REQUIRED_NODE_JS_MAJOR_VERSION = 16;
6
-
7
- /**
8
- * This program requires Node to be at least v16.0.0, since that is the version that added the
9
- * "fs.rmSync" function. (Node v15.0.0 is confirmed to not work.)
10
- */
11
- export function validateNodeVersion(): void {
12
- const { version } = process;
13
-
14
- const [majorVersion] = parseSemVer(version);
15
- if (majorVersion >= REQUIRED_NODE_JS_MAJOR_VERSION) {
16
- return;
17
- }
18
-
19
- console.error(`Your Node.js version is: ${chalk.red(version)}`);
20
- console.error(
21
- `${PROJECT_NAME} requires a Node.js version of ${chalk.red(
22
- `${REQUIRED_NODE_JS_MAJOR_VERSION}.0.0`,
23
- )} or greater.`,
24
- );
25
- console.error(
26
- `Please upgrade your version of Node.js before using ${PROJECT_NAME}.`,
27
- );
28
- process.exit(1);
29
- }
package/src/validateOS.ts DELETED
@@ -1,20 +0,0 @@
1
- import chalk from "chalk";
2
- import { PROJECT_NAME } from "./constants";
3
-
4
- const VALID_PLATFORMS = ["win32", "linux"];
5
-
6
- export function validateOS(): void {
7
- if (VALID_PLATFORMS.includes(process.platform)) {
8
- return;
9
- }
10
-
11
- console.error(
12
- `${PROJECT_NAME} is only supported on ${chalk.green(
13
- "Windows",
14
- )} and ${chalk.green("Linux")}.`,
15
- );
16
- console.error(
17
- `If you use another operating system and you want to use ${PROJECT_NAME}, make a request in the community Discord server.`,
18
- );
19
- process.exit(1);
20
- }
@@ -1,11 +0,0 @@
1
- // A special TypeScript configuration file, used by ESLint only.
2
- {
3
- "extends": "./tsconfig.json",
4
- "include": [
5
- // This must match the "include" setting in the "tsconfig.json" file.
6
- "./src/**/*.ts",
7
-
8
- // These are ESLint-only inclusions.
9
- "./.eslintrc.js",
10
- ],
11
- }
package/tsconfig.json DELETED
@@ -1,21 +0,0 @@
1
- // The configuration file for TypeScript.
2
- {
3
- // We extend the standard IsaacScript config:
4
- // https://github.com/IsaacScript/isaacscript-tsconfig/blob/main/tsconfig.node.json
5
- "extends": "isaacscript-tsconfig/tsconfig.node.json",
6
-
7
- // https://www.typescriptlang.org/docs/handbook/compiler-options.html
8
- "compilerOptions": {
9
- // "outDir" specifies the output directory.
10
- // By default, it will put the compiled ".js" next to the respective ".ts" file, which will
11
- // clutter the "src" directory.
12
- "outDir": "./dist",
13
-
14
- // We need to import the "package.json" file to see what version we are running.
15
- // By default, this is false.
16
- "resolveJsonModule": true,
17
- },
18
-
19
- // A list of the TypeScript files to compile.
20
- "include": ["./src/**/*.ts"],
21
- }
package/update.sh DELETED
@@ -1,21 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -e # Exit on any errors
4
-
5
- # Get the directory of this script:
6
- # https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
7
- DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
8
-
9
- cd "$DIR"
10
-
11
- PACKAGE_JSON="$DIR/package.json"
12
- OLD_HASH=$(md5sum "$PACKAGE_JSON")
13
- npx npm-check-updates --upgrade --packageFile "$PACKAGE_JSON" --reject chalk
14
- NEW_HASH=$(md5sum "$PACKAGE_JSON")
15
- if [[ $OLD_HASH != $NEW_HASH ]]; then
16
- if test -f "$DIR/yarn.lock"; then
17
- yarn
18
- else
19
- npm install
20
- fi
21
- fi