-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1576fc2
Showing
9 changed files
with
175 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# npm | ||
/node_modules | ||
|
||
# Suri | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Justin Stayton | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<h1 align="center" width="100%"> | ||
<img src="https://raw.githubusercontent.com/surishortlink/suri/HEAD/logo.png" width="200" alt="Suri" /> | ||
</h1> | ||
|
||
<h3 align="center" width="100%"> | ||
<i>Your own short links as an easily deployed static site on Netlify</i> | ||
</h3> | ||
|
||
You're viewing a template repository tailored for deploying Suri to | ||
[Netlify](https://www.netlify.com/). Head over to | ||
[the main repository](https://github.com/surishortlink/suri) to learn more about | ||
Suri, including additional deployment options. | ||
|
||
## Setup: One Click | ||
|
||
[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/surishortlink/suri-deploy-netlify) | ||
|
||
After you hit the above button, Netlify will walk you through the entire | ||
process, from creating a new repository based on this one, to the initial build | ||
and deploy. Everything should be correctly configured and ready to go. | ||
|
||
### Auto-Deploy | ||
|
||
Any commits to the `main` branch of your new repository will trigger a new build | ||
and deploy. You can change this by going to the "Site configuration" of your new | ||
site and editing the relevant "Build & deploy" options. | ||
|
||
### Custom Domain | ||
|
||
To use a custom domain, follow Netlify's guide: | ||
[Assign a domain to a production site](https://docs.netlify.com/domains-https/custom-domains/#assign-a-domain-to-a-production-site). | ||
|
||
## How It Works | ||
|
||
### Manage Links | ||
|
||
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://www.youtube.com/watch?v=CsHiG-43Fzg", | ||
"1": "https://fee.org/articles/the-use-of-knowledge-in-society/", | ||
"gh": "https://github.com/surishortlink/suri" | ||
} | ||
``` | ||
|
||
It couldn't be simpler: the key is the "short link" path that gets redirected, | ||
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. | ||
|
||
### Build Static Site | ||
|
||
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`. | ||
|
||
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 `<meta>` 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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[build] | ||
command = "npm run build" | ||
publish = "build/" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "@surishortlink/deploy-netlify", | ||
"version": "1.0.0", | ||
"private": true, | ||
"type": "module", | ||
"description": "A template repository tailored for deploying Suri to Netlify", | ||
"homepage": "https://github.com/surishortlink/suri-deploy-netlify#readme", | ||
"bugs": "https://github.com/surishortlink/suri-deploy-netlify/issues", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/surishortlink/suri-deploy-netlify.git" | ||
}, | ||
"scripts": { | ||
"build": "suri" | ||
}, | ||
"devDependencies": { | ||
"@surishortlink/suri": "^1" | ||
}, | ||
"engines": { | ||
"node": ">=18" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"/": "https://www.youtube.com/watch?v=CsHiG-43Fzg", | ||
"1": "https://fee.org/articles/the-use-of-knowledge-in-society/", | ||
"gh": "https://github.com/surishortlink/suri" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"js": false | ||
} |