UNPKG

@bluecadet/launchpad-cli

Version:
24 lines 1.25 kB
import { err, ResultAsync } from "neverthrow"; import { ConfigError, ImportError } from "../errors.js"; import { handleFatalError, initializeLogger, loadConfigAndEnv } from "../utils/command-utils.js"; export function content(argv) { return loadConfigAndEnv(argv) .mapErr((error) => handleFatalError(error, console)) .andThen(({ dir, config }) => { return initializeLogger(config, dir).asyncAndThen((rootLogger) => { return importLaunchpadContent() .andThen(({ default: LaunchpadContent }) => { if (!config.content) { return err(new ConfigError("No content config found in your config file.")); } const contentInstance = new LaunchpadContent(config.content, rootLogger, dir); return contentInstance.download(); }) .orElse((error) => handleFatalError(error, rootLogger)); }); }); } export function importLaunchpadContent() { return ResultAsync.fromPromise(import("@bluecadet/launchpad-content"), (e) => new ImportError('Could not find module "@bluecadet/launchpad-content". Make sure you have installed it.', { cause: e })); } //# sourceMappingURL=content.js.map