UNPKG

@shopify/create-app

Version:

A CLI tool to create a new Shopify app.

79 lines (74 loc) 2.4 kB
import { getNextDeprecationDate, reportAnalyticsEvent } from "./chunk-M7VMC3PN.js"; import { addSensitiveMetadata, getAllSensitiveMetadata, outputDebug, renderWarning } from "./chunk-YZFEE3WJ.js"; import { init_cjs_shims } from "./chunk-PKR7KJ6P.js"; // ../cli-kit/dist/public/node/hooks/postrun.js init_cjs_shims(); // ../cli-kit/dist/public/node/hooks/deprecations.js init_cjs_shims(); var postrun = (Command) => { let nextDeprecationDate = getNextDeprecationDate(); if (nextDeprecationDate) { let forThemes = Command.id.includes("theme"); renderUpgradeWarning(nextDeprecationDate, forThemes); } }; function renderUpgradeWarning(upgradeByDate, forThemes) { let headline = `Upgrade to the latest CLI version by ${new Intl.DateTimeFormat("default", { year: "numeric", month: "long", day: "numeric" }).format(upgradeByDate)}.`; renderWarning({ headline, body: "This command requires an upgrade to continue working as intended.", nextSteps: [["Run", { command: "upgrade" }, "to", { link: { label: "upgrade Shopify CLI", url: forThemes ? "https://shopify.dev/docs/themes/tools/cli#upgrade-shopify-cli" : "https://shopify.dev/docs/apps/tools/cli#upgrade-shopify-cli" } }]] }); } // ../cli-kit/dist/public/node/hooks/postrun.js var postRunHookCompleted = !1; function postRunHookHasCompleted() { return postRunHookCompleted; } var hook = async ({ config, Command }) => { await detectStopCommand(Command), await reportAnalyticsEvent({ config, exitMode: "ok" }), postrun(Command); let command = Command.id.replace(/:/g, " "); outputDebug(`Completed command ${command}`), postRunHookCompleted = !0; }; async function detectStopCommand(commandClass) { let currentTime = (/* @__PURE__ */ new Date()).getTime(); if (commandClass && Object.prototype.hasOwnProperty.call(commandClass, "analyticsStopCommand")) { let stopCommand = commandClass.analyticsStopCommand(); if (stopCommand) { let { commandStartOptions } = getAllSensitiveMetadata(); if (!commandStartOptions) return; await addSensitiveMetadata(() => ({ commandStartOptions: { ...commandStartOptions, startTime: currentTime, startCommand: stopCommand } })); } } } export { postRunHookHasCompleted, hook }; //# sourceMappingURL=chunk-YXRIPYLR.js.map