Skip to content

Commit 5a467fd

Browse files
committed
chore: wip
1 parent 2b0edeb commit 5a467fd

18 files changed

+1532
-174
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Launchpad transforms how you manage dependencies across your entire development
3434

3535
### System-Wide Dependency Management
3636
- 📦 **Global Tool Installation** — Install development tools and runtimes system-wide with automatic PATH management
37-
- 🔧 **Smart Installation Paths** — Automatically chooses `/usr/local` for system-wide access or `~/.local` for user-specific installs
37+
- 🔧 **Smart Installation Paths** — Automatically chooses `/usr/local` for system-wide access or `~/.local` for user-specific installs (pkgm compatible)
3838
- 🔌 **Shell Integration** — Seamless integration with your shell for immediate tool availability
3939
- 🪟 **Cross-Platform Support** — Consistent experience across macOS, Linux, and Windows
4040

@@ -263,6 +263,11 @@ const config: LaunchpadConfig = {
263263
// PATH and shell integration
264264
shimPath: '~/.local/bin', // Custom shim location
265265
autoAddToPath: true, // Automatic PATH management
266+
267+
// Shell message configuration
268+
showShellMessages: true,
269+
shellActivationMessage: '🚀 Dev environment ready for {path}',
270+
shellDeactivationMessage: '👋 Dev environment deactivated',
266271
}
267272

268273
export default config

docs/advanced/cross-platform.md

Lines changed: 142 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,23 @@ const isMacOS = platform() === 'darwin'
1515
const isLinux = platform() === 'linux'
1616
```
1717

18+
## Installation Philosophy Across Platforms
19+
20+
Launchpad follows the **pkgm approach** consistently across all platforms:
21+
22+
### Unix-like Systems (macOS, Linux)
23+
- **Primary**: `/usr/local` for system-wide installations
24+
- **Fallback**: `~/.local` for user-specific installations
25+
- **Never uses**: `/opt/homebrew` (Homebrew's directory)
26+
- **Maintains**: Clean separation from package managers like Homebrew
27+
28+
### Windows
29+
- **Primary**: `%LOCALAPPDATA%` for user-specific installations
30+
- **Alternative**: `%PROGRAMFILES%` for system-wide (requires elevation)
31+
- **Avoids**: Conflicting with Windows package managers
32+
33+
This consistent approach ensures clean coexistence with existing package managers on all platforms.
34+
1835
## Path Handling
1936

2037
### Windows Path Differences
@@ -48,6 +65,22 @@ Each platform uses different shells by default:
4865

4966
Launchpad adapts its PATH modification strategies accordingly.
5067

68+
### Shell Message Customization by Platform
69+
70+
You can customize shell messages differently on each platform:
71+
72+
```bash
73+
# macOS/Linux - Using ~/.zshrc or ~/.bashrc
74+
export LAUNCHPAD_SHELL_ACTIVATION_MESSAGE="🍎 macOS environment ready: {path}"
75+
export LAUNCHPAD_SHELL_DEACTIVATION_MESSAGE="🍎 macOS environment closed"
76+
```
77+
78+
```powershell
79+
# Windows - Using PowerShell profile
80+
$env:LAUNCHPAD_SHELL_ACTIVATION_MESSAGE = "🪟 Windows environment ready: {path}"
81+
$env:LAUNCHPAD_SHELL_DEACTIVATION_MESSAGE = "🪟 Windows environment closed"
82+
```
83+
5184
## File System Permissions
5285

5386
Permission handling differs by platform:
@@ -82,6 +115,9 @@ Launchpad's auto-sudo feature automatically adapts to the platform.
82115
# Add to PATH on Unix-like systems
83116
echo 'export PATH="~/.local/bin:$PATH"' >> ~/.zshrc
84117
source ~/.zshrc
118+
119+
# Custom shell messages
120+
echo 'export LAUNCHPAD_SHELL_ACTIVATION_MESSAGE="🔧 Dev environment: {path}"' >> ~/.zshrc
85121
```
86122

