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 24, 2024
1 parent 1a53b9e commit 8dab870
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 8dab870

Please sign in to comment.