isaacscript 3.18.4 → 3.18.6-dev.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 (116) hide show
  1. package/dist/banner.js +20 -0
  2. package/dist/banner.js.map +1 -0
  3. package/dist/checkForWindowsTerminalBugs.js +1 -0
  4. package/dist/checkForWindowsTerminalBugs.js.map +1 -0
  5. package/dist/classes/Config.js +1 -0
  6. package/dist/classes/Config.js.map +1 -0
  7. package/dist/classes/ValidatedConfig.js +1 -0
  8. package/dist/classes/ValidatedConfig.js.map +1 -0
  9. package/dist/commands/check/check.js +29 -4
  10. package/dist/commands/check/check.js.map +1 -0
  11. package/dist/commands/check/check.test.js +1 -0
  12. package/dist/commands/check/check.test.js.map +1 -0
  13. package/dist/commands/copy/copy.js +16 -3
  14. package/dist/commands/copy/copy.js.map +1 -0
  15. package/dist/commands/init/checkIfProjectPathExists.js +1 -0
  16. package/dist/commands/init/checkIfProjectPathExists.js.map +1 -0
  17. package/dist/commands/init/checkModSubdirectory.js +1 -0
  18. package/dist/commands/init/checkModSubdirectory.js.map +1 -0
  19. package/dist/commands/init/checkModTargetDirectory.js +1 -0
  20. package/dist/commands/init/checkModTargetDirectory.js.map +1 -0
  21. package/dist/commands/init/createProject.js +27 -8
  22. package/dist/commands/init/createProject.js.map +1 -0
  23. package/dist/commands/init/getAuthorName.js +1 -0
  24. package/dist/commands/init/getAuthorName.js.map +1 -0
  25. package/dist/commands/init/{getModsDir.js → getModsDirectory.js} +4 -8
  26. package/dist/commands/init/getModsDirectory.js.map +1 -0
  27. package/dist/commands/init/getProjectPath.js +3 -6
  28. package/dist/commands/init/getProjectPath.js.map +1 -0
  29. package/dist/commands/init/{promptSaveSlot.js → getSaveSlot.js} +9 -5
  30. package/dist/commands/init/getSaveSlot.js.map +1 -0
  31. package/dist/commands/init/init.js +59 -16
  32. package/dist/commands/init/init.js.map +1 -0
  33. package/dist/commands/init/installVSCodeExtensions.js +1 -0
  34. package/dist/commands/init/installVSCodeExtensions.js.map +1 -0
  35. package/dist/commands/init/promptVSCode.js +1 -0
  36. package/dist/commands/init/promptVSCode.js.map +1 -0
  37. package/dist/commands/monitor/copyWatcherMod.js +1 -0
  38. package/dist/commands/monitor/copyWatcherMod.js.map +1 -0
  39. package/dist/commands/monitor/modDirectorySyncer/modDirectorySyncer.js +1 -0
  40. package/dist/commands/monitor/modDirectorySyncer/modDirectorySyncer.js.map +1 -0
  41. package/dist/commands/monitor/monitor.js +27 -65
  42. package/dist/commands/monitor/monitor.js.map +1 -0
  43. package/dist/commands/monitor/notifyGame.js +4 -3
  44. package/dist/commands/monitor/notifyGame.js.map +1 -0
  45. package/dist/commands/monitor/saveDatWriter/saveDatWriter.js +1 -0
  46. package/dist/commands/monitor/saveDatWriter/saveDatWriter.js.map +1 -0
  47. package/dist/commands/monitor/saveDatWriter/types.js +1 -0
  48. package/dist/commands/monitor/saveDatWriter/types.js.map +1 -0
  49. package/dist/commands/monitor/spawnModDirectorySyncer.js +10 -5
  50. package/dist/commands/monitor/spawnModDirectorySyncer.js.map +1 -0
  51. package/dist/commands/monitor/spawnSaveDatWriter.js +1 -0
  52. package/dist/commands/monitor/spawnSaveDatWriter.js.map +1 -0
  53. package/dist/commands/monitor/spawnTSTLWatcher.js +8 -7
  54. package/dist/commands/monitor/spawnTSTLWatcher.js.map +1 -0
  55. package/dist/commands/monitor/touchWatcherSaveDatFiles.js +1 -0
  56. package/dist/commands/monitor/touchWatcherSaveDatFiles.js.map +1 -0
  57. package/dist/commands/publish/isaacscriptMod.js +5 -4
  58. package/dist/commands/publish/isaacscriptMod.js.map +1 -0
  59. package/dist/commands/publish/publish.js +147 -23
  60. package/dist/commands/publish/publish.js.map +1 -0
  61. package/dist/commands/publish/validate.js +2 -1
  62. package/dist/commands/publish/validate.js.map +1 -0
  63. package/dist/common.js +1 -0
  64. package/dist/common.js.map +1 -0
  65. package/dist/configFile.js +9 -13
  66. package/dist/configFile.js.map +1 -0
  67. package/dist/constants.js +1 -0
  68. package/dist/constants.js.map +1 -0
  69. package/dist/customStage.js +1 -0
  70. package/dist/customStage.js.map +1 -0
  71. package/dist/dev.js +1 -0
  72. package/dist/dev.js.map +1 -0
  73. package/dist/enums/copied/DoorSlot.js +1 -0
  74. package/dist/enums/copied/DoorSlot.js.map +1 -0
  75. package/dist/enums/copied/DoorSlotFlag.js +1 -0
  76. package/dist/enums/copied/DoorSlotFlag.js.map +1 -0
  77. package/dist/enums/copied/RoomShape.js +1 -0
  78. package/dist/enums/copied/RoomShape.js.map +1 -0
  79. package/dist/exec.js +1 -0
  80. package/dist/exec.js.map +1 -0
  81. package/dist/git.js +7 -3
  82. package/dist/git.js.map +1 -0
  83. package/dist/interfaces/GitHubCLIHostsYAML.js +1 -0
  84. package/dist/interfaces/GitHubCLIHostsYAML.js.map +1 -0
  85. package/dist/interfaces/IsaacScriptTSConfig.js +1 -0
  86. package/dist/interfaces/IsaacScriptTSConfig.js.map +1 -0
  87. package/dist/interfaces/ShadersXML.js +1 -0
  88. package/dist/interfaces/ShadersXML.js.map +1 -0
  89. package/dist/interfaces/copied/CustomStageTSConfig.js +1 -0
  90. package/dist/interfaces/copied/CustomStageTSConfig.js.map +1 -0
  91. package/dist/interfaces/copied/JSONRoomsFile.js +1 -0
  92. package/dist/interfaces/copied/JSONRoomsFile.js.map +1 -0
  93. package/dist/main.js +2 -119
  94. package/dist/main.js.map +1 -0
  95. package/dist/objects/copied/doorSlotToDoorSlotFlag.js +1 -0
  96. package/dist/objects/copied/doorSlotToDoorSlotFlag.js.map +1 -0
  97. package/dist/objects/copied/roomShapeToDoorSlotCoordinates.js +1 -0
  98. package/dist/objects/copied/roomShapeToDoorSlotCoordinates.js.map +1 -0
  99. package/dist/packageManager.js +16 -16
  100. package/dist/packageManager.js.map +1 -0
  101. package/dist/parseArgs.js +62 -270
  102. package/dist/parseArgs.js.map +1 -0
  103. package/dist/prompt.js +1 -0
  104. package/dist/prompt.js.map +1 -0
  105. package/dist/tsconfig.js +1 -0
  106. package/dist/tsconfig.js.map +1 -0
  107. package/dist/utils.js +1 -0
  108. package/dist/utils.js.map +1 -0
  109. package/dist/validateMod.js +72 -0
  110. package/dist/validateMod.js.map +1 -0
  111. package/dist/validateNodeVersion.js +11 -1
  112. package/dist/validateNodeVersion.js.map +1 -0
  113. package/package.json +5 -4
  114. package/dist/commands/publish/prePublish.js +0 -105
  115. package/dist/types/Command.js +0 -4
  116. package/dist/validateInIsaacScriptProject.js +0 -29
