Skip to content

Commit

Permalink
fix(shadcn-ui): Update alias paths
Browse files Browse the repository at this point in the history
  • Loading branch information
TriPSs committed Dec 13, 2024
1 parent fd78290 commit 645ca55
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
8 changes: 2 additions & 6 deletions packages/core/src/utils/exec-package-manager-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
4 changes: 2 additions & 2 deletions packages/shadcn-ui/src/executors/add/add.impl.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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'
Expand Down
5 changes: 3 additions & 2 deletions packages/shadcn-ui/src/generators/init/init.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`
}
})

Expand Down

0 comments on commit 645ca55

Please sign in to comment.