@useguano/create 0.1.5 → 0.1.6
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.js +24 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -74,6 +74,20 @@ const name =
|
|
|
74
74
|
.replace(/[^a-z0-9-]+/g, '-')
|
|
75
75
|
.replace(/^-+|-+$/g, '') || DEFAULT_DIR
|
|
76
76
|
|
|
77
|
+
/**
|
|
78
|
+
* The same thing, as a NAME rather than a package slug.
|
|
79
|
+
*
|
|
80
|
+
* `acme-landing` is what npm needs and what the folder is called; "Acme
|
|
81
|
+
* Landing" is what belongs in a field labelled Project name. The setup screen
|
|
82
|
+
* prefills it and the human can change it there — this is a head start, not a
|
|
83
|
+
* decision.
|
|
84
|
+
*/
|
|
85
|
+
const displayName = name
|
|
86
|
+
.split('-')
|
|
87
|
+
.filter(Boolean)
|
|
88
|
+
.map((w) => w[0].toUpperCase() + w.slice(1))
|
|
89
|
+
.join(' ')
|
|
90
|
+
|
|
77
91
|
await mkdir(target, { recursive: true })
|
|
78
92
|
if ((await readdir(target)).length) {
|
|
79
93
|
rl?.close()
|
|
@@ -95,9 +109,10 @@ if ((await readdir(target)).length) {
|
|
|
95
109
|
* 4174 is still preferred, so a first project looks exactly as documented.
|
|
96
110
|
*/
|
|
97
111
|
async function pickPort(first = 4174, tries = 40) {
|
|
98
|
-
//
|
|
99
|
-
|
|
100
|
-
|
|
112
|
+
// One port per site: the preview is served by the same server under
|
|
113
|
+
// /_guano/preview, so there is no second port to keep free above it.
|
|
114
|
+
for (let port = first; port < first + tries; port += 1) {
|
|
115
|
+
if (await free(port)) return port
|
|
101
116
|
}
|
|
102
117
|
return first
|
|
103
118
|
}
|
|
@@ -147,6 +162,12 @@ export default {}
|
|
|
147
162
|
# must not share one, or whichever starts first answers for both and the
|
|
148
163
|
# other's MCP token is refused with a 401.
|
|
149
164
|
PORT=${port}
|
|
165
|
+
|
|
166
|
+
# What you called this project in the terminal. It prefills the Project name
|
|
167
|
+
# on the setup screen, so nobody is asked to name the same thing twice. Only
|
|
168
|
+
# read before the first admin account exists; edit the name in the editor
|
|
169
|
+
# after that.
|
|
170
|
+
GUANO_PROJECT_NAME=${displayName}
|
|
150
171
|
`,
|
|
151
172
|
|
|
152
173
|
'.env.example': `PORT=${port}
|