isaacscript 1.2.43 → 2.0.0

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 (105) hide show
  1. package/.cspell-base.json +38 -0
  2. package/.cspell-check-unused.json +7 -0
  3. package/.cspell.json +51 -35
  4. package/.eslintrc.js +14 -10
  5. package/.gitattributes +3 -3
  6. package/.github/workflows/ci.yml +3 -4
  7. package/.prettierignore +5 -0
  8. package/.prettierrc.js +19 -5
  9. package/.vscode/extensions.json +2 -3
  10. package/.vscode/settings.json +26 -15
  11. package/README.md +3 -3
  12. package/build.sh +2 -2
  13. package/check-file-updates.sh +56 -0
  14. package/check-gitignore.sh +26 -0
  15. package/check-orphaned-words.sh +52 -0
  16. package/dist/package.json +6 -6
  17. package/dist/src/checkForWindowsTerminalBugs.js +8 -7
  18. package/dist/src/checkForWindowsTerminalBugs.js.map +1 -1
  19. package/dist/src/commands/init/createMod.js +13 -8
  20. package/dist/src/commands/init/createMod.js.map +1 -1
  21. package/dist/src/commands/init/getModsDir.js +4 -5
  22. package/dist/src/commands/init/getModsDir.js.map +1 -1
  23. package/dist/src/commands/init/getProjectPath.js +5 -5
  24. package/dist/src/commands/init/getProjectPath.js.map +1 -1
  25. package/dist/src/commands/init/git.js +2 -2
  26. package/dist/src/commands/init/git.js.map +1 -1
  27. package/dist/src/commands/init/promptSaveSlot.js +3 -4
  28. package/dist/src/commands/init/promptSaveSlot.js.map +1 -1
  29. package/dist/src/commands/init/promptVSCode.js +1 -2
  30. package/dist/src/commands/init/promptVSCode.js.map +1 -1
  31. package/dist/src/commands/monitor/copyWatcherMod.js +9 -11
  32. package/dist/src/commands/monitor/copyWatcherMod.js.map +1 -1
  33. package/dist/src/commands/monitor/monitor.js +3 -4
  34. package/dist/src/commands/monitor/monitor.js.map +1 -1
  35. package/dist/src/commands/monitor/notifyGame.js +3 -3
  36. package/dist/src/commands/monitor/notifyGame.js.map +1 -1
  37. package/dist/src/commands/monitor/saveDatWriter/saveDatWriter.js +8 -8
  38. package/dist/src/commands/monitor/saveDatWriter/saveDatWriter.js.map +1 -1
  39. package/dist/src/exec.js +2 -3
  40. package/dist/src/exec.js.map +1 -1
  41. package/dist/src/file.js +16 -1
  42. package/dist/src/file.js.map +1 -1
  43. package/dist/src/prompt.js +5 -7
  44. package/dist/src/prompt.js.map +1 -1
  45. package/dist/src/utils.js +1 -1
  46. package/dist/src/validateNodeVersion.js +4 -3
  47. package/dist/src/validateNodeVersion.js.map +1 -1
  48. package/eslint-debug.sh +8 -0
  49. package/file-templates/dynamic/README.md +2 -2
  50. package/file-templates/dynamic/main.ts +4 -4
  51. package/file-templates/dynamic/metadata.vdf +1 -1
  52. package/file-templates/dynamic/metadata.xml +3 -3
  53. package/file-templates/dynamic/package.json +1 -1
  54. package/file-templates/static/.cspell-check-unused.json +9 -0
  55. package/file-templates/static/.cspell.json.template +9 -0
  56. package/file-templates/static/.eslintrc.js +11 -10
  57. package/file-templates/static/.gitattributes +3 -3
  58. package/file-templates/static/.github/workflows/ci.yml +5 -6
  59. package/file-templates/static/.prettierignore +10 -1
  60. package/file-templates/static/.prettierrc.js +19 -5
  61. package/file-templates/static/.vscode/extensions.json +2 -3
  62. package/file-templates/static/.vscode/settings.json +26 -14
  63. package/file-templates/static/build.sh +2 -2
  64. package/file-templates/static/check-orphaned-words.sh +52 -0
  65. package/file-templates/static/lint.sh +17 -16
  66. package/file-templates/static/nuke.sh +1 -1
  67. package/file-templates/static/plugins/noExtendedEnums.ts +8 -12
  68. package/file-templates/static/publish.sh +1 -1
  69. package/file-templates/static/run.sh +1 -1
  70. package/file-templates/static/src/bundleEntry.ts +4 -4
  71. package/file-templates/static/tsconfig.eslint.json +3 -3
  72. package/file-templates/static/tsconfig.json +8 -10
  73. package/file-templates/static/update.sh +1 -1
  74. package/file-templates/static-alt/.cspell-base.json +38 -0
  75. package/file-templates/static-alt/.cspell-check-unused-base.json +7 -0
  76. package/file-templates/static-alt/.prettierignore-base +5 -0
  77. package/file-templates/static-alt/.prettierrc-base.js +29 -0
  78. package/file-templates/static-alt/.vscode/extensions-typescript.json +9 -0
  79. package/file-templates/static-alt/.vscode/settings-typescript.json +63 -0
  80. package/isaacscript-watcher/README.md +3 -2
  81. package/isaacscript-watcher/main.lua +31 -41
  82. package/lint.sh +19 -16
  83. package/nuke.sh +1 -1
  84. package/package.json +6 -6
  85. package/publish.sh +1 -1
  86. package/src/checkForWindowsTerminalBugs.ts +8 -7
  87. package/src/commands/init/createMod.ts +14 -8
  88. package/src/commands/init/getModsDir.ts +4 -5
  89. package/src/commands/init/getProjectPath.ts +5 -5
  90. package/src/commands/init/git.ts +2 -2
  91. package/src/commands/init/promptSaveSlot.ts +3 -4
  92. package/src/commands/init/promptVSCode.ts +1 -2
  93. package/src/commands/monitor/copyWatcherMod.ts +9 -11
  94. package/src/commands/monitor/monitor.ts +3 -4
  95. package/src/commands/monitor/notifyGame.ts +3 -3
  96. package/src/commands/monitor/saveDatWriter/saveDatWriter.ts +8 -8
  97. package/src/exec.ts +2 -3
  98. package/src/file.ts +25 -0
  99. package/src/prompt.ts +5 -7
  100. package/src/utils.ts +1 -1
  101. package/src/validateNodeVersion.ts +5 -4
  102. package/tsconfig.eslint.json +3 -3
  103. package/tsconfig.json +9 -11
  104. package/update.sh +1 -1
  105. package/file-templates/static/.cspell.json +0 -11
