-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(shadcn-ui): Fixed user input not propagating to lib
- Loading branch information
Showing
2 changed files
with
29 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
import { detectPackageManager, getPackageManagerCommand } from 'nx/src/utils/package-manager' | ||
import { | ||
detectPackageManager, | ||
getPackageManagerCommand as nxGetPackageManagerCommand | ||
} from 'nx/src/utils/package-manager' | ||
|
||
import { buildCommand } from './build-command' | ||
import { execCommand, Options } from './exec' | ||
|
||
export function getPackageManagerDlxCommand() { | ||
return getPackageManagerCommand(detectPackageManager()).dlx | ||
return nxGetPackageManagerCommand(detectPackageManager()).dlx | ||
} | ||
|
||
export function getPackageManagerCommand() { | ||
return process.env.NX_EXTEND_COMMAND_USE_NPX ? 'npx' : getPackageManagerDlxCommand() | ||
} | ||
|
||
export function execPackageManagerCommand(command: string, options?: Options) { | ||
return execCommand(buildCommand([ | ||
process.env.NX_EXTEND_COMMAND_USE_NPX ? 'npx' : getPackageManagerDlxCommand(), | ||
getPackageManagerCommand(), | ||
command | ||
]), options) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
import { ExecutorContext } from '@nx/devkit' | ||
import { buildCommand, execPackageManagerCommand } from '@nx-extend/core' | ||
import { workspaceRoot } from '@nx/devkit' | ||
import { buildCommand, getPackageManagerCommand } from '@nx-extend/core' | ||
import { execSync } from 'child_process' | ||
|
||
export interface ExecutorSchema { | ||
component?: string | ||
overwrite?: boolean | ||
} | ||
|
||
export async function addExecutor( | ||
options: ExecutorSchema, | ||
context: ExecutorContext | ||
): Promise<{ success: boolean }> { | ||
return execPackageManagerCommand( | ||
buildCommand([ | ||
'shadcn@latest add', | ||
(options.component ?? '').length === 0 ? '--all' : options.component, | ||
options.overwrite && '--overwrite' | ||
]), | ||
{ | ||
env: { | ||
...process.env, | ||
TS_NODE_PROJECT: 'tsconfig.base.json' | ||
} | ||
} | ||
) | ||
export async function addExecutor(options: ExecutorSchema): Promise<{ success: boolean }> { | ||
execSync(buildCommand([ | ||
getPackageManagerCommand(), | ||
'shadcn@latest add', | ||
(options.component ?? '').length === 0 ? '--all' : options.component, | ||
options.overwrite && '--overwrite' | ||
]), { | ||
cwd: workspaceRoot, | ||
env: { | ||
...process.env, | ||
TS_NODE_PROJECT: 'tsconfig.base.json' | ||
}, | ||
stdio: 'inherit' | ||
}) | ||
|
||
return { success: true } | ||
} | ||
|
||
export default addExecutor |