Skip to content

Commit 0378f34

Browse files
committed
chore: wip
1 parent 08c4a1b commit 0378f34

File tree

4 files changed

+403
-11
lines changed

4 files changed

+403
-11
lines changed

packages/launchpad/src/dev/dump.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,22 +212,18 @@ export async function dump(dir: string, options: DumpOptions = {}): Promise<void
212212
}
213213

214214
try {
215-
// Find dependency file
215+
// Find dependency file using our comprehensive detection
216216
const dependencyFile = findDependencyFile(dir)
217217

218-
// If no dependency file found, check for package.json to enable auto-detection
219-
const packageJsonPath = path.join(dir, 'package.json')
220-
const hasPackageJson = fs.existsSync(packageJsonPath)
221-
222-
if (!dependencyFile && !hasPackageJson) {
218+
if (!dependencyFile) {
223219
if (!quiet && !shellOutput) {
224220
console.log('No dependency file found')
225221
}
226222
return
227223
}
228224

229225
// For shell output mode, prioritize speed with aggressive optimizations
230-
const projectDir = dependencyFile ? path.dirname(dependencyFile) : dir
226+
const projectDir = path.dirname(dependencyFile)
231227

232228
// Ultra-fast path for shell output: check if environments exist and use cached data
233229
if (shellOutput) {

packages/launchpad/src/dev/shellcode.ts

Lines changed: 88 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,7 @@ __launchpad_find_deps_file() {
413413
__launchpad_cache_timestamp=0
414414
415415
while [[ "$dir" != "/" ]]; do
416-
# Check dependency files first
417-
# Supported files: dependencies.yaml, dependencies.yml, deps.yaml, deps.yml,
418-
# pkgx.yaml, pkgx.yml, launchpad.yaml, launchpad.yml
416+
# Check Launchpad-specific dependency files first (highest priority)
419417
for pattern in "dependencies" "deps" "pkgx" "launchpad"; do
420418
for ext in "yaml" "yml"; do
421419
local file="$dir/$pattern.$ext"
@@ -428,14 +426,100 @@ __launchpad_find_deps_file() {
428426
done
429427
done
430428
431-
# Check for package.json if no dependency files found
429+
# Check Node.js/JavaScript projects
432430
if [[ -f "$dir/package.json" ]]; then
433431
__launchpad_cache_dir="$dir"
434432
__launchpad_cache_timestamp=$current_time
435433
echo "$dir"
436434
return 0
437435
fi
438436
437+
# Check Python projects
438+
for file in "pyproject.toml" "requirements.txt" "setup.py" "Pipfile" "Pipfile.lock"; do
439+
if [[ -f "$dir/$file" ]]; then
440+
__launchpad_cache_dir="$dir"
441+
__launchpad_cache_timestamp=$current_time
442+
echo "$dir"
443+
return 0
444+
fi
445+
done
446+
447+
# Check Rust projects
448+
if [[ -f "$dir/Cargo.toml" ]]; then
449+
__launchpad_cache_dir="$dir"
450+
__launchpad_cache_timestamp=$current_time
451+
echo "$dir"
452+
return 0
453+
fi
454+
455+
# Check Go projects
456+
for file in "go.mod" "go.sum"; do
457+
if [[ -f "$dir/$file" ]]; then
458+
__launchpad_cache_dir="$dir"
459+
__launchpad_cache_timestamp=$current_time
460+
echo "$dir"
461+
return 0
462+
fi
463+
done
464+
465+
# Check Ruby projects
466+
if [[ -f "$dir/Gemfile" ]]; then
467+
__launchpad_cache_dir="$dir"
468+
__launchpad_cache_timestamp=$current_time
469+
echo "$dir"
470+
return 0
471+
fi
472+
473+
# Check Deno projects
474+
for file in "deno.json" "deno.jsonc"; do
475+
if [[ -f "$dir/$file" ]]; then
476+
__launchpad_cache_dir="$dir"
477+
__launchpad_cache_timestamp=$current_time
478+
echo "$dir"
479+
return 0
480+
fi
481+
done
482+
483+
# Check GitHub Actions
484+
for file in "action.yml" "action.yaml"; do
485+
if [[ -f "$dir/$file" ]]; then
486+
__launchpad_cache_dir="$dir"
487+
__launchpad_cache_timestamp=$current_time
488+
echo "$dir"
489+
return 0
490+
fi
491+
done
492+
493+
# Check Kubernetes/Docker projects
494+
for file in "skaffold.yaml" "skaffold.yml"; do
495+
if [[ -f "$dir/$file" ]]; then
496+
__launchpad_cache_dir="$dir"
497+
__launchpad_cache_timestamp=$current_time
498+
echo "$dir"
499+
return 0
500+
fi
501+
done
502+
503+
# Check version control files
504+
for file in ".nvmrc" ".node-version" ".ruby-version" ".python-version" ".terraform-version"; do
505+
if [[ -f "$dir/$file" ]]; then
506+
__launchpad_cache_dir="$dir"
507+
__launchpad_cache_timestamp=$current_time
508+
echo "$dir"
509+
return 0
510+
fi
511+
done
512+
513+
# Check package manager files
514+
for file in "yarn.lock" "bun.lockb" ".yarnrc"; do
515+
if [[ -f "$dir/$file" ]]; then
516+
__launchpad_cache_dir="$dir"
517+
__launchpad_cache_timestamp=$current_time
518+
echo "$dir"
519+
return 0
520+
fi
521+
done
522+
439523
dir="$(/usr/bin/dirname "$dir")"
440524
done
441525

packages/launchpad/src/env.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@ export async function removeAllEnvironments(options: RemoveEnvironmentOptions):
609609
}
610610

611611
export const DEPENDENCY_FILE_NAMES = [
612+
// Launchpad-specific files (highest priority)
612613
'dependencies.yaml',
613614
'dependencies.yml',
614615
'deps.yaml',
@@ -617,6 +618,50 @@ export const DEPENDENCY_FILE_NAMES = [
617618
'pkgx.yml',
618619
'launchpad.yaml',
619620
'launchpad.yml',
621+
622+
// Node.js/JavaScript projects
623+
'package.json',
624+
625+
// Python projects
626+
'pyproject.toml',
627+
'requirements.txt',
628+
'setup.py',
629+
'Pipfile',
630+
'Pipfile.lock',
631+
632+
// Rust projects
633+
'Cargo.toml',
634+
635+
// Go projects
636+
'go.mod',
637+
'go.sum',
638+
639+
// Ruby projects
640+
'Gemfile',
641+
642+
// Deno projects
643+
'deno.json',
644+
'deno.jsonc',
645+
646+
// GitHub Actions
647+
'action.yml',
648+
'action.yaml',
649+
650+
// Kubernetes/Docker
651+
'skaffold.yaml',
652+
'skaffold.yml',
653+
654+
// Version control files
655+
'.nvmrc',
656+
'.node-version',
657+
'.ruby-version',
658+
'.python-version',
659+
'.terraform-version',
660+
661+
// Package manager files
662+
'yarn.lock',
663+
'bun.lockb',
664+
'.yarnrc',
620665
] as const
621666

622667
export function findDependencyFile(root: string, searchAncestors = false): string | null {

0 commit comments

Comments
 (0)