23 lines
813 B
TypeScript
23 lines
813 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 stdout
|
|
getManifest(product as Product).then((output: IManifest) => {
|
|
process.stdout.write(JSON.stringify(output));
|
|
//process.exit(0);
|
|
});
|