@puls-atlas/cli
Version:
The Puls Atlas CLI tool for managing Atlas projects
32 lines • 1.29 kB
JavaScript
import { logger } from '../../utils/index.js';
import { validateAtlasProject } from './validateAtlasProject.js';
const createSectionStatusRow = section => ({
label: section.name,
tone: 'success',
value: 'present'
});
export const runValidateAtlasProject = (dependencies = {}, cwd = process.cwd()) => {
const loggerImpl = dependencies.logger ?? logger;
const validateAtlasProjectImpl = dependencies.validateAtlasProject ?? validateAtlasProject;
const spinner = loggerImpl.spinner('Validating Atlas feature configuration...');
try {
const result = validateAtlasProjectImpl(cwd);
spinner.succeed('Atlas feature configuration is valid.');
loggerImpl.summary('Validation summary', [result.configPath ? {
label: 'Config',
value: result.configPath
} : null, {
label: 'Generated output directory',
value: result.generatedDir
}]);
if (result.sections.length === 0) {
loggerImpl.warning('No Atlas feature configuration sections are defined.');
return;
}
loggerImpl.summary('Configured sections', result.sections.map(createSectionStatusRow));
} catch (error) {
spinner.fail('Atlas feature configuration is invalid.');
loggerImpl.error(error.message);
}
};
export default async () => runValidateAtlasProject();