diff --git a/packages/core/src/utils/exec-package-manager-command.ts b/packages/core/src/utils/exec-package-manager-command.ts index 0735622b..90a957cb 100644 --- a/packages/core/src/utils/exec-package-manager-command.ts +++ b/packages/core/src/utils/exec-package-manager-command.ts @@ -7,16 +7,12 @@ import { buildCommand } from './build-command' import { execCommand, Options } from './exec' export function getPackageManagerDlxCommand() { - return nxGetPackageManagerCommand(detectPackageManager()).dlx -} - -export function getPackageManagerCommand() { - return process.env.NX_EXTEND_COMMAND_USE_NPX ? 'npx' : getPackageManagerDlxCommand() + return process.env.NX_EXTEND_COMMAND_USE_NPX ? 'npx' : nxGetPackageManagerCommand(detectPackageManager()).dlx } export function execPackageManagerCommand(command: string, options?: Options) { return execCommand(buildCommand([ - getPackageManagerCommand(), + getPackageManagerDlxCommand(), command ]), options) } diff --git a/packages/shadcn-ui/src/executors/add/add.impl.ts b/packages/shadcn-ui/src/executors/add/add.impl.ts index 5f02f583..11bfe725 100644 --- a/packages/shadcn-ui/src/executors/add/add.impl.ts +++ b/packages/shadcn-ui/src/executors/add/add.impl.ts @@ -1,5 +1,5 @@ import { workspaceRoot } from '@nx/devkit' -import { buildCommand, getPackageManagerCommand } from '@nx-extend/core' +import { buildCommand, getPackageManagerDlxCommand } from '@nx-extend/core' import { execSync } from 'child_process' export interface ExecutorSchema { @@ -9,7 +9,7 @@ export interface ExecutorSchema { export async function addExecutor(options: ExecutorSchema): Promise<{ success: boolean }> { execSync(buildCommand([ - getPackageManagerCommand(), + getPackageManagerDlxCommand(), 'shadcn@latest add', (options.component ?? '').length === 0 ? '--all' : options.component, options.overwrite && '--overwrite' diff --git a/packages/shadcn-ui/src/generators/init/init.impl.ts b/packages/shadcn-ui/src/generators/init/init.impl.ts index ca244e09..e612f3e7 100644 --- a/packages/shadcn-ui/src/generators/init/init.impl.ts +++ b/packages/shadcn-ui/src/generators/init/init.impl.ts @@ -89,9 +89,10 @@ export default async function (tree: Tree, options: ShadecnUiSchema) { 'cssVariables': true }, 'aliases': { - 'components': uiLibOptions.importPath, + 'ui': uiLibOptions.importPath, + 'components': `${uiLibOptions.importPath}/components`, 'utils': utilsLibOptions.importPath, - "hooks": `${uiLibOptions.importPath}/hooks` + 'hooks': `${uiLibOptions.importPath}/hooks` } })