@@ -0,0 +1,38 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
3
+ "version": "0.2",
4
+ "loadDefaultConfiguration": true,
5
+ "import": [
6
+ "@cspell/dict-companies/cspell-ext.json",
7
+ "@cspell/dict-en_us/cspell-ext.json",
8
+ "@cspell/dict-public-licenses/cspell-ext.json",
9
+ "@cspell/dict-software-terms/cspell-ext.json",
10
+ "@cspell/dict-typescript/cspell-ext.json"
11
+ ],
12
+ "dictionaries": [
13
+ "companies",
14
+ "en_US",
15
+ "networking-terms",
16
+ "public-licenses",
17
+ "software-terms",
18
+ "typescript"
19
+ ],
20
+ "ignoreRegExpList": [
21
+ "Base64MultiLine",
22
+ "Base64SingleLine",
23
+ "CommitHash",
24
+ "CommitHashLink",
25
+ "CSSHexValue",
26
+ "CStyleHexValue",
27
+ "Email",
28
+ "HashStrings",
29
+ "RsaCert",
30
+ "SHA",
31
+ "SpellCheckerDisable",
32
+ "SpellCheckerIgnoreInDocSetting",
33
+ "SshRsa",
34
+ "UnicodeRef",
35
+ "Urls",
36
+ "UUID"
37
+ ]
38
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
3
+ "version": "0.2",
4
+ "import": ["./.cspell-base.json"],
5
+ "files": ["**"],
6
+ "ignorePaths": [".cspell-temp.json", ".git/**", "dist/**", "node_modules/**"]
7
+ }
package/.cspell.json CHANGED
@@ -1,37 +1,53 @@
1
1
  {
2
- "version": "0.2",
3
- "words": [
4
- "APPDATA",
5
- "backticks",
6
- "btmills",
7
- "chcp",
8
- "chdir",
9
- "codium",
10
- "dbaeumer",
11
- "hkcu",
12
- "hkey",
13
- "isaacconfig",
14
- "isaacscript",
15
- "lua's",
16
- "luadebug",
17
- "luamod",
18
- "mingw",
19
- "nicalis",
20
- "plusplus",
21
- "sarisia",
22
- "Spritesheet",
23
- "Spritesheets",
24
- "steamapps",
25
- "steamcmd",
26
- "subprocesses",
27
- "sycner",
28
- "syncer",
29
- "technote",
30
- "traceback",
31
- "transpiled",
32
- "tstl",
33
- "turnbull",
34
- "xmls",
35
- "zamiell"
36
- ]
2
+ "$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
3
+ "version": "0.2",
4
+ "import": [
5
+ "./.cspell-base.json"
6
+ ],
7
+ "files": [
8
+ "**"
9
+ ],
10
+ "ignorePaths": [
11
+ ".git/**",
12
+ "dist/**",
13
+ "node_modules/**"
14
+ ],
15
+ "words": [
16
+ "APPDATA",
17
+ "contentfolder",
18
+ "dbaeumer",
19
+ "dotenv",
20
+ "eslintcache",
21
+ "isaacscript",
22
+ "jscoverage",
23
+ "jspm",
24
+ "lcov",
25
+ "luamod",
26
+ "Microbundle",
27
+ "noout",
28
+ "npmignore",
29
+ "nuxt",
30
+ "pftempestasevencondensed",
31
+ "pids",
32
+ "pnpm",
33
+ "prettierignore",
34
+ "prettierrc",
35
+ "publishedfileid",
36
+ "sarisia",
37
+ "Spritesheet",
38
+ "Spritesheets",
39
+ "steamapps",
40
+ "steamcmd",
41
+ "stylelint",
42
+ "stylelintcache",
43
+ "subprocesses",
44
+ "sycner",
45
+ "syncer",
46
+ "technote",
47
+ "tstl",
48
+ "vuepress",
49
+ "workshopitem",
50
+ "wscript",
51
+ "zamiell"
52
+ ]
37
53
  }
