@platformatic/foundation 3.0.3 → 3.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/lib/module.js +36 -17
- package/package.json +1 -1
package/lib/module.js
CHANGED
|
@@ -10,6 +10,33 @@ let platformaticPackageVersion
|
|
|
10
10
|
|
|
11
11
|
export const defaultPackageManager = 'npm'
|
|
12
12
|
|
|
13
|
+
// Keep this in sync with packages/create-wattpm/lib/index.js.
|
|
14
|
+
// @platformatic/node is purposely missing as it's the fallback option.
|
|
15
|
+
export const applicationTypes = [
|
|
16
|
+
{ name: '@platformatic/nest', label: 'NestJS', dependencies: ['@nestjs/core'] },
|
|
17
|
+
{ name: '@platformatic/next', label: 'Next.js', dependencies: ['next'] },
|
|
18
|
+
{ name: '@platformatic/remix', label: 'Remix', dependencies: ['@remix-run/dev'] },
|
|
19
|
+
{ name: '@platformatic/astro', label: 'Astro', dependencies: ['astro'] },
|
|
20
|
+
// Since Vite is often used with other frameworks, we must check for Vite last amongst frontend frameworks
|
|
21
|
+
{ name: '@platformatic/vite', label: 'Vite', dependencies: ['vite'] },
|
|
22
|
+
{
|
|
23
|
+
name: '@platformatic/gateway',
|
|
24
|
+
label: 'Platformatic Gateway',
|
|
25
|
+
dependencies: ['@platformatic/gateway', '@platformatic/composer']
|
|
26
|
+
},
|
|
27
|
+
{ name: '@platformatic/service', label: 'Platformatic Service', dependencies: ['@platformatic/service'] },
|
|
28
|
+
{ name: '@platformatic/db', label: 'Platformatic DB', dependencies: ['@platformatic/db'] },
|
|
29
|
+
{ name: '@platformatic/php', label: 'Platformatic PHP', dependencies: ['@platformatic/php'] },
|
|
30
|
+
{ name: '@platformatic/ai-warp', label: 'AI-Warp', dependencies: ['@platformatic/ai-warp'] },
|
|
31
|
+
{ name: '@platformatic/pg-hooks', label: 'Platformatic PostgreSQL Hooks', dependencies: ['@platformatic/pg-hooks'] },
|
|
32
|
+
{
|
|
33
|
+
name: '@platformatic/rabbitmq-hooks',
|
|
34
|
+
label: 'Platformatic RabbitMQ Hooks',
|
|
35
|
+
dependencies: ['@platformatic/rabbitmq-hooks']
|
|
36
|
+
},
|
|
37
|
+
{ name: '@platformatic/kafka-hooks', label: 'Platformatic Kafka Hooks', dependencies: ['@platformatic/kafka-hooks'] }
|
|
38
|
+
]
|
|
39
|
+
|
|
13
40
|
export async function getLatestNpmVersion (pkg) {
|
|
14
41
|
const res = await request(`https://registry.npmjs.org/${pkg}`)
|
|
15
42
|
if (res.statusCode === 200) {
|
|
@@ -119,23 +146,15 @@ export async function detectApplicationType (root, packageJson) {
|
|
|
119
146
|
let name
|
|
120
147
|
let label
|
|
121
148
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
} else if (hasDependency(packageJson, 'astro')) {
|
|
132
|
-
name = '@platformatic/astro'
|
|
133
|
-
label = 'Astro'
|
|
134
|
-
// Since Vite is often used with other frameworks, we must check for Vite last
|
|
135
|
-
} else if (hasDependency(packageJson, 'vite')) {
|
|
136
|
-
name = '@platformatic/vite'
|
|
137
|
-
label = 'Vite'
|
|
138
|
-
} else if (await hasJavascriptFiles(root)) {
|
|
149
|
+
for (const appType of applicationTypes) {
|
|
150
|
+
if (appType.dependencies.some(dep => hasDependency(packageJson, dep))) {
|
|
151
|
+
name = appType.name
|
|
152
|
+
label = appType.label
|
|
153
|
+
break
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (!name && (await hasJavascriptFiles(root))) {
|
|
139
158
|
// If no specific framework is detected, we assume it's a generic Node.js application
|
|
140
159
|
name = '@platformatic/node'
|
|
141
160
|
label = 'Node.js'
|