@sanity/plugin-kit

7.0.28.0.0
dist/inject-B41UktQ3.js
+dist/inject-B41UktQ3.jsNew file
+62
Index: package/dist/inject-B41UktQ3.js
===================================================================
--- package/dist/inject-B41UktQ3.js
+++ package/dist/inject-B41UktQ3.js
@@ -0,0 +1,62 @@
+import { t as cliName } from "./constants-BLTUL_Wd.js";
+import { t as log_default } from "./log-DgQL-Rv9.js";
+import { i as presetHelpList, n as initFlags, r as inject } from "./init-BDY7XRmJ.js";
+import { u as findStudioV3Config } from "./package-BrKrShA_.js";
+import { t as loadPackageConfig } from "./load-package-config-CNQRvdGW.js";
+import meow from "meow";
+import path from "path";
+const help = `
+Usage
+  $ ${cliName} inject [dir] [<args>]
+
+Options
+  --no-oxlint             Disables oxlint config and dependencies from being added
+  --no-oxfmt              Disables oxfmt config and dependencies from being added
+  --no-typescript         Disables typescript config and dependencies from being added
+  --no-license            Disables LICENSE + package.json license field from being added
+  --no-editorconfig       Disables .editorconfig from being added
+  --no-gitignore          Disables .gitignore from being added
+  --no-scripts            Disables scripts from being added to package.json
+
+  --license [spdx]        Use the license with the given SPDX identifier
+  --force                 No prompt when overwriting files
+
+  --preset [preset-name]  Adds config and files from a named preset. --preset can be supplied multiple times.
+                          The following presets are available:
+${presetHelpList(30)}
+  --preset-only           Skips the default inject steps. Use this to apply a preset to an otherwise complete plugin.
+
+Examples
+  # Inject configuration into the plugin in the current directory
+  $ ${cliName} inject
+
+  # Inject configuration into the plugin in ~/my-plugin
+  $ ${cliName} inject ~/my-plugin
+
+  # Don't inject oxlint or oxfmt
+  $ ${cliName} inject --no-oxlint --no-oxfmt
+
+  # Inject plugin configuration and semver-workflow into the plugin in the current directory
+  $ @sanity/plugin-kit inject --preset semver-workflow
+
+  # Only inject semver-workflow and renovatebot config from presets
+  $ ${cliName} inject --preset-only --preset semver-workflow --preset renovatebot
+
+`;
+async function run({ argv }) {
+	let cli = meow(help, {
+		flags: initFlags,
+		argv,
+		description: "Inject configuration into a Sanity plugin"
+	}), basePath = path.resolve(cli.input[0] || process.cwd()), outDir = (await loadPackageConfig({ basePath }))?.dist ?? "dist", { v3ConfigFile } = await findStudioV3Config(basePath);
+	if (v3ConfigFile) throw Error(`${v3ConfigFile} exists - are you trying to INJECT into a studio instead of a plugin?`);
+	log_default.info("Inject config into plugin in \"%s\"", basePath), await inject({
+		basePath,
+		outDir,
+		flags: cli.flags,
+		validate: !1
+	}), log_default.info("Done!");
+}
+export { run as default };
+
+//# sourceMappingURL=inject-B41UktQ3.js.map
\ No newline at end of file