@wix/origami-site-express 1.0.2 → 1.0.3
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { sendAndExit } from '@wix/origami-bi'
|
|
2
|
+
import { createWorkspaceRun, sendAndExit } from '@wix/origami-bi'
|
|
3
|
+
import { readFileSync } from 'node:fs'
|
|
3
4
|
import * as commands from '../src/index.js'
|
|
4
5
|
|
|
5
6
|
const [command] = process.argv.slice(2)
|
|
@@ -7,9 +8,11 @@ if (!Object.hasOwn(commands, command)) {
|
|
|
7
8
|
console.error(`Usage: origami-site-express <${Object.keys(commands).join(' | ')}>`)
|
|
8
9
|
await sendAndExit(1)
|
|
9
10
|
}
|
|
11
|
+
const run = createWorkspaceRun({ command: /** @type {'yarn build' | 'yarn dev' | 'yarn start'} */ (`yarn ${command}`),
|
|
12
|
+
toolVersion: JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version })
|
|
10
13
|
try {
|
|
11
|
-
await commands[command]({ root: process.cwd() })
|
|
14
|
+
await run.trackCommand(() => commands[command]({ root: process.cwd() }), { finish: command === 'build' })
|
|
12
15
|
} catch (error) {
|
|
13
16
|
console.error(error instanceof Error ? error.stack ?? error.message : error)
|
|
14
|
-
await sendAndExit(1)
|
|
17
|
+
await sendAndExit(1, { run })
|
|
15
18
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/origami-site-express",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Run an exported Wix origami site on Node with Express and Vite.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@vitejs/plugin-react": "^6.1.1",
|
|
35
35
|
"express": "^5.2.1",
|
|
36
36
|
"vite": "^8.1.0",
|
|
37
|
-
"@wix/origami-bi": "0.
|
|
37
|
+
"@wix/origami-bi": "0.6.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@wix/origami-site": "^1.0.0"
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
]
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
|
-
"falconPackageHash": "
|
|
70
|
+
"falconPackageHash": "764851a0fb673047dbfd31642cfbcc5e14a8c10ab695e15b245ef69f"
|
|
71
71
|
}
|
package/src/server/lifecycle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { currentRow, sendAndExit } from '@wix/origami-bi'
|
|
1
|
+
import { claimProcessShutdown, currentRow, sendAndExit } from '@wix/origami-bi'
|
|
2
2
|
/** Listens, prints the one ready line, and shuts down on SIGTERM/SIGINT. No host means every interface.
|
|
3
3
|
* @param {import('node:http').Server} server @param {{ port: number, host?: string | undefined, onClose: () => Promise<unknown> }} options */
|
|
4
4
|
export async function serve(server, { port, host, onClose }) {
|
|
@@ -9,6 +9,7 @@ export async function serve(server, { port, host, onClose }) {
|
|
|
9
9
|
: address.family === 'IPv6' ? `[${address.address}]` : address.address
|
|
10
10
|
console.log(`origami-site-express ready http://${shown}:${address.port}`)
|
|
11
11
|
const run = currentRow()?.run
|
|
12
|
+
if (run) claimProcessShutdown(run)
|
|
12
13
|
let stopping = false
|
|
13
14
|
/** @param {'SIGINT' | 'SIGTERM' | 'SIGHUP'} signal */
|
|
14
15
|
const stop = async (signal) => {
|
|
@@ -20,8 +21,7 @@ export async function serve(server, { port, host, onClose }) {
|
|
|
20
21
|
try { await onClose() } catch (error) { console.error('[origami]', error) }
|
|
21
22
|
await closed
|
|
22
23
|
clearTimeout(force)
|
|
23
|
-
run
|
|
24
|
-
await sendAndExit(0, run ? { run } : {})
|
|
24
|
+
await sendAndExit(0, run ? { run, reason: signal } : {})
|
|
25
25
|
}
|
|
26
26
|
process.once('SIGTERM', () => stop('SIGTERM'))
|
|
27
27
|
process.once('SIGINT', () => stop('SIGINT'))
|