mirror of
https://github.com/System-End/YSWS-Catalog.git
synced 2026-04-19 21:05:07 +00:00
19 lines
536 B
JavaScript
19 lines
536 B
JavaScript
const fs = require('fs');
|
|
const jsyaml = require('js-yaml');
|
|
const path = require('path');
|
|
|
|
async function main() {
|
|
try {
|
|
const dataFile = path.join(__dirname, 'data.yml');
|
|
const fileContent = fs.readFileSync(dataFile, 'utf8');
|
|
const data = jsyaml.load(fileContent);
|
|
|
|
fs.writeFileSync(path.join(__dirname, 'api.json'), JSON.stringify(data, null, 2));
|
|
console.log('JSON file generated successfully!');
|
|
} catch (error) {
|
|
console.error('Error generating JSON file:', error);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
main();
|