optikit 1.2.2 → 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.
package/USAGE.md CHANGED
@@ -40,7 +40,7 @@ optikit init
40
40
  ```json
41
41
  {
42
42
  "backupRetentionCount": 5,
43
- "useFvmByDefault": false,
43
+ "useFvmByDefault": true,
44
44
  "autoBackup": true,
45
45
  "verbose": false
46
46
  }
@@ -20,7 +20,7 @@ async function initializeProject() {
20
20
  // Create default configuration
21
21
  const defaultConfig = {
22
22
  backupRetentionCount: 5,
23
- useFvmByDefault: false,
23
+ useFvmByDefault: true,
24
24
  autoBackup: true,
25
25
  verbose: false,
26
26
  };
@@ -57,6 +57,30 @@ export async function execCommand(command) {
57
57
  });
58
58
  });
59
59
  }
60
+ export async function execCommandSilent(command) {
61
+ return new Promise((resolve, reject) => {
62
+ const fullCommand = `${command}`;
63
+ const process = spawn(fullCommand, { shell: true });
64
+ let output = "";
65
+ process.stdout.on("data", (data) => {
66
+ output += data.toString();
67
+ });
68
+ process.stderr.on("data", (data) => {
69
+ output += data.toString();
70
+ });
71
+ process.on("close", (code) => {
72
+ if (code !== 0) {
73
+ reject(new Error(`Command failed with exit code ${code}`));
74
+ }
75
+ else {
76
+ resolve(output);
77
+ }
78
+ });
79
+ process.on("error", (err) => {
80
+ reject(new Error(`Failed to start subprocess: ${err.message}`));
81
+ });
82
+ });
83
+ }
60
84
  export async function execInIos(command) {
61
85
  return new Promise((resolve, reject) => {
62
86
  const fullCommand = `cd "${iosDirectory}" && ${command}`;
@@ -1,6 +1,6 @@
1
1
  import fs from "fs";
2
2
  import path from "path";
3
- import { execCommand } from "../services/exec.js";
3
+ import { execCommandSilent } from "../services/exec.js";
4
4
  import { LoggerHelpers } from "../services/logger.js";
5
5
  export { validateFlutterProject, validateFlutterSdk, validateIosProject, validateAndroidProject, checkFileExists, };
6
6
  /**
@@ -36,12 +36,12 @@ async function validateFlutterSdk(useFvm = false) {
36
36
  return false;
37
37
  }
38
38
  // Check if fvm command is available
39
- await execCommand("fvm --version");
39
+ await execCommandSilent("fvm --version");
40
40
  return true;
41
41
  }
42
42
  else {
43
43
  // Check if global Flutter is available
44
- await execCommand("flutter --version");
44
+ await execCommandSilent("flutter --version");
45
45
  return true;
46
46
  }
47
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "optikit",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "OptiKit CLI",
5
5
  "main": "src/cli.ts",
6
6
  "type": "module",
@@ -25,7 +25,7 @@ async function initializeProject(): Promise<void> {
25
25
  // Create default configuration
26
26
  const defaultConfig = {
27
27
  backupRetentionCount: 5,
28
- useFvmByDefault: false,
28
+ useFvmByDefault: true,
29
29
  autoBackup: true,
30
30
  verbose: false,
31
31
  };
@@ -73,6 +73,35 @@ export async function execCommand(command: string): Promise<string> {
73
73
  });
74
74
  }
75
75
 
76
+ export async function execCommandSilent(command: string): Promise<string> {
77
+ return new Promise((resolve, reject) => {
78
+ const fullCommand = `${command}`;
79
+ const process = spawn(fullCommand, { shell: true });
80
+
81
+ let output = "";
82
+
83
+ process.stdout.on("data", (data) => {
84
+ output += data.toString();
85
+ });
86
+
87
+ process.stderr.on("data", (data) => {
88
+ output += data.toString();
89
+ });
90
+
91
+ process.on("close", (code) => {
92
+ if (code !== 0) {
93
+ reject(new Error(`Command failed with exit code ${code}`));
94
+ } else {
95
+ resolve(output);
96
+ }
97
+ });
98
+
99
+ process.on("error", (err) => {
100
+ reject(new Error(`Failed to start subprocess: ${err.message}`));
101
+ });
102
+ });
103
+ }
104
+
76
105
  export async function execInIos(command: string): Promise<string> {
77
106
  return new Promise((resolve, reject) => {
78
107
  const fullCommand = `cd "${iosDirectory}" && ${command}`;
@@ -1,6 +1,6 @@
1
1
  import fs from "fs";
2
2
  import path from "path";
3
- import { execCommand } from "../services/exec.js";
3
+ import { execCommandSilent } from "../services/exec.js";
4
4
  import { LoggerHelpers } from "../services/logger.js";
5
5
 
6
6
  export {
@@ -49,11 +49,11 @@ async function validateFlutterSdk(useFvm: boolean = false): Promise<boolean> {
49
49
  }
50
50
 
51
51
  // Check if fvm command is available
52
- await execCommand("fvm --version");
52
+ await execCommandSilent("fvm --version");
53
53
  return true;
54
54
  } else {
55
55
  // Check if global Flutter is available
56
- await execCommand("flutter --version");
56
+ await execCommandSilent("flutter --version");
57
57
  return true;
58
58
  }
59
59
  } catch (error) {