netlify
Version:
Netlify command line tool
24 lines • 815 B
JavaScript
import { resetDatabase } from '@netlify/dev';
import { log, logJson } from '../../utils/command-helpers.js';
import { connectToDatabase } from './db-connection.js';
export const reset = async (options, command) => {
const { json } = options;
const buildDir = command.netlify.site.root ?? command.project.root ?? command.project.baseDirectory;
if (!buildDir) {
throw new Error('Could not determine the project root directory.');
}
const { executor, cleanup } = await connectToDatabase(buildDir);
try {
await resetDatabase(executor);
if (json) {
logJson({ reset: true });
}
else {
log('Local development database has been reset.');
}
}
finally {
await cleanup();
}
};
//# sourceMappingURL=reset.js.map