@sanity/plugin-kit

7.0.28.0.0
dist/verify-studio-DUoKxnYy.js
+dist/verify-studio-DUoKxnYy.jsNew file
+61
Index: package/dist/verify-studio-DUoKxnYy.js
===================================================================
--- package/dist/verify-studio-DUoKxnYy.js
+++ package/dist/verify-studio-DUoKxnYy.js
@@ -0,0 +1,61 @@
+import { a as urls, t as cliName } from "./constants-BLTUL_Wd.js";
+import { t as log_default } from "./log-DgQL-Rv9.js";
+import { A as validateStudioConfig, D as validateSanityDependencies, a as getPackage } from "./package-BrKrShA_.js";
+import { n as verifyFlags, t as createValidator } from "./verify-common-CzG3zw3J.js";
+import meow from "meow";
+import chalk from "chalk";
+import path from "path";
+import outdent from "outdent";
+async function verifyStudio({ basePath, flags }) {
+	let errors = [], packageJson = await getPackage({
+		basePath,
+		validate: !1
+	}), validation = createValidator(packageJson.sanityPlugin?.verifyPackage || {}, flags, errors);
+	if (await validation("studioConfig", async () => validateStudioConfig({ basePath })), await validation("dependencies", async () => validateSanityDependencies(packageJson)), errors.length) throw Error(outdent`
+        Detected validation issues!
+        This Sanity Studio is not completely V3 ready. Fix the issues starting from the top, or disable any checks you deem unnecessary.
+
+        More information is available here:
+        - Migration guide: ${urls.migrationGuideStudio}
+        - Reference documentation: ${urls.refDocs}
+
+        ${chalk.grey(`To fail-fast on first detected issue run:\nnpx ${cliName} verify-studio --single`)}
+      `.trimStart());
+	log_default.success(outdent`
+    No outstanding upgrade issues detected. Studio is V3 ready!
+  `.trim());
+}
+const help = `
+Usage
+  $ ${cliName} verify-studio [dir] [<args>]
+
+Options
+  --single      Enables fail-fast mode: Will only output the first validation that fails.
+  --silent      Do not print info and warning messages
+  --verbose     Log everything. This option conflicts with --silent
+  --version     Output the version number
+  --help        Output usage information
+
+Each check will describe how they can be individually disabled.
+
+Examples
+  # Verify Sanity Studio in current directory
+  $ ${cliName} verify-studio
+
+  # Verify Sanity Studio in my-sanity-studio directory in silent mode
+  $ ${cliName} verify-studio my-sanity-studio --silent
+`;
+function run({ argv }) {
+	let cli = meow(help, {
+		flags: verifyFlags,
+		argv,
+		description: "Verify that a Sanity Studio is configured correctly for v3, and print upgrade steps if not."
+	});
+	return verifyStudio({
+		basePath: path.resolve(cli.input[0] || process.cwd()),
+		flags: cli.flags
+	});
+}
+export { run as default };
+
+//# sourceMappingURL=verify-studio-DUoKxnYy.js.map
\ No newline at end of file