create-platformatic 2.68.0 → 2.70.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.
- package/package.json +8 -9
- package/src/index.mjs +12 -27
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-platformatic",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.70.0",
|
|
4
4
|
"description": "Create platformatic application interactive tool",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
"desm": "^1.3.1",
|
|
21
21
|
"es-main": "^1.3.0",
|
|
22
22
|
"execa": "^9.0.0",
|
|
23
|
-
"glob": "^11.0.2",
|
|
24
23
|
"help-me": "^5.0.0",
|
|
25
24
|
"inquirer": "^9.2.16",
|
|
26
25
|
"minimist": "^1.2.8",
|
|
@@ -32,9 +31,9 @@
|
|
|
32
31
|
"strip-ansi": "^7.1.0",
|
|
33
32
|
"undici": "^7.0.0",
|
|
34
33
|
"which": "^3.0.1",
|
|
35
|
-
"@platformatic/config": "2.
|
|
36
|
-
"@platformatic/generators": "2.
|
|
37
|
-
"@platformatic/utils": "2.
|
|
34
|
+
"@platformatic/config": "2.70.0",
|
|
35
|
+
"@platformatic/generators": "2.70.0",
|
|
36
|
+
"@platformatic/utils": "2.70.0"
|
|
38
37
|
},
|
|
39
38
|
"devDependencies": {
|
|
40
39
|
"@types/node": "^22.5.0",
|
|
@@ -49,10 +48,10 @@
|
|
|
49
48
|
"neostandard": "^0.12.0",
|
|
50
49
|
"typescript": "~5.8.0",
|
|
51
50
|
"yaml": "^2.4.1",
|
|
52
|
-
"@platformatic/
|
|
53
|
-
"@platformatic/
|
|
54
|
-
"@platformatic/
|
|
55
|
-
"@platformatic/
|
|
51
|
+
"@platformatic/db": "2.70.0",
|
|
52
|
+
"@platformatic/runtime": "2.70.0",
|
|
53
|
+
"@platformatic/composer": "2.70.0",
|
|
54
|
+
"@platformatic/service": "2.70.0"
|
|
56
55
|
},
|
|
57
56
|
"scripts": {
|
|
58
57
|
"test:cli": "borp --pattern \"test/cli/*test.mjs\" --timeout=300000 --concurrency=1",
|
package/src/index.mjs
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import ConfigManager, { findConfigurationFile, loadConfigurationFile } from '@platformatic/config'
|
|
2
2
|
import { ImportGenerator } from '@platformatic/generators'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
createDirectory,
|
|
5
|
+
detectApplicationType,
|
|
6
|
+
executeWithTimeout,
|
|
7
|
+
generateDashedName,
|
|
8
|
+
getPkgManager,
|
|
9
|
+
searchJavascriptFiles
|
|
10
|
+
} from '@platformatic/utils'
|
|
4
11
|
import { execa } from 'execa'
|
|
5
|
-
import { glob } from 'glob'
|
|
6
12
|
import defaultInquirer from 'inquirer'
|
|
7
13
|
import parseArgs from 'minimist'
|
|
8
14
|
import { existsSync } from 'node:fs'
|
|
@@ -129,7 +135,7 @@ async function findApplicationRoot (projectDir) {
|
|
|
129
135
|
return projectDir
|
|
130
136
|
}
|
|
131
137
|
|
|
132
|
-
const files = await
|
|
138
|
+
const files = await searchJavascriptFiles(projectDir)
|
|
133
139
|
|
|
134
140
|
if (files.length > 0) {
|
|
135
141
|
return dirname(resolve(projectDir, files[0]))
|
|
@@ -138,29 +144,6 @@ async function findApplicationRoot (projectDir) {
|
|
|
138
144
|
return null
|
|
139
145
|
}
|
|
140
146
|
|
|
141
|
-
export async function determineApplicationType (projectDir) {
|
|
142
|
-
let rootPackageJson
|
|
143
|
-
try {
|
|
144
|
-
rootPackageJson = JSON.parse(await readFile(resolve(projectDir, 'package.json'), 'utf-8'))
|
|
145
|
-
} catch {
|
|
146
|
-
rootPackageJson = {}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const { dependencies, devDependencies } = rootPackageJson
|
|
150
|
-
|
|
151
|
-
if (dependencies?.next || devDependencies?.next) {
|
|
152
|
-
return ['@platformatic/next', 'Next.js']
|
|
153
|
-
} else if (dependencies?.['@remix-run/dev'] || devDependencies?.['@remix-run/dev']) {
|
|
154
|
-
return ['@platformatic/remix', 'Remix']
|
|
155
|
-
} else if (dependencies?.astro || devDependencies?.astro) {
|
|
156
|
-
return ['@platformatic/astro', 'Astro']
|
|
157
|
-
} else if (dependencies?.vite || devDependencies?.vite) {
|
|
158
|
-
return ['@platformatic/vite', 'Vite']
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
return ['@platformatic/node', 'Node.js']
|
|
162
|
-
}
|
|
163
|
-
|
|
164
147
|
export async function wrapApplication (
|
|
165
148
|
logger,
|
|
166
149
|
inquirer,
|
|
@@ -258,7 +241,8 @@ export async function createApplication (
|
|
|
258
241
|
const applicationRoot = await findApplicationRoot(projectDir)
|
|
259
242
|
|
|
260
243
|
if (applicationRoot) {
|
|
261
|
-
|
|
244
|
+
// detectApplicationType cannot throw here as findApplicationRoot already checks for the existence of Javascript files
|
|
245
|
+
const { name: module, label } = await detectApplicationType(projectDir)
|
|
262
246
|
|
|
263
247
|
// Check if the file belongs to a Watt application, this can happen for instance if we executed watt create
|
|
264
248
|
// in the services folder
|
|
@@ -317,6 +301,7 @@ export async function createApplication (
|
|
|
317
301
|
|
|
318
302
|
projectDir = resolve(process.cwd(), optionsDir.dir)
|
|
319
303
|
await createDirectory(projectDir)
|
|
304
|
+
process.chdir(projectDir)
|
|
320
305
|
}
|
|
321
306
|
|
|
322
307
|
const projectName = basename(projectDir)
|