-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
35 lines (29 loc) · 777 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import path from 'path'
import { getWpNowConfig, startServer } from '@wp-now/wp-now'
async function main() {
const args = process.argv.slice(2)
const { php, options: wpNowOptions } = await startServer({
...await getWpNowConfig({
path: process.cwd(),
}),
mode: 'playground',
reset: true,
})
const scriptPath = import.meta.dirname
php.mount(path.join(scriptPath), `/here`)
try {
await php.cli([
'php',
'/here/example.phar',
`--path=${wpNowOptions.documentRoot}`,
])
} catch (resultOrError) {
const success =
resultOrError.name === 'ExitStatus' && resultOrError.status === 0
if (!success) {
console.log('PHP CLI error', resultOrError)
}
}
process.exit()
}
main().catch(console.error)