87123
### Windows (PowerShell)
@@ -91,6 +127,9 @@ source ~/.zshrc
91127
$currentPath = [Environment]::GetEnvironmentVariable("PATH", "User")
92128
$newPath = "$env:USERPROFILE\.local\bin;" + $currentPath
93129
[Environment]::SetEnvironmentVariable("PATH", $newPath, "User")
130+
131+
# Custom shell messages
132+
[Environment]::SetEnvironmentVariable("LAUNCHPAD_SHELL_ACTIVATION_MESSAGE", "🔧 Dev environment: {path}", "User")
94133
```
95134

96135
## Executable Detection
@@ -104,11 +143,24 @@ Launchpad handles these differences when creating and detecting executables.
104143

105144
## Platform-specific Installation Paths
106145

107-
Default installation paths vary by platform:
146+
Default installation paths vary by platform but follow consistent principles:
147+
148+
### macOS
149+
- **System-wide**: `/usr/local` (preferred, like pkgm)
150+
- **User-specific**: `~/.local` (fallback)
151+
- **Never uses**: `/opt/homebrew` (Homebrew's directory)
152+
153+
### Linux
154+
- **System-wide**: `/usr/local` (preferred, like pkgm)
155+
- **User-specific**: `~/.local` (fallback)
156+
- **Respects**: Existing system package manager directories
157+
158+
### Windows
159+
- **User-specific**: `%LOCALAPPDATA%\Programs\Launchpad` (preferred)
160+
- **System-wide**: `%PROGRAMFILES%\Launchpad` (requires elevation)
108161

109-
- **macOS**: `/usr/local` (traditional) or `/opt/homebrew` (newer systems)
110-
- **Linux**: `/usr/local` (system-wide) or `~/.local` (user-specific)
111-
- **Windows**: `%LOCALAPPDATA%` or `%PROGRAMFILES%`
162+
> [!NOTE]
163+
> Launchpad installs packages to `/usr/local` (like pkgm), not to Homebrew's `/opt/homebrew` directory. This ensures clean separation from Homebrew-managed packages and allows peaceful coexistence.
112164
113165
## Integration with pkgx
114166

@@ -125,6 +177,10 @@ node --version
125177

126178
# Verify shim creation
127179
ls -la ~/.local/bin/node
180+
181+
# Test environment messages
182+
cd my-project/ # Should show activation message
183+
cd ../ # Should show deactivation message
128184
```
129185

130186
```powershell
@@ -134,6 +190,10 @@ node --version
134190
135191
# Verify shim creation
136192
dir $env:USERPROFILE\.local\bin\node.exe
193+
194+
# Test environment messages
195+
cd my-project # Should show activation message
196+
cd ..\ # Should show deactivation message
137197
```
138198

139199
## Cross-platform CI/CD Integration
@@ -149,9 +209,85 @@ jobs:
149209
os: [ubuntu-latest, macos-latest, windows-latest]
150210
runs-on: ${{ matrix.os }}
151211
steps:
152-
- uses: actions/checkout@v2
212+
- uses: actions/checkout@v4
153213
- name: Install Launchpad
154-
run: npm install -g launchpad
214+
run: npm install -g @stacksjs/launchpad
155215
- name: Install dependencies with Launchpad
156216
run: launchpad install node@22 [email protected]
217+
- name: Test environment activation
218+
run: |
219+
cd test-project
220+
# Environment should activate automatically with shell integration
221+
```
222+
223+
## Platform-specific Configuration
224+
225+
### macOS Configuration
226+
227+
```typescript
228+
// launchpad.config.ts for macOS
229+
export default {
230+
installationPath: '/usr/local', // Preferred on macOS
231+
shellActivationMessage: '🍎 macOS environment ready: {path}',
232+
shellDeactivationMessage: '🍎 Environment closed',
233+
// Use Homebrew paths for fallback when needed
234+
fallbackPaths: ['/opt/homebrew/bin', '/usr/local/bin']
235+
}
236+
```
237+
238+
### Linux Configuration
239+
240+
```typescript
241+
// launchpad.config.ts for Linux
242+
export default {
243+
installationPath: '/usr/local', // Preferred on Linux
244+
shellActivationMessage: '🐧 Linux environment ready: {path}',
245+
shellDeactivationMessage: '🐧 Environment closed',
246+
// Respect system package manager paths
247+
fallbackPaths: ['/usr/bin', '/usr/local/bin']
248+
}
249+
```
250+
251+
### Windows Configuration
252+
253+
```typescript
254+
// launchpad.config.ts for Windows
255+
export default {
256+
installationPath: `${process.env.LOCALAPPDATA}\\Programs\\Launchpad`,
257+
shellActivationMessage: '🪟 Windows environment ready: {path}',
258+
shellDeactivationMessage: '🪟 Environment closed',
259+
// Windows-specific paths
260+
fallbackPaths: ['C:\\Program Files\\Git\\bin']
261+
}
262+
```
263+
264+
## Troubleshooting Cross-platform Issues
265+
266+
### Path Separator Issues
267+
268+
```bash
269+
# Use path.join() for cross-platform compatibility
270+
const installPath = path.join(baseDir, 'bin', 'executable')
271+
```
272+
273+
### Environment Variable Differences
274+
275+
```bash
276+
# Unix-like systems
277+
export LAUNCHPAD_PATH=/usr/local
278+
279+
# Windows
280+
set LAUNCHPAD_PATH=C:\usr\local
281+
# or in PowerShell
282+
$env:LAUNCHPAD_PATH = "C:\usr\local"
283+
```
284+
285+
### Shell Integration Differences
286+
287+
```bash
288+
# For Bash/Zsh (Unix-like)
289+
echo 'eval "$(launchpad dev:shellcode)"' >> ~/.zshrc
290+
291+
# For PowerShell (Windows)
292+
Add-Content $PROFILE 'Invoke-Expression (& launchpad dev:shellcode)'
157293
```

0 commit comments

Comments
 (0)