create-droid 1.0.5 → 1.0.7

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.
@@ -71,13 +71,14 @@ export async function generateProject(options) {
71
71
  version: "0.1.0",
72
72
  private: true,
73
73
  scripts: {
74
- "dev": "./gradlew -t installDebug",
74
+ "dev": "./gradlew installDebug --continuous --configuration-cache --parallel --offline",
75
75
  "start": "npm run dev",
76
76
  "build": "./gradlew assembleRelease",
77
77
  "build:debug": "./gradlew assembleDebug",
78
78
  "test": "./gradlew test",
79
79
  "lint": "./gradlew lint",
80
80
  "clean": "./gradlew clean",
81
+ "clean:deep": "rm -rf .gradle app/build build",
81
82
  "help": "./gradlew --help",
82
83
  "adb": "node scripts/adb.js",
83
84
  "adb:devices": "npm run adb devices",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-droid",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "The fastest way to start an Android project. No Studio required.",
5
5
  "author": "YELrhilassi",
6
6
  "license": "MIT",
@@ -1,4 +1,11 @@
1
- org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
1
+ # Performance Optimizations
2
+ org.gradle.jvmargs=-Xmx1536m -Dfile.encoding=UTF-8 -XX:+UseParallelGC
3
+ org.gradle.parallel=true
4
+ org.gradle.caching=true
5
+ org.gradle.configuration-cache=true
6
+
7
+ # Android Optimizations
2
8
  android.useAndroidX=true
3
9
  kotlin.code.style=official
4
10
  android.nonTransitiveRClass=true
11
+ android.enableJetifier=false
@@ -39,6 +39,31 @@ function runCommand(args, inherit = true) {
39
39
  }
40
40
  }
41
41
 
42
+ async function getMdnsServices() {
43
+ const output = runCommand(['mdns', 'services'], false);
44
+ if (!output) return [];
45
+
46
+ // Output format usually:
47
+ // List of discovered mdns services
48
+ // <name> <type> <ip>:<port>
49
+ // myphone _adb-tls-connect._tcp. 192.168.1.5:38291
50
+
51
+ const lines = output.split('\n');
52
+ const services = [];
53
+
54
+ for (const line of lines) {
55
+ if (!line.includes('_adb-tls-connect') && !line.includes('_adb._tcp')) continue;
56
+
57
+ const parts = line.trim().split(/\s+/);
58
+ if (parts.length >= 3) {
59
+ const ipPort = parts[parts.length - 1]; // last part is ip:port
60
+ const name = parts[0];
61
+ services.push({ name, ipPort });
62
+ }
63
+ }
64
+ return services;
65
+ }
66
+
42
67
  function clearScreen() {
43
68
  process.stdout.write('\x1Bc');
44
69
  }
@@ -85,7 +110,6 @@ async function showMenu() {
85
110
  case '5':
86
111
  console.log('Starting Logcat (Ctrl+C to stop)...');
87
112
  await runCommand(['logcat']);
88
- // Logcat blocks, so we won't return easily loop unless killed
89
113
  break;
90
114
  case '6':
91
115
  await runCommand(['kill-server']);
@@ -103,12 +127,31 @@ async function showMenu() {
103
127
  }
104
128
 
105
129
  async function handleConnect() {
130
+ console.log('\nScanning for devices via mDNS...');
131
+ const services = await getMdnsServices();
132
+
133
+ if (services.length > 0) {
134
+ console.log('\nDiscovered Devices:');
135
+ services.forEach((s, i) => console.log(`${i + 1}. ${s.name} (${s.ipPort})`));
136
+ console.log(`${services.length + 1}. Enter manually`);
137
+ } else {
138
+ console.log('No mDNS devices found.');
139
+ }
140
+
106
141
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
107
- rl.question('Enter Device IP:Port (e.g., 192.168.1.5:5555): ', async (ip) => {
142
+ rl.question('\nSelect device number or enter IP:Port: ', async (answer) => {
108
143
  rl.close();
109
- if (ip) {
110
- console.log(`Connecting to ${ip}...`);
111
- await runCommand(['connect', ip]);
144
+
145
+ let target = answer.trim();
146
+ const idx = parseInt(target) - 1;
147
+
148
+ if (!isNaN(idx) && idx >= 0 && idx < services.length) {
149
+ target = services[idx].ipPort;
150
+ }
151
+
152
+ if (target) {
153
+ console.log(`Connecting to ${target}...`);
154
+ await runCommand(['connect', target]);
112
155
  }
113
156
  await pause();
114
157
  showMenu();
@@ -116,13 +159,37 @@ async function handleConnect() {
116
159
  }
117
160
 
118
161
  async function handlePair() {
162
+ console.log('\nScanning for devices via mDNS...');
163
+ const services = await getMdnsServices();
164
+
165
+ if (services.length > 0) {
166
+ console.log('\nDiscovered Devices:');
167
+ services.forEach((s, i) => console.log(`${i + 1}. ${s.name} (${s.ipPort})`));
168
+ console.log(`${services.length + 1}. Enter manually`);
169
+ } else {
170
+ console.log('No mDNS devices found.');
171
+ }
172
+
119
173
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
120
- rl.question('Enter Device IP:Port (from "Wireless debugging"): ', (ip) => {
121
- rl.question('Enter Pairing Code: ', async (code) => {
174
+ rl.question('\nSelect device number or enter IP:Port: ', (answer) => {
175
+ let target = answer.trim();
176
+ const idx = parseInt(target) - 1;
177
+
178
+ if (!isNaN(idx) && idx >= 0 && idx < services.length) {
179
+ target = services[idx].ipPort;
180
+ }
181
+
182
+ if (!target) {
183
+ rl.close();
184
+ showMenu();
185
+ return;
186
+ }
187
+
188
+ rl.question(`Enter Pairing Code for ${target}: `, async (code) => {
122
189
  rl.close();
123
- if (ip && code) {
124
- console.log(`Pairing with ${ip}...`);
125
- await runCommand(['pair', ip, code]);
190
+ if (code) {
191
+ console.log(`Pairing with ${target}...`);
192
+ await runCommand(['pair', target, code]);
126
193
  }
127
194
  await pause();
128
195
  showMenu();