package/dist/parseArgs.js CHANGED
@@ -1,280 +1,72 @@
1
1
  // Other potential args libraries:
2
- // - util.parseArgs
2
+ // - util.parseArgs [X]
3
3
  // - https://nodejs.org/api/util.html#utilparseargsconfig
4
4
  // - Too bare bones; does not support numbers.
5
- // - arg (1.2K stars)
6
- // - https://github.com/vercel/arg
7
- // - Does not support commands (i.e. positional arguments).
8
- // - cmd-ts (193 stars)
9
- // - https://github.com/Schniz/cmd-ts
5
+ // - commander (25.4K stars)
6
+ // - https://github.com/tj/commander.js
10
7
  // - ?
8
+ // - yargs [X] (10.7K stars)
9
+ // - https://github.com/yargs/yargs
10
+ // - Sucks in TypeScript.
11
+ // - "commander" allows for more module command building.
11
12
  // - clack (4.3K stars)
12
13
  // - https://github.com/natemoo-re/clack
13
14
  // - ?
14
- // - commander (25.4K stars)
15
- // - https://github.com/tj/commander.js
15
+ // - arg [X} (1.2K stars)
16
+ // - https://github.com/vercel/arg
17
+ // - Does not support commands (i.e. positional arguments).
18
+ // - cmd-ts (193 stars)
19
+ // - https://github.com/Schniz/cmd-ts
16
20
  // - ?
