gl-store-s3.js/node_modules/aws-sdk/scripts/translate-api

26 lines
1007 B
Plaintext
Raw Normal View History

2019-05-08 11:19:12 +00:00
#!/usr/bin/env node
var fs = require('fs');
var Translator = require('./lib/translator');
var removeEventStreamOperations = require('./lib/remove-event-stream-ops').removeEventStreamOperations;
var util = require('util');
var basePath = __dirname + '/../apis/';
var paths = fs.readdirSync(basePath);
var modelName = process.argv[2] || '';
paths.forEach(function (path) {
if (path.match(new RegExp(modelName + ".+\\.normal\\.json$"))) {
var opath = path.replace(/\.normal\.json$/, '.min.json');
var data = JSON.parse(fs.readFileSync(basePath + path).toString());
var didModify = removeEventStreamOperations(data);
if (didModify) {
// original model modified, replace existing normal.json so docs/ts definitions are accurate
fs.writeFileSync(basePath + path, JSON.stringify(data, null, ' '));
}
var translated = new Translator(data, {documentation: false});
var json = JSON.stringify(translated, null, ' ');
fs.writeFileSync(basePath + opath, json);
}
});