Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
kewldan authored Sep 30, 2024
2 parents e1142ec + 36ebbf2 commit 3d3e0c8
Show file tree
Hide file tree
Showing 87 changed files with 3,154 additions and 34 deletions.
5 changes: 0 additions & 5 deletions .changeset/hip-moose-add.md

This file was deleted.

7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,9 @@ yarn-error.log*
.turbo

.contentlayer
tsconfig.tsbuildinfo
tsconfig.tsbuildinfo

# ide
.idea
.fleet
.vscode
13 changes: 4 additions & 9 deletions apps/www/content/docs/figma.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,10 @@ title: Figma
description: Every component recreated in Figma. With customizable props, typography and icons.
---

The Figma UI Kit is open sourced by [Pietro Schirano](https://twitter.com/skirano).
## Paid

<AspectRatio ratio={16 / 9} className="w-full mt-4">
<iframe
src="https://embed.figma.com/file/1203061493325953101/hf_embed?community_viewer=true&embed_host=shadcn&hub_file_id=1203061493325953101&kind=&viewer=1"
className="h-full w-full overflow-hidden rounded-lg border bg-muted"
/>
</AspectRatio>
- [shadcn/ui kit](http://shadcndesign.com) by [ Matt Wierzbicki](https://x.com/matsugfx) - A premium, always up-to-date UI kit for Figma - shadcn/ui compatible and optimized for smooth design-to-dev handoff.

## Grab a copy
## Free

https://www.figma.com/community/file/1203061493325953101
- [shadcn/ui design system](https://www.figma.com/community/file/1203061493325953101) by [Pietro Schirano](https://twitter.com/skirano) - A design companion for shadcn/ui. Each component was painstakingly crafted to perfectly match the code implementation.
2 changes: 1 addition & 1 deletion apps/www/content/docs/installation/remix.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default {
In your `app/root.tsx` file, import the `tailwind.css` file:

```js {1, 4}
import styles from "./tailwind.css"
import styles from "./tailwind.css?url"

export const links: LinksFunction = () => [
{ rel: "stylesheet", href: styles },
Expand Down
6 changes: 6 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @shadcn/ui

## 0.9.2

### Patch Changes

- [#4988](https://github.com/shadcn-ui/ui/pull/4988) [`5fc9ade`](https://github.com/shadcn-ui/ui/commit/5fc9ade413ea10da422a2439b5cc2027fb2a055e) Thanks [@shadcn](https://github.com/shadcn)! - add deprecation notice

## 0.9.1

### Patch Changes
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "shadcn-ui",
"version": "0.9.1",
"version": "0.9.2",
"description": "Add components to your apps.",
"publishConfig": {
"access": "public"
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/src/commands/add.ts
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/src/commands/init.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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)

Expand Down
7 changes: 7 additions & 0 deletions packages/cli/src/deprecated.ts
Original file line number Diff line number Diff line change
@@ -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`
)
2 changes: 2 additions & 0 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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",
Expand Down
12 changes: 12 additions & 0 deletions packages/shadcn/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @shadcn/ui

## 2.1.0

### Minor Changes

- [#4961](https://github.com/shadcn-ui/ui/pull/4961) [`28f34ed`](https://github.com/shadcn-ui/ui/commit/28f34ed3c3e944287cd6f521ff0310d39664329c) Thanks [@shadcn](https://github.com/shadcn)! - recursively resolve registry dependencies

### Patch Changes

- [#4972](https://github.com/shadcn-ui/ui/pull/4972) [`4b546bf`](https://github.com/shadcn-ui/ui/commit/4b546bfb13346fdbaf0fca4e8041ddba35d23f47) Thanks [@Fluf22](https://github.com/Fluf22)! - update remix detection

- [#4977](https://github.com/shadcn-ui/ui/pull/4977) [`96880e7`](https://github.com/shadcn-ui/ui/commit/96880e7c9afad3fed6749c5862d05dbfd65c4327) Thanks [@nsunami](https://github.com/nsunami)! - fix typo in components.json

## 2.0.8

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/shadcn/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "shadcn",
"version": "2.0.8",
"version": "2.1.0",
"description": "Add components to your apps.",
"publishConfig": {
"access": "public"
Expand Down
4 changes: 2 additions & 2 deletions packages/shadcn/src/commands/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ export const add = new Command()

let { errors, config } = await preFlightAdd(options)

// No component.json file. Prompt the user to run init.
// No components.json file. Prompt the user to run init.
if (errors[ERRORS.MISSING_CONFIG]) {
const { proceed } = await prompts({
type: "confirm",
name: "proceed",
message: `You need to create a ${highlighter.info(
"component.json"
"components.json"
)} file to add components. Proceed?`,
initial: true,
})
Expand Down
2 changes: 1 addition & 1 deletion packages/shadcn/src/utils/get-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export async function getRawConfig(cwd: string): Promise<RawConfig | null> {

return rawConfigSchema.parse(configResult.config)
} catch (error) {
const componentPath = `${cwd}/component.json`
const componentPath = `${cwd}/components.json`
throw new Error(
`Invalid configuration found in ${highlighter.info(componentPath)}.`
)
Expand Down
11 changes: 8 additions & 3 deletions packages/shadcn/src/utils/get-package-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ import path from "path"
import fs from "fs-extra"
import { type PackageJson } from "type-fest"

export function getPackageInfo() {
const packageJsonPath = path.join("package.json")
export function getPackageInfo(
cwd: string = "",
shouldThrow: boolean = true
): PackageJson | null {
const packageJsonPath = path.join(cwd, "package.json")

return fs.readJSONSync(packageJsonPath) as PackageJson
return fs.readJSONSync(packageJsonPath, {
throws: shouldThrow,
}) as PackageJson
}
27 changes: 17 additions & 10 deletions packages/shadcn/src/utils/get-project-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
getConfig,
resolveConfigPaths,
} from "@/src/utils/get-config"
import { getPackageInfo } from "@/src/utils/get-package-info"
import fg from "fast-glob"
import fs from "fs-extra"
import { loadConfig } from "tsconfig-paths"
Expand Down Expand Up @@ -36,6 +37,7 @@ export async function getProjectInfo(cwd: string): Promise<ProjectInfo | null> {
tailwindConfigFile,
tailwindCssFile,
aliasPrefix,
packageJson,
] = await Promise.all([
fg.glob("**/{next,vite,astro}.config.*|gatsby-config.*|composer.json", {
cwd,
Expand All @@ -47,6 +49,7 @@ export async function getProjectInfo(cwd: string): Promise<ProjectInfo | null> {
getTailwindConfigFile(cwd),
getTailwindCssFile(cwd),
getTsConfigAliasPrefix(cwd),
getPackageInfo(cwd, false),
])

const isUsingAppDir = await fs.pathExists(
Expand All @@ -63,10 +66,6 @@ export async function getProjectInfo(cwd: string): Promise<ProjectInfo | null> {
aliasPrefix,
}

if (!configFiles.length) {
return type
}

// Next.js.
if (configFiles.find((file) => file.startsWith("next.config."))?.length) {
type.framework = isUsingAppDir
Expand Down Expand Up @@ -94,13 +93,21 @@ export async function getProjectInfo(cwd: string): Promise<ProjectInfo | null> {
return type
}

// Vite and Remix.
// They both have a vite.config.* file.
// Remix.
if (
Object.keys(packageJson?.dependencies ?? {}).find((dep) =>
dep.startsWith("@remix-run/")
)
) {
type.framework = FRAMEWORKS["remix"]
return type
}

// Vite.
// Some Remix templates also have a vite.config.* file.
// We'll assume that it got caught by the Remix check above.
if (configFiles.find((file) => file.startsWith("vite.config."))?.length) {
// We'll assume that if the project has an app dir, it's a Remix project.
// Otherwise, it's a Vite project.
// TODO: Maybe check for `@remix-run/react` in package.json?
type.framework = isUsingAppDir ? FRAMEWORKS["remix"] : FRAMEWORKS["vite"]
type.framework = FRAMEWORKS["vite"]
return type
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/node_modules
*.log
.DS_Store
.env
/.cache
/public/build
/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DATABASE_URL="file:./data.db?connection_limit=1"
SESSION_SECRET="super-duper-s3cret"
Loading

0 comments on commit 3d3e0c8

Please sign in to comment.