17
- import { getArgs } from "isaacscript-common-node";
18
- import yargs from "yargs";
19
- import { PROJECT_NAME } from "./constants.js";
20
- /** Parse command-line arguments. */
21
+ import { Command } from "@commander-js/extra-typings";
22
+ import { dirName, getPackageJSONVersion, nukeDependencies, updatePackageJSON, } from "isaacscript-common-node";
23
+ import path from "node:path";
24
+ import { checkCommand, checkTSCommand } from "./commands/check/check.js";
25
+ import { copyCommand } from "./commands/copy/copy.js";
26
+ import { initCommand, initTSCommand } from "./commands/init/init.js";
27
+ import { monitorCommand } from "./commands/monitor/monitor.js";
28
+ import { publishCommand, publishTSCommand, } from "./commands/publish/publish.js";
29
+ import { CWD, PROJECT_NAME } from "./constants.js";
30
+ const __dirname = dirName();
21
31
  export function parseArgs() {
22
- const args = getArgs();
23
- const yargsObject = yargs(args)
24
- .strict()
25
- .usage(`usage: ${PROJECT_NAME.toLowerCase()} <command> [options]`)
26
- .scriptName(PROJECT_NAME.toLowerCase())
27
- .alias("h", "help") // By default, only "--help" is enabled.
28
- .alias("V", "version") // By default, only "--version" is enabled.
29
- .command("monitor", "Monitor a project for changes. (default)", (builder) => builder
30
- .option("mods-directory", {
31
- alias: "m",
32
- type: "string",
33
- description: "The directory where Isaac mods live on your system",
34
- })
35
- .option("save-slot", {
36
- alias: "s",
37
- type: "number",
38
- choices: [1, 2, 3],
39
- description: "The save slot in-game that you use",
40
- })
41
- .option("skip-project-checks", {
42
- type: "boolean",
43
- description: 'Skip checking for "package.json" and "node_modules"',
44
- })
45
- .option("dev", {
46
- alias: "d",
47
- type: "boolean",
48
- description: "Link the mod to the local development version of isaacscript-common",
49
- })
50
- .option("verbose", {
51
- alias: "v",
52
- type: "boolean",
53
- description: "Enable verbose output",
54
- }))
55
- .command("init [name]", `Initialize a new ${PROJECT_NAME} mod.`, (builder) => builder
56
- .option("yes", {
57
- alias: "y",
58
- type: "boolean",
59
- description: 'Answer yes to every dialog option, similar to how "npm init --yes" works',
60
- })
61
- .option("use-current-dir", {
62
- type: "boolean",
63
- description: "Use the current directory as the root for the project",
64
- })
65
- .option("mods-directory", {
66
- alias: "m",
67
- type: "string",
68
- description: "The directory where Isaac mods live on your system",
69
- })
70
- .option("save-slot", {
71
- alias: "s",
72
- type: "number",
73
- choices: [1, 2, 3],
74
- description: "The in-game save slot that you use",
75
- })
76
- .option("vscode", {
77
- type: "boolean",
78
- description: "Open the project in VSCode after initialization",
79
- })
80
- .option("npm", {
81
- alias: "n",
82
- type: "boolean",
83
- description: "Use npm as the package manager",
84
- })
85
- .option("yarn", {
86
- type: "boolean",
87
- description: "Use Yarn as the package manager",
88
- })
89
- .option("pnpm", {
90
- alias: "p",
91
- type: "boolean",
92
- description: "Use pnpm as the package manager",
93
- })
94
- .option("no-git", {
95
- type: "boolean",
96
- description: "Do not initialize Git",
97
- })
98
- .option("skip-install", {
99
- type: "boolean",
100
- description: "Don't automatically install the dependencies after initializing the project",
101
- })
102
- .option("force-name", {
103
- alias: "f",
104
- type: "boolean",
105
- description: "Allow project names that are normally illegal",
106
- })
107
- .option("dev", {
108
- alias: "d",
109
- type: "boolean",
110
- description: "Link the resulting mod to the local development version of isaacscript-common",
111
- })
112
- .option("verbose", {
113
- alias: "v",
114
- type: "boolean",
115
- description: "Enable verbose output",
116
- }))
117
- .command("init-ts [name]", `Initialize a new ${PROJECT_NAME} TypeScript project.`, (builder) => builder
118
- .option("yes", {
119
- alias: "y",
120
- type: "boolean",
121
- description: 'Answer yes to every dialog option, similar to how "npm init --yes" works',
122
- })
123
- .option("use-current-dir", {
124
- type: "boolean",
125
- description: "Use the current directory as the root for the project",
126
- })
127
- .option("vscode", {
128
- type: "boolean",
129
- description: "Open the project in VSCode after initialization",
130
- })
131
- .option("npm", {
132
- alias: "n",
133
- type: "boolean",
134
- description: "Use npm as the package manager",
135
- })
136
- .option("yarn", {
137
- type: "boolean",
138
- description: "Use Yarn as the package manager",
139
- })
140
- .option("pnpm", {
141
- alias: "p",
142
- type: "boolean",
143
- description: "Use pnpm as the package manager",
144
- })
145
- .option("no-git", {
146
- type: "boolean",
147
- description: "Do not initialize Git",
148
- })
149
- .option("skip-install", {
150
- type: "boolean",
151
- description: "Don't automatically install the dependencies after initializing the project",
152
- })
153
- .option("force-name", {
154
- alias: "f",
155
- type: "boolean",
156
- description: "Allow project names that are normally illegal",
157
- })
158
- .option("verbose", {
159
- alias: "v",
160
- type: "boolean",
161
- description: "Enable verbose output",
162
- }))
163
- .command("copy", "Only compile & copy the mod.", (builder) => builder.option("verbose", {
164
- alias: "v",
165
- type: "boolean",
166
- description: "Enable verbose output",
167
- }))
168
- .command("publish", "Bump the version & prepare for a new release.", (builder) => builder
169
- .option("major", {
170
- type: "boolean",
171
- description: "Perform a major version bump",
172
- })
173
- .option("minor", {
174
- type: "boolean",
175
- description: "Perform a minor version bump",
176
- })
177
- .option("patch", {
178
- type: "boolean",
179
- description: "Perform a patch version bump",
180
- })
181
- .option("skip-increment", {
182
- type: "boolean",
183
- description: "Skip incrementing the version number",
184
- })
185
- .option("set-version", {
186
- type: "string",
187
- description: "Specify the version number instead of incrementing it",
188
- })
189
- .option("dry-run", {
190
- alias: "d",
191
- type: "boolean",
192
- description: "Skip committing/uploading & perform a Git reset afterward",
193
- })
194
- .option("skip-update", {
195
- type: "boolean",
196
- description: "Skip updating dependencies",
197
- })
198
- .option("skip-lint", {
199
- type: "boolean",
200
- description: "Skip linting before publishing",
201
- })
202
- .option("verbose", {
203
- alias: "v",
204
- type: "boolean",
205
- description: "Enable verbose output",
206
- }))
207
- .command("publish-ts", "Bump the version & publish the project to npm.", (builder) => builder
208
- .option("major", {
209
- type: "boolean",
210
- description: "Perform a major version bump",
211
- })
212
- .option("minor", {
213
- type: "boolean",
214
- description: "Perform a minor version bump",
215
- })
216
- .option("patch", {
217
- type: "boolean",
218
- description: "Perform a patch version bump",
219
- })
220
- .option("skip-increment", {
221
- type: "boolean",
222
- description: "Skip incrementing the version number",
223
- })
224
- .option("set-version", {
225
- type: "string",
226
- description: "Specify the version number instead of incrementing it",
227
- })
228
- .option("dry-run", {
229
- alias: "d",
230
- type: "boolean",
231
- description: "Skip committing/uploading & perform a Git reset afterward",
232
- })
233
- .option("skip-lint", {
234
- type: "boolean",
235
- description: "Skip linting before publishing",
236
- })
237
- .option("otp", {
238
- type: "boolean",
239
- description: "Provide a two-factor OTP code tied to the npm account",
240
- })
241
- .option("verbose", {
242
- alias: "v",
243
- type: "boolean",
244
- description: "Enable verbose output",
245
- }))
246
- .command("check", "Check the template files of the current IsaacScript mod to see if they are up to date.", (builder) => builder
247
- .option("ignore", {
248
- alias: "i",
249
- type: "string",
250
- description: "Comma separated list of file names to ignore",
251
- })
252
- .option("verbose", {
253
- alias: "v",
254
- type: "boolean",
255
- description: "Enable verbose output",
256
- }))
257
- .command("check-ts", "Check the template files of the current TypeScript project to see if they are up to date.", (builder) => builder
258
- .option("ignore", {
259
- alias: "i",
260
- type: "string",
261
- description: "Comma separated list of file names to ignore",
262
- })
263
- .option("verbose", {
264
- alias: "v",
265
- type: "boolean",
266
- description: "Enable verbose output",
267
- }))
268
- .command("update", "Update the dependencies in the current project.", (builder) => builder.option("verbose", {
269
- alias: "v",
270
- type: "boolean",
271
- description: "Enable verbose output",
272
- }))
273
- .command("nuke", "Delete and reinstall the dependencies in the current project.", (builder) => builder.option("verbose", {
274
- alias: "v",
275
- type: "boolean",
276
- description: "Enable verbose output",
277
- }))
278
- .parseSync();
279
- return yargsObject;
32
+ const packageJSONPath = path.join(__dirname, "..", "package.json");
33
+ const version = getPackageJSONVersion(packageJSONPath);
34
+ const program = new Command()
35
+ .name(PROJECT_NAME.toLowerCase())
36
+ .description("The CLI for the IsaacScript framework.")
37
+ .version(version, "-V, --version", "Output the version number.")
38
+ .helpOption("-h, --help", "Display the list of commands and options.")
39
+ .addHelpCommand(false);
40
+ program.addCommand(monitorCommand, { isDefault: true });
41
+ program.addCommand(checkCommand);
42
+ program.addCommand(checkTSCommand);
43
+ program.addCommand(copyCommand);
44
+ program.addCommand(initCommand);
45
+ program.addCommand(initTSCommand);
46
+ program.addCommand(nukeCommand);
47
+ program.addCommand(publishCommand);
48
+ program.addCommand(publishTSCommand);
49
+ program.addCommand(updateCommand);
50
+ program.parse();
280
51
  }
