Skip to content

Commit

Permalink
fix: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Bekacru committed Jul 3, 2023
1 parent 5f2d772 commit 7186898
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
7 changes: 6 additions & 1 deletion packages/cli/src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ export async function promptForConfig(

const styles = await getRegistryStyles()
const baseColors = await getRegistryBaseColors()
const { DEFAULT_COMPONENTS, DEFAULT_TAILWIND_CONFIG, DEFAULT_UTILS, DEFAULT_TAILWIND_CSS } = await getDefaultValues()
const {
DEFAULT_COMPONENTS,
DEFAULT_TAILWIND_CONFIG,
DEFAULT_UTILS,
DEFAULT_TAILWIND_CSS,
} = await getDefaultValues()

const options = await prompts([
{
Expand Down
13 changes: 8 additions & 5 deletions packages/cli/src/utils/get-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { resolveImport } from "@/src/utils/resolve-import"
import { cosmiconfig } from "cosmiconfig"
import { loadConfig } from "tsconfig-paths"
import * as z from "zod"
import { getProjectInfo } from "./get-project-info"

import { getProjectInfo } from "./get-project-info"

// TODO: Figure out if we want to support all cosmiconfig formats.
// A simple components.json file would be nice.
Expand Down Expand Up @@ -88,17 +88,20 @@ export async function getRawConfig(cwd: string): Promise<RawConfig | null> {
}
}


export const getDefaultValues = async () => {
const { srcDir, appDir, tsconfig } = await getProjectInfo()
const src = srcDir ? "src/" : ""
let alias: string = tsconfig?.compilerOptions?.paths ? Object.keys(tsconfig.compilerOptions.paths)[0].split("/")[0] ?? "@" : ""
let alias: string = tsconfig?.compilerOptions?.paths
? Object.keys(tsconfig.compilerOptions.paths)[0].split("/")[0] ?? "@"
: ""
return {
DEFAULT_TAILWIND_CSS: appDir ? `${src}app/globals.css` : `${src}styles/global.css`,
DEFAULT_TAILWIND_CSS: appDir
? `${src}app/globals.css`
: `${src}styles/global.css`,
DEFAULT_COMPONENTS: `${alias}/components`,
DEFAULT_UTILS: `${alias}/lib/utils`,
DEFAULT_TAILWIND_BASE_COLOR: "slate",
DEFAULT_TAILWIND_CONFIG: "tailwind.config.js",
DEFAULT_STYLE: "default",
}
}
}

0 comments on commit 7186898

Please sign in to comment.