GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ImmutableWebApps/unpkg-immutable-example: Example using unpkg as a immutable web app repository

BranchesTags
Open more actions menu

Latest commit

 

History

20 Commits
20 Commits

Folders and files

NameName
Last commit message
Last commit date
e2e
e2e
 
 
src
src
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
angular.json
angular.json
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
tsconfig.json
tsconfig.json
 
 
tslint.json
tslint.json
 
 

Repository files navigation

unpkg-immutable-example

Hosting an Immutable Web App with npm, UNPKG, and GitHub Pages

Immutable Web Apps are composed of two concepts:

  • Immutable Assets: Static assets (javascript, CSS, images) that do not contain any environment-specific configuration and are hosted at a permanent, versioned, long-term browser cached location.

  • Deployment Manifest: An index.html that is unique to the environment and not cached by the browser. It contains environment-specific configuration, references to the versioned immutable assets, and meta data.

Using a combination of npm, UNPKG, and Github Pages covers nearly all of these requirements!

  • npm: The software registry stores the the static assets in versioned, immutable packages. Perfect for managing the immutable assets!

  • UNPKG: The CDN makes all assets of the packages on npm addressable over https and globally available. Perfect for delivering the immutable assets!

  • GitHub Pages: This static hosting site supports easy configuration of DNS and HTTPS, has great integration with GitHub (obviously), and has a short TTL for browser caching. Perfect for serving the deployment manifest!

This Immutable Web App is hosted using npm, UNPKG, and GitHub Pages!

Project Structure

The git repository unpkg-immutable-example is split into two critical branches:

  • default is where the Angular project is maintained. It was generated from Angular CLI and is maintained like any other static web application.

  • master is configured to serve the GitHub Pages site. It only contains a single file 404.html. This single file is served for every request made to the GitHub Pages site.

Project Lifecycle

Building

Developing this web application is the same as any other single-page app node project. Features are built and tested locally, commits and pull requests advance the state of the codebase. When a stable version of the app is ready to be deployed, the assets are rendered to the /dist folder using npm run build and new version of the project is published to npm using npm publish. The assets become available on UNPKG.

Deploying

With the new version of the assets available on UNPKG, an atomic deployment can be triggered by switching to the master branch and updating 404.html with the references to the new project assets and any changes to environment variables. Once the commit is is pushed to the GitHub repository, GitHub Pages deployment is triggered and the new version of the web application is available.

Deployments!

With our Immutable Web App hosted by npm/UNPKG and without any environment-specific configuration, deployments are cheap and reliable! Let's deploy index.html to wherever it is easiest to setup DNS and HTTPS!

Deploy to another Github Pages repository

and let's change the version!

  • Fork unpkg-immutable-deployment
  • Configure the repo as a publishing source for Github Pages
  • Modify the 404.html to point to a different version
  • Deployed!

Deploy to Netlify

and let's change some environment variables!

  • git clone https://github.com/ImmutableWebApps/unpkg-immutable-deployment
  • cd unpkg-immutable-deployment
  • Create a Netlify account
  • Run npm i -g netlify-cli
  • Run netlify login
  • Run netlify deploy
  • Deployed!

Deploy Locally

and configure it however you want! Try loading up some older versions!

  • git clone https://github.com/ImmutableWebApps/unpkg-immutable-deployment.git
  • cd unpkg-immutable-deployment
  • npm i -g ecstatic
  • ecstatic (ecstatic is a simple static file server)
  • Deployed!

About

Example using unpkg as a immutable web app repository

Resources

Readme
Apache-2.0 license
Activity
Custom properties

Stars

6 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.