52
+ const updateCommand = new Command()
53
+ .command("update")
54
+ .description("Update the npm dependencies in the current project.")
55
+ .helpOption("-h, --help", "Display the list of options for this command.")
56
+ .action(async () => {
57
+ const hasNewDependencies = await updatePackageJSON(CWD);
58
+ const msg = hasNewDependencies
59
+ ? "Successfully installed new Node.js dependencies."
60
+ : "There were no new dependency updates from npm.";
61
+ console.log(msg);
62
+ });
63
+ const nukeCommand = new Command()
64
+ .command("nuke")
65
+ .description("Delete and reinstall the dependencies in the current project.")
66
+ .helpOption("-h, --help", "Display the list of options for this command.")
67
+ .option("-v, --verbose", "Enable verbose output.", false)
68
+ .action(() => {
69
+ nukeDependencies(CWD);
70
+ console.log("Successfully reinstalled dependencies from npm.");
71
+ });
72
+ //# sourceMappingURL=parseArgs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseArgs.js","sourceRoot":"","sources":["../../../src/parseArgs.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,uBAAuB;AACvB,2DAA2D;AAC3D,gDAAgD;AAChD,4BAA4B;AAC5B,yCAAyC;AACzC,QAAQ;AACR,4BAA4B;AAC5B,qCAAqC;AACrC,2BAA2B;AAC3B,2DAA2D;AAC3D,uBAAuB;AACvB,0CAA0C;AAC1C,QAAQ;AACR,yBAAyB;AACzB,oCAAoC;AACpC,6DAA6D;AAC7D,uBAAuB;AACvB,uCAAuC;AACvC,QAAQ;AAER,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EACL,OAAO,EACP,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EACL,cAAc,EACd,gBAAgB,GACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,gBA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IAAI,EAAE;IACjB,MAAM,kBAAkB,GAAG,MAAM,iBAAiB,CAAC,GAAG,CAAC,CAAC;IACxD,MAAM,GAAG,GAAG,kBAAkB;QAC5B,CAAC,CAAC,kDAAkD;QACpD,CAAC,CAAC,gDAAgD,CAAC;IACrD,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACnB,CAAC,CAAC,CAAC;AAEL,MAAM,WAAW,GAAG,IAAI,OAAO,EAAE;KAC9B,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,+DAA+D,CAAC;KAC5E,UAAU,CAAC,YAAY,EAAE,+CAA+C,CAAC;KACzE,MAAM,CAAC,eAAe,EAAE,wBAAwB,EAAE,KAAK,CAAC;KACxD,MAAM,CAAC,GAAG,EAAE;IACX,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACtB,OAAO,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC;AACjE,CAAC,CAAC,CAAC"}
package/dist/prompt.js CHANGED
@@ -77,3 +77,4 @@ export async function getInputInt(msg, defaultValue = 1) {
77
77
  }
