contentful-import
Version:
this tool allows you to import JSON dump exported by contentful-export
103 lines (99 loc) • 4.21 kB
JavaScript
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// lib/usageParams.ts
var usageParams_exports = {};
__export(usageParams_exports, {
default: () => usageParams_default
});
module.exports = __toCommonJS(usageParams_exports);
var import_yargs = __toESM(require("yargs"));
// package.json
var version = "0.0.0-determined-by-semantic-release";
// lib/usageParams.ts
var usageParams_default = import_yargs.default.version(version || "Version only available on installed package").usage("Usage: $0 [options]").option("space-id", {
describe: "ID of the destination space",
type: "string",
demand: true
}).option("environment-id", {
describe: "ID the environment in the destination space",
type: "string",
default: "master",
demand: false
}).option("management-token", {
describe: "Contentful management API token for the destination space",
type: "string",
demand: true
}).option("content-file", {
describe: "JSON file that contains data to be import to your space",
type: "string",
demand: true
}).option("content-model-only", {
describe: "Import only content types",
type: "boolean",
default: false
}).option("skip-content-model", {
describe: "Skip importing content types and locales",
type: "boolean",
default: false
}).option("skip-locales", {
describe: "Skip importing locales",
type: "boolean",
default: false
}).option("skip-content-publishing", {
describe: "Skips content publishing. Creates content but does not publish it",
type: "boolean",
default: false
}).option("upload-assets", {
describe: "Uses local asset files and uploads them instead of pointing to the URLs of previously uploaded assets. Requires assets-directory",
type: "boolean"
}).implies("upload-assets", "assets-directory").option("assets-directory", {
describe: "Path to a directory with an asset export made using the downloadAssets option to upload those files instead of pointing to the URLs of previously uploaded assets. Requires upload-assets",
type: "string"
}).implies("assets-directory", "upload-assets").option("error-log-file", {
describe: "Full path to the error log file",
type: "string"
}).option("host", {
describe: "Management API host",
type: "string",
default: "api.contentful.com"
}).option("proxy", {
describe: "Proxy configuration in HTTP auth format: [http|https]://host:port or [http|https]://user:password@host:port",
type: "string"
}).option("raw-proxy", {
describe: "Pass proxy config to Axios instead of creating a custom httpsAgent",
type: "boolean",
default: false
}).option("rate-limit", {
describe: "Maximum requests per second used for API requests",
type: "number",
default: 7
}).option("header", {
alias: "H",
type: "string",
describe: "Pass an additional HTTP Header"
}).config("config", "An optional configuration JSON file containing all the options for a single run").argv;