isaacscript 1.2.30 → 1.2.31
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.
- package/dist/package.json +2 -2
- package/dist/src/checkForWindowsTerminalBugs.js +7 -7
- package/dist/src/checkForWindowsTerminalBugs.js.map +1 -1
- package/dist/src/commands/copy/copy.js +1 -1
- package/dist/src/commands/copy/copy.js.map +1 -1
- package/dist/src/commands/init/checkIfProjectPathExists.js +2 -2
- package/dist/src/commands/init/checkIfProjectPathExists.js.map +1 -1
- package/dist/src/commands/init/checkModTargetDirectory.js +2 -2
- package/dist/src/commands/init/checkModTargetDirectory.js.map +1 -1
- package/dist/src/commands/init/createMod.js +8 -8
- package/dist/src/commands/init/createMod.js.map +1 -1
- package/dist/src/commands/init/getModsDir.js +5 -4
- package/dist/src/commands/init/getModsDir.js.map +1 -1
- package/dist/src/commands/init/getProjectPath.js +7 -10
- package/dist/src/commands/init/getProjectPath.js.map +1 -1
- package/dist/src/commands/init/git.js +5 -5
- package/dist/src/commands/init/git.js.map +1 -1
- package/dist/src/commands/init/init.js +1 -1
- package/dist/src/commands/init/init.js.map +1 -1
- package/dist/src/commands/init/installVSCodeExtensions.js +4 -4
- package/dist/src/commands/init/installVSCodeExtensions.js.map +1 -1
- package/dist/src/commands/monitor/copyWatcherMod.js +3 -3
- package/dist/src/commands/monitor/copyWatcherMod.js.map +1 -1
- package/dist/src/commands/monitor/getTSConfigInclude.js +2 -2
- package/dist/src/commands/monitor/getTSConfigInclude.js.map +1 -1
- package/dist/src/commands/monitor/monitor.js +2 -2
- package/dist/src/commands/monitor/monitor.js.map +1 -1
- package/dist/src/commands/monitor/saveDatWriter/saveDatWriter.js +13 -12
- package/dist/src/commands/monitor/saveDatWriter/saveDatWriter.js.map +1 -1
- package/dist/src/commands/monitor/touchWatcherSaveDatFiles.js +2 -2
- package/dist/src/commands/monitor/touchWatcherSaveDatFiles.js.map +1 -1
- package/dist/src/commands/publish/publish.js +16 -16
- package/dist/src/commands/publish/publish.js.map +1 -1
- package/dist/src/configFile.js +5 -5
- package/dist/src/configFile.js.map +1 -1
- package/dist/src/exec.js +2 -2
- package/dist/src/exec.js.map +1 -1
- package/dist/src/file.js +37 -7
- package/dist/src/file.js.map +1 -1
- package/dist/src/main.js +5 -4
- package/dist/src/main.js.map +1 -1
- package/dist/src/utils.js +7 -1
- package/dist/src/utils.js.map +1 -1
- package/dist/src/validateInIsaacScriptProject.js +3 -2
- package/dist/src/validateInIsaacScriptProject.js.map +1 -1
- package/package.json +2 -2
- package/src/checkForWindowsTerminalBugs.ts +9 -7
- package/src/commands/copy/copy.ts +1 -1
- package/src/commands/init/checkIfProjectPathExists.ts +2 -2
- package/src/commands/init/checkModTargetDirectory.ts +2 -2
- package/src/commands/init/createMod.ts +8 -8
- package/src/commands/init/getModsDir.ts +7 -3
- package/src/commands/init/getProjectPath.ts +10 -11
- package/src/commands/init/git.ts +5 -5
- package/src/commands/init/init.ts +1 -1
- package/src/commands/init/installVSCodeExtensions.ts +4 -4
- package/src/commands/monitor/copyWatcherMod.ts +3 -3
- package/src/commands/monitor/getTSConfigInclude.ts +2 -2
- package/src/commands/monitor/monitor.ts +2 -2
- package/src/commands/monitor/saveDatWriter/saveDatWriter.ts +14 -12
- package/src/commands/monitor/touchWatcherSaveDatFiles.ts +2 -2
- package/src/commands/publish/publish.ts +16 -16
- package/src/configFile.ts +5 -5
- package/src/exec.ts +2 -4
- package/src/file.ts +51 -7
- package/src/main.ts +5 -4
- package/src/utils.ts +8 -0
- package/src/validateInIsaacScriptProject.ts +5 -2
package/src/main.ts
CHANGED
|
@@ -36,6 +36,7 @@ async function main(): Promise<void> {
|
|
|
36
36
|
|
|
37
37
|
// Get command line arguments
|
|
38
38
|
const argv = parseArgs();
|
|
39
|
+
const verbose = argv.verbose === true;
|
|
39
40
|
|
|
40
41
|
printBanner();
|
|
41
42
|
|
|
@@ -43,9 +44,9 @@ async function main(): Promise<void> {
|
|
|
43
44
|
updateNotifier({ pkg }).notify();
|
|
44
45
|
|
|
45
46
|
// Pre-flight checks
|
|
46
|
-
await checkForWindowsTerminalBugs();
|
|
47
|
+
await checkForWindowsTerminalBugs(verbose);
|
|
47
48
|
|
|
48
|
-
await handleCommands(argv);
|
|
49
|
+
await handleCommands(argv, verbose);
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
function loadEnvironmentVariables() {
|
|
@@ -62,7 +63,7 @@ function printBanner() {
|
|
|
62
63
|
console.log();
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
async function handleCommands(argv: Record<string, unknown
|
|
66
|
+
async function handleCommands(argv: Record<string, unknown>, verbose: boolean) {
|
|
66
67
|
const positionalArgs = argv._ as string[];
|
|
67
68
|
let command: Command;
|
|
68
69
|
if (positionalArgs.length > 0) {
|
|
@@ -73,7 +74,7 @@ async function handleCommands(argv: Record<string, unknown>) {
|
|
|
73
74
|
|
|
74
75
|
let config = new Config();
|
|
75
76
|
if (command !== "init") {
|
|
76
|
-
validateInIsaacScriptProject();
|
|
77
|
+
validateInIsaacScriptProject(verbose);
|
|
77
78
|
config = await configFile.get(argv);
|
|
78
79
|
}
|
|
79
80
|
|
package/src/utils.ts
CHANGED
|
@@ -2,6 +2,10 @@ import moment from "moment";
|
|
|
2
2
|
import { CURRENT_DIRECTORY_NAME } from "./constants";
|
|
3
3
|
import { Config } from "./types/Config";
|
|
4
4
|
|
|
5
|
+
/** From: https://github.com/expandjs/expandjs/blob/master/lib/kebabCaseRegex.js */
|
|
6
|
+
const KEBAB_CASE_REGEX =
|
|
7
|
+
/^([a-z](?![\d])|[\d](?![a-z]))+(-?([a-z](?![\d])|[\d](?![a-z])))*$|^$/;
|
|
8
|
+
|
|
5
9
|
export const ensureAllCases = (obj: never): never => obj;
|
|
6
10
|
|
|
7
11
|
export function error(...args: unknown[]): never {
|
|
@@ -24,6 +28,10 @@ export function hasWhiteSpace(s: string): boolean {
|
|
|
24
28
|
return /\s/g.test(s);
|
|
25
29
|
}
|
|
26
30
|
|
|
31
|
+
export function isKebabCase(s: string): boolean {
|
|
32
|
+
return KEBAB_CASE_REGEX.test(s);
|
|
33
|
+
}
|
|
34
|
+
|
|
27
35
|
/**
|
|
28
36
|
* parseIntSafe is a more reliable version of parseInt. By default, "parseInt('1a')" will return
|
|
29
37
|
* "1", which is unexpected. This returns either an integer or NaN.
|
|
@@ -4,11 +4,14 @@ import { CWD, PROJECT_NAME } from "./constants";
|
|
|
4
4
|
import * as file from "./file";
|
|
5
5
|
|
|
6
6
|
// Validate that we are in a directory that looks like an IsaacScript project
|
|
7
|
-
export function validateInIsaacScriptProject(): void {
|
|
7
|
+
export function validateInIsaacScriptProject(verbose: boolean): void {
|
|
8
8
|
const subdirectoriesToCheck = ["src", "mod", "node_modules"];
|
|
9
9
|
for (const subdirectoryName of subdirectoriesToCheck) {
|
|
10
10
|
const subdirectoryPath = path.join(CWD, subdirectoryName);
|
|
11
|
-
if (
|
|
11
|
+
if (
|
|
12
|
+
!file.exists(subdirectoryPath, verbose) ||
|
|
13
|
+
!file.isDir(subdirectoryPath, verbose)
|
|
14
|
+
) {
|
|
12
15
|
errorNotExists(subdirectoryPath);
|
|
13
16
|
}
|
|
14
17
|
}
|