isaacscript 1.1.74-dev.3 → 1.2.3

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 (66) hide show
  1. package/dist/package.json +5 -5
  2. package/dist/src/commands/copy/copy.js +13 -12
  3. package/dist/src/commands/copy/copy.js.map +1 -1
  4. package/dist/src/commands/init/checkIfProjectPathExists.js +2 -2
  5. package/dist/src/commands/init/checkIfProjectPathExists.js.map +1 -1
  6. package/dist/src/commands/init/checkModTargetDirectory.js +2 -2
  7. package/dist/src/commands/init/checkModTargetDirectory.js.map +1 -1
  8. package/dist/src/commands/init/createMod.js +55 -34
  9. package/dist/src/commands/init/createMod.js.map +1 -1
  10. package/dist/src/commands/init/init.js +10 -8
  11. package/dist/src/commands/init/init.js.map +1 -1
  12. package/dist/src/commands/init/installVSCodeExtensions.js +3 -2
  13. package/dist/src/commands/init/installVSCodeExtensions.js.map +1 -1
  14. package/dist/src/commands/init/promptVSCode.js +7 -7
  15. package/dist/src/commands/init/promptVSCode.js.map +1 -1
  16. package/dist/src/commands/monitor/copyWatcherMod.js +7 -7
  17. package/dist/src/commands/monitor/copyWatcherMod.js.map +1 -1
  18. package/dist/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.js +4 -4
  19. package/dist/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.js.map +1 -1
  20. package/dist/src/commands/monitor/monitor.js +4 -3
  21. package/dist/src/commands/monitor/monitor.js.map +1 -1
  22. package/dist/src/commands/monitor/saveDatWriter/saveDatWriter.js +1 -1
  23. package/dist/src/commands/monitor/saveDatWriter/saveDatWriter.js.map +1 -1
  24. package/dist/src/commands/monitor/touchWatcherSaveDatFiles.js +3 -3
  25. package/dist/src/commands/monitor/touchWatcherSaveDatFiles.js.map +1 -1
  26. package/dist/src/commands/publish/publish.js +48 -46
  27. package/dist/src/commands/publish/publish.js.map +1 -1
  28. package/dist/src/configFile.js +4 -3
  29. package/dist/src/configFile.js.map +1 -1
  30. package/dist/src/exec.js +79 -0
  31. package/dist/src/exec.js.map +1 -0
  32. package/dist/src/file.js +35 -5
  33. package/dist/src/file.js.map +1 -1
  34. package/dist/src/main.js +1 -1
  35. package/dist/src/main.js.map +1 -1
  36. package/dist/src/monkeyPatch.js +8 -14
  37. package/dist/src/monkeyPatch.js.map +1 -1
  38. package/dist/src/parseArgs.js +20 -1
  39. package/dist/src/parseArgs.js.map +1 -1
  40. package/dist/src/util.js +22 -57
  41. package/dist/src/util.js.map +1 -1
  42. package/dist/src/validateNodeVersion.js +6 -24
  43. package/dist/src/validateNodeVersion.js.map +1 -1
  44. package/package.json +5 -5
  45. package/publish.sh +1 -1
  46. package/src/commands/copy/copy.ts +20 -12
  47. package/src/commands/init/checkIfProjectPathExists.ts +2 -1
  48. package/src/commands/init/checkModTargetDirectory.ts +2 -1
  49. package/src/commands/init/createMod.ts +87 -29
  50. package/src/commands/init/init.ts +15 -7
  51. package/src/commands/init/installVSCodeExtensions.ts +4 -2
  52. package/src/commands/init/promptVSCode.ts +12 -7
  53. package/src/commands/monitor/copyWatcherMod.ts +10 -7
  54. package/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.ts +3 -3
  55. package/src/commands/monitor/monitor.ts +5 -3
  56. package/src/commands/monitor/saveDatWriter/saveDatWriter.ts +1 -1
  57. package/src/commands/monitor/touchWatcherSaveDatFiles.ts +6 -3
  58. package/src/commands/publish/publish.ts +65 -55
  59. package/src/configFile.ts +9 -3
  60. package/src/exec.ts +102 -0
  61. package/src/file.ts +48 -5
  62. package/src/main.ts +1 -1
  63. package/src/monkeyPatch.ts +8 -13
  64. package/src/parseArgs.ts +22 -1
  65. package/src/util.ts +29 -79
  66. package/src/validateNodeVersion.ts +7 -39