package/.eslintrc.js CHANGED
@@ -1,24 +1,28 @@
1
- // This is the configuration file for ESLint, the TypeScript linter
1
+ // This is the configuration file for ESLint, the TypeScript linter:
2
2
  // https://eslint.org/docs/user-guide/configuring
3
3
  module.exports = {
4
4
  extends: [
5
- // The linter base is the shared IsaacScript config
6
- // https://github.com/IsaacScript/eslint-config-isaacscript/blob/main/base.js
5
+ /**
6
+ * The linter base is the shared IsaacScript config:
7
+ * https://github.com/IsaacScript/eslint-config-isaacscript/blob/main/base.js
8
+ */
7
9
  "eslint-config-isaacscript/base",
8
10
  ],
9
11
 
10
- // Don't bother linting the template files (for inserting into a new IsaacScript project)
11
- // or the compiled output
12
+ /**
13
+ * Don't bother linting the template files (for inserting into a new IsaacScript project) or the
14
+ * compiled output.
15
+ */
12
16
  ignorePatterns: ["./file-templates/**", "./dist/**"],
13
17
 
14
18
  parserOptions: {
15
- // ESLint needs to know about the project's TypeScript settings in order for TypeScript-specific
16
- // things to lint correctly
17
- // We do not point this at "./tsconfig.json" because certain files (such at this file) should be
18
- // linted but not included in the actual project output
19
+ /**
20
+ * ESLint needs to know about the project's TypeScript settings in order for TypeScript-specific
21
+ * things to lint correctly. We do not point this at "./tsconfig.json" because certain files
22
+ * (such at this file) should be linted but not included in the actual project output.
23
+ */
19
24
  project: "./tsconfig.eslint.json",
20
25
  },
21
26
 
22
- // We modify the linting rules from the base for some specific things
23
27
  rules: {},
24
28
  };
package/.gitattributes CHANGED
@@ -1,9 +1,9 @@
1
- # Prevent Windows systems from cloning this repository with "\r\n" line endings
1
+ # Prevent Windows systems from cloning this repository with "\r\n" line endings.
2
2
  core.autocrlf=false
3
3
 
4
- # Prevent people from making merge commits
4
+ # Prevent people from making merge commits:
5
5
  # https://www.endoflineblog.com/gitflow-considered-harmful
6
6
  pull.rebase=true
7
7
 
8
- # Convert all files to use "\n" line endings
8
+ # Convert all files to use "\n" line endings.
9
9
  * text=auto eol=lf
