UNPKG

@nuxt/cli

Version:
38 lines (37 loc) • 1.29 kB
import { h as defineCommand } from "./_shared-B9W-9akb.mjs"; import { h as logger } from "./startup-clock-SyYej6uN.mjs"; import process from "node:process"; import { styleText } from "node:util"; import "std-env"; import "pathe"; // src/utils/headless.ts const createCommands = { npm: "npm create nuxt@latest", pnpm: "pnpm create nuxt@latest", yarn: "yarn create nuxt@latest", bun: "bun create nuxt@latest", deno: "deno run -A npm:create-nuxt@latest" }; function currentPackageManager(userAgent) { const name = userAgent?.split("/")[0]; return name && name in createCommands ? name : void 0; } /** How to scaffold a project with the latest release, in the user's package manager. */ function getCreateCommand(userAgent = process.env.npm_config_user_agent) { return createCommands[currentPackageManager(userAgent) ?? "npm"]; } // src/commands/init.ts var init_default = defineCommand({ meta: { name: "init", description: "Scaffold a fresh project (moved to create-nuxt)", hidden: true }, run(ctx) { const command = [getCreateCommand(), ...ctx.rawArgs].join(" "); logger.info(`Project scaffolding now lives in ${styleText("cyan", "create-nuxt")}.`); logger.info(`Run ${styleText("cyan", command)} instead.`); process.exit(1); } }); export { init_default as default };