@criticalmanufacturing/node-package-bundler
Version:
Connect IoT Package Bundler
52 lines • 2.87 kB
JavaScript
#! /usr/bin/env node
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const packagePacker_1 = require("./packagePacker");
const yargs = require("yargs");
function main() {
return __awaiter(this, void 0, void 0, function* () {
yargs(process.argv.slice(2));
yargs.strict(false);
yargs.version(false);
yargs.usage("Usage: packageBundler [options]").wrap(0);
// Id
yargs.option("i", { alias: "input", type: "string", default: "", description: "Location of the package to pack", required: true });
yargs.option("o", { alias: "output", type: "string", default: "", description: "Location of the generated package will be stored", required: true });
yargs.option("t", { alias: "temp", type: "string", default: "", description: "Temporary location to use (default: ${source}\\_TEMP_)", required: false });
yargs.option("c", { alias: "config", type: "string", default: "", description: "Location of the Configuration to use (default: ${source}/packConfig.json)", required: false });
yargs.option("a", { alias: "addons", type: "string", default: "", description: "Location of the compiled addons", required: false });
yargs.option("d", { alias: "debug", type: "boolean", default: false, description: "Debug Mode (doesn't delete temporary directory after processing)", required: false });
yargs.option("v", { alias: "version", type: "string", default: "", description: "Version to use to generate the package", required: false });
yargs.help("h").alias("h", "help");
if (yargs.argv) {
const generator = new packagePacker_1.PackagePacker();
yield generator.go(yargs.argv);
}
});
}
main()
.then()
.catch((error) => {
console.error("\x1b[31m", error.message, "\x1b[0m");
console.error("");
console.error("\x1b[31m", "** Failure **", "\x1b[0m");
process.exit(1);
});
process.on("uncaughtException", (error) => {
console.error(error);
process.exit(1);
});
process.on("unhandledRejection", (reason, promise) => {
console.error(reason);
process.exit(1);
});
//# sourceMappingURL=index.js.map