Skip to content

Commit

Permalink
fix(init, type): reduce apis.all.d.ts file writes
Browse files Browse the repository at this point in the history
  • Loading branch information
lostrepo committed Jun 12, 2024
1 parent 1243306 commit 31bca79
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}
/// <reference no-default-lib="true"/>
${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}
/// <reference no-default-lib="true"/>
${apis_all_dts}`)
encoder.encode(apis_all_dts_str)
)
}

Expand Down

0 comments on commit 31bca79

Please sign in to comment.