chore(cli): add deprecation notice (#4988)

* feat(cli): add deprecation message

* chore: changesets
This commit is contained in:
shadcn
2024-09-27 17:43:16 +04:00
committed by GitHub
parent 96880e7c9a
commit 5fc9ade413
6 changed files with 23 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
"shadcn-ui": patch
---
add deprecation notice

View File

@@ -2,6 +2,9 @@
A CLI for adding components to your project.
> [!WARNING]
> The shadcn-ui CLI is going to be deprecated soon. Bug fixes and new features should be added to the `.packages/shadcn` instead.
## Usage
Use the `init` command to initialize dependencies for a new project.

View File

@@ -1,5 +1,6 @@
import { existsSync, promises as fs } from "fs"
import path from "path"
import { DEPRECATED_MESSAGE } from "@/src/deprecated"
import { getConfig } from "@/src/utils/get-config"
import { getPackageManager } from "@/src/utils/get-package-manager"
import { handleError } from "@/src/utils/handle-error"
@@ -43,6 +44,8 @@ export const add = new Command()
.option("-p, --path <path>", "the path to add the component to.")
.action(async (components, opts) => {
try {
console.log(DEPRECATED_MESSAGE)
const options = addOptionsSchema.parse({
components,
...opts,

View File

@@ -1,5 +1,6 @@
import { existsSync, promises as fs } from "fs"
import path from "path"
import { DEPRECATED_MESSAGE } from "@/src/deprecated"
import {
DEFAULT_COMPONENTS,
DEFAULT_TAILWIND_CONFIG,
@@ -55,6 +56,8 @@ export const init = new Command()
)
.action(async (opts) => {
try {
console.log(DEPRECATED_MESSAGE)
const options = initOptionsSchema.parse(opts)
const cwd = path.resolve(options.cwd)

View File

@@ -0,0 +1,7 @@
import chalk from "chalk"
export const DEPRECATED_MESSAGE = chalk.yellow(
`\nNote: The shadcn-ui CLI is going to be deprecated soon. Please use ${chalk.bold(
"npx shadcn"
)} instead.\n`
)

View File

@@ -4,6 +4,7 @@ import { diff } from "@/src/commands/diff"
import { init } from "@/src/commands/init"
import { Command } from "commander"
import { DEPRECATED_MESSAGE } from "./deprecated"
import { getPackageInfo } from "./utils/get-package-info"
process.on("SIGINT", () => process.exit(0))
@@ -15,6 +16,7 @@ async function main() {
const program = new Command()
.name("shadcn-ui")
.description("add components and dependencies to your project")
.addHelpText("after", DEPRECATED_MESSAGE)
.version(
packageInfo.version || "1.0.0",
"-v, --version",