@launch77/cli 1.4.3 → 1.5.0

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.
Files changed (152) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cli.js +1 -4
  3. package/dist/cli.js.map +1 -1
  4. package/dist/infrastructure/npm-package.d.ts +42 -0
  5. package/dist/infrastructure/npm-package.d.ts.map +1 -0
  6. package/dist/infrastructure/npm-package.js +46 -0
  7. package/dist/infrastructure/npm-package.js.map +1 -0
  8. package/dist/infrastructure/package-resolver.d.ts +117 -0
  9. package/dist/infrastructure/package-resolver.d.ts.map +1 -0
  10. package/dist/infrastructure/package-resolver.js +170 -0
  11. package/dist/infrastructure/package-resolver.js.map +1 -0
  12. package/dist/infrastructure/package-resolver.test.d.ts +2 -0
  13. package/dist/infrastructure/package-resolver.test.d.ts.map +1 -0
  14. package/dist/infrastructure/package-resolver.test.js +251 -0
  15. package/dist/infrastructure/package-resolver.test.js.map +1 -0
  16. package/dist/infrastructure/template.d.ts +0 -1
  17. package/dist/infrastructure/template.d.ts.map +1 -1
  18. package/dist/infrastructure/template.js.map +1 -1
  19. package/dist/modules/app/commands/create-app.d.ts.map +1 -1
  20. package/dist/modules/app/commands/create-app.js +14 -15
  21. package/dist/modules/app/commands/create-app.js.map +1 -1
  22. package/dist/modules/app/commands/delete-app.js +1 -1
  23. package/dist/modules/app/commands/delete-app.js.map +1 -1
  24. package/dist/modules/app/commands/validate-manifest.d.ts.map +1 -1
  25. package/dist/modules/app/commands/validate-manifest.js +0 -1
  26. package/dist/modules/app/commands/validate-manifest.js.map +1 -1
  27. package/dist/modules/app/index.d.ts +1 -2
  28. package/dist/modules/app/index.d.ts.map +1 -1
  29. package/dist/modules/app/index.js +0 -1
  30. package/dist/modules/app/index.js.map +1 -1
  31. package/dist/modules/app/lib/app-template-resolver.d.ts +14 -0
  32. package/dist/modules/app/lib/app-template-resolver.d.ts.map +1 -0
  33. package/dist/modules/app/lib/app-template-resolver.js +51 -0
  34. package/dist/modules/app/lib/app-template-resolver.js.map +1 -0
  35. package/dist/modules/app/lib/manifest-schema.d.ts +0 -7
  36. package/dist/modules/app/lib/manifest-schema.d.ts.map +1 -1
  37. package/dist/modules/app/lib/manifest-schema.js +0 -2
  38. package/dist/modules/app/lib/manifest-schema.js.map +1 -1
  39. package/dist/modules/app/services/app-svc.d.ts +2 -1
  40. package/dist/modules/app/services/app-svc.d.ts.map +1 -1
  41. package/dist/modules/app/services/app-svc.js +77 -12
  42. package/dist/modules/app/services/app-svc.js.map +1 -1
  43. package/dist/modules/app/services/manifest-svc.d.ts +2 -2
  44. package/dist/modules/app/services/manifest-svc.d.ts.map +1 -1
  45. package/dist/modules/app/services/manifest-svc.js +9 -50
  46. package/dist/modules/app/services/manifest-svc.js.map +1 -1
  47. package/dist/modules/app/types/app-types.d.ts +2 -5
  48. package/dist/modules/app/types/app-types.d.ts.map +1 -1
  49. package/dist/modules/app/types/app-types.js +1 -4
  50. package/dist/modules/app/types/app-types.js.map +1 -1
  51. package/dist/modules/catalog/commands/scan.js +3 -3
  52. package/dist/modules/catalog/commands/scan.js.map +1 -1
  53. package/dist/modules/catalog/services/catalog-svc.d.ts +2 -2
  54. package/dist/modules/catalog/services/catalog-svc.d.ts.map +1 -1
  55. package/dist/modules/catalog/services/catalog-svc.js +2 -2
  56. package/dist/modules/catalog/services/catalog-svc.js.map +1 -1
  57. package/dist/modules/deploy/commands/deploy-init-action.d.ts.map +1 -1
  58. package/dist/modules/deploy/commands/deploy-init-action.js +21 -20
  59. package/dist/modules/deploy/commands/deploy-init-action.js.map +1 -1
  60. package/dist/modules/deploy/commands/deploy-logs-action.d.ts.map +1 -1
  61. package/dist/modules/deploy/commands/deploy-logs-action.js +16 -13
  62. package/dist/modules/deploy/commands/deploy-logs-action.js.map +1 -1
  63. package/dist/modules/deploy/commands/deploy-status-action.d.ts.map +1 -1
  64. package/dist/modules/deploy/commands/deploy-status-action.js +16 -13
  65. package/dist/modules/deploy/commands/deploy-status-action.js.map +1 -1
  66. package/dist/modules/plugin/lib/plugin-resolver.d.ts +10 -72
  67. package/dist/modules/plugin/lib/plugin-resolver.d.ts.map +1 -1
  68. package/dist/modules/plugin/lib/plugin-resolver.js +23 -115
  69. package/dist/modules/plugin/lib/plugin-resolver.js.map +1 -1
  70. package/dist/modules/plugin/lib/plugin-resolver.test.js +45 -39
  71. package/dist/modules/plugin/lib/plugin-resolver.test.js.map +1 -1
  72. package/dist/modules/plugin/services/plugin-svc.d.ts +2 -0
  73. package/dist/modules/plugin/services/plugin-svc.d.ts.map +1 -1
  74. package/dist/modules/plugin/services/plugin-svc.js +24 -19
  75. package/dist/modules/plugin/services/plugin-svc.js.map +1 -1
  76. package/dist/modules/plugin/services/plugin-svc.test.js +12 -6
  77. package/dist/modules/plugin/services/plugin-svc.test.js.map +1 -1
  78. package/dist/templates/plugin/package.json.hbs +1 -1
  79. package/dist/templates/plugin/plugin.json.hbs +1 -3
  80. package/dist/utils/validation.d.ts +3 -7
  81. package/dist/utils/validation.d.ts.map +1 -1
  82. package/dist/utils/validation.js +7 -31
  83. package/dist/utils/validation.js.map +1 -1
  84. package/package.json +1 -1
  85. package/src/cli.ts +1 -4
  86. package/src/infrastructure/npm-package.ts +73 -0
  87. package/src/infrastructure/package-resolver.test.ts +313 -0
  88. package/src/infrastructure/package-resolver.ts +223 -0
  89. package/src/infrastructure/template.ts +0 -1
  90. package/src/modules/app/commands/create-app.ts +14 -18
  91. package/src/modules/app/commands/delete-app.ts +1 -1
  92. package/src/modules/app/commands/validate-manifest.ts +0 -1
  93. package/src/modules/app/index.ts +1 -2
  94. package/src/modules/app/lib/app-template-resolver.ts +56 -0
  95. package/src/modules/app/lib/manifest-schema.ts +0 -5
  96. package/src/modules/app/services/app-svc.ts +89 -13
  97. package/src/modules/app/services/manifest-svc.ts +8 -57
  98. package/src/modules/app/types/app-types.ts +2 -9
  99. package/src/modules/catalog/commands/scan.ts +3 -3
  100. package/src/modules/catalog/services/catalog-svc.ts +4 -4
  101. package/src/modules/deploy/commands/deploy-init-action.ts +23 -20
  102. package/src/modules/deploy/commands/deploy-logs-action.ts +19 -13
  103. package/src/modules/deploy/commands/deploy-status-action.ts +19 -13
  104. package/src/modules/plugin/lib/plugin-resolver.test.ts +48 -39
  105. package/src/modules/plugin/lib/plugin-resolver.ts +22 -141
  106. package/src/modules/plugin/services/plugin-svc.test.ts +12 -6
  107. package/src/modules/plugin/services/plugin-svc.ts +27 -18
  108. package/src/utils/validation.ts +10 -38
  109. package/templates/plugin/package.json.hbs +1 -1
  110. package/templates/plugin/plugin.json.hbs +1 -3
  111. package/dist/modules/app/commands/generate-manifest.d.ts +0 -3
  112. package/dist/modules/app/commands/generate-manifest.d.ts.map +0 -1
  113. package/dist/modules/app/commands/generate-manifest.js +0 -62
  114. package/dist/modules/app/commands/generate-manifest.js.map +0 -1
  115. package/dist/modules/startup/commands/create-startup.d.ts +0 -3
  116. package/dist/modules/startup/commands/create-startup.d.ts.map +0 -1
  117. package/dist/modules/startup/commands/create-startup.js +0 -43
  118. package/dist/modules/startup/commands/create-startup.js.map +0 -1
  119. package/dist/modules/startup/errors/startup-errors.d.ts +0 -13
  120. package/dist/modules/startup/errors/startup-errors.d.ts.map +0 -1
  121. package/dist/modules/startup/errors/startup-errors.js +0 -25
  122. package/dist/modules/startup/errors/startup-errors.js.map +0 -1
  123. package/dist/modules/startup/index.d.ts +0 -5
  124. package/dist/modules/startup/index.d.ts.map +0 -1
  125. package/dist/modules/startup/index.js +0 -7
  126. package/dist/modules/startup/index.js.map +0 -1
  127. package/dist/modules/startup/services/startup-service.d.ts +0 -7
  128. package/dist/modules/startup/services/startup-service.d.ts.map +0 -1
  129. package/dist/modules/startup/services/startup-service.js +0 -43
  130. package/dist/modules/startup/services/startup-service.js.map +0 -1
  131. package/dist/modules/startup/types/startup-types.d.ts +0 -8
  132. package/dist/modules/startup/types/startup-types.d.ts.map +0 -1
  133. package/dist/modules/startup/types/startup-types.js +0 -2
  134. package/dist/modules/startup/types/startup-types.js.map +0 -1
  135. package/dist/modules/startup/utils/startup-validators.d.ts +0 -8
  136. package/dist/modules/startup/utils/startup-validators.d.ts.map +0 -1
  137. package/dist/modules/startup/utils/startup-validators.js +0 -17
  138. package/dist/modules/startup/utils/startup-validators.js.map +0 -1
  139. package/dist/templates/startup/apps/.gitkeep +0 -8
  140. package/dist/utils/monorepo.d.ts +0 -19
  141. package/dist/utils/monorepo.d.ts.map +0 -1
  142. package/dist/utils/monorepo.js +0 -100
  143. package/dist/utils/monorepo.js.map +0 -1
  144. package/src/modules/app/commands/generate-manifest.ts +0 -75
  145. package/src/modules/startup/commands/create-startup.ts +0 -53
  146. package/src/modules/startup/errors/startup-errors.ts +0 -23
  147. package/src/modules/startup/index.ts +0 -11
  148. package/src/modules/startup/services/startup-service.ts +0 -57
  149. package/src/modules/startup/types/startup-types.ts +0 -8
  150. package/src/modules/startup/utils/startup-validators.ts +0 -19
  151. package/src/utils/monorepo.ts +0 -137
  152. package/templates/startup/apps/.gitkeep +0 -8
