feat: add deployment profile generation slice
This commit is contained in:
25
scripts/generate_reporting_governance_profile_artifact.mjs
Normal file
25
scripts/generate_reporting_governance_profile_artifact.mjs
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env node
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
import { generateDeploymentProfileArtifactFromFile } from '../plugins/reporting-governance/src/storage/profile-generator.mjs';
|
||||
import { validateDeploymentProfileArtifact } from '../plugins/reporting-governance/src/storage/profile-artifact.mjs';
|
||||
|
||||
function main() {
|
||||
const [, , sourcePathArg, outputPathArg] = process.argv;
|
||||
if (!sourcePathArg || !outputPathArg) {
|
||||
console.error('usage: node scripts/generate_reporting_governance_profile_artifact.mjs <source-profile.yaml> <output-artifact.json>');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const sourcePath = path.resolve(sourcePathArg);
|
||||
const outputPath = path.resolve(outputPathArg);
|
||||
const artifact = generateDeploymentProfileArtifactFromFile(sourcePath);
|
||||
validateDeploymentProfileArtifact(artifact);
|
||||
|
||||
fs.mkdirSync(path.dirname(outputPath), { recursive: true });
|
||||
fs.writeFileSync(outputPath, JSON.stringify(artifact, null, 2) + '\n', 'utf8');
|
||||
console.log(JSON.stringify({ ok: true, sourcePath, outputPath, profileId: artifact.metadata.id }, null, 2));
|
||||
}
|
||||
|
||||
main();
|
||||
Reference in New Issue
Block a user