isaacscript 2.0.11 → 2.0.14-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 (137) hide show
  1. package/README.md +8 -4
  2. package/package.json +2 -53
  3. package/src/checkForWindowsTerminalBugs.d.ts +5 -0
  4. package/src/checkForWindowsTerminalBugs.js +80 -0
  5. package/src/checkForWindowsTerminalBugs.js.map +1 -0
  6. package/src/commands/copy/copy.d.ts +3 -0
  7. package/src/commands/copy/copy.js +33 -0
  8. package/src/commands/copy/copy.js.map +1 -0
  9. package/src/commands/init/checkIfProjectPathExists.d.ts +1 -0
  10. package/src/commands/init/checkIfProjectPathExists.js +30 -0
  11. package/src/commands/init/checkIfProjectPathExists.js.map +1 -0
  12. package/src/commands/init/checkModSubdirectory.d.ts +1 -0
  13. package/src/commands/init/checkModSubdirectory.js +16 -0
  14. package/src/commands/init/checkModSubdirectory.js.map +1 -0
  15. package/src/commands/init/checkModTargetDirectory.d.ts +1 -0
  16. package/src/commands/init/checkModTargetDirectory.js +33 -0
  17. package/src/commands/init/checkModTargetDirectory.js.map +1 -0
  18. package/src/commands/init/createMod.d.ts +1 -0
  19. package/{dist/src → src}/commands/init/createMod.js +137 -162
  20. package/src/commands/init/createMod.js.map +1 -0
  21. package/src/commands/init/getModsDir.d.ts +1 -0
  22. package/src/commands/init/getModsDir.js +58 -0
  23. package/src/commands/init/getModsDir.js.map +1 -0
  24. package/src/commands/init/getProjectPath.d.ts +1 -0
  25. package/src/commands/init/getProjectPath.js +93 -0
  26. package/src/commands/init/getProjectPath.js.map +1 -0
  27. package/src/commands/init/git.d.ts +4 -0
  28. package/{dist/src → src}/commands/init/git.js +152 -175
  29. package/src/commands/init/git.js.map +1 -0
  30. package/src/commands/init/init.d.ts +1 -0
  31. package/src/commands/init/init.js +70 -0
  32. package/src/commands/init/init.js.map +1 -0
  33. package/src/commands/init/installVSCodeExtensions.d.ts +1 -0
  34. package/src/commands/init/installVSCodeExtensions.js +33 -0
  35. package/src/commands/init/installVSCodeExtensions.js.map +1 -0
  36. package/src/commands/init/promptSaveSlot.d.ts +1 -0
  37. package/src/commands/init/promptSaveSlot.js +25 -0
  38. package/src/commands/init/promptSaveSlot.js.map +1 -0
  39. package/src/commands/init/promptVSCode.d.ts +1 -0
  40. package/src/commands/init/promptVSCode.js +27 -0
  41. package/src/commands/init/promptVSCode.js.map +1 -0
  42. package/src/commands/monitor/constants.d.ts +1 -0
  43. package/{dist/src → src}/commands/monitor/constants.js +4 -4
  44. package/src/commands/monitor/constants.js.map +1 -0
  45. package/src/commands/monitor/copyWatcherMod.d.ts +2 -0
  46. package/{dist/src → src}/commands/monitor/copyWatcherMod.js +38 -63
  47. package/src/commands/monitor/copyWatcherMod.js.map +1 -0
  48. package/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.d.ts +1 -0
  49. package/{dist/src → src}/commands/monitor/modDirectorySyncer/modDirectorySyncer.js +49 -51
  50. package/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.js.map +1 -0
  51. package/src/commands/monitor/monitor.d.ts +2 -0
  52. package/{dist/src → src}/commands/monitor/monitor.js +146 -171
  53. package/src/commands/monitor/monitor.js.map +1 -0
  54. package/src/commands/monitor/notifyGame.d.ts +3 -0
  55. package/{dist/src → src}/commands/monitor/notifyGame.js +57 -59
  56. package/src/commands/monitor/notifyGame.js.map +1 -0
  57. package/src/commands/monitor/saveDatWriter/saveDatWriter.d.ts +1 -0
  58. package/{dist/src → src}/commands/monitor/saveDatWriter/saveDatWriter.js +116 -141
  59. package/src/commands/monitor/saveDatWriter/saveDatWriter.js.map +1 -0
  60. package/src/commands/monitor/saveDatWriter/types.d.ts +5 -0
  61. package/{dist/src → src}/commands/monitor/saveDatWriter/types.js +2 -2
  62. package/src/commands/monitor/saveDatWriter/types.js.map +1 -0
  63. package/src/commands/monitor/spawnSaveDatWriter.d.ts +4 -0
  64. package/{dist/src → src}/commands/monitor/spawnSaveDatWriter.js +34 -36
  65. package/src/commands/monitor/spawnSaveDatWriter.js.map +1 -0
  66. package/src/commands/monitor/touchWatcherSaveDatFiles.d.ts +2 -0
  67. package/src/commands/monitor/touchWatcherSaveDatFiles.js +21 -0
  68. package/src/commands/monitor/touchWatcherSaveDatFiles.js.map +1 -0
  69. package/src/commands/publish/publish.d.ts +2 -0
  70. package/{dist/src → src}/commands/publish/publish.js +220 -260
  71. package/src/commands/publish/publish.js.map +1 -0
  72. package/src/configFile.d.ts +4 -0
  73. package/src/configFile.js +66 -0
  74. package/src/configFile.js.map +1 -0
  75. package/src/constants.d.ts +34 -0
  76. package/{dist/src → src}/constants.js +59 -61
  77. package/src/constants.js.map +1 -0
  78. package/src/exec.d.ts +4 -0
  79. package/{dist/src → src}/exec.js +95 -97
  80. package/src/exec.js.map +1 -0
  81. package/src/file.d.ts +12 -0
  82. package/{dist/src → src}/file.js +193 -195
  83. package/src/file.js.map +1 -0
  84. package/src/main.d.ts +2 -0
  85. package/src/main.js +122 -0
  86. package/src/main.js.map +1 -0
  87. package/src/parseArgs.d.ts +1 -0
  88. package/{dist/src → src}/parseArgs.js +106 -108
  89. package/src/parseArgs.js.map +1 -0
  90. package/src/prompt.d.ts +5 -0
  91. package/src/prompt.js +93 -0
  92. package/src/prompt.js.map +1 -0
  93. package/src/types/Command.d.ts +2 -0
  94. package/{dist/src → src}/types/Command.js +4 -4
  95. package/src/types/Command.js.map +1 -0
  96. package/src/types/Config.d.ts +18 -0
  97. package/{dist/src → src}/types/Config.js +12 -12
  98. package/src/types/Config.js.map +1 -0
  99. package/src/types/GitHubCLIHostsYAML.d.ts +7 -0
  100. package/{dist/src → src}/types/GitHubCLIHostsYAML.js +2 -2
  101. package/src/types/GitHubCLIHostsYAML.js.map +1 -0
  102. package/src/utils.d.ts +13 -0
  103. package/{dist/src → src}/utils.js +81 -83
  104. package/src/utils.js.map +1 -0
  105. package/src/validateInIsaacScriptProject.d.ts +1 -0
  106. package/src/validateInIsaacScriptProject.js +27 -0
  107. package/src/validateInIsaacScriptProject.js.map +1 -0
  108. package/src/validateNodeVersion.d.ts +5 -0
  109. package/{dist/src → src}/validateNodeVersion.js +24 -26
  110. package/src/validateNodeVersion.js.map +1 -0
  111. package/src/validateOS.d.ts +1 -0
  112. package/{dist/src → src}/validateOS.js +16 -18
  113. package/src/validateOS.js.map +1 -0
  114. package/LICENSE +0 -674
  115. package/dist/package.json +0 -57
  116. package/dist/src/checkForWindowsTerminalBugs.js +0 -101
  117. package/dist/src/commands/copy/copy.js +0 -58
  118. package/dist/src/commands/init/checkIfProjectPathExists.js +0 -53
  119. package/dist/src/commands/init/checkModSubdirectory.js +0 -41
  120. package/dist/src/commands/init/checkModTargetDirectory.js +0 -56
  121. package/dist/src/commands/init/getModsDir.js +0 -81
  122. package/dist/src/commands/init/getProjectPath.js +0 -91
  123. package/dist/src/commands/init/init.js +0 -68
  124. package/dist/src/commands/init/installVSCodeExtensions.js +0 -58
  125. package/dist/src/commands/init/promptSaveSlot.js +0 -22
  126. package/dist/src/commands/init/promptVSCode.js +0 -27
  127. package/dist/src/commands/monitor/touchWatcherSaveDatFiles.js +0 -46
  128. package/dist/src/configFile.js +0 -89
  129. package/dist/src/main.js +0 -136
  130. package/dist/src/prompt.js +0 -89
  131. package/dist/src/validateInIsaacScriptProject.js +0 -52
  132. package/isaacscript-watcher/.luacheckrc +0 -96
  133. package/isaacscript-watcher/README.md +0 -8
  134. package/isaacscript-watcher/main.lua +0 -270
  135. package/isaacscript-watcher/metadata.xml +0 -7
  136. package/isaacscript-watcher/resources/gfx/logo.anm2 +0 -27
  137. package/isaacscript-watcher/resources/gfx/logo.png +0 -0
