UNPKG

dynamo-db-local

Version:

A wrapper around Amazon's DynamoDB Local to start and stop it from Node.js.

41 lines 1.37 kB
export const createSpawn = (cwd, spawn) => ({ command = 'java', detached = false, name = null, path = null, port = null, sharedDb = false, stdio = 'pipe' } = {}) => { const args = command === 'docker' ? ['run'] : [ '-Djava.library.path=../../lib/dynamodb_local_2025-02-25/DynamoDBLocal_lib', '-jar', '../../lib/dynamodb_local_2025-02-25/DynamoDBLocal.jar' ]; if (command === 'docker') { if (path !== null) { args.push('--mount', `source=${path},target=/home/dynamodblocal/db,type=bind`); } if (name !== null) { args.push('--name', name); } args.push('--publish', `${port === null ? '8000' : port.toString()}:8000`, '--rm', 'amazon/dynamodb-local:2.6.0', '-jar', 'DynamoDBLocal.jar'); if (path !== null) { args.push('-dbPath', '/home/dynamodblocal/db'); } } if (path === null) { args.push('-inMemory'); } if (command === 'java') { if (path !== null) { args.push('-dbPath', path); } if (port !== null) { args.push('-port', port.toString()); } } if (sharedDb) { args.push('-sharedDb'); } return spawn(command, args, { cwd, detached, stdio }); }; //# sourceMappingURL=spawn.js.map