@sap/cds-dk
Version:
Command line client and development toolkit for the SAP Cloud Application Programming Model
31 lines (21 loc) • 834 B
JavaScript
const cds = require ('../lib/cds'); require = cds._local // eslint-disable-line no-global-assign
const serve = require ('@sap/cds/bin/serve')
module.exports = exports = Object.assign (cds_mock, serve)
exports.help = `
# SYNOPSIS
*cds mock* <service> [<options>]
This command is essentially just a convenience shortcut to
_cds serve --mocked <service> --in-memory? --port 0_.
If <service> resolves to an existing CAP project root, that changes to
_cds serve --mocked --project <service> --in-memory? --port 0_.
# OPTIONS
- see _cds help serve_
# OPTIONS
`
function cds_mock (argv, options) {
const [service] = argv
const o = { mocked: true, port: '0', 'in-memory?': true, ...options }
if (!o.project && cds.utils.isfile (service, 'package.json'))
o.project = true
return serve (argv, o)
}