1
- import type { aliases , packages } from 'ts-pkgx'
1
+ import type {
2
+ PackageAlias ,
3
+ PackageDomain ,
4
+ PackageName ,
5
+ Packages ,
6
+ Dependencies
7
+ } from 'ts-pkgx'
8
+ import { createDependencies } from 'ts-pkgx'
2
9
3
- // Extract all package alias names from ts-pkgx
4
- export type PackageAlias = keyof typeof aliases
10
+ // Re-export ts-pkgx types for internal use
11
+ export type {
12
+ PackageAlias ,
13
+ PackageDomain ,
14
+ PackageName ,
15
+ Packages ,
16
+ Dependencies
17
+ }
18
+
19
+ // Re-export ts-pkgx utilities
20
+ export { createDependencies }
5
21
6
- // Extract all package domain names from ts-pkgx packages
7
- export type PackageDomain = keyof typeof packages
22
+ /**
23
+ * Helper function to create a fully typed dependencies configuration with version validation
24
+ * This provides IntelliSense and type safety for both package names AND versions!
25
+ */
26
+ export function defineFullyTypedDependencies ( deps : FullyTypedDependencies ) : FullyTypedDependencies {
27
+ return deps
28
+ }
8
29
9
- // Union type of all valid package identifiers (aliases + domains)
10
- export type PackageName = PackageAlias | PackageDomain
30
+
31
+ /**
32
+ * Helper function to create a typed dependencies configuration (backward compatible)
33
+ * This provides IntelliSense and type safety while maintaining flexibility
34
+ */
35
+ export function definePackageDependencies ( deps : TypedDependencies ) : TypedDependencies {
36
+ return deps
37
+ }
38
+
39
+ /**
40
+ * Helper function to create a fully typed dependencies array
41
+ */
42
+ export function definePackageList < T extends readonly PackageName [ ] > ( packages : T ) : T {
43
+ return packages
44
+ }
11
45
12
46
// Type for package with optional version (allowing string for flexibility)
13
47
export type PackageSpec = string
14
48
49
+ // Type for package dependency specification in config
50
+ export interface PackageDependencySpec {
51
+ version ?: string
52
+ global ?: boolean
53
+ }
54
+
55
+ // Extract version types from ts-pkgx packages
56
+ type PackageVersions < T extends PackageName > = T extends keyof Packages
57
+ ? Packages [ T ] extends { versions : readonly ( infer V ) [ ] }
58
+ ? V extends string
59
+ ? V
60
+ : never
61
+ : never
62
+ : never
63
+
64
+ // Version constraint that allows valid versions or version ranges
65
+ type VersionConstraint < T extends PackageName > =
66
+ | PackageVersions < T >
67
+ | `^${PackageVersions < T > } `
68
+ | `~${PackageVersions < T > } `
69
+ | `>=${PackageVersions < T > } `
70
+ | `<=${PackageVersions < T > } `
71
+ | `>${PackageVersions < T > } `
72
+ | `<${PackageVersions < T > } `
73
+ | 'latest'
74
+ | '*'
75
+
76
+ // Enhanced dependency spec with typed versions
77
+ export interface TypedPackageDependencySpec < T extends PackageName > {
78
+ version ?: VersionConstraint < T >
79
+ global ?: boolean
80
+ }
81
+
82
+ // Fully typed dependencies with version validation
83
+ // Note: TypeScript will highlight property names for invalid versions (language limitation)
84
+ export type FullyTypedDependencies = {
85
+ readonly [ K in PackageName ] ?: VersionConstraint < K > | TypedPackageDependencySpec < K >
86
+ }
87
+
88
+ // Backward compatible typed dependencies (allows string versions for flexibility)
89
+ export type TypedDependencies = {
90
+ [ K in PackageName ] ?: string | PackageDependencySpec
91
+ }
92
+
15
93
// Supported distribution formats
16
94
export type SupportedFormat = 'tar.xz' | 'tar.gz'
17
95
export type SupportedPlatform = 'darwin' | 'linux' | 'windows'
@@ -65,6 +143,21 @@ export interface LaunchpadConfig {
65
143
* - string | string[]: install only for the listed package name(s)
66
144
*/
67
145
installBuildDeps ?: boolean | string | string [ ]
146
+ /**
147
+ * Package dependencies to install (similar to deps.yaml)
148
+ * FULLY TYPED package names AND versions from ts-pkgx
149
+ *
150
+ * Supports both domain names ('bun.sh') and aliases ('bun')
151
+ * Invalid package names and versions will cause TypeScript errors
152
+ *
153
+ * Use createDependencies() helper for enhanced developer experience:
154
+ * dependencies: createDependencies({ 'bun': '^1.2.19' })
155
+ */
156
+ dependencies ?: Dependencies
157
+ /**
158
+ * Global flag for dependencies - when true, all dependencies are installed globally
159
+ */
160
+ global ?: boolean
68
161
shellMessages ?: {
69
162
activation ?: string
70
163
deactivation ?: string
@@ -209,7 +302,7 @@ export interface LaunchpadConfig {
209
302
autoRestart ?: boolean
210
303
startupTimeout ?: number
211
304
shutdownTimeout ?: number
212
- /** Infer services to auto-start from framework config (e.g., Laravel/ Stacks .env) */
305
+ /** Infer services to auto-start from framework config (e.g., Stacks .env) */
213
306
infer ?: boolean
214
307
database ?: {
215
308
username ?: string
@@ -218,10 +311,6 @@ export interface LaunchpadConfig {
218
311
}
219
312
frameworks ?: {
220
313
enabled ?: boolean
221
- laravel ?: {
222
- enabled ?: boolean
223
- autoDetect ?: boolean
224
- }
225
314
stacks ?: {
226
315
enabled ?: boolean
227
316
autoDetect ?: boolean
0 commit comments