9
9
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
10
10
# specific language governing permissions and limitations under the License.
11
11
12
+ import os
12
13
import platform
13
14
import subprocess
14
15
import sys
@@ -23,9 +24,19 @@ def build_gui(root_path: Path):
23
24
if already_exists :
24
25
print (f'Found taipy-gui frontend bundle in { root_path / "taipy" / "gui" / "webapp" } .' ) # noqa: T201
25
26
else :
26
- subprocess .run (["npm" , "ci" ], cwd = root_path / "frontend" / "taipy-gui" / "dom" , check = True , shell = with_shell )
27
- subprocess .run (["npm" , "ci" ], cwd = root_path / "frontend" / "taipy-gui" , check = True , shell = with_shell )
28
- subprocess .run (["npm" , "run" , "build" ], cwd = root_path / "frontend" / "taipy-gui" , check = True , shell = with_shell )
27
+ my_env = os .environ .copy ()
28
+ if my_env .get ("NODE_OPTIONS" ) is None :
29
+ print ("Setting NODE_OPTIONS to --max-old-space-size=16384" ) # noqa: T201
30
+ my_env ["NODE_OPTIONS" ] = "--max-old-space-size=16384"
31
+ subprocess .run (
32
+ ["npm" , "ci" ], cwd = root_path / "frontend" / "taipy-gui" / "dom" , check = True , shell = with_shell , env = my_env
33
+ )
34
+ subprocess .run (
35
+ ["npm" , "ci" ], cwd = root_path / "frontend" / "taipy-gui" , check = True , shell = with_shell , env = my_env
36
+ )
37
+ subprocess .run (
38
+ ["npm" , "run" , "build" ], cwd = root_path / "frontend" / "taipy-gui" , check = True , shell = with_shell , env = my_env
39
+ )
29
40
30
41
31
42
def build_taipy (root_path : Path ):
@@ -39,8 +50,14 @@ def build_taipy(root_path: Path):
39
50
if not env_file_path .exists ():
40
51
with open (env_file_path , "w" ) as env_file :
41
52
env_file .write (f"TAIPY_DIR={ root_path } \n " )
42
- subprocess .run (["npm" , "ci" ], cwd = root_path / "frontend" / "taipy" , check = True , shell = with_shell )
43
- subprocess .run (["npm" , "run" , "build" ], cwd = root_path / "frontend" / "taipy" , check = True , shell = with_shell )
53
+ my_env = os .environ .copy ()
54
+ if my_env .get ("NODE_OPTIONS" ) is None :
55
+ print ("Setting NODE_OPTIONS to --max-old-space-size=16384" ) # noqa: T201
56
+ my_env ["NODE_OPTIONS" ] = "--max-old-space-size=16384"
57
+ subprocess .run (["npm" , "ci" ], cwd = root_path / "frontend" / "taipy" , check = True , shell = with_shell , env = my_env )
58
+ subprocess .run (
59
+ ["npm" , "run" , "build" ], cwd = root_path / "frontend" / "taipy" , check = True , shell = with_shell , env = my_env
60
+ )
44
61
45
62
46
63
if __name__ == "__main__" :
0 commit comments