import path from 'path' ; import parseArgs from 'minimist' ; import { TGetPathToTargetWorkspaceRootDirFromCLIArgs } from '../../types' ; /**
 * Returns the path to the workspace root directory from the CLI args.
 * If is a relative path to transform it to an absolute path (basically needed just by contributors for testing|development mode this last feature).
 */ const getPathToTargetWorkspaceRootDirFromCLIArgs = ( ) => { const rawArgs = process . argv . slice ( 2 ) ; const parsedArguments = parseArgs ( rawArgs ) ; const rawPathToTargetWorkspaceRootDir = ( parsedArguments [ 'path-to-workspace-root-dir' ] || parsedArguments . w ) as string ; return path . isAbsolute ( rawPathToTargetWorkspaceRootDir ) ? rawPathToTargetWorkspaceRootDir : path . resolve ( process . cwd ( ) , rawPathToTargetWorkspaceRootDir ) ; } ; export default getPathToTargetWorkspaceRootDirFromCLIArgs ;