@@ -1,181 +1,158 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.gitCommitIfChanges = exports.isGitDirty = exports.initGitRepository = exports.promptGitHubRepoOrGitRemoteURL = void 0;
30
- const chalk_1 = __importDefault(require("chalk"));
31
- const command_exists_1 = __importDefault(require("command-exists"));
32
- const path_1 = __importDefault(require("path"));
33
- const yaml_1 = __importDefault(require("yaml"));
34
- const constants_1 = require("../../constants");
35
- const exec_1 = require("../../exec");
36
- const file = __importStar(require("../../file"));
37
- const prompt_1 = require("../../prompt");
38
- const utils_1 = require("../../utils");
39
- const REQUIRED_GIT_MAJOR_VERSION = 2;
40
- const REQUIRED_GIT_MINOR_VERSION = 30;
41
- async function promptGitHubRepoOrGitRemoteURL(projectName, yes, verbose) {
42
- // We do not need to prompt the user if they do not have Git installed.
43
- if (!command_exists_1.default.sync("git")) {
44
- console.log('Git does not seem to be installed. (The "git" command is not in the path.) Skipping Git-related things.');
45
- return undefined;
46
- }
47
- validateNewGitVersion(verbose);
48
- const gitHubUsername = getGitHubUsername(verbose);
49
- if (gitHubUsername !== undefined) {
50
- const [exitStatus] = (0, exec_1.execShell)("gh", ["repo", "view", projectName], verbose, true);
51
- const gitHubRepoExists = exitStatus === 0;
52
- const url = `https://github.com/${gitHubUsername}/${projectName}`;
53
- if (gitHubRepoExists) {
54
- console.log(`Detected an existing GitHub repository at: ${chalk_1.default.green(url)}`);
55
- const guessedRemoteURL = getGitRemoteURL(projectName, gitHubUsername);
56
- if (yes) {
57
- console.log(`Using a Git remote URL of: ${chalk_1.default.green(guessedRemoteURL)}`);
58
- return guessedRemoteURL;
59
- }
60
- const shouldUseGuessedURL = await (0, prompt_1.getInputYesNo)(`Do you want to use a Git remote URL of: ${chalk_1.default.green(guessedRemoteURL)}`);
61
- if (shouldUseGuessedURL) {
62
- return guessedRemoteURL;
63
- }
64
- // Assume that since they do not want to connect this project to the existing GitHub
65
- // repository, they do not want to initialize a remote Git URL at all.
66
- return undefined;
67
- }
68
- if (yes) {
69
- (0, exec_1.execShell)("gh", ["repo", "create", projectName, "--public"]);
70
- console.log(`Created a new GitHub repository at: ${chalk_1.default.green(url)}`);
71
- return getGitRemoteURL(projectName, gitHubUsername);
72
- }
73
- const createNewGitHubRepo = await (0, prompt_1.getInputYesNo)(`Would you like to create a new GitHub repository at: ${chalk_1.default.green(url)}`);
74
- if (createNewGitHubRepo) {
75
- (0, exec_1.execShell)("gh", ["repo", "create", projectName, "--public"]);
76
- console.log("Successfully created a new GitHub repository.");
77
- return getGitRemoteURL(projectName, gitHubUsername);
78
- }
79
- // Assume that since they do not want to create a new GitHub repository, they do not want to
80
- // initialize a remote Git URL at all.
81
- return undefined;
82
- }
83
- const gitRemoteURL = await (0, prompt_1.getInputString)(`Paste in the remote Git URL for your project.
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.gitCommitIfChanges = exports.isGitDirty = exports.initGitRepository = exports.promptGitHubRepoOrGitRemoteURL = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
+ const command_exists_1 = tslib_1.__importDefault(require("command-exists"));
7
+ const path_1 = tslib_1.__importDefault(require("path"));
8
+ const yaml_1 = tslib_1.__importDefault(require("yaml"));
9
+ const constants_1 = require("../../constants");
10
+ const exec_1 = require("../../exec");
11
+ const file = tslib_1.__importStar(require("../../file"));
12
+ const prompt_1 = require("../../prompt");
13
+ const utils_1 = require("../../utils");
14
+ const REQUIRED_GIT_MAJOR_VERSION = 2;
15
+ const REQUIRED_GIT_MINOR_VERSION = 30;
16
+ function promptGitHubRepoOrGitRemoteURL(projectName, yes, verbose) {
17
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
18
+ // We do not need to prompt the user if they do not have Git installed.
19
+ if (!command_exists_1.default.sync("git")) {
20
+ console.log('Git does not seem to be installed. (The "git" command is not in the path.) Skipping Git-related things.');
21
+ return undefined;
22
+ }
23
+ validateNewGitVersion(verbose);
24
+ const gitHubUsername = getGitHubUsername(verbose);
25
+ if (gitHubUsername !== undefined) {
26
+ const [exitStatus] = (0, exec_1.execShell)("gh", ["repo", "view", projectName], verbose, true);
27
+ const gitHubRepoExists = exitStatus === 0;
28
+ const url = `https://github.com/${gitHubUsername}/${projectName}`;
29
+ if (gitHubRepoExists) {
30
+ console.log(`Detected an existing GitHub repository at: ${chalk_1.default.green(url)}`);
31
+ const guessedRemoteURL = getGitRemoteURL(projectName, gitHubUsername);
32
+ if (yes) {
33
+ console.log(`Using a Git remote URL of: ${chalk_1.default.green(guessedRemoteURL)}`);
34
+ return guessedRemoteURL;
35
+ }
36
+ const shouldUseGuessedURL = yield (0, prompt_1.getInputYesNo)(`Do you want to use a Git remote URL of: ${chalk_1.default.green(guessedRemoteURL)}`);
37
+ if (shouldUseGuessedURL) {
38
+ return guessedRemoteURL;
39
+ }
40
+ // Assume that since they do not want to connect this project to the existing GitHub
41
+ // repository, they do not want to initialize a remote Git URL at all.
42
+ return undefined;
43
+ }
44
+ if (yes) {
45
+ (0, exec_1.execShell)("gh", ["repo", "create", projectName, "--public"]);
46
+ console.log(`Created a new GitHub repository at: ${chalk_1.default.green(url)}`);
47
+ return getGitRemoteURL(projectName, gitHubUsername);
48
+ }
49
+ const createNewGitHubRepo = yield (0, prompt_1.getInputYesNo)(`Would you like to create a new GitHub repository at: ${chalk_1.default.green(url)}`);
50
+ if (createNewGitHubRepo) {
51
+ (0, exec_1.execShell)("gh", ["repo", "create", projectName, "--public"]);
52
+ console.log("Successfully created a new GitHub repository.");
53
+ return getGitRemoteURL(projectName, gitHubUsername);
54
+ }
55
+ // Assume that since they do not want to create a new GitHub repository, they do not want to
56
+ // initialize a remote Git URL at all.
57
+ return undefined;
58
+ }
59
+ const gitRemoteURL = yield (0, prompt_1.getInputString)(`Paste in the remote Git URL for your project.
84
60
  For example, if you have an SSH key, it would be something like:
85
61
  ${chalk_1.default.green("git@github.com:Alice/green-candle.git")}
86
62
  If you don't have an SSH key, it would be something like:
87
63
  ${chalk_1.default.green("https://github.com/Alice/green-candle.git")}
88
64
  If you don't want to initialize a Git repository for this project, press enter to skip.
89
- `);
90
- return gitRemoteURL === "" ? undefined : gitRemoteURL;
91
- }
92
- exports.promptGitHubRepoOrGitRemoteURL = promptGitHubRepoOrGitRemoteURL;
93
- function validateNewGitVersion(verbose) {
94
- const [, stdout] = (0, exec_1.execShell)("git", ["--version"], verbose);
95
- const outputPrefix = "git version ";
96
- if (!stdout.startsWith(outputPrefix)) {
97
- (0, utils_1.error)(`Failed to parse the output from the "git --version" command: ${stdout}`);
98
- }
99
- const gitVersionString = stdout.slice(outputPrefix.length);
100
- const [majorVersion, minorVersion] = (0, utils_1.parseSemVer)(gitVersionString);
101
- if (majorVersion >= REQUIRED_GIT_MAJOR_VERSION &&
102
- minorVersion >= REQUIRED_GIT_MINOR_VERSION) {
103
- return;
104
- }
105
- console.error(`Your Git version is: ${chalk_1.default.red(gitVersionString)}`);
106
- console.error(`${constants_1.PROJECT_NAME} requires a Git version of ${chalk_1.default.red(`${REQUIRED_GIT_MAJOR_VERSION}.${REQUIRED_GIT_MINOR_VERSION}.0`)} or greater.`);
107
- console.error(`Please upgrade your version of Git before using ${constants_1.PROJECT_NAME}.`);
108
- process.exit(1);
109
- }
110
- function getGitHubUsername(verbose) {
111
- // If the GitHub CLI is installed, we can derive the user's GitHub username.
112
- if (!command_exists_1.default.sync("gh")) {
113
- return undefined;
114
- }
115
- const appData = process.env["APPDATA"];
116
- if (appData === undefined || appData === "") {
117
- return undefined;
118
- }
119
- const githubCLIHostsPath = path_1.default.join(appData, "GitHub CLI", "hosts.yml");
120
- if (!file.exists(githubCLIHostsPath, verbose)) {
121
- return undefined;
122
- }
123
- const configYAMLRaw = file.read(githubCLIHostsPath, verbose);
124
- const configYAML = yaml_1.default.parse(configYAMLRaw);
125
- const githubCom = configYAML["github.com"];
126
- if (githubCom === undefined) {
127
- return undefined;
128
- }
129
- const { user } = githubCom;
130
- if (user === undefined || user === "") {
131
- return undefined;
132
- }
133
- return user;
134
- }
135
- function getGitRemoteURL(projectName, gitHubUsername) {
136
- return `git@github.com:${gitHubUsername}/${projectName}.git`;
137
- }
138
- function initGitRepository(projectPath, gitRemoteURL, verbose) {
139
- if (!command_exists_1.default.sync("git")) {
140
- return;
141
- }
142
- if (gitRemoteURL === undefined) {
143
- return;
144
- }
145
- (0, exec_1.execShell)("git", ["init"], verbose, false, projectPath);
146
- (0, exec_1.execShell)("git", ["branch", "-M", "main"], verbose, false, projectPath);
147
- if (isGitNameAndEmailConfigured(verbose)) {
148
- (0, exec_1.execShell)("git", ["add", "--all"], verbose, false, projectPath);
149
- (0, exec_1.execShell)("git", ["commit", "--message", `${constants_1.PROJECT_NAME} template`], verbose, false, projectPath);
150
- }
151
- if (gitRemoteURL !== undefined) {
152
- (0, exec_1.execShell)("git", ["remote", "add", "origin", gitRemoteURL], verbose, false, projectPath);
153
- }
154
- }
155
- exports.initGitRepository = initGitRepository;
156
- function isGitNameAndEmailConfigured(verbose) {
157
- const [nameExitStatus] = (0, exec_1.execShell)("git", ["config", "--global", "user.name"], verbose, true);
158
- const [emailExitStatus] = (0, exec_1.execShell)("git", ["config", "--global", "user.email"], verbose, true);
159
- return nameExitStatus === 0 && emailExitStatus === 0;
160
- }
161
- function isGitDirty(verbose) {
162
- // From: https://remarkablemark.org/blog/2017/10/12/check-git-dirty/
163
- const [, stdout] = (0, exec_1.execShell)("git", ["status", "--porcelain"], verbose);
164
- return stdout !== "";
165
- }
166
- exports.isGitDirty = isGitDirty;
167
- function gitCommitIfChanges(version, verbose) {
168
- // Throw an error if this is not a git repository.
169
- (0, exec_1.execShell)("git", ["status"], verbose);
170
- if (!isGitDirty(verbose)) {
171
- console.log("There are no changes to commit.");
172
- return;
173
- }
174
- const commitMessage = `v${version}`;
175
- (0, exec_1.execShell)("git", ["add", "-A"], verbose);
176
- (0, exec_1.execShell)("git", ["commit", "-m", commitMessage], verbose);
177
- (0, exec_1.execShell)("git", ["push"], verbose);
178
- console.log(`Committed and pushed to the git repository with a message of: ${commitMessage}`);
179
- }
180
- exports.gitCommitIfChanges = gitCommitIfChanges;
65
+ `);
66
+ return gitRemoteURL === "" ? undefined : gitRemoteURL;
67
+ });
68
+ }
69
+ exports.promptGitHubRepoOrGitRemoteURL = promptGitHubRepoOrGitRemoteURL;
70
+ function validateNewGitVersion(verbose) {
71
+ const [, stdout] = (0, exec_1.execShell)("git", ["--version"], verbose);
72
+ const outputPrefix = "git version ";
73
+ if (!stdout.startsWith(outputPrefix)) {
74
+ (0, utils_1.error)(`Failed to parse the output from the "git --version" command: ${stdout}`);
75
+ }
76
+ const gitVersionString = stdout.slice(outputPrefix.length);
77
+ const [majorVersion, minorVersion] = (0, utils_1.parseSemVer)(gitVersionString);
78
+ if (majorVersion >= REQUIRED_GIT_MAJOR_VERSION &&
79
+ minorVersion >= REQUIRED_GIT_MINOR_VERSION) {
80
+ return;
81
+ }
82
+ console.error(`Your Git version is: ${chalk_1.default.red(gitVersionString)}`);
83
+ console.error(`${constants_1.PROJECT_NAME} requires a Git version of ${chalk_1.default.red(`${REQUIRED_GIT_MAJOR_VERSION}.${REQUIRED_GIT_MINOR_VERSION}.0`)} or greater.`);
84
+ console.error(`Please upgrade your version of Git before using ${constants_1.PROJECT_NAME}.`);
85
+ process.exit(1);
86
+ }
87
+ function getGitHubUsername(verbose) {
88
+ // If the GitHub CLI is installed, we can derive the user's GitHub username.
89
+ if (!command_exists_1.default.sync("gh")) {
90
+ return undefined;
91
+ }
92
+ const appData = process.env["APPDATA"];
93
+ if (appData === undefined || appData === "") {
94
+ return undefined;
95
+ }
96
+ const githubCLIHostsPath = path_1.default.join(appData, "GitHub CLI", "hosts.yml");
97
+ if (!file.exists(githubCLIHostsPath, verbose)) {
98
+ return undefined;
99
+ }
100
+ const configYAMLRaw = file.read(githubCLIHostsPath, verbose);
101
+ const configYAML = yaml_1.default.parse(configYAMLRaw);
102
+ const githubCom = configYAML["github.com"];
103
+ if (githubCom === undefined) {
104
+ return undefined;
105
+ }
106
+ const { user } = githubCom;
107
+ if (user === undefined || user === "") {
108
+ return undefined;
109
+ }
110
+ return user;
111
+ }
112
+ function getGitRemoteURL(projectName, gitHubUsername) {
113
+ return `git@github.com:${gitHubUsername}/${projectName}.git`;
114
+ }
115
+ function initGitRepository(projectPath, gitRemoteURL, verbose) {
116
+ if (!command_exists_1.default.sync("git")) {
117
+ return;
118
+ }
119
+ if (gitRemoteURL === undefined) {
120
+ return;
121
+ }
122
+ (0, exec_1.execShell)("git", ["init"], verbose, false, projectPath);
123
+ (0, exec_1.execShell)("git", ["branch", "-M", "main"], verbose, false, projectPath);
124
+ if (isGitNameAndEmailConfigured(verbose)) {
125
+ (0, exec_1.execShell)("git", ["add", "--all"], verbose, false, projectPath);
126
+ (0, exec_1.execShell)("git", ["commit", "--message", `${constants_1.PROJECT_NAME} template`], verbose, false, projectPath);
127
+ }
128
+ if (gitRemoteURL !== undefined) {
129
+ (0, exec_1.execShell)("git", ["remote", "add", "origin", gitRemoteURL], verbose, false, projectPath);
130
+ }
131
+ }
132
+ exports.initGitRepository = initGitRepository;
133
+ function isGitNameAndEmailConfigured(verbose) {
134
+ const [nameExitStatus] = (0, exec_1.execShell)("git", ["config", "--global", "user.name"], verbose, true);
135
+ const [emailExitStatus] = (0, exec_1.execShell)("git", ["config", "--global", "user.email"], verbose, true);
136
+ return nameExitStatus === 0 && emailExitStatus === 0;
137
+ }
138
+ function isGitDirty(verbose) {
139
+ // From: https://remarkablemark.org/blog/2017/10/12/check-git-dirty/
140
+ const [, stdout] = (0, exec_1.execShell)("git", ["status", "--porcelain"], verbose);
141
+ return stdout !== "";
142
+ }
143
+ exports.isGitDirty = isGitDirty;
144
+ function gitCommitIfChanges(version, verbose) {
145
+ // Throw an error if this is not a git repository.
146
+ (0, exec_1.execShell)("git", ["status"], verbose);
147
+ if (!isGitDirty(verbose)) {
148
+ console.log("There are no changes to commit.");
149
+ return;
150
+ }
151
+ const commitMessage = `v${version}`;
152
+ (0, exec_1.execShell)("git", ["add", "-A"], verbose);
153
+ (0, exec_1.execShell)("git", ["commit", "-m", commitMessage], verbose);
154
+ (0, exec_1.execShell)("git", ["push"], verbose);
155
+ console.log(`Committed and pushed to the git repository with a message of: ${commitMessage}`);
156
+ }
157
+ exports.gitCommitIfChanges = gitCommitIfChanges;
181
158
  //# sourceMappingURL=git.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.js","sourceRoot":"","sources":["../../../../../../packages/isaacscript-cli/src/commands/init/git.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAC1B,4EAA2C;AAC3C,wDAAwB;AACxB,wDAAwB;AACxB,+CAA+C;AAC/C,qCAAuC;AACvC,yDAAmC;AACnC,yCAA6D;AAE7D,uCAAiD;AAEjD,MAAM,0BAA0B,GAAG,CAAC,CAAC;AACrC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAEtC,SAAsB,8BAA8B,CAClD,WAAmB,EACnB,GAAY,EACZ,OAAgB;;QAEhB,uEAAuE;QACvE,IAAI,CAAC,wBAAa,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YAC9B,OAAO,CAAC,GAAG,CACT,yGAAyG,CAC1G,CAAC;YACF,OAAO,SAAS,CAAC;SAClB;QAED,qBAAq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: Record<string, unknown>): Promise<void>;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.init = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
+ const command_exists_1 = tslib_1.__importDefault(require("command-exists"));
7
+ const path_1 = tslib_1.__importDefault(require("path"));
8
+ const constants_1 = require("../../constants");
9
+ const checkIfProjectPathExists_1 = require("./checkIfProjectPathExists");
10
+ const checkModSubdirectory_1 = require("./checkModSubdirectory");
11
+ const checkModTargetDirectory_1 = require("./checkModTargetDirectory");
12
+ const createMod_1 = require("./createMod");
13
+ const getModsDir_1 = require("./getModsDir");
14
+ const getProjectPath_1 = require("./getProjectPath");
15
+ const git_1 = require("./git");
16
+ const installVSCodeExtensions_1 = require("./installVSCodeExtensions");
17
+ const promptSaveSlot_1 = require("./promptSaveSlot");
18
+ const promptVSCode_1 = require("./promptVSCode");
19
+ function init(argv) {
20
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
21
+ const skipNPMInstall = argv["skipNpmInstall"] === true;
22
+ const useCurrentDir = argv["useCurrentDir"] === true;
23
+ const verbose = argv["verbose"] === true;
24
+ const vscode = argv["vscode"] === true;
25
+ const yes = argv["yes"] === true;
26
+ const forceName = argv["forceName"] === true;
27
+ // Prompt the end-user for some information (and validate it as we go).
28
+ const [projectPath, createNewDir] = yield (0, getProjectPath_1.getProjectPath)(argv, useCurrentDir, yes, forceName);
29
+ yield (0, checkIfProjectPathExists_1.checkIfProjectPathExists)(projectPath, yes, verbose);
30
+ const modsDirectory = yield (0, getModsDir_1.getModsDir)(argv, verbose);
31
+ (0, checkModSubdirectory_1.checkModSubdirectory)(projectPath, modsDirectory);
32
+ const projectName = path_1.default.basename(projectPath);
33
+ yield (0, checkModTargetDirectory_1.checkModTargetDirectory)(modsDirectory, projectName, yes, verbose);
34
+ const saveSlot = yield (0, promptSaveSlot_1.promptSaveSlot)(argv, yes);
35
+ const gitRemoteURL = yield (0, git_1.promptGitHubRepoOrGitRemoteURL)(projectName, yes, verbose);
36
+ // Now that we have asked the user all of the questions we need, we can create the project.
37
+ (0, createMod_1.createMod)(projectName, projectPath, createNewDir, modsDirectory, saveSlot, gitRemoteURL, skipNPMInstall, verbose);
38
+ yield openVSCode(projectPath, vscode, verbose);
39
+ printFinishMessage(projectPath, projectName);
40
+ });
41
+ }
42
+ exports.init = init;
43
+ function openVSCode(projectPath, vscode, verbose) {
44
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
45
+ const VSCodeCommand = getVSCodeCommand();
46
+ if (VSCodeCommand === null) {
47
+ console.log('VSCode does not seem to be installed. (The "code" command is not in the path.) Skipping VSCode-related things.');
48
+ return;
49
+ }
50
+ (0, installVSCodeExtensions_1.installVSCodeExtensions)(projectPath, VSCodeCommand, verbose);
51
+ yield (0, promptVSCode_1.promptVSCode)(projectPath, VSCodeCommand, vscode, verbose);
52
+ });
53
+ }
54
+ function getVSCodeCommand() {
55
+ for (const VSCodeCommand of ["code", "codium", "code-oss", "code-insiders"]) {
56
+ if (command_exists_1.default.sync(VSCodeCommand)) {
57
+ return VSCodeCommand;
58
+ }
59
+ }
60
+ return null;
61
+ }
62
+ function printFinishMessage(projectPath, projectName) {
63
+ let commandsToType = "";
64
+ if (projectPath !== constants_1.CWD) {
65
+ commandsToType += `"${chalk_1.default.green(`cd ${projectName}`)}" and `;
66
+ }
67
+ commandsToType += `"${chalk_1.default.green("npx isaacscript")}"`;
68
+ console.log(`Now, start ${constants_1.PROJECT_NAME} by typing ${commandsToType}.`);
69
+ }
70
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/isaacscript-cli/src/commands/init/init.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAC1B,4EAA2C;AAC3C,wDAAwB;AACxB,+CAAoD;AACpD,yEAAsE;AACtE,iEAA8D;AAC9D,uEAAoE;AACpE,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ACzE,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function installVSCodeExtensions(projectPath: string, VSCodeCommand: string, verbose: boolean): void;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.installVSCodeExtensions = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
+ const JSONC = tslib_1.__importStar(require("jsonc-parser"));
7
+ const path_1 = tslib_1.__importDefault(require("path"));
8
+ const exec_1 = require("../../exec");
9
+ const file = tslib_1.__importStar(require("../../file"));
10
+ const utils_1 = require("../../utils");
11
+ function installVSCodeExtensions(projectPath, VSCodeCommand, verbose) {
12
+ const extensions = getExtensionsFromJSON(projectPath, verbose);
13
+ for (const extensionName of extensions) {
14
+ (0, exec_1.execShell)(VSCodeCommand, ["--install-extension", extensionName], verbose);
15
+ }
16
+ }
17
+ exports.installVSCodeExtensions = installVSCodeExtensions;
18
+ function getExtensionsFromJSON(projectPath, verbose) {
19
+ const extensionsJSONPath = path_1.default.join(projectPath, ".vscode", "extensions.json");
20
+ if (!file.exists(extensionsJSONPath, verbose)) {
21
+ return [];
22
+ }
23
+ const extensionsJSONRaw = file.read(extensionsJSONPath, verbose);
24
+ let extensionsJSON;
25
+ try {
26
+ extensionsJSON = JSONC.parse(extensionsJSONRaw);
27
+ }
28
+ catch (err) {
29
+ (0, utils_1.error)(`Failed to parse the "${chalk_1.default.green(extensionsJSONPath)}" file:`, err);
30
+ }
31
+ return extensionsJSON.recommendations;
32
+ }
33
+ //# sourceMappingURL=installVSCodeExtensions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installVSCodeExtensions.js","sourceRoot":"","sources":["../../../../../../packages/isaacscript-cli/src/commands/init/installVSCodeExtensions.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAC1B,4DAAsC;AACtC,wDAAwB;AACxB,qCAAuC;AACvC,yDAAmC;AACnC,uCAAoC;AAEpC,SAAgB,uBAAuB,CACrC,WAAmB,EACnB,aAAqB,EACrB,OAAgB;IAEhB,MAAM,UAAU,GAAG,qBAAqB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAC/D,KAAK,MAAM,aAAa,IAAI,UAAU,EAAE;QACtC,IAAA,gBAAS,EAAC,aAAa,EAAE,CAAC,qBAAqB,EAAE,aAAa,CAAC,EAAE,OAAO,CAAC,CAAC;KAC3E;AACH,CAAC;AATD,0DASC;AAMD,SAAS,qBAAqB,CAAC,WAAmB,EAAE,OAAgB;IAClE,MAAM,kBAAkB,GAAG,cAAI,CAAC,IAAI,CAClC,WAAW,EACX,SAAS,EACT,iBAAiB,CAClB,CAAC;IAEF,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,OAAO,CAAC,EAAE;QAC7C,OAAO,EAAE,CAAC;KACX;IAED,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;IAEjE,IAAI,cAA8B,CAAC;IACnC,IAAI;QACF,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAAmB,CAAC;KACnE;IAAC,OAAO,GAAG,EAAE;QACZ,IAAA,aAAK,EACH,wBAAwB,eAAK,CAAC,KAAK,CAAC,kBAAkB,CAAC,SAAS,EAChE,GAAG,CACJ,CAAC;KACH;IAED,OAAO,cAAc,CAAC,eAAe,CAAC;AACxC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function promptSaveSlot(argv: Record<string, unknown>, yes: boolean): Promise<number>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.promptSaveSlot = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const prompt_1 = require("../../prompt");
6
+ const utils_1 = require("../../utils");
7
+ function promptSaveSlot(argv, yes) {
8
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
9
+ if (argv["saveSlot"] !== undefined) {
10
+ // They specified the "--save-slot" command-line flag, so there is no need to prompt the user
11
+ // for it.
12
+ return argv["saveSlot"]; // yargs converts this to a number
13
+ }
14
+ if (yes) {
15
+ return 1;
16
+ }
17
+ const saveSlot = yield (0, prompt_1.getInputInt)("In-game, will you test your mod on save slot 1, 2, or 3?");
18
+ if (saveSlot !== 1 && saveSlot !== 2 && saveSlot !== 3) {
19
+ (0, utils_1.error)("Error: You must choose a number between 1 and 3.");
20
+ }
21
+ return saveSlot;
22
+ });
23
+ }
24
+ exports.promptSaveSlot = promptSaveSlot;
25
+ //# sourceMappingURL=promptSaveSlot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promptSaveSlot.js","sourceRoot":"","sources":["../../../../../../packages/isaacscript-cli/src/commands/init/promptSaveSlot.ts"],"names":[],"mappings":";;;;AAAA,yCAA2C;AAC3C,uCAAoC;AAEpC,SAAsB,cAAc,CAClC,IAA6B,EAC7B,GAAY;;QAEZ,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,SAAS,EAAE;YAClC,6FAA6F;YAC7F,UAAU;YACV,OAAO,IAAI,CAAC,UAAU,CAAW,CAAC,CAAC,kCAAkC;SACtE;QAED,IAAI,GAAG,EAAE;YACP,OAAO,CAAC,CAAC;SACV;QAED,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,0DAA0D,CAC3D,CAAC;QAEF,IAAI,QAAQ,KAAK,CAAC,IAAI,QAAQ,KAAK,CAAC,IAAI,QAAQ,KAAK,CAAC,EAAE;YACtD,IAAA,aAAK,EAAC,kDAAkD,CAAC,CAAC;SAC3D;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CAAA;AAvBD,wCAuBC"}
@@ -0,0 +1 @@
1
+ export declare function promptVSCode(projectPath: string, VSCodeCommand: string, vscode: boolean, verbose: boolean): Promise<void>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.promptVSCode = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const path_1 = tslib_1.__importDefault(require("path"));
6
+ const constants_1 = require("../../constants");
7
+ const exec_1 = require("../../exec");
8
+ const prompt_1 = require("../../prompt");
9
+ function promptVSCode(projectPath, VSCodeCommand, vscode, verbose) {
10
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
11
+ if (vscode) {
12
+ // They supplied the "--vscode" command-line flag, so there is no need to prompt the user.
13
+ openVSCode(projectPath, VSCodeCommand, verbose);
14
+ return;
15
+ }
16
+ const shouldOpenVSCode = yield (0, prompt_1.getInputYesNo)("Do you want to open your new project in VSCode now?");
17
+ if (shouldOpenVSCode) {
18
+ openVSCode(projectPath, VSCodeCommand, verbose);
19
+ }
20
+ });
21
+ }
22
+ exports.promptVSCode = promptVSCode;
23
+ function openVSCode(projectPath, VSCodeCommand, verbose) {
24
+ const MAIN_TS_PATH = path_1.default.join(projectPath, "src", constants_1.MAIN_TS);
25
+ (0, exec_1.execShell)(VSCodeCommand, [projectPath, MAIN_TS_PATH], verbose);
26
+ }
27
+ //# sourceMappingURL=promptVSCode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promptVSCode.js","sourceRoot":"","sources":["../../../../../../packages/isaacscript-cli/src/commands/init/promptVSCode.ts"],"names":[],"mappings":";;;;AAAA,wDAAwB;AACxB,+CAA0C;AAC1C,qCAAuC;AACvC,yCAA6C;AAE7C,SAAsB,YAAY,CAChC,WAAmB,EACnB,aAAqB,EACrB,MAAe,EACf,OAAgB;;QAEhB,IAAI,MAAM,EAAE;YACV,0FAA0F;YAC1F,UAAU,CAAC,WAAW,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;YAChD,OAAO;SACR;QAED,MAAM,gBAAgB,GAAG,MAAM,IAAA,sBAAa,EAC1C,qDAAqD,CACtD,CAAC;QACF,IAAI,gBAAgB,EAAE;YACpB,UAAU,CAAC,WAAW,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;SACjD;IACH,CAAC;CAAA;AAlBD,oCAkBC;AAED,SAAS,UAAU,CACjB,WAAmB,EACnB,aAAqB,EACrB,OAAgB;IAEhB,MAAM,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,mBAAO,CAAC,CAAC;IAC5D,IAAA,gBAAS,EAAC,aAAa,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC;AACjE,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const COMPILATION_SUCCESSFUL = "Compilation successful.";
@@ -1,5 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.COMPILATION_SUCCESSFUL = void 0;
4
- exports.COMPILATION_SUCCESSFUL = "Compilation successful.";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.COMPILATION_SUCCESSFUL = void 0;
4
+ exports.COMPILATION_SUCCESSFUL = "Compilation successful.";
5
5
  //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/isaacscript-cli/src/commands/monitor/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,sBAAsB,GAAG,yBAAyB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Config } from "../../types/Config";
2
+ export declare function copyWatcherMod(config: Config, verbose: boolean): void;