@@ -12,9 +12,8 @@ jobs:
12
12
  - name: Setup Node.js
13
13
  uses: actions/setup-node@v2
14
14
  with:
15
- # The default version is 14
16
- # The ESLint config requires Node 16 to work properly
17
- node-version: '16'
15
+ # The default version is 14. The ESLint config requires Node 16 to work properly.
16
+ node-version: "16"
18
17
 
19
18
  - name: Retrieve the cached "node_modules" directory (if present)
20
19
  uses: actions/cache@v2
@@ -36,7 +35,7 @@ jobs:
36
35
  discord:
37
36
  name: Discord Failure Notification
38
37
  needs: [build_and_lint]
39
- if: always() # This is needed to always run this job, even if the other jobs fail
38
+ if: always() # This is needed to always run this job, even if the other jobs fail.
40
39
  runs-on: ubuntu-latest
41
40
  steps:
42
41
  - uses: technote-space/workflow-conclusion-action@v2
@@ -0,0 +1,5 @@
1
+ # Ignore compiled output.
2
+ dist
3
+
4
+ # The VSCode CSpell plugin causes the file to become unformatted whenever a new word is added.
5
+ .cspell.json
package/.prettierrc.js CHANGED
@@ -1,10 +1,9 @@
1
- // This is the configuration file for Prettier, the auto-formatter
1
+ // This is the configuration file for Prettier, the auto-formatter:
2
2
  // https://prettier.io/docs/en/configuration.html
3
3
  module.exports = {
4
4
  // https://prettier.io/docs/en/options.html#trailing-commas
5
5
  // The default is "es5" - Trailing commas where valid in ES5 (objects, arrays, etc.)
6
- // However, always having trailing commas is objectively better
7
- // The Airbnb style guide agrees:
6
+ // However, always having trailing commas is objectively better. The Airbnb style guide agrees:
8
7
  // https://github.com/airbnb/javascript#commas--dangling
9
8
  // Prettier itself also acknowledges Nik Graf's blog in their official blog:
10
9
  // https://prettier.io/blog/2020/03/21/2.0.0.html
@@ -13,8 +12,23 @@ module.exports = {
13
12
  // https://github.com/prettier/prettier/issues/9369
14
13
  trailingComma: "all",
15
14
 
15
+ // We want to always use "lf" to be consistent with all platforms.
16
+ endOfLine: "lf",
17
+
18
+ // Allow proper formatting of JSONC files:
19
+ // https://github.com/prettier/prettier/issues/5708
20
+ overrides: [
21
+ {
22
+ files: ["**/.vscode/*.json", "**/tsconfig.json", "**/tsconfig.*.json"],
23
+ options: {
24
+ parser: "json5",
25
+ quoteProps: "preserve",
26
+ },
27
+ },
28
+ ],
29
+
16
30
  // https://github.com/prettier/plugin-xml#configuration
17
- // The default is "struct"
18
- // However, whitespace cannot be reformatted unless this is set to "ignore"
31
+ // The default is "struct".
32
+ // Whitespace cannot be reformatted unless this is set to "ignore".
19
33
  xmlWhitespaceSensitivity: "ignore",
20
34
  };
@@ -1,10 +1,9 @@
1
1
  // These are Visual Studio Code extensions that are intended to be used with this particular
2
- // repository
3
- // https://go.microsoft.com/fwlink/?LinkId=827846
2
+ // repository: https://go.microsoft.com/fwlink/?LinkId=827846
4
3
  {
5
4
  "recommendations": [
6
5
  "esbenp.prettier-vscode", // The TypeScript formatter
7
6
  "dbaeumer.vscode-eslint", // The TypeScript linter
8
7
  "streetsidesoftware.code-spell-checker", // A spell-checker extension based on cspell
9
- ]
8
+ ],
10
9
  }
@@ -1,10 +1,10 @@
1
- // These are Visual Studio Code settings that should apply to this particular repository
1
+ // These are Visual Studio Code settings that should apply to this particular repository.
2
2
  {
3
3
  // ----------------
4
4
  // Vanilla settings
5
5
  // ----------------
6
6
 
7
- // This matches the Airbnb JavaScript style guide
7
+ // This matches the Airbnb JavaScript style guide.
8
8
  "editor.rulers": [100],
9
9
  "editor.tabSize": 2,
10
10
 
@@ -13,13 +13,13 @@
13
13
  "*.dat": "json", // Nearly all mods save JSON to the "save#.dat" file
14
14
  },
