fleet/website/scripts/generate-merged-schema.js
Eric 8fecef3ed5
Update merged schema helper and script. (#8092)
* update helper to use the osquery schema from the osquery/osquery-site repo

* update script description and generated json filename

* Add ritual to digital experience handbook

* add merged schema

* Update README.md

* Update get-extended-osquery-schema.js
2022-10-05 15:10:08 -05:00

31 lines
992 B
JavaScript
Vendored

module.exports = {
friendlyName: 'Generate merged schema',
description: 'Merge the osquery schema from the osquery/osquery-site GitHub repo with Fleet\'s overrides (/schema/fleet_schema.json) and save the merged schema to /schema/osquery_fleet_schema.json',
fn: async function () {
let path = require('path');
let topLvlRepoPath = path.resolve(sails.config.appPath, '../');
let mergedSchemaOutputPath = path.resolve(topLvlRepoPath+'/schema', 'osquery_fleet_schema.json');
let mergedSchemaTables = await sails.helpers.getExtendedOsquerySchema();
// Save the merged schema to /schema/merged_schema.json. Note: If this file already exists, it will be overwritten.
await sails.helpers.fs.writeJson.with({
destination: mergedSchemaOutputPath,
json: mergedSchemaTables,
force: true
});
sails.log(`osquery schema successfully merged with Fleet\'s overrides. The merged schema has been saved at ${mergedSchemaOutputPath}`);
}
};