mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	help: Serve help center build without relative links for zulip.com.
We have a copy of help center with relative links disabled which is reserved for root domains without an organisation on the root domain. Ideally, we should have some logic to determine whether we are on such a root domain or not. For practical short term purposes, since this type of documentation is mainly useful for zulip.com, we add an exception for zulip.com.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							246fbf6d29
						
					
				
				
					commit
					7db29f29de
				
			@@ -26,6 +26,13 @@ parser.add_argument(
 | 
			
		||||
    dest="show_relative_links",
 | 
			
		||||
    help="Disable relative links when using NavigationSteps component. Typically only set to true in case of the help center being hosted on zulip.com.",
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
parser.add_argument(
 | 
			
		||||
    "--out-dir",
 | 
			
		||||
    action="store",
 | 
			
		||||
    dest="out_dir",
 | 
			
		||||
    help="Output directory for the final build.",
 | 
			
		||||
)
 | 
			
		||||
args = parser.parse_args()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -34,8 +41,12 @@ def run() -> None:
 | 
			
		||||
    env["SUPPORT_EMAIL"] = parseaddr(settings.ZULIP_ADMINISTRATOR)[1]
 | 
			
		||||
    env["CORPORATE_ENABLED"] = str(settings.CORPORATE_ENABLED).lower()
 | 
			
		||||
    env["SHOW_RELATIVE_LINKS"] = str(args.show_relative_links).lower()
 | 
			
		||||
    build_command = ["/usr/local/bin/corepack", "pnpm", "build"]
 | 
			
		||||
    if args.out_dir:
 | 
			
		||||
        build_command += ["--outDir", args.out_dir]
 | 
			
		||||
 | 
			
		||||
    subprocess.check_call(
 | 
			
		||||
        ["/usr/local/bin/corepack", "pnpm", "build"],
 | 
			
		||||
        build_command,
 | 
			
		||||
        cwd="starlight_help",
 | 
			
		||||
        env=env,
 | 
			
		||||
    )
 | 
			
		||||
 
 | 
			
		||||
@@ -46,17 +46,20 @@ run(["./tools/setup/build_timezone_values"])
 | 
			
		||||
# need them.
 | 
			
		||||
if settings.CORPORATE_ENABLED:
 | 
			
		||||
    run(["./tools/setup/generate_landing_page_images.py"])
 | 
			
		||||
    # We ideally should be generating two builds for Zulip cloud
 | 
			
		||||
    # and serve a different one depending on whether the subdomain
 | 
			
		||||
    # is same as the root domain or not.
 | 
			
		||||
    run(["./tools/build-help-center", "--no-relative-links"])
 | 
			
		||||
else:
 | 
			
		||||
    run(["./tools/build-help-center"])
 | 
			
		||||
    run(
 | 
			
		||||
        [
 | 
			
		||||
            "./tools/build-help-center",
 | 
			
		||||
            "--no-relative-links",
 | 
			
		||||
            "--out-dir",
 | 
			
		||||
            "./dist_no_relative_links",
 | 
			
		||||
        ]
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
run(["./tools/build-help-center"])
 | 
			
		||||
 | 
			
		||||
# Create webpack bundle
 | 
			
		||||
run(["./tools/webpack", "--quiet"])
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Collect the files that we're going to serve; this creates prod-static/serve.
 | 
			
		||||
run(["./manage.py", "collectstatic", "-v0", "--noinput"])
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user