Skip to content

outergroup/hello-outerframe-macOS-swift

Repository files navigation

HelloWorldStatic

This is a minimal outerframe app that can be deployed to a static web server.

It includes:

  • A small standalone Xcode project that builds HelloWorldStatic.bundle
  • A Python script that generates the .outer descriptor
  • A Python script that serves the generated site locally with the right MIME type for .outer

Build

From this directory:

./build_site.sh

That produces a ready-to-upload static site in build/site/:

  • hello-world.outer
  • binaries/HelloWorldStatic/index.html
  • binaries/HelloWorldStatic/macos-arm
  • binaries/HelloWorldStatic/macos-x86

If you want the raw build command, build_site.sh runs xcodebuild against HelloWorldStatic.xcodeproj and then archives the built bundle with aa.

By default, the generated .outer file points at /binaries/HelloWorldStatic, so the uploaded site is intended to live at the web server root. If you want to host it under a subpath, set BINARY_URL_PATH when building, for example:

BINARY_URL_PATH=/demo/binaries/HelloWorldStatic ./build_site.sh

Local testing

Build the site, then serve it locally:

python3 Scripts/serve_site.py --root build/site --port 8025

Then open this URL in Outer Loop:

http://127.0.0.1:8025/hello-world.outer

Deploying to a static server

Upload the contents of build/site/ to your server.

The server needs to satisfy these rules:

  • hello-world.outer should be served as application/vnd.outerframe
  • binaries/HelloWorldStatic/macos-arm and binaries/HelloWorldStatic/macos-x86 should be served as raw binary data

build_site.sh also writes binaries/HelloWorldStatic/index.html with a plain-text list of supported platforms. Current Outer Loop builds do not need to fetch that listing because they directly request the current platform archive, but it is harmless to upload.

AWS S3

Put the correct Content-Type metadata on the S3 objects.

If the site is hosted at the bucket root:

BUCKET=your-bucket-name

aws s3 cp build/site/hello-world.outer "s3://${BUCKET}/hello-world.outer" \
  --content-type "application/vnd.outerframe"

aws s3 cp build/site/binaries/HelloWorldStatic/index.html "s3://${BUCKET}/binaries/HelloWorldStatic/index.html" \
  --content-type "text/plain; charset=utf-8"

aws s3 cp build/site/binaries/HelloWorldStatic/macos-arm "s3://${BUCKET}/binaries/HelloWorldStatic/macos-arm" \
  --content-type "application/octet-stream"

aws s3 cp build/site/binaries/HelloWorldStatic/macos-x86 "s3://${BUCKET}/binaries/HelloWorldStatic/macos-x86" \
  --content-type "application/octet-stream"

If the site is hosted under a s3 path prefix, rebuild with a matching BINARY_URL_PATH and upload to the same prefix:

BINARY_URL_PATH=/demo/binaries/HelloWorldStatic ./build_site.sh

PREFIX=demo
aws s3 cp build/site/hello-world.outer "s3://${BUCKET}/${PREFIX}/hello-world.outer" \
  --content-type "application/vnd.outerframe"
aws s3 cp build/site/binaries/HelloWorldStatic/macos-arm "s3://${BUCKET}/${PREFIX}/binaries/HelloWorldStatic/macos-arm" \
  --content-type "application/octet-stream"
aws s3 cp build/site/binaries/HelloWorldStatic/macos-x86 "s3://${BUCKET}/${PREFIX}/binaries/HelloWorldStatic/macos-x86" \
  --content-type "application/octet-stream"
curl -I https://your-domain.example/hello-world.outer
curl -I https://your-domain.example/binaries/HelloWorldStatic/macos-arm
curl -I https://your-domain.example/binaries/HelloWorldStatic/macos-x86

The .outer response must include Content-Type: application/vnd.outerframe. The platform archive responses should be application/octet-stream.

After upload, navigate Outer Loop to the deployed .outer URL.

Renaming this template

If you copy this folder and rename it, update these places together:

  • HelloWorldStatic.xcodeproj
  • Frontend/HelloWorldStaticContent.swift
  • build_site.sh
  • README.md

About

Jumping off point for macOS outerframe apps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors