Add jsonl output to releases
Some checks failed
Generate Release / validate_and_release (push) Failing after 7s
Some checks failed
Generate Release / validate_and_release (push) Failing after 7s
This commit is contained in:
27
scripts/ndjson-out.js
Normal file
27
scripts/ndjson-out.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const fs = require('fs');
|
||||
const yaml = require('yaml');
|
||||
|
||||
const inputFile = process.argv[2];
|
||||
const outputFile = 'pis-objects.jsonl';
|
||||
|
||||
if (!inputFile) {
|
||||
console.error('Please provide an input YAML file');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
try {
|
||||
const fileContent = fs.readFileSync(inputFile, 'utf8');
|
||||
const data = yaml.loadAll(fileContent);
|
||||
|
||||
if (!data || !data.pis || !Array.isArray(data.pis)) {
|
||||
throw new Error('Invalid structure: Expected object with "pis" array.');
|
||||
}
|
||||
|
||||
const jsonl = data.pis.map(item => JSON.stringify(item));
|
||||
|
||||
fs.writeFileSync(outputFile, jsonl.join('\n') + '\n');
|
||||
console.log(`Successfully processed ${data.pis.length} items.`);
|
||||
} catch (e) {
|
||||
console.error("Conversion failed: ", e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
0
scripts/test.yaml
Normal file
0
scripts/test.yaml
Normal file
Reference in New Issue
Block a user