From 580eb49a14d84b6497be5706c7fd5df691ec47b3 Mon Sep 17 00:00:00 2001 From: Justin Stayton Date: Tue, 28 Nov 2023 23:41:57 -0500 Subject: [PATCH] Update README and URLs --- README.md | 88 +++++++++++++++++++++++++++++++---------------- package-lock.json | 6 ++-- package.json | 8 ++--- src/links.json | 4 +-- 4 files changed, 68 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 70a7312..8374e8b 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,52 @@ -# Suri × Deploy to GitHub Pages +

+ Suri +

+ +

+ Your own shortlinks as an easily deployed static site on GitHub Pages +

You're viewing a template repository tailored for deploying Suri to [GitHub Pages](https://pages.github.com/) with -[GitHub Actions](https://docs.github.com/en/actions). - -What's Suri? Suri is your own link shortener that's easily deployed as a static -site. No server-side hosting, serverless cloud functions, or database necessary. -Head over to the main [`jstayton/suri`](https://github.com/jstayton/suri) -repository to learn more, including additional deployment methods. +[GitHub Actions](https://docs.github.com/en/actions). Head over to +[the main repository](https://github.com/surishortlink/suri) to learn more about +Suri, including additional deployment options. -## Setup +## Setup: Step By Step -1. Click the "Use this template" button above and then "Create a new - repository". Fill in the required details to create a new repository based on - this one. +1. Hit the "Use this template" button above and then "Create a new repository". + Fill in the required details to create a new repository based on this one. 2. Go to the "Settings" of your new repository and head to the "Pages" section. Under "Build and deployment", change the "Source" to "GitHub Actions". 3. Go to the "Actions" of your new repository. There should be a workflow run that likely failed because the previous step wasn't yet completed. Go ahead - and click into the workflow run and click the "Re-run jobs" button. -4. Any commits to the `main` branch of your new repository will trigger a new - deploy. You can change this by editing - [`.github/workflows/deploy.yml`](./.github/workflows/deploy.yml), which is - the GitHub Actions workflow for building the site and deploying to GitHub - Pages. -5. If you want to use a custom domain, follow GitHub's guide: - [Managing a custom domain for your GitHub Pages site](https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/managing-a-custom-domain-for-your-github-pages-site). + and view the workflow run and hit the "Re-run jobs" button. + +### Auto-Deploy + +Any commits to the `main` branch of your new repository will trigger a new build +and deploy. You can change this by editing +[`.github/workflows/deploy.yml`](.github/workflows/deploy.yml), which is the +GitHub Actions workflow for building the site and deploying to GitHub Pages. + +### Custom Domain + +To use a custom domain, follow GitHub's guide: +[Managing a custom domain for your GitHub Pages site](https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/managing-a-custom-domain-for-your-github-pages-site). + +## How It Works -## Manage Links +### Manage Links -Links are managed through [`./src/links.json`](./src/links.json), which is -seeded with a few examples to start: +At the heart of Suri is the [`links.json`](src/links.json) file, located in the +`src` directory, where you manage your links. All of the template repositories +include this file seeded with a few examples: ```json { - "/": "https://github.com/jstayton/suri", + "/": "https://www.youtube.com/watch?v=CsHiG-43Fzg", "1": "https://fee.org/articles/the-use-of-knowledge-in-society/", - "tw": "https://twitter.com" + "gh": "https://github.com/surishortlink/suri" } ``` @@ -45,14 +55,34 @@ and the value is the target URL. Keys can be as short or as long as you want, using whatever mixture of characters you want. `/` is a special entry for redirecting the root path. -Go ahead and make an edit, then commit and push to your repository. GitHub -Actions should automatically build and deploy your change. That's it! +### Build Static Site -## Config +Suri ships with a `suri` executable file that generates the static site from the +`links.json` file. The static site is output to a directory named `build`. -Config options are set in [`suri.config.json`](suri.config.json). There is only -one at this point: +All of the template repositories are configured with a `build` script that +invokes this executable, making the command you run simple: + +```bash +npm run build +``` + +When you make a change to the `links.json` file, simply re-run this command to +re-generate the static site, which can then be re-deployed. This template +repository is configured to do this automatically. + +### Config + +Configuration is handled through the [`suri.config.json`](suri.config.json) file +in the root directory. There is only one option at this point: | Option | Description | Type | Default | | ------ | ------------------------------------------------------------------ | ------- | ------- | | `js` | Whether to redirect with JavaScript instead of a `` refresh. | Boolean | `false` | + +### Public Directory + +Finally, any files in the `public` directory will be copied over to the `build` +directory without modification when the static site is built. This can be useful +for files like `favicon.ico` or `robots.txt` (that said, Suri provides sensible +defaults for both). diff --git a/package-lock.json b/package-lock.json index 4a4dbf5..a0e4a04 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "@suri/deploy-github", + "name": "@surishortlink/deploy-github", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "@suri/deploy-github", + "name": "@surishortlink/deploy-github", "version": "1.0.0", "license": "MIT", "devDependencies": { @@ -17,7 +17,7 @@ }, "node_modules/suri": { "version": "1.0.0", - "resolved": "git+ssh://git@github.com/jstayton/suri.git#eeb12749b3804d4cda135c9b46e26d4eb8e1d295", + "resolved": "git+ssh://git@github.com/jstayton/suri.git#ed47196095d89afa7321605a77f80ab2d6f66270", "dev": true, "license": "MIT", "bin": { diff --git a/package.json b/package.json index a99031c..ee87f3a 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { - "name": "@suri/deploy-github", + "name": "@surishortlink/deploy-github", "version": "1.0.0", "private": true, "type": "module", "description": "A template repository tailored for deploying Suri to GitHub Pages", - "homepage": "https://github.com/staticsuri/suri-deploy-github#readme", - "bugs": "https://github.com/staticsuri/suri-deploy-github/issues", + "homepage": "https://github.com/surishortlink/suri-deploy-github#readme", + "bugs": "https://github.com/surishortlink/suri-deploy-github/issues", "license": "MIT", - "repository": "staticsuri/suri-deploy-github", + "repository": "surishortlink/suri-deploy-github", "scripts": { "build": "suri" }, diff --git a/src/links.json b/src/links.json index 902d279..fcb8fc9 100644 --- a/src/links.json +++ b/src/links.json @@ -1,5 +1,5 @@ { - "/": "https://github.com/jstayton/suri", + "/": "https://www.youtube.com/watch?v=CsHiG-43Fzg", "1": "https://fee.org/articles/the-use-of-knowledge-in-society/", - "tw": "https://twitter.com" + "gh": "https://github.com/surishortlink/suri" }