mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-02-09 02:49:29 +08:00
chore(cli): add deprecation notice (#4988)
* feat(cli): add deprecation message * chore: changesets
This commit is contained in:
5
.changeset/small-plums-swim.md
Normal file
5
.changeset/small-plums-swim.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"shadcn-ui": patch
|
||||
---
|
||||
|
||||
add deprecation notice
|
||||
@@ -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.
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
7
packages/cli/src/deprecated.ts
Normal file
7
packages/cli/src/deprecated.ts
Normal 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`
|
||||
)
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user