ssn/src/getManifest.ts
2018-07-05 02:09:26 +02:00

23 lines
814 B
TypeScript

import failWithError from './failWithError';
import IManifest from './interfaces/IManifest';
import { Product } from './interfaces/ISettings';
import getManifest from './ssn/getManifest';
import verifyProductName from './ssn/verify/verifyProductName';
const failFunction = failWithError.bind(null, 'node dist/getManifest.js <product>');
if (process.argv.length !== 3) {
failFunction(`Expected 1 argument but ${process.argv.length - 2} arguments were supplied.`);
}
//Check that product name is valid
const product = process.argv[2];
if (!verifyProductName(product)) {
failFunction(`"${product} is not a valid product name.`);
}
//Get manifest and write output to console
getManifest(product as Product).then((output: IManifest) => {
process.stdout.write(JSON.stringify(output));
//process.exit(0);
});