15
15
 
16
- // Linux line endings are used in this project
16
+ // Linux line endings are used in this project.
17
17
  "files.eol": "\n",
18
18
 
19
- // Automatically removing all trailing whitespace when saving a file
19
+ // Automatically removing all trailing whitespace when saving a file.
20
20
  "files.trimTrailingWhitespace": true,
21
21
 
22
- // Configure glob patterns for excluding files and folders in full text searches and quick open
22
+ // Configure glob patterns for excluding files and folders in full text searches and quick open.
23
23
  "search.exclude": {
24
24
  "dist/**": true,
25
25
  },
@@ -28,35 +28,46 @@
28
28
  // Language settings
29
29
  // -----------------
30
30
 
31
- // By default, VSCode will not automatically fill-in function arguments
31
+ // By default, VSCode will not automatically fill-in function arguments.
32
32
  "javascript.suggest.completeFunctionCalls": true,
33
33
  "typescript.suggest.completeFunctionCalls": true,
34
34
 
35
- // Automatically run the formatter when certain files are saved
35
+ // Automatically run the formatter when certain files are saved.
36
36
  "[javascript]": {
37
- "editor.codeActionsOnSave": [
38
- "source.fixAll.eslint",
39
- ],
37
+ "editor.codeActionsOnSave": ["source.fixAll.eslint"],
40
38
  "editor.defaultFormatter": "esbenp.prettier-vscode",
41
39
  "editor.formatOnSave": true,
42
40
  "editor.tabSize": 2,
43
41
  },
44
42
  "[typescript]": {
45
- "editor.codeActionsOnSave": [
46
- "source.fixAll.eslint",
47
- ],
43
+ "editor.codeActionsOnSave": ["source.fixAll.eslint"],
48
44
  "editor.defaultFormatter": "esbenp.prettier-vscode",
49
45
  "editor.formatOnSave": true,
50
46
  "editor.tabSize": 2,
51
47
  },