@@ -1,57 +0,0 @@
1
- import * as path from 'path'
2
- import { fileURLToPath } from 'url'
3
-
4
- import * as filesystem from '../../../infrastructure/filesystem.js'
5
- import { StartupAlreadyExistsError, NotInMonorepoRootError } from '../errors/startup-errors.js'
6
- import { validateStartupName } from '../utils/startup-validators.js'
7
-
8
- import type { MonorepoContext } from '../../../utils/monorepo.js'
9
- import type { CreateStartupRequest, CreateStartupResult } from '../types/startup-types.js'
10
-
11
- export class StartupService {
12
- async createStartup(request: CreateStartupRequest, context: MonorepoContext): Promise<CreateStartupResult> {
13
- const { name } = request
14
-
15
- // 1. Validate name
16
- validateStartupName(name)
17
-
18
- // 2. Verify we found the monorepo
19
- if (!context.isValid) {
20
- throw new NotInMonorepoRootError()
21
- }
22
-
23
- // 3. Determine startup path
24
- const startupsDir = path.join(context.monorepoRoot, 'startups')
25
- const startupPath = path.join(startupsDir, name)
26
-
27
- // 4. Check if startup already exists
28
- if (await filesystem.exists(startupPath)) {
29
- throw new StartupAlreadyExistsError(name, startupPath)
30
- }
31
-
32
- // 5. Ensure startups directory exists
33
- await filesystem.ensureDir(startupsDir)
34
-
35
- // 6. Copy template
36
- const templatePath = this.getTemplatePath()
37
- await filesystem.copy(templatePath, startupPath)
38
-
39
- return {
40
- startupPath,
41
- name,
42
- }
43
- }
44
-
45
- private getTemplatePath(): string {
46
- const __filename = fileURLToPath(import.meta.url)
47
- const __dirname = path.dirname(__filename)
48
-
49
- // From src/modules/startup/services/ or dist/modules/startup/services/ up to cli root
50
- const isDev = __filename.includes('/src/')
51
- const cliRoot = isDev
52
- ? path.join(__dirname, '../../../..') // src/modules/startup/services -> cli root
53
- : path.join(__dirname, '../../../..') // dist/modules/startup/services -> cli root
54
-
55
- return path.join(cliRoot, 'templates/startup')
56
- }
57
- }
@@ -1,8 +0,0 @@
1
- export interface CreateStartupRequest {
2
- name: string
3
- }
4
-
5
- export interface CreateStartupResult {
6
- startupPath: string
7
- name: string
8
- }
@@ -1,19 +0,0 @@
1
- import { InvalidStartupNameError } from '../errors/startup-errors.js'
2
-
3
- /**
4
- * Validate startup name format
5
- * - Must be lowercase
6
- * - Can only contain lowercase letters, numbers, and hyphens
7
- * - Cannot contain spaces, uppercase, underscores, periods, or special characters
8
- */
9
- export function validateStartupName(name: string): void {
10
- if (!name || name.trim().length === 0) {
11
- throw new Error('Startup name cannot be empty')
12
- }
13
-
14
- const validPattern = /^[a-z0-9-]+$/
15
-
16
- if (!validPattern.test(name)) {
17
- throw new InvalidStartupNameError(name)
18
- }
19
- }
@@ -1,137 +0,0 @@
1
- import * as path from 'path'
2
-
3
- import fs from 'fs-extra'
4
-
5
- export type LocationType = 'monorepo-root' | 'startup-root' | 'startup-app' | 'unknown'
6
-
7
- export interface MonorepoContext {
8
- isValid: boolean
9
- location: LocationType
10
- monorepoRoot: string
11
- appsDir: string | null
12
- // Specific context info
13
- startupName?: string
14
- appName?: string
15
- packageName?: string
16
- }
17
-
18
- const MONOREPO_ROOT_MARKER = '.launch-monorepo-root.md'
19
-
20
- /**
21
- * Check if a directory is the monorepo root by looking for the marker file
22
- */
23
- async function isMonorepoRoot(dir: string): Promise<boolean> {
24
- const markerPath = path.join(dir, MONOREPO_ROOT_MARKER)
25
- return await fs.pathExists(markerPath)
26
- }
27
-
28
- /**
29
- * Find the monorepo root by traversing up from a starting directory
30
- * Looks for .launch-monorepo-root.md marker file
31
- */
32
- async function findMonorepoRoot(startDir: string): Promise<string | null> {
33
- let currentDir = path.resolve(startDir)
34
- const rootDir = path.parse(currentDir).root
35
-
36
- while (currentDir !== rootDir) {
37
- if (await isMonorepoRoot(currentDir)) {
38
- return currentDir
39
- }
40
- currentDir = path.dirname(currentDir)
41
- }
42
-
43
- return null
44
- }
45
-
46
- interface ParsedLocation {
47
- location: LocationType
48
- startupName?: string
49
- appName?: string
50
- }
51
-
52
- /**
53
- * Parse the directory structure to determine location context
54
- * Based on patterns:
55
- * - startups/[name] → startup-root
56
- * - startups/[name]/apps/[app] → startup-app
57
- * - (empty or root) → monorepo-root
58
- */
59
- function parseLocationFromPath(cwdPath: string, monorepoRoot: string): ParsedLocation {
60
- const relativePath = path.relative(monorepoRoot, cwdPath)
61
-
62
- // At monorepo root
63
- if (!relativePath || relativePath === '.') {
64
- return { location: 'monorepo-root' }
65
- }
66
-
67
- const parts = relativePath.split(path.sep)
68
-
69
- // startups/[name]/...
70
- if (parts[0] === 'startups' && parts.length >= 2) {
71
- const startupName = parts[1]
72
-
73
- // startups/[name]/apps/[app]
74
- if (parts.length >= 4 && parts[2] === 'apps') {
75
- return {
76
- location: 'startup-app',
77
- startupName,
78
- appName: parts[3],
79
- }
80
- }
81
-
82
- // startups/[name]
83
- return {
84
- location: 'startup-root',
85
- startupName,
86
- }
87
- }
88
-
89
- return { location: 'unknown' }
90
- }
91
-
92
- /**
93
- * Determine the apps directory based on location context
94
- * Returns null for invalid locations (e.g., monorepo-root, unknown)
95
- */
96
- function getAppsDir(monorepoRoot: string, location: LocationType, startupName?: string): string | null {
97
- if (location === 'startup-root' || location === 'startup-app') {
98
- return path.join(monorepoRoot, 'startups', startupName!, 'apps')
99
- }
100
- return null
101
- }
102
-
103
- /**
104
- * Detect the monorepo context from the current working directory
105
- *
106
- * @deprecated Use detectLaunch77Context() from launch77-context.ts instead.
107
- * This function is maintained for legacy monorepo structure only.
108
- * New workspaces created with `launch77 init` should use the new context system.
109
- */
110
- export async function detectMonorepoContext(cwd: string): Promise<MonorepoContext> {
111
- const resolvedCwd = path.resolve(cwd)
112
-
113
- // Find the monorepo root
114
- const monorepoRoot = await findMonorepoRoot(resolvedCwd)
115
-
116
- if (!monorepoRoot) {
117
- return {
118
- isValid: false,
119
- location: 'unknown',
120
- monorepoRoot: '',
121
- appsDir: null,
122
- }
123
- }
124
-
125
- // Parse the directory structure to determine location
126
- const parsed = parseLocationFromPath(resolvedCwd, monorepoRoot)
127
- const appsDir = getAppsDir(monorepoRoot, parsed.location, parsed.startupName)
128
-
129
- return {
130
- isValid: true,
131
- location: parsed.location,
132
- monorepoRoot,
133
- appsDir,
134
- startupName: parsed.startupName,
135
- appName: parsed.appName,
136
- }
137
- }
@@ -1,8 +0,0 @@
1
- # Apps Directory
2
-
3
- This directory will contain all applications for this startup.
4
-
5
- Create new apps using:
6
- ```bash
7
- launch77 create-app marketing-site <app-name>
8
- ```