@releaseotto/core
Version:
OTTO performs your action on new versioning of APIs, packages, schemas, etc. Keepings things nice and neatly automated.
27 lines • 988 B
JavaScript
import * as fs from 'fs';
import { Meta } from '../types/meta/Meta';
import { loadConfig } from './input';
const schema = require('../schemas/meta-options.json');
/**
* Load otto config file based on either data or location.
*/
export function loadMetaConfig(input) {
const obj = loadConfig(input, schema);
if (obj instanceof Meta) {
return obj;
}
else {
return Meta.unmarshal(JSON.stringify(obj));
}
}
export function writeMetaInformation({ config, versionDiffs }) {
var _a, _b;
const metaConfig = new Meta({});
metaConfig.dependencies = {};
for (const [id, version] of Object.entries(versionDiffs)) {
metaConfig.dependencies[id] = version.remoteVersion;
}
const location = ((_b = (_a = config.location) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.metaMinusLocation) || './meta.conf';
fs.writeFileSync(location, metaConfig.marshal());
}
//# sourceMappingURL=meta.js.map