52
- "[markdown]": {
48
+ "[json]": {
49
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
50
+ "editor.formatOnSave": true,
51
+ "editor.tabSize": 2,
52
+ },
53
+ "[jsonc]": {
53
54
  "editor.defaultFormatter": "esbenp.prettier-vscode",
54
55
  "editor.formatOnSave": true,
55
- "editor.tabSize": 2
56
+ "editor.tabSize": 2,
57
+ },
58
+ "[yaml]": {
59
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
60
+ "editor.formatOnSave": true,
61
+ "editor.tabSize": 2,
56
62
  },
57
63
  "[xml]": {
58
64
  "editor.defaultFormatter": "esbenp.prettier-vscode",
59
65
  "editor.formatOnSave": true,
60
66
  "editor.tabSize": 2,
61
67
  },
68
+ "[markdown]": {
69
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
70
+ "editor.formatOnSave": true,
71
+ "editor.tabSize": 2,
72
+ },
62
73
  }
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
- [![npm version](https://img.shields.io/npm/v/isaacscript.svg)](https://www.npmjs.com/package/isaacscript)
2
-
3
1
  # IsaacScript
4
2
 
5
- IsaacScript is a tool to help you create *Binding of Isaac: Repentance* mods using [TypeScript](https://www.typescriptlang.org/).
3
+ [![npm version](https://img.shields.io/npm/v/isaacscript.svg)](https://www.npmjs.com/package/isaacscript)
4
+
5
+ IsaacScript is a tool to help you create _Binding of Isaac: Repentance_ mods using [TypeScript](https://www.typescriptlang.org/).
6
6
 
7
7
  Please visit the [official website](https://isaacscript.github.io/) for more information.
package/build.sh CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  set -e # Exit on any errors
4
4
 
5
- # Get the directory of this script
5
+ # Get the directory of this script:
6
6
  # https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
7
7
  DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
8
8
 
9
- # Get the name of the repository
9
+ # Get the name of the repository:
10
10
  # https://stackoverflow.com/questions/23162299/how-to-get-the-last-part-of-dirname-in-bash/23162553
11
11
  REPO="$(basename "$DIR")"
12
12
 
@@ -0,0 +1,56 @@
1
+ #!/bin/bash
2
+
3
+ FILES_TO_CHECK=(
4
+ ".vscode/extensions.json:.vscode/extensions-typescript.json"
5
+ ".cspell-base.json:.cspell-base.json"
6
+ ".cspell-check-unused.json:.cspell-check-unused-base.json"
7
+ ".gitattributes"
8
+ ".prettierrc.js"
9
+ ".prettierignore:.prettierignore-base"
10
+ "tsconfig.eslint.json"
11
+ )
12
+
13
+ set -e # Exit on any errors
14
+
15
+ # Get the directory of this script:
16
+ # https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
17
+ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
18
+
19
+ ONE_OR_MORE_FAILURES=0
20
+ for FILE in "${FILES_TO_CHECK[@]}"; do
21
+ if [[ "$FILE" =~ (.+):(.+) ]]; then
22
+ FILE=${BASH_REMATCH[1]}
23
+ REMOTE_FILE=${BASH_REMATCH[2]}
24
+ STATIC_DIRECTORY="static-alt"
25
+ else
26
+ REMOTE_FILE=$FILE
27
+ STATIC_DIRECTORY="static"
28
+ fi
29
+
30
+ echo "Checking for an updated version of: $FILE"
31
+ TMP_FILE="/tmp/base-file"
32
+ URL="https://raw.githubusercontent.com/IsaacScript/isaacscript/main/file-templates/$STATIC_DIRECTORY/$REMOTE_FILE"
33
+ curl "$URL" --output "$TMP_FILE" --silent --show-error
34
+ if grep "404: Not Found" "$TMP_FILE" --silent; then
35
+ echo "Failed to find the following remote file:"
36
+ echo "$URL"
37
+ exit 1
38
+ fi
39
+
40
+ set +e
41
+ if ! cmp "$DIR/$FILE" "$TMP_FILE" --silent; then
42
+ echo "File \"$FILE\" is out of date. Get the updated version here:"
43
+ echo "$URL"
44
+ ONE_OR_MORE_FAILURES=1
45
+ fi
46
+ set -e
47
+
48
+ rm -f "$TMP_FILE"
49
+ done
50
+
51
+ if [ $ONE_OR_MORE_FAILURES -ne "0" ]; then
52
+ echo "One or more files was not valid."
53
+ exit 1
54
+ fi
55
+
56
+ echo "All core files up to date!"
@@ -0,0 +1,26 @@
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
+ LOCAL_GITIGNORE="/tmp/gitignore-template-local"
12
+ REMOTE_GITIGNORE="/tmp/gitignore-template-remote"
13
+ URL="https://raw.githubusercontent.com/github/gitignore/master/Node.gitignore"
14
+ tail -n +6 "$DIR/.gitignore" > $LOCAL_GITIGNORE
15
+ curl "$URL" --output "$REMOTE_GITIGNORE" --silent
16
+ set +e
17
+ cmp --silent "$LOCAL_GITIGNORE" "$REMOTE_GITIGNORE"
18
+ UP_TO_DATE=$?
19
+ set -e
20
+ rm -f "$LOCAL_GITIGNORE" "$REMOTE_GITIGNORE"
21
+
22
+ if [[ "$UP_TO_DATE" -ne "0" ]]; then
23
+ echo "There is an update for the gitignore template from GitHub:"
24
+ echo "$URL"
25
+ exit 1
26
+ fi
@@ -0,0 +1,52 @@
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
+ REPO_ROOT="$DIR"
10
+ cd "$REPO_ROOT"
11
+
12
+ # Do nothing if the configuration file does not exist
13
+ CSPELL_CONFIGURATION_PATH="$REPO_ROOT/.cspell.json"
14
+ if ! test -f "$CSPELL_CONFIGURATION_PATH"; then
15
+ exit 0
16
+ fi
17
+
18
+ # Do nothing if the configuration file does not have any words in it
19
+ if ! grep -q '"words": ' "$CSPELL_CONFIGURATION_PATH"; then
20
+ exit 0
21
+ fi
22
+
23
+ # Make a list of every misspelled word without any custom dictionaries
24
+ CSPELL_CONFIGURATION_PATH_TEMP="$REPO_ROOT/.cspell-temp.json"
25
+ mv "$CSPELL_CONFIGURATION_PATH" "$CSPELL_CONFIGURATION_PATH_TEMP" # Otherwise the below command won't work properly
26
+ MISSPELLED_WORDS_PATH="/tmp/misspelled-words.txt"
27
+ CSPELL_CONFIGURATION_TEST_PATH="$REPO_ROOT/.cspell-check-unused.json"
28
+ npx cspell lint --config "$CSPELL_CONFIGURATION_TEST_PATH" --dot --no-progress --no-summary --unique --words-only | sort --ignore-case --unique > "$MISSPELLED_WORDS_PATH"
29
+ mv "$CSPELL_CONFIGURATION_PATH_TEMP" "$CSPELL_CONFIGURATION_PATH"
30
+
31
+ # Check that each ".cspell.json" word is actually being used
32
+ echo "Checking for orphaned CSpell configuration words in: $CSPELL_CONFIGURATION_PATH"
33
+ CSPELL_CONFIGURATION_WORDS=$(cat "$CSPELL_CONFIGURATION_PATH" | python -c "import sys, json; print('\n'.join(json.load(sys.stdin)['words']))")
34
+ ONE_OR_MORE_FAILURES=0
35
+ set +e
36
+ for LINE in $CSPELL_CONFIGURATION_WORDS; do
37
+ LINE_TRIMMED=$(echo "$LINE" | xargs)
38
+ if ! grep "$LINE_TRIMMED" "$MISSPELLED_WORDS_PATH" --ignore-case --quiet; then
39
+ echo "The following word in the CSpell config is not being used: $LINE_TRIMMED"
40
+ ONE_OR_MORE_FAILURES=1
41
+ fi
42
+ done
43
+ set -e
44
+
45
+ rm -f "$MISSPELLED_WORDS_PATH"
46
+
47
+ if [ $ONE_OR_MORE_FAILURES -ne "0" ]; then
48
+ echo "CSpell configuration words are not valid."
49
+ exit 1
50
+ fi
51
+
52
+ echo "CSpell configuration words are valid."
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript",
3
- "version": "1.2.43",
3
+ "version": "2.0.0",
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,13 +16,13 @@
16
16
  "isaacscript": "./dist/src/main.js"
17
17
  },
18
18
  "dependencies": {
19
- "@types/node": "^17.0.31",
19
+ "@types/node": "^17.0.33",
20
20
  "chalk": "4.1.2",
21
21
  "command-exists": "^1.2.9",
22
- "dotenv": "^16.0.0",
22
+ "dotenv": "^16.0.1",
23
23
  "figlet": "^1.5.2",
24
24
  "fs-extra": "^10.1.0",
25
- "isaacscript-tsconfig": "^1.1.14",
25
+ "isaacscript-tsconfig": "^1.1.16",
26
26
  "jsonc-parser": "^3.0.0",
27
27
  "moment": "^2.29.3",
28
28
  "npm-check-updates": "^12.5.11",
@@ -35,7 +35,7 @@
35
35
  "typescript-to-lua": "^1.4.4",
36
36
  "update-notifier": "^5.1.0",
37
37
  "yaml": "^2.0.1",
38
- "yargs": "^17.4.1"
38
+ "yargs": "^17.5.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/command-exists": "^1.2.0",
@@ -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.113"
48
+ "isaacscript-lint": "^1.0.140"
49
49
  }
50
50
  }
@@ -35,9 +35,10 @@ const file = __importStar(require("./file"));
35
35
  const prompt_1 = require("./prompt");
36
36
  const utils_1 = require("./utils");
37
37
  const BASH_PROFILE_PATH = path_1.default.join(constants_1.HOME_DIR, ".bash_profile");
38
- // By default, Git Bash for Windows uses MINGW64
39
- // This will not work correctly with the prompt library
40
- // Try to detect this and warn the end-user
38
+ /**
39
+ * By default, Git Bash for Windows uses MINGW64. This will not work correctly with the prompt
40
+ * library. Try to detect this and warn the end-user.
41
+ */
41
42
  async function checkForWindowsTerminalBugs(verbose) {
42
43
  if (process.platform !== "win32") {
43
44
  return;
@@ -61,7 +62,7 @@ async function checkForWindowsBugColor(verbose) {
61
62
  applyFixesToBashProfile(verbose);
62
63
  }
63
64
  function applyFixesToBashProfile(verbose) {
64
- // Check to see if the Bash profile has data
65
+ // Check to see if the Bash profile has data.
65
66
  let bashProfileContents;
66
67
  if (file.exists(BASH_PROFILE_PATH, verbose)) {
67
68
  bashProfileContents = file.read(BASH_PROFILE_PATH, verbose);
@@ -84,13 +85,13 @@ function getBashProfileAppendText(bashProfileContents) {
84
85
  let newText = "";
85
86
  if (bashProfileContents !== "" &&
86
87
  bashProfileContents[bashProfileContents.length - 1] !== "\n") {
87
- // If the Bash profile exists and has data, it should end in a newline
88
- // Add an extra newline if this is not the case
88
+ // If the Bash profile exists and has data, it should end in a newline. Add an extra newline if
89
+ // this is not the case.
89
90
  newText += "\n";
90
91
  }
91
92
  if (bashProfileContents !== "") {
92
93
  // If the Bash profile exists and has data, add an extra newline between the existing stuff and
93
- // the new lines added by us
94
+ // the new lines added by us.
94
95
  newText += "\n";
95
96
  }
96
97
  newText += `# Terminal fixes added by ${constants_1.PROJECT_NAME}\n`;
@@ -1 +1 @@
1
- {"version":3,"file":"checkForWindowsTerminalBugs.js","sourceRoot":"","sources":["../../src/checkForWindowsTerminalBugs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,4CAAoB;AACpB,gDAAwB;AACxB,2CAAqD;AACrD,6CAA+B;AAC/B,qCAAyC;AACzC,mCAAgC;AAEhC,MAAM,iBAAiB,GAAG,cAAI,CAAC,IAAI,CAAC,oBAAQ,EAAE,eAAe,CAAC,CAAC;AAE/D,gDAAgD;AAChD,uDAAuD;AACvD,2CAA2C;AACpC,KAAK,UAAU,2BAA2B,CAC/C,OAAgB;IAEhB,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;QAChC,OAAO;KACR;IAED,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,4CAA4C,EAAE;QACzE,OAAO;KACR;IAED,MAAM,uBAAuB,CAAC,OAAO,CAAC,CAAC;AACzC,CAAC;AAZD,kEAYC;AAED,KAAK,UAAU,uBAAuB,CAAC,OAAgB;IACrD,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,KAAK,MAAM,EAAE;QACzC,OAAO;KACR;IAED,OAAO,CAAC,KAAK,CACX,eAAK,CAAC,GAA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C,CAAC,KAAK,IAAI,EAC5D;QACA,sEAAsE;QACtE,+CAA+C;QAC/C,OAAO,IAAI,IAAI,CAAC;KACjB;IAED,IAAI,mBAAmB,KAAK,EAAE,EAAE;QAC9B,+FAA+F;QAC/F,4BAA4B;QAC5B,OAAO,IAAI,IAAI,CAAC;KACjB;IAED,OAAO,IAAI,6BAA6B,wBAAY,IAAI,CAAC;IACzD,OAAO,IAAI,2BAA2B,CAAC;IAEvC,OAAO,OAAO,CAAC;AACjB,CAAC"}
1
+ {"version":3,"file":"checkForWindowsTerminalBugs.js","sourceRoot":"","sources":["../../src/checkForWindowsTerminalBugs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,4CAAoB;AACpB,gDAAwB;AACxB,2CAAqD;AACrD,6CAA+B;AAC/B,qCAAyC;AACzC,mCAAgC;AAEhC,MAAM,iBAAiB,GAAG,cAAI,CAAC,IAAI,CAAC,oBAAQ,EAAE,eAAe,CAAC,CAAC;AAE/D;;;GAGG;AACI,KAAK,UAAU,2BAA2B,CAC/C,OAAgB;IAEhB,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;QAChC,OAAO;KACR;IAED,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,4CAA4C,EAAE;QACzE,OAAO;KACR;IAED,MAAM,uBAAuB,CAAC,OAAO,CAAC,CAAC;AACzC,CAAC;AAZD,kEAYC;AAED,KAAK,UAAU,uBAAuB,CAAC,OAAgB;IACrD,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,KAAK,MAAM,EAAE;QACzC,OAAO;KACR;IAED,OAAO,CAAC,KAAK,CACX,eAAK,CAAC,GAAG,CACP,kFAAkF,eAAK,CAAC,KAAK,CAC3F,aAAa,CACd,yBAAyB,CAC3B,CACF,CAAC;IACF,OAAO,CAAC,KAAK,CACX,yEAAyE,CAC1E,CAAC;IAEF,MAAM,eAAe,GAAG,MAAM,IAA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