78
78
  return int;
79
79
  }
80
+ //# sourceMappingURL=prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../src/prompt.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,sEAAsE;AAEtE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,mBAAmB,GAAG,IAAI,WAAW,CAAS,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;AACxE,MAAM,kBAAkB,GAAG,IAAI,WAAW,CAAS,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;AAEhE,MAAM,UAAU,UAAU;IAC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config.js CHANGED
@@ -96,3 +96,4 @@ export function getCustomStagesFromTSConfig() {
96
96
  }
97
97
  return customStages;
98
98
  }
99
+ //# sourceMappingURL=tsconfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tsconfig.js","sourceRoot":"","sources":["../../../src/tsconfig.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,KAAK,CAAC;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EACL,uBAAuB,EACvB,YAAY,EACZ,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAGxB,MAAM,MAAM,GAAG,oBAAoB,aAAa,sBAAsB,YAAY,WAAW,CAAC;AAE9F,MAAM,iBAAiB,GAAG,QAAQ,CAAC,uBAAuB,CAAC,CAAC;AAE5D,qEAAqE;AACrE,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC;AAC9B,MAAM,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;AACtB,MAAM,cAAc,GAAG,GAAG,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAEtD,SAAS,eAAe;IACtB,OAAO,QAAQ,CAAC,kBAAkB,CAAC,CAAC;AACtC,CAAC;AAED,SAAS,qBAAqB;IAC5B,MAAM,QAAQ,GAAG,eAAe,EAAE,CAAC;IAEnC,yDAAyD;IACzD,KAAK,MAAM,SAAS,IAAI,CAAC,aAAa,EAAE,aAAa,EAAE,aAAa,CAAC,EAAE;QACrE,MAAM,KAAK,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;QAClC,IAAI,KAAK,KAAK,SAAS,EAAE;YACvB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;gBACpB,UAAU,CACR,SAAS,KAAK,CAAC,KAAK,CAClB,kBAAkB,CACn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,GAAG,CAAC,IAAI,aAAa,GAAG,CAAC,CAAC,EACxC;YACA,UAAU,CACR,QAAQ,IAAI,sEAAsE,aAAa,EAAE,CAClG,CAAC;SACH;KACF;IAED,OAAO,YAAqC,CAAC;AAC/C,CAAC"}
package/dist/utils.js CHANGED
@@ -6,3 +6,4 @@ export function getModTargetDirectoryName(config) {
6
6
  export function getTime() {
7
7
  return moment().format("h:mm:ss A"); // e.g. "1:23:45 AM"
8
8
  }
9
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM,UAAU,yBAAyB,CAAC,MAAc;IACtD,OAAO,MAAM,CAAC,4BAA4B,IAAI,sBAAsB,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,OAAO;IACrB,OAAO,MAAM,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,oBAAoB;AAC3D,CAAC"}
@@ -0,0 +1,72 @@
1
+ import chalk from "chalk";
2
+ import { PACKAGE_JSON, fatalError, getPackageJSON, getPackageJSONDependencies, getPackageManagerAddDevCommand, getPackageManagerInstallCommand, isDirectory, isFile, } from "isaacscript-common-node";
3
+ import path from "node:path";
4
+ import { CWD, PROJECT_NAME } from "./constants.js";
5
+ import { execShellString } from "./exec.js";
6
+ import { getPackageManagerUsedForExistingProject } from "./packageManager.js";
7
+ const FILE_NAMES_TO_CHECK = [PACKAGE_JSON];
8
+ /** We don't check "node_modules" because we might be cloning a fresh IsaacScript project. */
9
+ const SUBDIRECTORY_NAMES_TO_CHECK = ["src", "mod"];
10
+ /**
11
+ * We want "typescript" and some of the other dependencies to be in "devDependencies" instead of
12
+ * "dependencies" because it prevents their functions from being placed into the list of
13
+ * auto-complete functions.
14
+ */
15
+ const REQUIRED_PACKAGE_JSON_DEV_DEPENDENCIES = [
16
+ "isaacscript",
17
+ // - "isaacscript-lint" is not required.
18
+ // - "isaacscript-spell" is not required.
19
+ // - "isaacscript-tsconfig" is not required.
20
+ "typescript",
21
+ "typescript-to-lua",
22
+ ];
23
+ // Validate that we are in a directory that looks like an IsaacScript project.
24
+ export function validateInIsaacScriptProject() {
25
+ for (const fileName of FILE_NAMES_TO_CHECK) {
26
+ const filePath = path.join(CWD, fileName);
27
+ if (!isFile(filePath)) {
28
+ errorNotExists(fileName, true);
29
+ }
30
+ }
31
+ for (const subdirectoryName of SUBDIRECTORY_NAMES_TO_CHECK) {
32
+ const subdirectoryPath = path.join(CWD, subdirectoryName);
33
+ if (!isDirectory(subdirectoryPath)) {
34
+ errorNotExists(subdirectoryName, false);
35
+ }
36
+ }
37
+ }
38
+ function errorNotExists(dirName, file) {
39
+ const noun = file ? "file" : "subdirectory";
40
+ console.error(chalk.red(`It looks like the current working directory is not an ${PROJECT_NAME} project. (There is no "${dirName}" ${noun} here.)`));
41
+ console.error(`Did you mean to create a new ${PROJECT_NAME} project with "${chalk.green("npx isaacscript init")}"?`);
42
+ console.error(`If not, then change the current working directory to an ${PROJECT_NAME} project.`);
43
+ process.exit(1);
44
+ }
45
+ export function validatePackageJSONDependencies() {
46
+ const packageJSON = getPackageJSON(CWD);
47
+ const dependencies = getPackageJSONDependencies(packageJSON, "devDependencies") ?? {};
48
+ const dependenciesArray = Object.keys(dependencies);
49
+ const devDependencies = getPackageJSONDependencies(packageJSON, "devDependencies") ?? {};
50
+ const devDependenciesArray = Object.keys(devDependencies);
51
+ for (const devDependency of REQUIRED_PACKAGE_JSON_DEV_DEPENDENCIES) {
52
+ if (dependenciesArray.includes(devDependency)) {
53
+ const packageManager = getPackageManagerUsedForExistingProject();
54
+ const addDevCommand = getPackageManagerAddDevCommand(packageManager, devDependency);
55
+ fatalError(`${chalk.red(`The "${devDependency}" dependency is located in the "dependencies" object instead of the "devDependencies" object in the "${PACKAGE_JSON}" file. You can fix this with the following command:`)} ${chalk.green(addDevCommand)}`);
56
+ }
57
+ }
58
+ for (const devDependency of REQUIRED_PACKAGE_JSON_DEV_DEPENDENCIES) {
59
+ if (!devDependenciesArray.includes(devDependency)) {
60
+ const packageManager = getPackageManagerUsedForExistingProject();
61
+ const addDevCommand = getPackageManagerAddDevCommand(packageManager, devDependency);
62
+ fatalError(`${chalk.red(`IsaacScript projects require a "devDependencies" entry of "${devDependency}" in the "${PACKAGE_JSON}" file. You can add it with the following command:`)} ${chalk.green(addDevCommand)}`);
63
+ }
64
+ }
65
+ }
66
+ export function validateDepsInstalled(verbose) {
67
+ const packageManager = getPackageManagerUsedForExistingProject();
68
+ const command = getPackageManagerInstallCommand(packageManager);
69
+ console.log(`Running "${command}" to ensure that the project's dependencies are installed correctly.`);
70
+ execShellString(command, verbose);
71
+ }
72
+ //# sourceMappingURL=validateMod.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateMod.js","sourceRoot":"","sources":["../../../src/validateMod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,YAAY,EACZ,UAAU,EACV,cAAc,EACd,0BAA0B,EAC1B,8BAA8B,EAC9B,+BAA+B,EAC/B,WAAW,EACX,MAAM,GACP,MAAM,yBAAyB,CAAC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,uCAAuC,EAAE,MAAM,qBAAqB,CAAC;AAE9E,MAAM,mBAAmB,GAAG,CAAC,YAAY,CAAU,CAAC;AAEpD,6FAA6F;AAC7F,MAAM,2BAA2B,GAAG,CAAC,KAAK,EAAE,KAAK,CAAU,CAAC;AAE5D;;;;GAIG;AACH,MAAM,sCAAsC,GAAG;IAC7C,aAAa;IACb,wCAAwC;IACxC,yCAAyC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
@@ -2,7 +2,16 @@ import chalk from "chalk";
2
2
  import { fatalError } from "isaacscript-common-node";
3
3
  import { parseSemanticVersion } from "isaacscript-common-ts";
4
4
  import { PROJECT_NAME } from "./constants.js";
5
- const REQUIRED_NODE_JS_MAJOR_VERSION = 16;
5
+ /**
6
+ * The lowest supported LTS version as of the time of this writing.
7
+ *
8
+ * @see https://endoflife.date/nodejs
9
+ */
10
+ const REQUIRED_NODE_JS_MAJOR_VERSION = 18;
11
+ /**
12
+ * The IsaacScript CLI will probably work on versions of Node.js that are past end-of-life, but this
13
+ * is not supported. We prefer failing fast to get the end-user on a modern version of Node.js.
14
+ */
6
15
  export function validateNodeVersion() {
7
16
  const { version } = process;
8
17
  const semanticVersion = parseSemanticVersion(version);
@@ -18,3 +27,4 @@ export function validateNodeVersion() {
18
27
  console.error(`Please upgrade your version of Node.js before using ${PROJECT_NAME}.`);
19
28
  process.exit(1);
20
29
  }
30
+ //# sourceMappingURL=validateNodeVersion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateNodeVersion.js","sourceRoot":"","sources":["../../../src/validateNodeVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;GAIG;AACH,MAAM,8BAA8B,GAAG,EAAE,CAAC;AAE1C;;;GAGG;AACH,MAAM,UAAU,mBAAmB;IACjC,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAE5B,MAAM,eAAe,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;IACtD,IAAI,eAAe,KAAK,SAAS,EAAE;QACjC,UAAU,CAAC,qCAAqC,OAAO,EAAE,CAAC,CAAC;KAC5D;IAED,MAAM,EAAE,YAAY,EAAE,GAAG,eAAe,CAAC;IACzC,IAAI,YAAY,IAAI,8BAA8B,EAAE;QAClD,OAAO;KACR;IAED,OAAO,CAAC,KAAK,CAAC,4BAA4B,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAChE,OAAO,CAAC,KAAK,CACX,GAAG,YAAY,kCAAkC,KAAK,CAAC,GAAG,CACxD,GAAG,8BAA8B,MAAM,CACxC,cAAc,CAChB,CAAC;IACF,OAAO,CAAC,KAAK,CACX,uDAAuD,YAAY,GAAG,CACvE,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript",
3
- "version": "3.18.4",
3
+ "version": "3.18.6-dev.0",
4
4
  "description": "A command line tool for managing Isaac mods written in TypeScript.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -39,14 +39,16 @@
39
39
  "scripts": {
40
40
  "build": "tsx ./scripts/build.ts",
41
41
  "lint": "tsx ./scripts/lint.ts",
42
- "run": "tsx ./src/main.ts",
42
+ "start": "tsx ./src/main.ts",
43
43
  "test": "glob \"./src/**/*.test.ts\" --cmd=\"node --import tsx --test --test-reporter spec\""
44
44
  },
45
45
  "dependencies": {
46
+ "@commander-js/extra-typings": "^11.1.0",
46
47
  "@zamiell/sync-directory": "^6.0.5",
47
48
  "ajv": "^8.12.0",
48
49
  "chalk": "^5.3.0",
49
50
  "command-exists": "^1.2.9",
51
+ "commander": "^11.1.0",
50
52
  "figlet": "^1.7.0",
51
53
  "isaacscript-common-node": "^1.2.0",
52
54
  "isaacscript-common-ts": "^11.3.1",
@@ -57,8 +59,7 @@
57
59
  "source-map-support": "^0.5.21",
58
60
  "typescript-to-lua": "^1.21.0",
59
61
  "xml2js": "^0.6.2",
60
- "yaml": "^2.3.4",
61
- "yargs": "^17.7.2"
62
+ "yaml": "^2.3.4"
62
63
  },
63
64
  "peerDependencies": {
64
65
  "typescript": ">= 5.0.0"
@@ -1,105 +0,0 @@
1
- import { PACKAGE_JSON, fatalError, getPackageJSONVersion, getPackageManagerInstallCommand, isFile, readFile, updatePackageJSON, writeFile, } from "isaacscript-common-node";
2
- import { CONSTANTS_TS_PATH, METADATA_XML_PATH, VERSION_TXT_PATH, } from "../../constants.js";
3
- import { execShell, execShellString } from "../../exec.js";
4
- import { gitCommitAllAndPush } from "../../git.js";
5
- import { getPackageManagerUsedForExistingProject } from "../../packageManager.js";
6
- /**
7
- * Before uploading the project, we want to update dependencies, increment the version, and perform
8
- * some other steps.
9
- */
10
- export async function prePublish(args, typeScript) {
11
- const skipUpdate = args.skipUpdate === true;
12
- const skipLint = args.skipLint === true;
13
- const dryRun = args.dryRun === true;
14
- const verbose = args.verbose === true;
15
- const packageManager = getPackageManagerUsedForExistingProject(args);
16
- execShellString("git pull --rebase");
17
- execShellString("git push");
18
- await updateDependencies(skipUpdate, dryRun, packageManager, verbose);
19
- incrementVersion(args, typeScript);
20
- tryRunNPMScript("build", verbose);
21
- if (!skipLint) {
22
- tryRunNPMScript("lint", verbose);
23
- }
24
- }
25
- async function updateDependencies(skipUpdate, dryRun, packageManager, verbose) {
26
- if (skipUpdate) {
27
- return;
28
- }
29
- console.log(`Updating dependencies in the "${PACKAGE_JSON}" file...`);
30
- const hasNewDependencies = await updatePackageJSON(undefined);
31
- if (hasNewDependencies) {
32
- const command = getPackageManagerInstallCommand(packageManager);
33
- execShellString(command, verbose);
34
- if (!dryRun) {
35
- gitCommitAllAndPush("chore: update dependencies", verbose);
36
- }
37
- }
38
- }
39
- function incrementVersion(args, typeScript) {
40
- const skipIncrement = args.skipIncrement === true;
41
- const verbose = args.verbose === true;
42
- if (skipIncrement) {
43
- return;
44
- }
45
- const versionCommandArgument = getVersionCommandArgument(args);
46
- // We always use `npm` here to avoid differences with the version command between package
47
- // managers. The "--no-git-tag-version" flag will prevent npm from both making a commit and adding
48
- // a tag.
49
- execShellString(`npm version ${versionCommandArgument} --no-git-tag-version`, verbose);
50
- if (!typeScript) {
51
- const version = getPackageJSONVersion(undefined);
52
- writeVersionToConstantsTS(version);
53
- writeVersionToMetadataXML(version);
54
- writeVersionToVersionTXT(version);
55
- }
56
- }
57
- function getVersionCommandArgument(args) {
58
- const { setVersion } = args;
59
- if (setVersion !== undefined) {
60
- // They want to use a specific version, which was manually specified.
61
- return setVersion;
62
- }
63
- const major = args.major === true;
64
- if (major) {
65
- return "major";
66
- }
67
- const minor = args.minor === true;
68
- if (minor) {
69
- return "minor";
70
- }
71
- const patch = args.patch === true;
72
- if (patch) {
73
- return "patch";
74
- }
75
- // Default to a patch version.
76
- return "patch";
77
- }
78
- function writeVersionToConstantsTS(version) {
79
- if (!isFile(CONSTANTS_TS_PATH)) {
80
- console.log('Skipping writing the version to "constants.ts" since it was not found.');
81
- return;
82
- }
83
- const constantsTS = readFile(CONSTANTS_TS_PATH);
84
- const newConstantsTS = constantsTS.replace(/const VERSION = ".+"/, `const VERSION = "${version}"`);
85
- writeFile(CONSTANTS_TS_PATH, newConstantsTS);
86
- console.log(`The version of ${version} was written to: ${CONSTANTS_TS_PATH}`);
87
- }
88
- function writeVersionToMetadataXML(version) {
89
- const metadataXML = readFile(METADATA_XML_PATH);
90
- const newMetadataXML = metadataXML.replace(/<version>.+<\/version>/, `<version>${version}</version>`);
91
- writeFile(METADATA_XML_PATH, newMetadataXML);
92
- console.log(`The version of ${version} was written to: ${METADATA_XML_PATH}`);
93
- }
94
- function writeVersionToVersionTXT(version) {
95
- writeFile(VERSION_TXT_PATH, version);
96
- console.log(`The version of ${version} was written to: ${VERSION_TXT_PATH}`);
97
- }
98
- function tryRunNPMScript(scriptName, verbose) {
99
- console.log(`Running: ${scriptName}`);
100
- const { exitStatus, stdout } = execShell("npm", ["run", scriptName], verbose, true);
101
- if (exitStatus !== 0) {
102
- execShellString("git reset --hard", verbose); // Revert the version changes.
103
- fatalError(`Failed to run "${scriptName}":`, stdout);
104
- }
105
- }
@@ -1,4 +0,0 @@
1
- export const DEFAULT_COMMAND = "monitor";
2
- export function isIsaacScriptModCommand(command) {
3
- return !command.endsWith("-ts") && command !== "update" && command !== "nuke";
4
- }