mirror of
https://github.com/latentPrion/cppbessot.git
synced 2026-04-17 18:44:23 +00:00
Update with improvements from testing in couresilient
This commit is contained in:
@@ -63,15 +63,28 @@ function(_cppbessot_require_npx_package_executable npx_executable package_execut
|
|||||||
# - No return value; raises FATAL_ERROR if execution fails.
|
# - No return value; raises FATAL_ERROR if execution fails.
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND "${npx_executable}" --no-install "${package_executable}" --help
|
COMMAND "${npx_executable}" --no-install "${package_executable}" --help
|
||||||
RESULT_VARIABLE _exec_result
|
RESULT_VARIABLE _help_result
|
||||||
OUTPUT_QUIET
|
OUTPUT_QUIET
|
||||||
ERROR_VARIABLE _exec_stderr
|
ERROR_VARIABLE _help_stderr
|
||||||
)
|
)
|
||||||
if(NOT _exec_result EQUAL 0)
|
|
||||||
|
if(_help_result EQUAL 0)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Some CLIs return non-zero for --help; verify with version as fallback.
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${npx_executable}" --no-install "${package_executable}" version
|
||||||
|
RESULT_VARIABLE _version_result
|
||||||
|
OUTPUT_QUIET
|
||||||
|
ERROR_VARIABLE _version_stderr
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT _version_result EQUAL 0)
|
||||||
message(FATAL_ERROR
|
message(FATAL_ERROR
|
||||||
"${package_executable} is not available through npx. "
|
"${package_executable} is not available through npx. "
|
||||||
"Ensure the supplying package is installed locally or globally. "
|
"Ensure the supplying package is installed locally or globally. "
|
||||||
"Underlying error: ${_exec_stderr}")
|
"Help check error: ${_help_stderr}\nVersion check error: ${_version_stderr}")
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
@@ -98,6 +111,9 @@ function(cppbessot_check_dependencies)
|
|||||||
_cppbessot_require_program(CPPBESSOT_GIT_EXECUTABLE git
|
_cppbessot_require_program(CPPBESSOT_GIT_EXECUTABLE git
|
||||||
"Install Git and ensure it is available in PATH.")
|
"Install Git and ensure it is available in PATH.")
|
||||||
|
|
||||||
|
_cppbessot_require_npm_package("${CPPBESSOT_NPM_EXECUTABLE}" "@openapitools/openapi-generator-cli")
|
||||||
|
_cppbessot_require_npx_package_executable("${CPPBESSOT_NPX_EXECUTABLE}" "@openapitools/openapi-generator-cli")
|
||||||
|
|
||||||
_cppbessot_require_npm_package("${CPPBESSOT_NPM_EXECUTABLE}" "openapi-zod-client")
|
_cppbessot_require_npm_package("${CPPBESSOT_NPM_EXECUTABLE}" "openapi-zod-client")
|
||||||
_cppbessot_require_npx_package_executable("${CPPBESSOT_NPX_EXECUTABLE}" "openapi-zod-client")
|
_cppbessot_require_npx_package_executable("${CPPBESSOT_NPX_EXECUTABLE}" "openapi-zod-client")
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ function(cppbessot_add_db_gen_zod_target version)
|
|||||||
add_custom_target(db_gen_zod
|
add_custom_target(db_gen_zod
|
||||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${_output_dir}"
|
COMMAND ${CMAKE_COMMAND} -E make_directory "${_output_dir}"
|
||||||
COMMAND "${CPPBESSOT_NPX_EXECUTABLE}" --no-install openapi-zod-client
|
COMMAND "${CPPBESSOT_NPX_EXECUTABLE}" --no-install openapi-zod-client
|
||||||
--input "${_openapi_file}"
|
"${_openapi_file}"
|
||||||
--output "${_output_file}"
|
--output "${_output_file}"
|
||||||
--export-schemas
|
--export-schemas
|
||||||
COMMENT "Generating Zod schemas for ${version}"
|
COMMENT "Generating Zod schemas for ${version}"
|
||||||
|
|||||||
Reference in New Issue
Block a user