From 8dab87073cf161600cea65af5cb62d9379b0a5df Mon Sep 17 00:00:00 2001 From: lostrepo Date: Wed, 12 Jun 2024 23:25:53 +0300 Subject: [PATCH] fix(init, type): reduce apis.all.d.ts file writes --- lib/types.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/types.js b/lib/types.js index b98550a..6278574 100644 --- a/lib/types.js +++ b/lib/types.js @@ -57,11 +57,17 @@ export function add_lib_apisalldts (lib_dir = 'lib') { // lib/apis.all.d.ts const lib_apis_all_dts_path = `${lib_dir}/apis.all.d.ts` + const apis_all_dts_str = `${auogenerated_warning_line} +/// +${apis_all_dts}` + + if (is_file(lib_apis_all_dts_path) + && new TextDecoder().decode(read_file(lib_apis_all_dts_path)) == apis_all_dts_str + ) return + write_file( lib_apis_all_dts_path, - encoder.encode(`${auogenerated_warning_line} - /// - ${apis_all_dts}`) + encoder.encode(apis_all_dts_str) ) }