UNPKG

@orvium/orvium-tools

Version:

Set of tools to interact with Orvium API

55 lines (54 loc) 2.32 kB
#!/usr/bin/env node "use strict"; /** * CLI tool for importing deposits and uploading manuscripts to the Orvium platform. * * This script provides a command-line interface (CLI) for automating the import of deposit data * and manuscript files to the Orvium platform. It expects two command-line arguments: * * - `<directory>`: The directory path where the JSON metadata and manuscript files are located. * - `<community>`: The community identifier to which the deposit will be associated. * * The script performs the following tasks: * * - Loads environment variables using `dotenv` for API authentication and configuration. * - Validates the provided command-line arguments (directory path and community). * - Executes the `importDeposit` function from the core module, which handles the full import and upload process. * - Outputs the result or any errors encountered during the process. * * Example usage: * ``` * npx importDeposit <directory> <community> * ``` * * This script is designed for use in automation pipelines or as a standalone tool for uploading deposits * on the Orvium platform. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const import_deposit_1 = require("./import-deposit"); // Import the core function from the programmatic entry point const dotenv_1 = __importDefault(require("dotenv")); dotenv_1.default.config(); // Obtain filepath to JSON metadata folder in the command line const directoryPath = process.argv[2]; // Check is provided, otherwise exit if (!directoryPath) { console.error('Please use: npx ts-node import.ts <directory> <community>'); process.exit(1); } const community = process.argv[3]; // Check is provided, otherwise exit if (!community) { console.error('Please use: npx ts-node import.ts <directory> <community>'); process.exit(1); } // Validate arguments if (!directoryPath || !community) { console.error('Usage: deposit-importer <directory> <community>'); process.exit(1); } // Execute the import process using the provided arguments (0, import_deposit_1.importDeposit)(directoryPath, community) .catch(err => console.error('Error during deposit import:', err));