|
13 | 13 |
|
14 | 14 | # Get the path to the JS source directory |
15 | 15 | js_src_dir = pathlib.Path(__file__).parent.parent / "js" |
16 | | - |
17 | | -# Get the paths to all `dist` folders in the JS source directory |
18 | | -dist_dirs = glob.glob(str(js_src_dir / "**/dist"), recursive=True) |
19 | | - |
20 | | -# Get the paths to all `node_modules` folders in the JS source directory |
21 | | -node_modules_dirs = glob.glob(str(js_src_dir / "**/node_modules"), recursive=True) |
22 | | - |
23 | | -# Get the paths to all `tsconfig.tsbuildinfo` files in the JS source directory |
24 | | -tsconfig_tsbuildinfo_files = glob.glob( |
25 | | - str(js_src_dir / "**/tsconfig.tsbuildinfo"), recursive=True |
26 | | -) |
| 16 | +static_output_dir = pathlib.Path(__file__).parent.parent / "reactpy" / "static" |
27 | 17 |
|
28 | 18 | # Delete all `dist` folders |
| 19 | +dist_dirs = glob.glob(str(js_src_dir / "**/dist"), recursive=True) |
29 | 20 | for dist_dir in dist_dirs: |
30 | 21 | with contextlib.suppress(FileNotFoundError): |
31 | 22 | shutil.rmtree(dist_dir) |
32 | 23 |
|
33 | 24 | # Delete all `node_modules` folders |
| 25 | +node_modules_dirs = glob.glob(str(js_src_dir / "**/node_modules"), recursive=True) |
34 | 26 | for node_modules_dir in node_modules_dirs: |
35 | 27 | with contextlib.suppress(FileNotFoundError): |
36 | 28 | shutil.rmtree(node_modules_dir) |
37 | 29 |
|
38 | 30 | # Delete all `tsconfig.tsbuildinfo` files |
| 31 | +tsconfig_tsbuildinfo_files = glob.glob( |
| 32 | + str(js_src_dir / "**/tsconfig.tsbuildinfo"), recursive=True |
| 33 | +) |
39 | 34 | for tsconfig_tsbuildinfo_file in tsconfig_tsbuildinfo_files: |
40 | 35 | with contextlib.suppress(FileNotFoundError): |
41 | 36 | os.remove(tsconfig_tsbuildinfo_file) |
| 37 | + |
| 38 | +# Delete all `index-*.js` files |
| 39 | +index_js_files = glob.glob(str(static_output_dir / "index-*.js*")) |
| 40 | +for index_js_file in index_js_files: |
| 41 | + with contextlib.suppress(FileNotFoundError): |
| 42 | + os.remove(index_js_file) |
0 commit comments