@prismatic-io/embedded
Version:
Embed Prismatic's integration marketplace and workflow designer within your existing application.
33 lines (32 loc) • 1.46 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const promises_1 = require("node:fs/promises");
const node_path_1 = __importDefault(require("node:path"));
const node_util_1 = require("node:util");
const fetchWorkflowContexts_1 = require("./fetchWorkflowContexts");
const generateTypes_1 = require("./generateTypes");
const main = async () => {
const { values } = (0, node_util_1.parseArgs)({
args: process.argv.slice(2),
options: {
output: { type: "string", short: "o", default: "prismatic.d.ts" },
},
});
const output = values.output;
const outputPath = node_path_1.default.resolve(process.cwd(), output);
console.log("Fetching workflow contexts...");
const contexts = await (0, fetchWorkflowContexts_1.fetchWorkflowContexts)();
console.log(`Found ${contexts.length} workflow context(s).`);
console.log("Generating types...");
const content = await (0, generateTypes_1.generateTypes)(contexts);
await (0, promises_1.writeFile)(outputPath, content, "utf-8");
console.log(`Types written to ${outputPath}`);
console.log(`\nMake sure this file is included in your tsconfig.json:\n\n {\n "include": ["${output}"]\n }`);
};
main().catch((error) => {
console.error(error.message);
process.exit(1);
});