isaacscript 2.0.6 → 2.0.9

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 (142) hide show
  1. package/dist/package.json +12 -6
  2. package/dist/src/commands/init/createMod.js +9 -9
  3. package/dist/src/commands/init/git.js +3 -3
  4. package/dist/src/commands/init/init.js +2 -2
  5. package/dist/src/commands/monitor/monitor.js +9 -9
  6. package/dist/src/commands/monitor/saveDatWriter/saveDatWriter.js +2 -2
  7. package/dist/src/configFile.js +1 -1
  8. package/dist/src/constants.js +12 -9
  9. package/dist/src/file.js +1 -1
  10. package/dist/src/main.js +3 -3
  11. package/dist/src/utils.js +5 -5
  12. package/dist/src/validateInIsaacScriptProject.js +1 -1
  13. package/package.json +12 -6
  14. package/.cspell.json +0 -25
  15. package/.eslintrc.js +0 -28
  16. package/.gitattributes +0 -9
  17. package/.github/workflows/ci.yml +0 -47
  18. package/.prettierignore +0 -5
  19. package/.prettierrc.js +0 -42
  20. package/.vscode/extensions.json +0 -9
  21. package/.vscode/settings.json +0 -75
  22. package/build.sh +0 -30
  23. package/check-file-updates.sh +0 -67
  24. package/check-file-updates.txt +0 -8
  25. package/check-gitignore.sh +0 -26
  26. package/check-orphaned-words.sh +0 -58
  27. package/dist/src/checkForWindowsTerminalBugs.js.map +0 -1
  28. package/dist/src/commands/copy/copy.js.map +0 -1
  29. package/dist/src/commands/init/checkIfProjectPathExists.js.map +0 -1
  30. package/dist/src/commands/init/checkModSubdirectory.js.map +0 -1
  31. package/dist/src/commands/init/checkModTargetDirectory.js.map +0 -1
  32. package/dist/src/commands/init/createMod.js.map +0 -1
  33. package/dist/src/commands/init/getModsDir.js.map +0 -1
  34. package/dist/src/commands/init/getProjectPath.js.map +0 -1
  35. package/dist/src/commands/init/git.js.map +0 -1
  36. package/dist/src/commands/init/init.js.map +0 -1
  37. package/dist/src/commands/init/installVSCodeExtensions.js.map +0 -1
  38. package/dist/src/commands/init/promptSaveSlot.js.map +0 -1
  39. package/dist/src/commands/init/promptVSCode.js.map +0 -1
  40. package/dist/src/commands/monitor/copyWatcherMod.js.map +0 -1
  41. package/dist/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.js.map +0 -1
  42. package/dist/src/commands/monitor/monitor.js.map +0 -1
  43. package/dist/src/commands/monitor/notifyGame.js.map +0 -1
  44. package/dist/src/commands/monitor/saveDatWriter/saveDatWriter.js.map +0 -1
  45. package/dist/src/commands/monitor/saveDatWriter/types.js.map +0 -1
  46. package/dist/src/commands/monitor/spawnSaveDatWriter.js.map +0 -1
  47. package/dist/src/commands/monitor/touchWatcherSaveDatFiles.js.map +0 -1
  48. package/dist/src/commands/publish/publish.js.map +0 -1
  49. package/dist/src/configFile.js.map +0 -1
  50. package/dist/src/constants.js.map +0 -1
  51. package/dist/src/exec.js.map +0 -1
  52. package/dist/src/file.js.map +0 -1
  53. package/dist/src/main.js.map +0 -1
  54. package/dist/src/parseArgs.js.map +0 -1
  55. package/dist/src/prompt.js.map +0 -1
  56. package/dist/src/types/Command.js.map +0 -1
  57. package/dist/src/types/Config.js.map +0 -1
  58. package/dist/src/types/GitHubCLIHostsYAML.js.map +0 -1
  59. package/dist/src/utils.js.map +0 -1
  60. package/dist/src/validateInIsaacScriptProject.js.map +0 -1
  61. package/dist/src/validateNodeVersion.js.map +0 -1
  62. package/dist/src/validateOS.js.map +0 -1
  63. package/eslint-debug.sh +0 -11
  64. package/file-templates/dynamic/README.md +0 -3
  65. package/file-templates/dynamic/gitignore +0 -144
  66. package/file-templates/dynamic/main.ts +0 -19
  67. package/file-templates/dynamic/metadata.vdf +0 -6
  68. package/file-templates/dynamic/metadata.xml +0 -8
  69. package/file-templates/dynamic/package.json +0 -20
  70. package/file-templates/static/.cspell.json.template +0 -21
  71. package/file-templates/static/.env_template +0 -2
  72. package/file-templates/static/.eslintrc.js +0 -24
  73. package/file-templates/static/.gitattributes +0 -9
  74. package/file-templates/static/.github/workflows/ci.yml +0 -53
  75. package/file-templates/static/.prettierignore +0 -14
  76. package/file-templates/static/.prettierrc.js +0 -42
  77. package/file-templates/static/.vscode/extensions.json +0 -10
  78. package/file-templates/static/.vscode/settings.json +0 -75
  79. package/file-templates/static/LICENSE +0 -674
  80. package/file-templates/static/build.sh +0 -15
  81. package/file-templates/static/check-orphaned-words.sh +0 -58
  82. package/file-templates/static/lint.sh +0 -39
  83. package/file-templates/static/nuke.sh +0 -18
  84. package/file-templates/static/plugins/addCrashDebugStatements.ts +0 -40
  85. package/file-templates/static/plugins/addIsaacScriptCommentHeader.ts +0 -37
  86. package/file-templates/static/plugins/noExtendedEnums.ts +0 -66
  87. package/file-templates/static/publish.sh +0 -10
  88. package/file-templates/static/run.sh +0 -10
  89. package/file-templates/static/src/bundleEntry.ts +0 -10
  90. package/file-templates/static/tsconfig.eslint.json +0 -11
  91. package/file-templates/static/tsconfig.json +0 -33
  92. package/file-templates/static/update.sh +0 -21
  93. package/file-templates/static-alt/.prettierignore-base +0 -5
  94. package/file-templates/static-alt/.prettierrc-base.js +0 -30
  95. package/file-templates/static-alt/.vscode/extensions-format.json +0 -8
  96. package/file-templates/static-alt/.vscode/extensions-typescript.json +0 -9
  97. package/file-templates/static-alt/.vscode/settings-typescript.json +0 -63
  98. package/file-templates/static-alt/check-file-updates.sh +0 -67
  99. package/lint.sh +0 -38
  100. package/misc/logo.png +0 -0
  101. package/misc/mouseover.png +0 -0
  102. package/nuke.sh +0 -18
  103. package/publish.sh +0 -11
  104. package/src/checkForWindowsTerminalBugs.ts +0 -106
  105. package/src/commands/copy/copy.ts +0 -41
  106. package/src/commands/init/checkIfProjectPathExists.ts +0 -34
  107. package/src/commands/init/checkModSubdirectory.ts +0 -20
  108. package/src/commands/init/checkModTargetDirectory.ts +0 -42
  109. package/src/commands/init/createMod.ts +0 -196
  110. package/src/commands/init/getModsDir.ts +0 -107
  111. package/src/commands/init/getProjectPath.ts +0 -111
  112. package/src/commands/init/git.ts +0 -249
  113. package/src/commands/init/init.ts +0 -93
  114. package/src/commands/init/installVSCodeExtensions.ts +0 -47
  115. package/src/commands/init/promptSaveSlot.ts +0 -27
  116. package/src/commands/init/promptVSCode.ts +0 -33
  117. package/src/commands/monitor/copyWatcherMod.ts +0 -54
  118. package/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.ts +0 -67
  119. package/src/commands/monitor/monitor.ts +0 -180
  120. package/src/commands/monitor/notifyGame.ts +0 -59
  121. package/src/commands/monitor/saveDatWriter/saveDatWriter.ts +0 -145
  122. package/src/commands/monitor/saveDatWriter/types.ts +0 -6
  123. package/src/commands/monitor/spawnSaveDatWriter.ts +0 -36
  124. package/src/commands/monitor/touchWatcherSaveDatFiles.ts +0 -20
  125. package/src/commands/publish/publish.ts +0 -392
  126. package/src/configFile.ts +0 -80
  127. package/src/constants.ts +0 -85
  128. package/src/exec.ts +0 -125
  129. package/src/file.ts +0 -235
  130. package/src/main.ts +0 -131
  131. package/src/parseArgs.ts +0 -127
  132. package/src/prompt.ts +0 -109
  133. package/src/types/Command.ts +0 -3
  134. package/src/types/Config.ts +0 -23
  135. package/src/types/GitHubCLIHostsYAML.ts +0 -7
  136. package/src/utils.ts +0 -92
  137. package/src/validateInIsaacScriptProject.ts +0 -35
  138. package/src/validateNodeVersion.ts +0 -29
  139. package/src/validateOS.ts +0 -20
  140. package/tsconfig.eslint.json +0 -11
  141. package/tsconfig.json +0 -21
  142. package/update.sh +0 -21
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