create-epicflare 1.0.0 → 1.1.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/index.ts +19 -5
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -2,13 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
import { spawnSync } from 'node:child_process'
|
|
4
4
|
import { join } from 'node:path'
|
|
5
|
+
import { createInterface } from 'node:readline'
|
|
5
6
|
|
|
6
|
-
const appName = process.argv[2]
|
|
7
|
+
const appName = process.argv[2] || (await getAppName())
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
function getAppName() {
|
|
10
|
+
return new Promise<string>((resolve, reject) => {
|
|
11
|
+
const rl = createInterface({
|
|
12
|
+
input: process.stdin,
|
|
13
|
+
output: process.stdout,
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
rl.question('Please provide an app name: ', (answer: string) => {
|
|
17
|
+
if (!answer.trim()) {
|
|
18
|
+
reject(new Error('App name is required.'))
|
|
19
|
+
}
|
|
20
|
+
process.argv[2] = answer.trim()
|
|
21
|
+
rl.close()
|
|
22
|
+
// Re-run the script with the provided app name.
|
|
23
|
+
resolve(answer.trim())
|
|
24
|
+
})
|
|
25
|
+
})
|
|
12
26
|
}
|
|
13
27
|
|
|
14
28
|
const commands = [
|