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
package/dist/package.json DELETED
@@ -1,57 +0,0 @@
1
- {
2
- "name": "isaacscript",
3
- "version": "2.0.11",
4
- "description": "A command line tool for managing Isaac mods written in TypeScript",
5
- "homepage": "https://isaacscript.github.io/",
6
- "bugs": {
7
- "url": "https://github.com/IsaacScript/isaacscript/issues"
8
- },
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/IsaacScript/isaacscript.git"
12
- },
13
- "license": "GPL-3.0",
14
- "author": "Zamiell",
15
- "bin": {
16
- "isaacscript": "./dist/src/main.js"
17
- },
18
- "files": [
19
- "dist/**/*.js",
20
- "dist/**/*.d.ts",
21
- "dist/**/*.json",
22
- "isaacscript-watcher/**"
23
- ],
24
- "dependencies": {
25
- "@types/node": "^17.0.35",
26
- "chalk": "4.1.2",
27
- "command-exists": "^1.2.9",
28
- "dotenv": "^16.0.1",
29
- "figlet": "^1.5.2",
30
- "fs-extra": "^10.1.0",
31
- "isaacscript-tsconfig": "^1.1.16",
32
- "jsonc-parser": "^3.0.0",
33
- "moment": "^2.29.3",
34
- "npm-check-updates": "^13.0.1",
35
- "prompt": "^1.3.0",
36
- "source-map": "^0.7.3",
37
- "source-map-support": "^0.5.21",
38
- "sync-directory": "^5.0.8",
39
- "ts-node": "^10.7.0",
40
- "typescript": "^4.6.4",
41
- "typescript-to-lua": "^1.4.4",
42
- "update-notifier": "^5.1.0",
43
- "yaml": "^2.1.0",
44
- "yargs": "^17.5.1"
45
- },
46
- "devDependencies": {
47
- "@types/command-exists": "^1.2.0",
48
- "@types/figlet": "^1.5.4",
49
- "@types/fs-extra": "^9.0.13",
50
- "@types/prompt": "^1.1.2",
51
- "@types/source-map-support": "^0.5.4",
52
- "@types/update-notifier": "^5.1.0",
53
- "@types/yargs": "^17.0.10",
54
- "isaacscript-lint": "^1.0.159",
55
- "isaacscript-spell": "^1.0.3"
56
- }
57
- }
@@ -1,101 +0,0 @@
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.checkForWindowsTerminalBugs = void 0;
30
- const chalk_1 = __importDefault(require("chalk"));
31
- const fs_1 = __importDefault(require("fs"));
32
- const path_1 = __importDefault(require("path"));
33
- const constants_1 = require("./constants");
34
- const file = __importStar(require("./file"));
35
- const prompt_1 = require("./prompt");
36
- const utils_1 = require("./utils");
37
- const BASH_PROFILE_PATH = path_1.default.join(constants_1.HOME_DIR, ".bash_profile");
38
- /**
39
- * By default, Git Bash for Windows uses MINGW64. This will not work correctly with the prompt
40
- * library. Try to detect this and warn the end-user.
41
- */
42
- async function checkForWindowsTerminalBugs(verbose) {
43
- if (process.platform !== "win32") {
44
- return;
45
- }
46
- if (process.env["SHELL"] !== "C:\\Program Files\\Git\\usr\\bin\\bash.exe") {
47
- return;
48
- }
49
- await checkForWindowsBugColor(verbose);
50
- }
51
- exports.checkForWindowsTerminalBugs = checkForWindowsTerminalBugs;
52
- async function checkForWindowsBugColor(verbose) {
53
- if (process.env["FORCE_COLOR"] === "true") {
54
- return;
55
- }
56
- console.error(chalk_1.default.red(`Error: It looks like you are using Git Bash for Windows (MINGW64) without the "${chalk_1.default.green("FORCE_COLOR")}" environment variable.`));
57
- console.error("This is necessary in order for colors to work properly in the terminal.");
58
- const shouldFixColors = await (0, prompt_1.getInputYesNo)("Do you want me to fix this for you?");
59
- if (!shouldFixColors) {
60
- return;
61
- }
62
- applyFixesToBashProfile(verbose);
63
- }
64
- function applyFixesToBashProfile(verbose) {
65
- // Check to see if the Bash profile has data.
66
- let bashProfileContents;
67
- if (file.exists(BASH_PROFILE_PATH, verbose)) {
68
- bashProfileContents = file.read(BASH_PROFILE_PATH, verbose);
69
- }
70
- else {
71
- bashProfileContents = "";
72
- }
73
- const appendText = getBashProfileAppendText(bashProfileContents);
74
- try {
75
- fs_1.default.appendFileSync(BASH_PROFILE_PATH, appendText);
76
- }
77
- catch (err) {
78
- (0, utils_1.error)(`Failed to append text to "${BASH_PROFILE_PATH}":`, err);
79
- }
80
- console.log(chalk_1.default.green("Complete!"), `The terminal fixes have been added to: ${chalk_1.default.green(BASH_PROFILE_PATH)}`);
81
- console.log(chalk_1.default.red("Please close and re-open your terminal, then run this program again."));
82
- process.exit(0);
83
- }
84
- function getBashProfileAppendText(bashProfileContents) {
85
- let newText = "";
86
- if (bashProfileContents !== "" &&
87
- bashProfileContents[bashProfileContents.length - 1] !== "\n") {
88
- // If the Bash profile exists and has data, it should end in a newline. Add an extra newline if
89
- // this is not the case.
90
- newText += "\n";
91
- }
92
- if (bashProfileContents !== "") {
93
- // If the Bash profile exists and has data, add an extra newline between the existing stuff and
94
- // the new lines added by us.
95
- newText += "\n";
96
- }
97
- newText += `# Terminal fixes added by ${constants_1.PROJECT_NAME}\n`;
98
- newText += "export FORCE_COLOR=true\n";
99
- return newText;
100
- }
101
- //# sourceMappingURL=checkForWindowsTerminalBugs.js.map
@@ -1,58 +0,0 @@
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.compileAndCopy = exports.copy = void 0;
30
- const path_1 = __importDefault(require("path"));
31
- const constants_1 = require("../../constants");
32
- const exec_1 = require("../../exec");
33
- const file = __importStar(require("../../file"));
34
- const utils_1 = require("../../utils");
35
- function copy(argv, config) {
36
- const verbose = argv["verbose"] === true;
37
- const modTargetDirectoryName = (0, utils_1.getModTargetDirectoryName)(config);
38
- const modTargetPath = path_1.default.join(config.modsDirectory, modTargetDirectoryName);
39
- compileAndCopy(constants_1.MOD_SOURCE_PATH, modTargetPath, verbose);
40
- }
41
- exports.copy = copy;
42
- function compileAndCopy(modSourcePath, modTargetPath, verbose) {
43
- compile(verbose);
44
- copyMod(modSourcePath, modTargetPath, verbose);
45
- }
46
- exports.compileAndCopy = compileAndCopy;
47
- function compile(verbose) {
48
- (0, exec_1.execShell)("npx", ["tstl"], verbose);
49
- console.log("Mod compiled successfully.");
50
- }
51
- function copyMod(modSourcePath, modTargetPath, verbose) {
52
- if (file.exists(modTargetPath, verbose)) {
53
- file.deleteFileOrDirectory(modTargetPath, verbose);
54
- }
55
- file.copy(modSourcePath, modTargetPath, verbose);
56
- console.log("Mod copied successfully.");
57
- }
58
- //# sourceMappingURL=copy.js.map
@@ -1,53 +0,0 @@
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.checkIfProjectPathExists = void 0;
30
- const chalk_1 = __importDefault(require("chalk"));
31
- const constants_1 = require("../../constants");
32
- const file = __importStar(require("../../file"));
33
- const prompt_1 = require("../../prompt");
34
- const utils_1 = require("../../utils");
35
- async function checkIfProjectPathExists(projectPath, yes, verbose) {
36
- if (projectPath === constants_1.CWD || !file.exists(projectPath, verbose)) {
37
- return;
38
- }
39
- const fileType = file.isDir(projectPath, verbose) ? "directory" : "file";
40
- if (yes) {
41
- file.deleteFileOrDirectory(projectPath, verbose);
42
- console.log(`Deleted ${fileType}: ${chalk_1.default.green(projectPath)}`);
43
- return;
44
- }
45
- console.log(`A ${fileType} already exists with a name of: ${chalk_1.default.green(projectPath)}`);
46
- const shouldDelete = await (0, prompt_1.getInputYesNo)("Do you want me to delete it?");
47
- if (!shouldDelete) {
48
- (0, utils_1.error)("Ok then. Goodbye.");
49
- }
50
- file.deleteFileOrDirectory(projectPath, verbose);
51
- }
52
- exports.checkIfProjectPathExists = checkIfProjectPathExists;
53
- //# sourceMappingURL=checkIfProjectPathExists.js.map
@@ -1,41 +0,0 @@
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.checkModSubdirectory = void 0;
30
- const chalk_1 = __importDefault(require("chalk"));
31
- const constants_1 = require("../../constants");
32
- const file = __importStar(require("../../file"));
33
- const utils_1 = require("../../utils");
34
- function checkModSubdirectory(projectPath, modsDirectory) {
35
- if (file.isSubDirOf(constants_1.CWD, modsDirectory)) {
36
- console.error(`Error: The project directory of "${chalk_1.default.green(projectPath)}" is a subdirectory of "${chalk_1.default.green(modsDirectory)}".`);
37
- (0, utils_1.error)('You are supposed to have your project folder somewhere else on the system than the Isaac mods directory. (This is because we don\'t want to upload the ".git" folder or the TypeScript files to the Steam Workshop.) Exiting.');
38
- }
39
- }
40
- exports.checkModSubdirectory = checkModSubdirectory;
41
- //# sourceMappingURL=checkModSubdirectory.js.map
@@ -1,56 +0,0 @@
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.checkModTargetDirectory = void 0;
30
- const chalk_1 = __importDefault(require("chalk"));
31
- const path_1 = __importDefault(require("path"));
32
- const constants_1 = require("../../constants");
33
- const file = __importStar(require("../../file"));
34
- const prompt_1 = require("../../prompt");
35
- const utils_1 = require("../../utils");
36
- async function checkModTargetDirectory(modsDirectory, projectName, yes, verbose) {
37
- const modTargetPath = path_1.default.join(modsDirectory, projectName);
38
- if (!file.exists(modTargetPath, verbose)) {
39
- return;
40
- }
41
- const fileType = file.isDir(modTargetPath, verbose) ? "directory" : "file";
42
- if (yes) {
43
- file.deleteFileOrDirectory(modTargetPath, verbose);
44
- console.log(`Deleted ${fileType}: ${chalk_1.default.green(modTargetPath)}`);
45
- return;
46
- }
47
- console.log(`A ${fileType} already exists at at the mod path of: ${chalk_1.default.green(modTargetPath)}`);
48
- console.log(`${constants_1.PROJECT_NAME} will need to sync your project folder with this directory.`);
49
- const shouldDelete = await (0, prompt_1.getInputYesNo)("Do you want me to delete it?");
50
- if (!shouldDelete) {
51
- (0, utils_1.error)("Ok then. Goodbye.");
52
- }
53
- file.deleteFileOrDirectory(modTargetPath, verbose);
54
- }
55
- exports.checkModTargetDirectory = checkModTargetDirectory;
56
- //# sourceMappingURL=checkModTargetDirectory.js.map
@@ -1,81 +0,0 @@
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.getModsDir = void 0;
30
- const chalk_1 = __importDefault(require("chalk"));
31
- const path_1 = __importDefault(require("path"));
32
- const constants_1 = require("../../constants");
33
- const file = __importStar(require("../../file"));
34
- const prompt_1 = require("../../prompt");
35
- const utils_1 = require("../../utils");
36
- const MODS = "mods";
37
- const DEFAULT_MODS_PATH_WINDOWS = path_1.default.join("C:", "Program Files (x86)", "Steam", "steamapps", "common", "The Binding of Isaac Rebirth", MODS);
38
- /** This is a subdirectory of `$HOME`. */
39
- const DEFAULT_MODS_PATH_LINUX = path_1.default.join(constants_1.HOME_DIR, ".local", "share", "Steam", "steamapps", "common", "The Binding of Isaac Rebirth", MODS);
40
- async function getModsDir(argv, verbose) {
41
- if (argv["modsDirectory"] !== undefined) {
42
- // They specified the "--mods-directory" command-line flag, so there is no need to prompt the
43
- // user for it.
44
- return argv["modsDirectory"];
45
- }
46
- const defaultModsPath = getDefaultModsPath(process.platform);
47
- if (file.exists(defaultModsPath, verbose) &&
48
- file.isDir(defaultModsPath, verbose)) {
49
- return defaultModsPath;
50
- }
51
- console.error(`Failed to find your mods directory at: ${chalk_1.default.green(defaultModsPath)}`);
52
- const modsDir = await (0, prompt_1.getInputString)(`Enter the full path to the "${MODS}" directory on your system, which should be next to your "isaac-ng.exe" program:`);
53
- if (modsDir === "") {
54
- (0, utils_1.error)("Error: You did not provide a response; exiting.");
55
- }
56
- if (!file.exists(modsDir, verbose)) {
57
- (0, utils_1.error)(`Error: The directory of "${chalk_1.default.green(modsDir)}" does not exist. Exiting.`);
58
- }
59
- if (!file.isDir(modsDir, verbose)) {
60
- (0, utils_1.error)(`Error: The path of "${chalk_1.default.green(modsDir)}" is not a directory. Exiting.`);
61
- }
62
- if (path_1.default.basename(modsDir) !== MODS) {
63
- (0, utils_1.error)(`Error: You entered a path of "${chalk_1.default.green(modsDir)}", but you need to input a directory with a name of "${MODS}" at the end. Exiting.`);
64
- }
65
- return modsDir;
66
- }
67
- exports.getModsDir = getModsDir;
68
- function getDefaultModsPath(platform) {
69
- switch (platform) {
70
- case "win32": {
71
- return DEFAULT_MODS_PATH_WINDOWS;
72
- }
73
- case "linux": {
74
- return DEFAULT_MODS_PATH_LINUX;
75
- }
76
- default: {
77
- return (0, utils_1.error)(`There does not exist a default mod path for the platform of: ${chalk_1.default.green(platform)}`);
78
- }
79
- }
80
- }
81
- //# sourceMappingURL=getModsDir.js.map
@@ -1,91 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getProjectPath = void 0;
7
- const chalk_1 = __importDefault(require("chalk"));
8
- const path_1 = __importDefault(require("path"));
9
- const constants_1 = require("../../constants");
10
- const prompt_1 = require("../../prompt");
11
- const utils_1 = require("../../utils");
12
- // From: https://gist.github.com/doctaphred/d01d05291546186941e1b7ddc02034d3
13
- const ILLEGAL_CHARACTERS_FOR_WINDOWS_FILENAMES = [
14
- "<",
15
- ">",
16
- ":",
17
- '"',
18
- "/",
19
- "\\",
20
- "|",
21
- "?",
22
- "*",
23
- ];
24
- async function getProjectPath(argv, useCurrentDir, yes, forceName) {
25
- let projectName = getProjectNameFromCommandLineArgument(argv);
26
- let projectPath;
27
- let createNewDir;
28
- if (useCurrentDir) {
29
- // The "--use-current-dir" command-line flag was specified, so there is no need to prompt the
30
- // user.
31
- projectName = constants_1.CURRENT_DIRECTORY_NAME;
32
- projectPath = constants_1.CWD;
33
- createNewDir = false;
34
- }
35
- else if (projectName !== undefined) {
36
- // The project name was specified on the command-line.
37
- projectPath = path_1.default.join(constants_1.CWD, projectName);
38
- createNewDir = true;
39
- }
40
- else if (yes) {
41
- // The "--yes" command-line flag was specified and the project name was not specified on the
42
- // command-line, so default to using the current directory.
43
- projectName = constants_1.CURRENT_DIRECTORY_NAME;
44
- projectPath = constants_1.CWD;
45
- createNewDir = false;
46
- }
47
- else {
48
- // The project name was not specified on the command-line, so prompt the user for it.
49
- [projectName, projectPath, createNewDir] = await getNewProjectName();
50
- }
51
- validateProjectName(projectName, forceName);
52
- console.log(`Using a project name of: ${chalk_1.default.green(projectName)}`);
53
- return [projectPath, createNewDir];
54
- }
55
- exports.getProjectPath = getProjectPath;
56
- function getProjectNameFromCommandLineArgument(argv) {
57
- const name = argv["name"];
58
- return typeof name === "string" && name !== "" ? name : undefined;
59
- }
60
- async function getNewProjectName() {
61
- console.log("You did not specify a project name as a command-line argument.");
62
- const shouldUseCurrentDir = await (0, prompt_1.getInputYesNo)(`Would you like to create a new project using the current directory "${chalk_1.default.green(constants_1.CURRENT_DIRECTORY_NAME)}" as the root?`);
63
- if (shouldUseCurrentDir) {
64
- return [constants_1.CURRENT_DIRECTORY_NAME, constants_1.CWD, false];
65
- }
66
- const projectName = await (0, prompt_1.getInputString)("Enter the name of the project:");
67
- const projectPath = path_1.default.join(constants_1.CWD, projectName);
68
- return [projectName, projectPath, true];
69
- }
70
- function validateProjectName(projectName, forceName) {
71
- if (projectName === "") {
72
- (0, utils_1.error)("Error: You cannot have a blank project name.");
73
- }
74
- if (process.platform === "win32") {
75
- for (const character of ILLEGAL_CHARACTERS_FOR_WINDOWS_FILENAMES) {
76
- if (projectName.includes(character)) {
77
- (0, utils_1.error)(`Error: The "${character}" character is not allowed in a Windows file name.`);
78
- }
79
- }
80
- }
81
- if (forceName) {
82
- return;
83
- }
84
- if ((0, utils_1.hasWhiteSpace)(projectName)) {
85
- (0, utils_1.error)('Error: The project name has whitespace in it, which is not allowed. Use kebab-case for your project name. (e.g. "green-candle")');
86
- }
87
- if (!(0, utils_1.isKebabCase)(projectName)) {
88
- (0, utils_1.error)('Error: The project name is not in kebab-case. (Kebab-case is the style of using all lowercase letters, with words separated by hyphens.) Project names must use kebab-case to match GitHub repository standards. If necessary, you can override this check with the "--force-name" flag.');
89
- }
90
- }
91
- //# sourceMappingURL=getProjectPath.js.map
@@ -1,68 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.init = void 0;
7
- const chalk_1 = __importDefault(require("chalk"));
8
- const command_exists_1 = __importDefault(require("command-exists"));
9
- const path_1 = __importDefault(require("path"));
10
- const constants_1 = require("../../constants");
11
- const checkIfProjectPathExists_1 = require("./checkIfProjectPathExists");
12
- const checkModSubdirectory_1 = require("./checkModSubdirectory");
13
- const checkModTargetDirectory_1 = require("./checkModTargetDirectory");
14
- const createMod_1 = require("./createMod");
15
- const getModsDir_1 = require("./getModsDir");
16
- const getProjectPath_1 = require("./getProjectPath");
17
- const git_1 = require("./git");
18
- const installVSCodeExtensions_1 = require("./installVSCodeExtensions");
19
- const promptSaveSlot_1 = require("./promptSaveSlot");
20
- const promptVSCode_1 = require("./promptVSCode");
21
- async function init(argv) {
22
- const skipNPMInstall = argv["skipNpmInstall"] === true;
23
- const useCurrentDir = argv["useCurrentDir"] === true;
24
- const verbose = argv["verbose"] === true;
25
- const vscode = argv["vscode"] === true;
26
- const yes = argv["yes"] === true;
27
- const forceName = argv["forceName"] === true;
28
- // Prompt the end-user for some information (and validate it as we go).
29
- const [projectPath, createNewDir] = await (0, getProjectPath_1.getProjectPath)(argv, useCurrentDir, yes, forceName);
30
- await (0, checkIfProjectPathExists_1.checkIfProjectPathExists)(projectPath, yes, verbose);
31
- const modsDirectory = await (0, getModsDir_1.getModsDir)(argv, verbose);
32
- (0, checkModSubdirectory_1.checkModSubdirectory)(projectPath, modsDirectory);
33
- const projectName = path_1.default.basename(projectPath);
34
- await (0, checkModTargetDirectory_1.checkModTargetDirectory)(modsDirectory, projectName, yes, verbose);
35
- const saveSlot = await (0, promptSaveSlot_1.promptSaveSlot)(argv, yes);
36
- const gitRemoteURL = await (0, git_1.promptGitHubRepoOrGitRemoteURL)(projectName, yes, verbose);
37
- // Now that we have asked the user all of the questions we need, we can create the project.
38
- (0, createMod_1.createMod)(projectName, projectPath, createNewDir, modsDirectory, saveSlot, gitRemoteURL, skipNPMInstall, verbose);
39
- await openVSCode(projectPath, vscode, verbose);
40
- printFinishMessage(projectPath, projectName);
41
- }
42
- exports.init = init;
43
- async function openVSCode(projectPath, vscode, verbose) {
44
- const VSCodeCommand = getVSCodeCommand();
45
- if (VSCodeCommand === null) {
46
- console.log('VSCode does not seem to be installed. (The "code" command is not in the path.) Skipping VSCode-related things.');
47
- return;
48
- }
49
- (0, installVSCodeExtensions_1.installVSCodeExtensions)(projectPath, VSCodeCommand, verbose);
50
- await (0, promptVSCode_1.promptVSCode)(projectPath, VSCodeCommand, vscode, verbose);
51
- }
52
- function getVSCodeCommand() {
53
- for (const VSCodeCommand of ["code", "codium", "code-oss", "code-insiders"]) {
54
- if (command_exists_1.default.sync(VSCodeCommand)) {
55
- return VSCodeCommand;
56
- }
57
- }
58
- return null;
59
- }
60
- function printFinishMessage(projectPath, projectName) {
61
- let commandsToType = "";
62
- if (projectPath !== constants_1.CWD) {
63
- commandsToType += `"${chalk_1.default.green(`cd ${projectName}`)}" and `;
64
- }
65
- commandsToType += `"${chalk_1.default.green("npx isaacscript")}"`;
66
- console.log(`Now, start ${constants_1.PROJECT_NAME} by typing ${commandsToType}.`);
67
- }
68
- //# sourceMappingURL=init.js.map