@o-a/cms-agent 0.1.5 → 0.1.7
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/README.md +1 -1
- package/dist/create-site/cli.js +2 -2
- package/dist/create-site/generate-site.js +10 -0
- package/dist/server.js +10 -0
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/create-site/cli.js
CHANGED
|
@@ -17,10 +17,10 @@ try {
|
|
|
17
17
|
console.log('Next steps:');
|
|
18
18
|
console.log(` cd ${targetArg}/vhost`);
|
|
19
19
|
console.log(' npm install');
|
|
20
|
-
console.log('
|
|
20
|
+
console.log(' npm start');
|
|
21
21
|
console.log('');
|
|
22
22
|
console.log('Want to edit this site from a hosted admin while developing locally?');
|
|
23
|
-
console.log('
|
|
23
|
+
console.log(' npm run tunnel');
|
|
24
24
|
}
|
|
25
25
|
catch (error) {
|
|
26
26
|
if (error instanceof ScaffoldError) {
|
|
@@ -94,6 +94,16 @@ export function scaffoldSite(targetDir) {
|
|
|
94
94
|
version: '0.0.0',
|
|
95
95
|
private: true,
|
|
96
96
|
type: 'module',
|
|
97
|
+
// "start" matters beyond convenience: several PaaS platforms
|
|
98
|
+
// auto-detect and run `npm start` by default for a Node app
|
|
99
|
+
// with no other deploy config - without this, a site pushed
|
|
100
|
+
// straight to one of those (no Dockerfile in the loop) simply
|
|
101
|
+
// wouldn't boot. "tunnel" mirrors the --tunnel flag create-site
|
|
102
|
+
// already tells the operator about in its own next-steps output.
|
|
103
|
+
scripts: {
|
|
104
|
+
start: 'node server.js',
|
|
105
|
+
tunnel: 'node server.js --tunnel',
|
|
106
|
+
},
|
|
97
107
|
dependencies: {
|
|
98
108
|
// Pinned exact, never a ^range - at v0.x even a minor bump
|
|
99
109
|
// can be breaking (build plan's own word is "pinned").
|
package/dist/server.js
CHANGED
|
@@ -159,6 +159,16 @@ export async function startServer(siteRoot, options = {}) {
|
|
|
159
159
|
}
|
|
160
160
|
throw error;
|
|
161
161
|
}
|
|
162
|
+
// The real bound port, not just serverConfig.port verbatim - the
|
|
163
|
+
// same reasoning tests already rely on (app.server.address()):
|
|
164
|
+
// port 0 means "OS picks a free one", so echoing the configured
|
|
165
|
+
// value back would print a meaningless 0 in that case. 127.0.0.1,
|
|
166
|
+
// not the 0.0.0.0 bind host above - that's what's actually
|
|
167
|
+
// reachable and clickable from the machine running this.
|
|
168
|
+
const address = app.server.address();
|
|
169
|
+
if (address !== null && typeof address !== 'string') {
|
|
170
|
+
console.log(`Site running at http://127.0.0.1:${address.port}`);
|
|
171
|
+
}
|
|
162
172
|
if (options.tunnel) {
|
|
163
173
|
try {
|
|
164
174
|
tunnel = await (options.startTunnel ?? startDevTunnel)(serverConfig.port);
|