File tree Expand file tree Collapse file tree
remove-json-keys/src/remove_json_keys/lib
translate-messages/src/translate_messages/lib Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,14 +23,15 @@ def config_file(cli):
2323 return
2424 cli .config_filename = f'.{ cli .name } .config.jsonc'
2525 cli .config_filepath = os .path .join (cli .project_root , cli .config_filename )
26- try :
27- jsd_url = f'{ cli .urls .jsdelivr } /{ cli .name } /{ cli .config_filename } '
28- resp = requests .get (jsd_url , timeout = 5 )
29- resp .raise_for_status ()
30- cli .file_config = resp .json ()
31- except (requests .RequestException , ValueError ) as err :
32- raise RuntimeError (f"Failed to fetch default config from { jsd_url } : { err } " )
33- data .json .write (cli .file_config , cli .config_filepath )
26+ if not cli .default_file_config :
27+ try :
28+ jsd_url = f'{ cli .urls .jsdelivr } /{ cli .name } /{ cli .config_filename } '
29+ resp = requests .get (jsd_url , timeout = 5 )
30+ resp .raise_for_status ()
31+ cli .default_file_config = resp .json ()
32+ except (requests .RequestException , ValueError ) as err :
33+ raise RuntimeError (f"Failed to fetch default config from { jsd_url } : { err } " )
34+ data .json .write (cli .default_file_config , cli .config_filepath )
3435 log .success (f'Default config created at { cli .config_filepath } ' )
3536
3637def locales_dir (target_dir ):
Original file line number Diff line number Diff line change @@ -17,14 +17,15 @@ def config_file(cli):
1717 return
1818 cli .config_filename = f'.{ cli .short_name } .config.jsonc'
1919 cli .config_filepath = os .path .join (cli .project_root , cli .config_filename )
20- try :
21- jsd_url = f'{ cli .urls .jsdelivr } /{ cli .name } /{ cli .config_filename } '
22- resp = requests .get (jsd_url , timeout = 5 )
23- resp .raise_for_status ()
24- cli .file_config = resp .json ()
25- except (requests .RequestException , ValueError ) as err :
26- raise RuntimeError (f"Failed to fetch default config from { jsd_url } : { err } " )
27- data .json .write (cli .file_config , cli .config_filepath )
20+ if not cli .default_file_config :
21+ try :
22+ jsd_url = f'{ cli .urls .jsdelivr } /{ cli .name } /{ cli .config_filename } '
23+ resp = requests .get (jsd_url , timeout = 5 )
24+ resp .raise_for_status ()
25+ cli .default_file_config = resp .json ()
26+ except (requests .RequestException , ValueError ) as err :
27+ raise RuntimeError (f"Failed to fetch default config from { jsd_url } : { err } " )
28+ data .json .write (cli .default_file_config , cli .config_filepath )
2829 log .success (f'Default config created at { cli .config_filepath } ' )
2930
3031def locales_dir (target_dir ):
You can’t perform that action at this time.
0 commit comments