@@ -841,7 +841,7 @@ def generate_clion_run_configs(self, configs):
841841 run_config_path = os .path .join (run_dir , f"{ config_name } .run.xml" )
842842 root = ET .Element ("component" , name = "ProjectRunConfigurationManager" )
843843 if 'target' in config :
844- clion_config = ET . SubElement ( root , "configuration" , {
844+ attrib = {
845845 "default" : "false" ,
846846 "name" : config ["name" ],
847847 "type" : "CMakeRunConfiguration" ,
@@ -857,20 +857,26 @@ def generate_clion_run_configs(self, configs):
857857 "CONFIG_NAME" : self .options .mrdocs_preset_name or "debug" ,
858858 "RUN_TARGET_PROJECT_NAME" : "MrDocs" ,
859859 "RUN_TARGET_NAME" : config ["target" ]
860- })
860+ }
861+ if 'folder' in config :
862+ attrib ["folderName" ] = config ["folder" ]
863+ clion_config = ET .SubElement (root , "configuration" , attrib )
861864 method = ET .SubElement (clion_config , "method" , v = "2" )
862865 ET .SubElement (method , "option" ,
863866 name = "com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" ,
864867 enabled = "true" )
865868 elif 'script' in config :
866869 if config ["script" ].endswith (".py" ):
867- clion_config = ET . SubElement ( root , "configuration" , {
870+ attrib = {
868871 "default" : "false" ,
869872 "name" : config ["name" ],
870873 "type" : "PythonConfigurationType" ,
871874 "factoryName" : "Python" ,
872875 "nameIsGenerated" : "false"
873- })
876+ }
877+ if 'folder' in config :
878+ attrib ["folderName" ] = config ["folder" ]
879+ clion_config = ET .SubElement (root , "configuration" , attrib )
874880 ET .SubElement (clion_config , "module" , name = "mrdocs" )
875881 ET .SubElement (clion_config , "option" , name = "ENV_FILES" , value = "" )
876882 ET .SubElement (clion_config , "option" , name = "INTERPRETER_OPTIONS" , value = "" )
@@ -895,11 +901,14 @@ def generate_clion_run_configs(self, configs):
895901 ET .SubElement (clion_config , "option" , name = "INPUT_FILE" , value = "" )
896902 ET .SubElement (clion_config , "method" , v = "2" )
897903 elif config ["script" ].endswith (".sh" ):
898- clion_config = ET . SubElement ( root , "configuration" , {
904+ attrib = {
899905 "default" : "false" ,
900906 "name" : config ["name" ],
901907 "type" : "ShConfigurationType"
902- })
908+ }
909+ if 'folder' in config :
910+ attrib ["folderName" ] = config ["folder" ]
911+ clion_config = ET .SubElement (root , "configuration" , attrib )
903912 ET .SubElement (clion_config , "option" , name = "SCRIPT_TEXT" , value = f"bash { shlex .quote (config ['script' ])} " )
904913 ET .SubElement (clion_config , "option" , name = "INDEPENDENT_SCRIPT_PATH" , value = "true" )
905914 ET .SubElement (clion_config , "option" , name = "SCRIPT_PATH" , value = config ["script" ])
@@ -913,9 +922,43 @@ def generate_clion_run_configs(self, configs):
913922 ET .SubElement (clion_config , "option" , name = "INTERPRETER_PATH" , value = "" )
914923 ET .SubElement (clion_config , "option" , name = "INTERPRETER_OPTIONS" , value = "" )
915924 ET .SubElement (clion_config , "option" , name = "EXECUTE_IN_TERMINAL" , value = "true" )
916- ET .SubElement (clion_config , "option" , name = "EXECUTE_SCRIPT_FILE" , value = "true " )
925+ ET .SubElement (clion_config , "option" , name = "EXECUTE_SCRIPT_FILE" , value = "false " )
917926 ET .SubElement (clion_config , "envs" )
918927 ET .SubElement (clion_config , "method" , v = "2" )
928+ elif config ["script" ].endswith (".js" ):
929+ attrb = {
930+ "default" : "false" ,
931+ "name" : config ["name" ],
932+ "type" : "NodeJSConfigurationType" ,
933+ "path-to-js-file" : config ["script" ],
934+ "working-dir" : config .get ("cwd" , "$PROJECT_DIR$" )
935+ }
936+ if 'folder' in config :
937+ attrb ["folderName" ] = config ["folder" ]
938+ clion_config = ET .SubElement (root , "configuration" , attrb )
939+ envs = ET .SubElement (clion_config , "envs" )
940+ if 'env' in config :
941+ for key , value in config ['env' ].items ():
942+ ET .SubElement (envs , "env" , name = key , value = value )
943+ ET .SubElement (clion_config , "method" , v = "2" )
944+ elif config ["script" ] == "npm" :
945+ attrib = {
946+ "default" : "false" ,
947+ "name" : config ["name" ],
948+ "type" : "js.build_tools.npm"
949+ }
950+ if 'folder' in config :
951+ attrib ["folderName" ] = config ["folder" ]
952+ clion_config = ET .SubElement (root , "configuration" , attrib )
953+ ET .SubElement (clion_config , "package-json" , value = os .path .join (config ["cwd" ], "package.json" ))
954+ ET .SubElement (clion_config , "command" , value = config ["args" ][0 ] if config ["args" ] else "ci" )
955+ ET .SubElement (clion_config , "node-interpreter" , value = "project" )
956+ envs = ET .SubElement (clion_config , "envs" )
957+ if 'env' in config :
958+ for key , value in config ['env' ].items ():
959+ ET .SubElement (envs , "env" , name = key , value = value )
960+ ET .SubElement (clion_config , "method" , v = "2" )
961+
919962 tree = ET .ElementTree (root )
920963 tree .write (run_config_path , encoding = "utf-8" , xml_declaration = False )
921964
@@ -988,6 +1031,7 @@ def generate_run_configs(self):
9881031 configs .append ({
9891032 "name" : f"MrDocs { verb .title ()} Test Fixtures ({ generator .upper ()} )" ,
9901033 "target" : "mrdocs-test" ,
1034+ "folder" : "MrDocs Test Fixtures" ,
9911035 "args" : [
9921036 f'"{ self .options .mrdocs_src_dir } /test-files/golden-tests"' ,
9931037 '--unit=false' ,
@@ -1062,6 +1106,7 @@ def generate_run_configs(self):
10621106 configs .append ({
10631107 "name" : f"MrDocs Bootstrap Update ({ bootstrap_refresh_config_name } )" ,
10641108 "script" : os .path .join (self .options .mrdocs_src_dir , "bootstrap.py" ),
1109+ "folder" : "MrDocs Bootstrap Update" ,
10651110 "args" : bootstrap_args ,
10661111 "cwd" : self .options .mrdocs_src_dir
10671112 })
@@ -1070,6 +1115,7 @@ def generate_run_configs(self):
10701115 configs .append ({
10711116 "name" : f"MrDocs Bootstrap Refresh ({ bootstrap_refresh_config_name } )" ,
10721117 "script" : os .path .join (self .options .mrdocs_src_dir , "bootstrap.py" ),
1118+ "folder" : "MrDocs Bootstrap Refresh" ,
10731119 "args" : bootstrap_refresh_args ,
10741120 "cwd" : self .options .mrdocs_src_dir
10751121 })
@@ -1078,6 +1124,7 @@ def generate_run_configs(self):
10781124 configs .append ({
10791125 "name" : f"MrDocs Generate Config Info ({ bootstrap_refresh_config_name } )" ,
10801126 "script" : os .path .join (self .options .mrdocs_src_dir , 'util' , 'generate-config-info.py' ),
1127+ "folder" : "MrDocs Generate Config Info" ,
10811128 "args" : [os .path .join (self .options .mrdocs_src_dir , 'src' , 'lib' , 'ConfigOptions.json' ),
10821129 os .path .join (self .options .mrdocs_build_dir )],
10831130 "cwd" : self .options .mrdocs_src_dir
@@ -1121,6 +1168,32 @@ def generate_run_configs(self):
11211168 "cwd" : test_files_dir
11221169 })
11231170
1171+ # Render landing page
1172+ mrdocs_website_dir = os .path .join (mrdocs_docs_dir , "website" )
1173+ configs .append ({
1174+ "name" : f"MrDocs Render Landing Page ({ bootstrap_refresh_config_name } )" ,
1175+ "script" : os .path .join (mrdocs_website_dir , "render.js" ),
1176+ "folder" : "MrDocs Render Landing Page" ,
1177+ "args" : [],
1178+ "cwd" : mrdocs_website_dir ,
1179+ "env" : {
1180+ "NODE_ENV" : "production" ,
1181+ "MRDOCS_ROOT" : self .options .mrdocs_install_dir
1182+ }
1183+ })
1184+ configs .append ({
1185+ "name" : f"MrDocs Clean Install Website Dependencies" ,
1186+ "script" : "npm" ,
1187+ "args" : ["ci" ],
1188+ "cwd" : mrdocs_website_dir
1189+ })
1190+ configs .append ({
1191+ "name" : f"MrDocs Install Website Dependencies" ,
1192+ "script" : "npm" ,
1193+ "args" : ["install" ],
1194+ "cwd" : mrdocs_website_dir
1195+ })
1196+
11241197 print ("Generating CLion run configurations for MrDocs..." )
11251198 self .generate_clion_run_configs (configs )
11261199 print ("Generating Visual Studio run configurations for MrDocs..." )
0 commit comments