moomodding 2.0.0 → 2.0.1

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/cli.js CHANGED
@@ -18,7 +18,7 @@ const program = new Command();
18
18
  program
19
19
  .name("moo")
20
20
  .description("MooModding Developer CLI — Build, test, and sync MooMoo.io mods with zero friction.")
21
- .version("2.0.0");
21
+ .version("2.0.1");
22
22
  // 1. Auth Commands
23
23
  program
24
24
  .command("login [token]")
@@ -3,56 +3,55 @@ import pc from "picocolors";
3
3
  import { setAuth, getApiUrl } from "../core/config.js";
4
4
  import { api } from "../core/client.js";
5
5
  function askQuestion(query, hideInput = false) {
6
- const rl = readline.createInterface({
7
- input: process.stdin,
8
- output: process.stdout
9
- });
10
- return new Promise((resolve) => {
11
- if (!hideInput) {
6
+ if (!hideInput) {
7
+ const rl = readline.createInterface({
8
+ input: process.stdin,
9
+ output: process.stdout
10
+ });
11
+ return new Promise((resolve) => {
12
12
  rl.question(query, (answer) => {
13
13
  rl.close();
14
14
  resolve(answer.trim());
15
15
  });
16
- }
17
- else {
18
- // Mask password typing
19
- process.stdout.write(query);
20
- const stdin = process.stdin;
21
- let input = "";
22
- const onData = (char) => {
23
- const c = char.toString("utf-8");
24
- switch (c) {
25
- case "\n":
26
- case "\r":
27
- case "\u0004":
28
- stdin.removeListener("data", onData);
29
- if (stdin.isTTY)
30
- stdin.setRawMode(false);
31
- rl.close();
32
- process.stdout.write("\n");
33
- resolve(input.trim());
34
- break;
35
- case "\u0003": // Ctrl+C
36
- process.exit(1);
37
- break;
38
- case "\u007f": // Backspace
39
- case "\b":
40
- if (input.length > 0) {
41
- input = input.slice(0, -1);
42
- process.stdout.write("\b \b");
43
- }
44
- break;
45
- default:
46
- input += c;
47
- process.stdout.write("*");
48
- break;
16
+ });
17
+ }
18
+ return new Promise((resolve) => {
19
+ process.stdout.write(query);
20
+ const stdin = process.stdin;
21
+ let input = "";
22
+ const onData = (buf) => {
23
+ const str = buf.toString("utf-8");
24
+ for (const c of str) {
25
+ if (c === "\n" || c === "\r" || c === "\u0004") {
26
+ stdin.removeListener("data", onData);
27
+ if (stdin.isTTY)
28
+ stdin.setRawMode(false);
29
+ stdin.pause();
30
+ process.stdout.write("\n");
31
+ resolve(input.trim());
32
+ return;
49
33
  }
50
- };
51
- if (stdin.isTTY)
52
- stdin.setRawMode(true);
53
- stdin.resume();
54
- stdin.on("data", onData);
55
- }
34
+ else if (c === "\u0003") {
35
+ if (stdin.isTTY)
36
+ stdin.setRawMode(false);
37
+ process.exit(1);
38
+ }
39
+ else if (c === "\u007f" || c === "\b") {
40
+ if (input.length > 0) {
41
+ input = input.slice(0, -1);
42
+ process.stdout.write("\b \b");
43
+ }
44
+ }
45
+ else if (c >= " ") {
46
+ input += c;
47
+ process.stdout.write("*");
48
+ }
49
+ }
50
+ };
51
+ if (stdin.isTTY)
52
+ stdin.setRawMode(true);
53
+ stdin.resume();
54
+ stdin.on("data", onData);
56
55
  });
57
56
  }
58
57
  export async function loginCommand(explicitToken) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moomodding",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Official MooModding.io Developer CLI & Game SDK - Build, test, and sync MooMoo.io mods seamlessly.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",