From 2645390e7840f8efbcf655d0d03a022df63ad062 Mon Sep 17 00:00:00 2001 From: shadcn Date: Fri, 27 Sep 2024 17:38:58 +0400 Subject: [PATCH 1/2] feat(cli): add deprecation message --- packages/cli/README.md | 3 +++ packages/cli/src/commands/add.ts | 3 +++ packages/cli/src/commands/init.ts | 3 +++ packages/cli/src/deprecated.ts | 7 +++++++ packages/cli/src/index.ts | 2 ++ 5 files changed, 18 insertions(+) create mode 100644 packages/cli/src/deprecated.ts diff --git a/packages/cli/README.md b/packages/cli/README.md index 49b9014fdf9..816337065e7 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -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. diff --git a/packages/cli/src/commands/add.ts b/packages/cli/src/commands/add.ts index 3bded1a9b6f..abf509f49ff 100644 --- a/packages/cli/src/commands/add.ts +++ b/packages/cli/src/commands/add.ts @@ -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 ", "the path to add the component to.") .action(async (components, opts) => { try { + console.log(DEPRECATED_MESSAGE) + const options = addOptionsSchema.parse({ components, ...opts, diff --git a/packages/cli/src/commands/init.ts b/packages/cli/src/commands/init.ts index 78893dc530d..4ba66f47c26 100644 --- a/packages/cli/src/commands/init.ts +++ b/packages/cli/src/commands/init.ts @@ -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) diff --git a/packages/cli/src/deprecated.ts b/packages/cli/src/deprecated.ts new file mode 100644 index 00000000000..e143fb3e07f --- /dev/null +++ b/packages/cli/src/deprecated.ts @@ -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` +) diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index f92c33c2714..5a3e938d8cf 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -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", From 959def859f164d8805ccf154a5e01ab21980e479 Mon Sep 17 00:00:00 2001 From: shadcn Date: Fri, 27 Sep 2024 17:39:25 +0400 Subject: [PATCH 2/2] chore: changesets --- .changeset/small-plums-swim.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/small-plums-swim.md diff --git a/.changeset/small-plums-swim.md b/.changeset/small-plums-swim.md new file mode 100644 index 00000000000..cd25161ef71 --- /dev/null +++ b/.changeset/small-plums-swim.md @@ -0,0 +1,5 @@ +--- +"shadcn-ui": patch +--- + +add deprecation notice