@@ -19,10 +19,14 @@ import {
19
19
  README_MD_TEMPLATES_PATH,
20
20
  TEMPLATES_STATIC_DIR,
21
21
  } from "../../constants";
22
+ import { execShell } from "../../exec";
22
23
  import * as file from "../../file";
23
24
  import { getInputString, getInputYesNo } from "../../prompt";
24
25
  import { GitHubCLIHostsYAML } from "../../types/GitHubCLIHostsYAML";
25
- import { execShell } from "../../util";
26
+ import { error, parseSemVer } from "../../util";
27
+
28
+ const REQUIRED_GIT_MAJOR_VERSION = 2;
29
+ const REQUIRED_GIT_MINOR_VERSION = 30;
26
30
 
27
31
  export async function createMod(
28
32
  projectName: string,
@@ -31,41 +35,42 @@ export async function createMod(
31
35
  modsDirectory: string,
32
36
  saveSlot: number,
33
37
  skipNPMInstall: boolean,
38
+ verbose: boolean,
34
39
  ): Promise<void> {
35
40
  if (createNewDir) {
36
- file.makeDir(projectPath);
41
+ file.makeDir(projectPath, verbose);
37
42
  }
38
43
 
39
44
  const config = configFile.createObject(modsDirectory, saveSlot);
40
- configFile.createFile(projectPath, config);
45
+ configFile.createFile(projectPath, config, verbose);
41
46
  const targetModDirectory = path.join(config.modsDirectory, projectName);
42
47
 
43
- makeSubdirectories(projectPath);
44
- copyStaticFiles(projectPath);
45
- copyDynamicFiles(projectName, projectPath, targetModDirectory);
46
- updateNodeModules(projectPath);
47
- await initGitRepository(projectPath, projectName);
48
- installNodeModules(projectPath, skipNPMInstall);
48
+ makeSubdirectories(projectPath, verbose);
49
+ copyStaticFiles(projectPath, verbose);
50
+ copyDynamicFiles(projectName, projectPath, targetModDirectory, verbose);
51
+ updateNodeModules(projectPath, verbose);
52
+ await initGitRepository(projectPath, projectName, verbose);
53
+ installNodeModules(projectPath, skipNPMInstall, verbose);
49
54
 
50
55
  console.log(`Successfully created mod: ${chalk.green(projectName)}`);
51
56
  }
52
57
 
53
- function makeSubdirectories(projectPath: string) {
58
+ function makeSubdirectories(projectPath: string, verbose: boolean) {
54
59
  // The "src" directory is created during copying of static files
55
60
  for (const subdirectory of ["mod"]) {
56
61
  const srcPath = path.join(projectPath, subdirectory);
57
- file.makeDir(srcPath);
62
+ file.makeDir(srcPath, verbose);
58
63
  }
59
64
  }
60
65
 
61
66
  // Copy static files, like ".eslintrc.js", "tsconfig.json", etc.
62
- function copyStaticFiles(projectPath: string) {
67
+ function copyStaticFiles(projectPath: string, verbose: boolean) {
63
68
  const staticFileList = file.getDirList(TEMPLATES_STATIC_DIR);
64
69
  staticFileList.forEach((fileName: string) => {
65
70
  const templateFilePath = path.join(TEMPLATES_STATIC_DIR, fileName);
66
71
  const destinationFilePath = path.join(projectPath, fileName);
67
72
  if (!file.exists(destinationFilePath)) {
68
- file.copy(templateFilePath, destinationFilePath);
73
+ file.copy(templateFilePath, destinationFilePath, verbose);
69
74
  }
70
75
  });
71
76
  }
@@ -75,6 +80,7 @@ function copyDynamicFiles(
75
80
  projectName: string,
76
81
  projectPath: string,
77
82
  targetModDirectory: string,
83
+ verbose: boolean,
78
84
  ) {
79
85
  // ".gitignore"
80
86
  {
@@ -92,7 +98,7 @@ function copyDynamicFiles(
92
98
  const gitignore = gitignoreHeader + template;
93
99
 
94
100
  const destinationPath = path.join(projectPath, `.${fileName}`); // We need to prepend a period
95
- file.write(destinationPath, gitignore);
101
+ file.write(destinationPath, gitignore, verbose);
96
102
  }
97
103
 
98
104
  // "package.json"
@@ -103,7 +109,7 @@ function copyDynamicFiles(
103
109
  const template = file.read(templatePath);
104
110
  const packageJSON = template.replace(/MOD_NAME_TO_REPLACE/g, projectName);
105
111
  const destinationPath = path.join(projectPath, fileName);
106
- file.write(destinationPath, packageJSON);
112
+ file.write(destinationPath, packageJSON, verbose);
107
113
  }
108
114
 
109
115
  // "README.md"
@@ -113,7 +119,7 @@ function copyDynamicFiles(
113
119
  const template = file.read(templatePath);
114
120
  const readmeMD = template.replace(/MOD_NAME_TO_REPLACE/g, projectName);
115
121
  const destinationPath = path.join(projectPath, fileName);
116
- file.write(destinationPath, readmeMD);
122
+ file.write(destinationPath, readmeMD, verbose);
117
123
  }
118
124
 
119
125
  // "mod/metadata.xml"
@@ -124,7 +130,7 @@ function copyDynamicFiles(
124
130
  const metadataXML = template.replace(/MOD_NAME_TO_REPLACE/g, projectName);
125
131
  const modPath = path.join(projectPath, "mod");
126
132
  const destinationPath = path.join(modPath, fileName);
127
- file.write(destinationPath, metadataXML);
133
+ file.write(destinationPath, metadataXML, verbose);
128
134
  }
129
135
 
130
136
  // "mod/metadata.vdf"
@@ -135,7 +141,7 @@ function copyDynamicFiles(
135
141
  const metadataVDF = template.replace(/MOD_TARGET_DIR/g, targetModDirectory);
136
142
  const modPath = path.join(projectPath, "mod");
137
143
  const destinationPath = path.join(modPath, fileName);
138
- file.write(destinationPath, metadataVDF);
144
+ file.write(destinationPath, metadataVDF, verbose);
139
145
  }
140
146
 
141
147
  // "src/main.ts"
@@ -148,21 +154,26 @@ function copyDynamicFiles(
148
154
  const template = file.read(templatePath);
149
155
  const mainTS = template.replace(/MOD_NAME_TO_REPLACE/g, projectName);
150
156
  const destinationPath = path.join(srcPath, fileName);
151
- file.write(destinationPath, mainTS);
157
+ file.write(destinationPath, mainTS, verbose);
152
158
  }
153
159
  }
154
160
 
155
- function updateNodeModules(projectPath: string) {
161
+ function updateNodeModules(projectPath: string, verbose: boolean) {
156
162
  console.log("Finding out the latest versions of the NPM packages...");
157
163
  execShell(
158
164
  "npx",
159
165
  ["npm-check-updates", "--upgrade", "--packageFile", "package.json"],
166
+ verbose,
160
167
  false,
161
168
  projectPath,
162
169
  );
163
170
  }
164
171
 
165
- async function initGitRepository(projectPath: string, projectName: string) {
172
+ async function initGitRepository(
173
+ projectPath: string,
174
+ projectName: string,
175
+ verbose: boolean,
176
+ ) {
166
177
  if (!commandExists.sync("git")) {
167
178
  console.log(
168
179
  'Git does not seem to be installed. (The "git" command is not in the path.) Skipping Git-related things.',
@@ -170,19 +181,28 @@ async function initGitRepository(projectPath: string, projectName: string) {
170
181
  return;
171
182
  }
172
183
 
184
+ checkOldGitVersion(verbose);
185
+
173
186
  const remoteURL = await getGitRemoteURL(projectName);
174
187
  if (remoteURL === "") {
175
188
  return;
176
189
  }
177
190
 
178
- execShell("git", ["init"], false, projectPath);
179
- execShell("git", ["branch", "-M", "main"], false, projectPath);
180
- execShell("git", ["remote", "add", "origin", remoteURL], false, projectPath);
181
- if (isGitNameAndEmailConfigured()) {
182
- execShell("git", ["add", "--all"], false, projectPath);
191
+ execShell("git", ["init"], verbose, false, projectPath);
192
+ execShell("git", ["branch", "-M", "main"], verbose, false, projectPath);
193
+ execShell(
194
+ "git",
195
+ ["remote", "add", "origin", remoteURL],
196
+ verbose,
197
+ false,
198
+ projectPath,
199
+ );
200
+ if (isGitNameAndEmailConfigured(verbose)) {
201
+ execShell("git", ["add", "--all"], verbose, false, projectPath);
183
202
  execShell(
184
203
  "git",
185
204
  ["commit", "--message", `${PROJECT_NAME} template`],
205
+ verbose,
186
206
  false,
187
207
  projectPath,
188
208
  );
@@ -211,6 +231,38 @@ If you don't want to initialize a Git repository for this project, press enter t
211
231
  `);
212
232
  }
213
233
 
234
+ function checkOldGitVersion(verbose: boolean) {
235
+ const [, stdout] = execShell("git", ["--version"], verbose);
236
+
237
+ const outputPrefix = "git version ";
238
+ if (!stdout.startsWith(outputPrefix)) {
239
+ error(
240
+ `Failed to parse the output from the "git --version" command: ${stdout}`,
241
+ );
242
+ }
243
+
244
+ const gitVersionString = stdout.slice(outputPrefix.length);
245
+ const [majorVersion, minorVersion] = parseSemVer(gitVersionString);
246
+
247
+ if (
248
+ majorVersion >= REQUIRED_GIT_MAJOR_VERSION &&
249
+ minorVersion >= REQUIRED_GIT_MINOR_VERSION
250
+ ) {
251
+ return;
252
+ }
253
+
254
+ console.error(`Your Git version is: ${chalk.red(gitVersionString)}`);
255
+ console.error(
256
+ `${PROJECT_NAME} requires a Git version of ${chalk.red(
257
+ `${REQUIRED_GIT_MAJOR_VERSION}.${REQUIRED_GIT_MINOR_VERSION}.0`,
258
+ )} or greater.`,
259
+ );
260
+ console.error(
261
+ `Please upgrade your version of Git before using ${PROJECT_NAME}.`,
262
+ );
263
+ process.exit(1);
264
+ }
265
+
214
266
  function guessRemoteURL(projectName: string) {
215
267
  const gitHubUsername = getGitHubUsername();
216
268
  if (gitHubUsername === undefined) {
@@ -255,27 +307,33 @@ function getGitHubUsername() {
255
307
  return user;
256
308
  }
257
309
 
258
- function isGitNameAndEmailConfigured() {
310
+ function isGitNameAndEmailConfigured(verbose: boolean) {
259
311
  const [nameExitStatus] = execShell(
260
312
  "git",
261
313
  ["config", "--global", "user.name"],
314
+ verbose,
262
315
  true,
263
316
  );
264
317
 
265
318
  const [emailExitStatus] = execShell(
266
319
  "git",
267
320
  ["config", "--global", "user.email"],
321
+ verbose,
268
322
  true,
269
323
  );
270
324
 
271
325
  return nameExitStatus === 0 && emailExitStatus === 0;
272
326
  }
273
327
 
274
- function installNodeModules(projectPath: string, skipNPMInstall: boolean) {
328
+ function installNodeModules(
329
+ projectPath: string,
330
+ skipNPMInstall: boolean,
331
+ verbose: boolean,
332
+ ) {
275
333
  if (skipNPMInstall) {
276
334
  return;
277
335
  }
278
336
 
279
337
  console.log("Installing node modules... (This can take a long time.)");
280
- execShell("npm", ["install"], false, projectPath);
338
+ execShell("npm", ["install"], verbose, false, projectPath);
281
339
  }
@@ -13,15 +13,18 @@ import { promptSaveSlot } from "./promptSaveSlot";
13
13
  import { promptVSCode } from "./promptVSCode";
14
14
 
15
15
  export async function init(argv: Record<string, unknown>): Promise<void> {
16
+ const vscode = argv.vscode === true;
17
+ const skipNPMInstall = argv.skipNpmInstall === true;
18
+ const verbose = argv.verbose === true;
19
+
16
20
  // Prompt the end-user for some information (and validate it as we go)
17
21
  const [projectPath, createNewDir] = await getProjectPath(argv);
18
- await checkIfProjectPathExists(projectPath);
22
+ await checkIfProjectPathExists(projectPath, verbose);
19
23
  const modsDirectory = await getModsDir(argv);
20
24
  checkModSubdirectory(projectPath, modsDirectory);
21
25
  const projectName = path.basename(projectPath);
22
- await checkModTargetDirectory(modsDirectory, projectName);
26
+ await checkModTargetDirectory(modsDirectory, projectName, verbose);
23
27
  const saveSlot = await promptSaveSlot(argv);
24
- const skipNPMInstall = argv.skipNpmInstall === true;
25
28
 
26
29
  await createMod(
27
30
  projectName,
@@ -30,12 +33,17 @@ export async function init(argv: Record<string, unknown>): Promise<void> {
30
33
  modsDirectory,
31
34
  saveSlot,
32
35
  skipNPMInstall,
36
+ verbose,
33
37
  );
34
- await openVSCode(projectPath, argv);
38
+ await openVSCode(projectPath, vscode, verbose);
35
39
  printFinishMessage(projectPath, projectName);
36
40
  }
37
41
 
38
- async function openVSCode(projectPath: string, argv: Record<string, unknown>) {
42
+ async function openVSCode(
43
+ projectPath: string,
44
+ vscode: boolean,
45
+ verbose: boolean,
46
+ ) {
39
47
  const VSCodeCommand = getVSCodeCommand();
40
48
  if (VSCodeCommand === null) {
41
49
  console.log(
@@ -44,8 +52,8 @@ async function openVSCode(projectPath: string, argv: Record<string, unknown>) {
44
52
  return;
45
53
  }
46
54
 
47
- installVSCodeExtensions(projectPath, VSCodeCommand);
48
- await promptVSCode(projectPath, argv, VSCodeCommand);
55
+ installVSCodeExtensions(projectPath, VSCodeCommand, verbose);
56
+ await promptVSCode(projectPath, VSCodeCommand, vscode, verbose);
49
57
  }
50
58
 
51
59
  function getVSCodeCommand() {
@@ -1,16 +1,18 @@
1
1
  import chalk from "chalk";
2
2
  import * as JSONC from "jsonc-parser";
3
3
  import path from "path";
4
+ import { execShell } from "../../exec";
4
5
  import * as file from "../../file";
5
- import { error, execShell } from "../../util";
6
+ import { error } from "../../util";
6
7
 
7
8
  export function installVSCodeExtensions(
8
9
  projectPath: string,
9
10
  VSCodeCommand: string,
11
+ verbose: boolean,
10
12
  ): void {
11
13
  const extensions = getExtensionsFromJSON(projectPath);
12
14
  for (const extensionName of extensions) {
13
- execShell(VSCodeCommand, ["--install-extension", extensionName]);
15
+ execShell(VSCodeCommand, ["--install-extension", extensionName], verbose);
14
16
  }
15
17
  }
16
18
 
@@ -1,17 +1,18 @@
1
1
  import path from "path";
2
2
  import { MAIN_TS } from "../../constants";
3
+ import { execShell } from "../../exec";
3
4
  import { getInputYesNo } from "../../prompt";
4
- import { execShell } from "../../util";
5
5
 
6
6
  export async function promptVSCode(
7
7
  projectPath: string,
8
- argv: Record<string, unknown>,
9
8
  VSCodeCommand: string,
9
+ vscode: boolean,
10
+ verbose: boolean,
10
11
  ): Promise<void> {
11
- if (argv.vscode !== undefined) {
12
+ if (vscode) {
12
13
  // They supplied the "--vscode" command-line flag,
13
14
  // so there is no need to prompt the user
14
- openVSCode(projectPath, VSCodeCommand);
15
+ openVSCode(projectPath, VSCodeCommand, verbose);
15
16
  return;
16
17
  }
17
18
 
@@ -19,11 +20,15 @@ export async function promptVSCode(
19
20
  "Do you want to open your new project in VSCode now?",
20
21
  );
21
22
  if (shouldOpenVSCode) {
22
- openVSCode(projectPath, VSCodeCommand);
23
+ openVSCode(projectPath, VSCodeCommand, verbose);
23
24
  }
24
25
  }
25
26
 
26
- function openVSCode(projectPath: string, VSCodeCommand: string) {
27
+ function openVSCode(
28
+ projectPath: string,
29
+ VSCodeCommand: string,
30
+ verbose: boolean,
31
+ ) {
27
32
  const MAIN_TS_PATH = path.join(projectPath, "src", MAIN_TS);
28
- execShell(VSCodeCommand, [projectPath, MAIN_TS_PATH]);
33
+ execShell(VSCodeCommand, [projectPath, MAIN_TS_PATH], verbose);
29
34
  }
@@ -8,7 +8,7 @@ import {
8
8
  import * as file from "../../file";
9
9
  import { Config } from "../../types/Config";
10
10
 
11
- export function copyWatcherMod(config: Config): void {
11
+ export function copyWatcherMod(config: Config, verbose: boolean): void {
12
12
  // Check to see if this mod was disabled
13
13
  const watcherModPath = path.join(config.modsDirectory, WATCHER_MOD_NAME);
14
14
  const disableItPath = path.join(watcherModPath, DISABLE_IT_FILE);
@@ -17,21 +17,21 @@ export function copyWatcherMod(config: Config): void {
17
17
  // Delete and re-copy the watcher mod every time IsaacScript starts
18
18
  // This ensures that it is always the latest version
19
19
  if (file.exists(watcherModPath)) {
20
- file.deleteFileOrDirectory(watcherModPath);
20
+ file.deleteFileOrDirectory(watcherModPath, verbose);
21
21
  }
22
22
 
23
- file.copy(WATCHER_MOD_SOURCE_PATH, watcherModPath);
23
+ file.copy(WATCHER_MOD_SOURCE_PATH, watcherModPath, verbose);
24
24
 
25
25
  if (watcherModDisabled) {
26
26
  // Since we deleted the directory, the "disable.it" file was deleted
27
27
  // Restore it
28
- file.write(disableItPath, "");
28
+ file.write(disableItPath, "", verbose);
29
29
  }
30
30
 
31
31
  // By default, the IsaacScript watcher mod automatically restarts the game,
32
32
  // so we only need to disable it if the config option is explicitly set to false
33
33
  if (config.enableIsaacScriptWatcherAutoRestart === false) {
34
- disableIsaacScriptWatcherAutomaticRestart(watcherModPath);
34
+ disableIsaacScriptWatcherAutomaticRestart(watcherModPath, verbose);
35
35
  }
36
36
 
37
37
  // If we copied a new version of the watcher mod into place,
@@ -40,7 +40,10 @@ export function copyWatcherMod(config: Config): void {
40
40
  // so there is no automated solution for this
41
41
  }
42
42
 
43
- function disableIsaacScriptWatcherAutomaticRestart(watcherModPath: string) {
43
+ function disableIsaacScriptWatcherAutomaticRestart(
44
+ watcherModPath: string,
45
+ verbose: boolean,
46
+ ) {
44
47
  const mainLuaPath = path.join(watcherModPath, MAIN_LUA);
45
48
  const mainLua = file.read(mainLuaPath);
46
49
 
@@ -49,5 +52,5 @@ function disableIsaacScriptWatcherAutomaticRestart(watcherModPath: string) {
49
52
  "local RESTART_GAME_ON_RECOMPILATION = false",
50
53
  );
51
54
 
52
- file.write(mainLuaPath, modifiedMainLua);
55
+ file.write(mainLuaPath, modifiedMainLua, verbose);
53
56
  }
@@ -1,7 +1,5 @@
1
- import path from "path";
2
1
  import syncDirectory from "sync-directory";
3
- import { FILE_SYNCED_MESSAGE, MAIN_LUA } from "../../../constants";
4
- import { monkeyPatchMainLua } from "../../../monkeyPatch";
2
+ import { FILE_SYNCED_MESSAGE } from "../../../constants";
5
3
 
6
4
  let modSourcePath: string;
7
5
  let modTargetPath: string;
@@ -43,9 +41,11 @@ function afterEachSync(params?: {
43
41
  return;
44
42
  }
45
43
 
44
+ /*
46
45
  if (params.relativePath === path.sep + MAIN_LUA) {
47
46
  monkeyPatchMainLua(modTargetPath);
48
47
  }
48
+ */
49
49
 
50
50
  if (params.eventType !== "init:copy") {
51
51
  send(`${FILE_SYNCED_MESSAGE} ${params.relativePath}`);
@@ -19,6 +19,8 @@ import { spawnSaveDatWriter } from "./spawnSaveDatWriter";
19
19
  import { touchWatcherSaveDatFiles } from "./touchWatcherSaveDatFiles";
20
20
 
21
21
  export function monitor(argv: Record<string, unknown>, config: Config): void {
22
+ const verbose = argv.verbose === true;
23
+
22
24
  // If they specified some command-line flags, override the values found in the config file
23
25
  if (argv.modsDirectory !== undefined) {
24
26
  config.modsDirectory = argv.modsDirectory as string; // eslint-disable-line no-param-reassign
@@ -34,13 +36,13 @@ export function monitor(argv: Record<string, unknown>, config: Config): void {
34
36
  const modTargetPath = path.join(config.modsDirectory, modTargetDirectoryName);
35
37
 
36
38
  // Prepare the IsaacScript watcher mod
37
- copyWatcherMod(config);
38
- touchWatcherSaveDatFiles(config);
39
+ copyWatcherMod(config, verbose);
40
+ touchWatcherSaveDatFiles(config, verbose);
39
41
 
40
42
  // Delete and re-copy the mod every time IsaacScript starts
41
43
  // This ensures that it is always the latest version
42
44
  if (file.exists(modTargetPath)) {
43
- file.deleteFileOrDirectory(modTargetPath);
45
+ file.deleteFileOrDirectory(modTargetPath, true);
44
46
  }
45
47
 
46
48
  // Subprocess #1 - The "save#.dat" file writer
@@ -27,7 +27,7 @@ function init() {
27
27
  // Check to see if the data directory exists
28
28
  const watcherModDataPath = path.dirname(saveDatPath);
29
29
  if (!file.exists(watcherModDataPath)) {
30
- file.makeDir(watcherModDataPath);
30
+ file.makeDir(watcherModDataPath, false);
31
31
  }
32
32
 
33
33
  // Listen for messages from the parent process
@@ -3,15 +3,18 @@ import { WATCHER_MOD_NAME } from "../../constants";
3
3
  import * as file from "../../file";
4
4
  import { Config } from "../../types/Config";
5
5
 
6
- export function touchWatcherSaveDatFiles(config: Config): void {
6
+ export function touchWatcherSaveDatFiles(
7
+ config: Config,
8
+ verbose: boolean,
9
+ ): void {
7
10
  const modsDataPath = path.join(config.modsDirectory, "..", "data");
8
11
  const watcherModDataPath = path.join(modsDataPath, WATCHER_MOD_NAME);
9
12
  if (!file.exists(watcherModDataPath)) {
10
- file.makeDir(watcherModDataPath);
13
+ file.makeDir(watcherModDataPath, verbose);
11
14
  }
12
15
  const saveDatFileName = `save${config.saveSlot}.dat`;
13
16
  const saveDatPath = path.join(watcherModDataPath, saveDatFileName);
14
17
  if (!file.exists(saveDatPath)) {
15
- file.touch(saveDatPath);
18
+ file.touch(saveDatPath, verbose);
16
19
  }
17
20
  }