Fixes: FRMW-2728, FRMW-2729 After this PR gets merged the following middleware will be exported from the `@medusajs/framework/http` import path. - applyParamsAsFilters - clearFiltersByKey - applyDefaultFilters - setContext - getQueryConfig - httpCompression - maybeApplyLinkFilter - refetchEntities - unlessPath - validateBody - validateQuery Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
30 lines
659 B
JavaScript
30 lines
659 B
JavaScript
const execa = require(`execa`)
|
|
|
|
const defaultSpawnArgs = {
|
|
cwd: process.cwd(),
|
|
stdio: `inherit`,
|
|
}
|
|
|
|
exports.setDefaultSpawnStdio = (stdio) => {
|
|
defaultSpawnArgs.stdio = stdio
|
|
}
|
|
|
|
exports.promisifiedSpawn = async ([cmd, args = [], spawnArgs = {}]) => {
|
|
const spawnOptions = {
|
|
...defaultSpawnArgs,
|
|
...spawnArgs,
|
|
}
|
|
try {
|
|
return await execa(cmd, args, spawnOptions)
|
|
} catch (e) {
|
|
if (spawnOptions.stdio === `ignore`) {
|
|
console.log(
|
|
`\nCommand "${cmd} ${args.join(
|
|
` `
|
|
)}" failed.\nTo see details of failed command, rerun "medusa-dev" without "--quiet" or "-q" switch\n`
|
|
)
|
|
}
|
|
throw e
|
|
}
|
|
}
|