@sanity/plugin-kit
10.0.710.0.8
dist/init-CQLTseJC.js.map−
dist/init-CQLTseJC.js.mapDeleted−1
Index: package/dist/init-CQLTseJC.js.map
===================================================================
--- package/dist/init-CQLTseJC.js.map
+++ package/dist/init-CQLTseJC.js.map
@@ -1,1 +0,0 @@
-{"version":3,"file":"init-CQLTseJC.js","names":[],"sources":["../src/npm/manager.ts","../src/cmds/init.ts"],"sourcesContent":["import {execa} from 'execa'\n\nimport {prompt} from '../util/prompt'\n\nfunction npmIsAvailable() {\n return execa('npm', ['-v'])\n .then(() => true)\n .catch(() => false)\n}\n\nfunction yarnIsAvailable() {\n return execa('yarn', ['-v'])\n .then(() => true)\n .catch(() => false)\n}\n\nfunction pnpmAvailable() {\n return execa('pnpm', ['-v'])\n .then(() => true)\n .catch(() => false)\n}\n\nexport async function promptForPackageManager() {\n const [npm, yarn, pnpm] = await Promise.all([\n npmIsAvailable(),\n yarnIsAvailable(),\n pnpmAvailable(),\n ])\n\n const choices = [npm && 'npm', yarn && 'yarn', pnpm && 'pnpm'].filter(Boolean)\n if (choices.length < 2) {\n return choices[0] || 'npm'\n }\n\n return prompt('Which package manager do you prefer?', {\n choices: choices.map((value) => ({value, name: value})),\n default: choices[0],\n })\n}\n\nexport async function installDependencies(pm: string, {cwd}: {cwd?: string}) {\n // `reject: false` covers non-zero exits; try/catch covers spawn failures (e.g. ENOENT\n // when the package manager binary is missing) so the caller can print its hint\n try {\n const {exitCode} = await execa(pm, ['install'], {cwd, stdio: 'inherit', reject: false})\n return exitCode === 0\n } catch {\n return false\n }\n}\n","import path from 'path'\n\nimport meow from 'meow'\n\nimport {init, initFlags} from '../actions/init'\nimport {cliName} from '../constants'\nimport {installDependencies, promptForPackageManager} from '../npm/manager'\nimport {presetHelpList} from '../presets/presets'\nimport {findStudioConfig} from '../sanity/studio-detect'\nimport {isEmptyish, ensureDir} from '../util/files'\nimport log from '../util/log'\nimport {prompt} from '../util/prompt'\n\nconst description = `Initialize a new Sanity plugin`\n\nconst help = `\nUsage\n $ ${cliName} init [dir] [<args>]\n\nOptions\n --no-oxlint Disables oxlint config and dependencies from being added\n --no-oxfmt Disables oxfmt config and dependencies from being added\n --no-typescript Disables typescript config and dependencies from being added\n --no-license Disables LICENSE + package.json license field from being added\n --no-editorconfig Disables .editorconfig from being added\n --no-gitignore Disables .gitignore from being added\n --no-scripts Disables scripts from being added to package.json\n --no-install Disables automatically running package manager install\n\n --name [package-name] Use the provided package-name\n --author [name] Use the provided author\n --repo [url] Use the provided repo url\n --license [spdx] Use the license with the given SPDX identifier\n --force No prompt when overwriting files\n\n --preset [preset-name] Adds config and files from a named preset. --preset can be supplied multiple times.\n The following presets are available:\n${presetHelpList(30)}\n\nExamples\n # Initialize a new plugin in the current directory\n $ ${cliName} init\n\n # Initialize a plugin in the directory ~/my-plugin\n $ ${cliName} init ~/my-plugin\n\n # Don't add oxlint or oxfmt\n $ ${cliName} init --no-oxlint --no-oxfmt\n`\n\nasync function run({argv}: {argv: string[]}) {\n const cli = meow(help, {importMeta: import.meta, flags: initFlags, argv, description})\n const basePath = path.resolve(cli.input[0] || process.cwd())\n\n const {configFile} = await findStudioConfig(basePath)\n if (configFile) {\n throw new Error(\n `${configFile} exists - are you trying to init into a studio instead of a plugin?`,\n )\n }\n\n log.info('Initializing new plugin in \"%s\"', basePath)\n if (\n !cli.flags.force &&\n !(await isEmptyish(basePath)) &&\n !(await prompt('Directory is not empty, proceed?', {type: 'confirm', default: false}))\n ) {\n log.error('Directory is not empty. Cancelled.')\n return\n }\n\n await ensureDir(basePath)\n await init({basePath, flags: cli.flags})\n if (cli.flags.install) {\n if (await installDependencies(await promptForPackageManager(), {cwd: basePath})) {\n log.info('Done!')\n } else {\n log.error('Failed to install dependencies, try manually running `npm install`')\n }\n } else {\n log.info('Dependency installation skipped.')\n }\n}\n\nexport default run\n"],"mappings":";;;;;;;AAIA,SAAS,iBAAiB;CACxB,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CACxB,WAAW,EAA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