launchbase 1.0.3 → 1.0.4
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/bin/launchbase.js
CHANGED
|
@@ -6,7 +6,7 @@ const crypto = require('crypto');
|
|
|
6
6
|
const fs = require('fs-extra');
|
|
7
7
|
const { execSync, spawn } = require('child_process');
|
|
8
8
|
|
|
9
|
-
const VERSION = '1.0.
|
|
9
|
+
const VERSION = '1.0.4';
|
|
10
10
|
const program = new Command();
|
|
11
11
|
|
|
12
12
|
function replaceInFile(filePath, replacements) {
|
|
@@ -167,15 +167,88 @@ async function ensureDocker() {
|
|
|
167
167
|
|
|
168
168
|
// Check if Docker daemon is running
|
|
169
169
|
if (!checkDockerRunning()) {
|
|
170
|
-
console.log('\n⚠️ Docker is installed but not running.\n');
|
|
171
|
-
console.log('Please start Docker Desktop and run the command again.\n');
|
|
172
|
-
|
|
173
170
|
const platform = getPlatform();
|
|
174
|
-
if (platform === 'win32' || platform === 'darwin') {
|
|
175
|
-
console.log('💡 Tip: Open Docker Desktop from your applications.\n');
|
|
176
|
-
}
|
|
177
171
|
|
|
178
|
-
|
|
172
|
+
console.log('\n⚠️ Docker is installed but not running.');
|
|
173
|
+
|
|
174
|
+
// Try to start Docker Desktop automatically on Windows/macOS
|
|
175
|
+
if (platform === 'win32') {
|
|
176
|
+
console.log('🔄 Attempting to start Docker Desktop...\n');
|
|
177
|
+
try {
|
|
178
|
+
// Try to start Docker Desktop via PowerShell
|
|
179
|
+
execSync('Start-Process "C:\\Program Files\\Docker\\Docker\\Docker Desktop.exe"', {
|
|
180
|
+
shell: 'powershell.exe',
|
|
181
|
+
stdio: 'pipe'
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
console.log('⏳ Waiting for Docker to start');
|
|
185
|
+
|
|
186
|
+
// Wait for Docker to be ready (up to 60 seconds)
|
|
187
|
+
let retries = 60;
|
|
188
|
+
while (retries > 0) {
|
|
189
|
+
await new Promise(r => setTimeout(r, 1000));
|
|
190
|
+
try {
|
|
191
|
+
execSync('docker info', { stdio: 'pipe' });
|
|
192
|
+
console.log('\n✅ Docker is now running!\n');
|
|
193
|
+
return true;
|
|
194
|
+
} catch {
|
|
195
|
+
process.stdout.write('.');
|
|
196
|
+
retries--;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
console.log('\n\n⚠️ Docker did not start in time. Please start Docker Desktop manually.\n');
|
|
201
|
+
process.exit(1);
|
|
202
|
+
} catch (error) {
|
|
203
|
+
console.log('❌ Could not start Docker Desktop automatically.\n');
|
|
204
|
+
console.log('💡 Please start Docker Desktop from your Start menu and run the command again.\n');
|
|
205
|
+
process.exit(1);
|
|
206
|
+
}
|
|
207
|
+
} else if (platform === 'darwin') {
|
|
208
|
+
console.log('🔄 Attempting to start Docker Desktop...\n');
|
|
209
|
+
try {
|
|
210
|
+
execSync('open -a Docker', { stdio: 'pipe' });
|
|
211
|
+
|
|
212
|
+
console.log('⏳ Waiting for Docker to start');
|
|
213
|
+
|
|
214
|
+
// Wait for Docker to be ready (up to 60 seconds)
|
|
215
|
+
let retries = 60;
|
|
216
|
+
while (retries > 0) {
|
|
217
|
+
await new Promise(r => setTimeout(r, 1000));
|
|
218
|
+
try {
|
|
219
|
+
execSync('docker info', { stdio: 'pipe' });
|
|
220
|
+
console.log('\n✅ Docker is now running!\n');
|
|
221
|
+
return true;
|
|
222
|
+
} catch {
|
|
223
|
+
process.stdout.write('.');
|
|
224
|
+
retries--;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
console.log('\n\n⚠️ Docker did not start in time. Please start Docker Desktop manually.\n');
|
|
229
|
+
process.exit(1);
|
|
230
|
+
} catch (error) {
|
|
231
|
+
console.log('❌ Could not start Docker Desktop automatically.\n');
|
|
232
|
+
console.log('💡 Please start Docker Desktop from your Applications and run the command again.\n');
|
|
233
|
+
process.exit(1);
|
|
234
|
+
}
|
|
235
|
+
} else {
|
|
236
|
+
// Linux - try systemctl
|
|
237
|
+
console.log('🔄 Attempting to start Docker daemon...\n');
|
|
238
|
+
try {
|
|
239
|
+
execSync('sudo systemctl start docker', { stdio: 'inherit' });
|
|
240
|
+
|
|
241
|
+
// Wait briefly and check
|
|
242
|
+
await new Promise(r => setTimeout(r, 2000));
|
|
243
|
+
if (checkDockerRunning()) {
|
|
244
|
+
console.log('✅ Docker is now running!\n');
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
} catch {}
|
|
248
|
+
|
|
249
|
+
console.log('💡 Please start Docker manually and run the command again.\n');
|
|
250
|
+
process.exit(1);
|
|
251
|
+
}
|
|
179
252
|
}
|
|
180
253
|
|
|
181
254
|
return true;
|
package/package.json
CHANGED
package/template/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"private": true,
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "tsc -p tsconfig.build.json",
|
|
7
|
+
"build": "prisma generate && tsc -p tsconfig.build.json",
|
|
8
8
|
"start": "node dist/src/main.js",
|
|
9
9
|
"start:dev": "ts-node-dev --respawn --transpile-only src/main.ts",
|
|
10
10
|
"prisma:generate": "prisma generate",
|
|
@@ -4,7 +4,7 @@ import LaunchBase from '@launchbasex/sdk'
|
|
|
4
4
|
|
|
5
5
|
@Injectable()
|
|
6
6
|
export class LaunchBaseService implements OnModuleInit {
|
|
7
|
-
private client
|
|
7
|
+
private client!: LaunchBase // Definite assignment assertion - initialized in onModuleInit
|
|
8
8
|
|
|
9
9
|
constructor(private configService: ConfigService) {}
|
|
10
10
|
|