Skip to content

Commit

Permalink
Showing 39 changed files with 1,228 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local

.vercel

# TODO: Generated files
# ./public/Packages
# ./public/Packages.bz2
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"semi": false,
"trailingComma": "all",
"tabWidth": 4,
"printWidth": 120,
"singleQuote": true,
"useTabs": true
}
Binary file added .vscode/Button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .vscode/VercelComment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["esbenp.prettier-vscode", "andrewrazumovsky.vscode-styled-jsx-languageserver"]
}
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"editor.tabSize": 4,
"editor.insertSpaces": false
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Dimitar Nestorov

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.
98 changes: 98 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Repo on Vercel

This is a Cydia/APT repository template built for the [Vercel platform](https://vercel.com/). This is a [Next.js](https://nextjs.org/) project.

## Why Repo on Vercel?

Repo on Vercel is aimed to make possible downloading packages directly from GitHub Releases which has a download counter unlike GitHub Pages.

## Getting Started

<p align="center"><a href="https://github.com/dimitarnestorov/RepoOnVercel/generate"><img width="200" src=".vscode/Button.png" alt="Use this template"></a></p>

### Run the development server

#### Install Node.js

To build and run this repo locally you need Node.js: https://nodejs.org/

You can install it using [Homebrew](https://brew.sh/) on macOS: `brew install node`

You can install it using [Chocolatey](https://chocolatey.org/) on Windows: `choco install nodejs`

#### Install the dependencies

Run the following in the root folder of your repo:

```sh
npm install
```

#### Run the server

```bash
npm run dev
```

### Edit the repository metadata

Edit the `exports.name` and `exports.description` strings in the `repo.js` file.

### Replace `CydiaIcon.png` and `favicon.ico` with your own

Icons are located in the `public` folder. They are visible in package managers and on the web.

### Add your packages

Insert your GitHub Releases package URLs in the `exports.packages` array in the `repo.js` file.

### Add your depictions

Depictions live in the `pages` folder. The format for the file name is `name.js` where `name` is the name of your package. To view your depictions before deploying run the development server and visit `http://localhost:3000/name` where `name` is the name of your package.

If your package name has spaces in it replace those with `-` for the depiction file.

### Add your package icons

Put your icons in the public folder and then edit the `exports.icons` object in the `repo.js` file. The key is the name of your package, the value is the path of the icon without `public`.

### Modify the home page

Modify `index.js` in the `pages` folder, [run the development server](#run-the-development-server), and open [http://localhost:3000](http://localhost:3000) in your browser to see the result.

### Deploy on Vercel

After you've created your repo click [here to import](https://vercel.com/import) your repo on Vercel. Choose "Import Git Repository" and enter the URL of your Git repository.

## Increase rate limit (fix "Error: rate limit exceeded")

This template uses the GitHub API to cache requests. The GitHub API is limited to 60 unauthenticated requests per IP address per hour. To increase this limit you need to specify a GitHub token as an environment variable (`GITHUB_TOKEN`) when running `npm run dev`. To get a token go to [Settings -> Developer settings -> Personal access tokens](https://github.com/settings/tokens) and click "Generate new token". If you experience `rate limit exceeded` when deploying to Vercel you need to specify a GitHub token as an environment variable in your project settings.

```sh
GITHUB_TOKEN=d107d6aaf3a6b550ebeead351a3974cb8b262b74 npm run dev
```

## Disable Vercel comments

<p align="center"><img src=".vscode/VercelComment.png" width="836" alt="Vercel comment example"></p>

By default Vercel for GitHub will comment on commits and pull requests when it successfully deploys your repo. This can be disabled by setting `github.silent` to `true` in your Vercel configuration (add `vercel.json` in the root of your repository). [Reference](https://vercel.com/docs/configuration#git-integrations/github-silent).

## Notes

- If you reupload a package with the same name and tag (resulting with a URL that is already in `repo.js`) you will need to redeploy your repo or restart your development server

## Join [The Community Repo](https://repo.community/)

To become a part of The Community Repo add a file in the `public` folder called `repo_community_validation.txt` with the following contents:

```
community.repo.access: allow_forwarding_all
```

Visit the [Add Your Repo](https://repo.community/add) page, fill out the form at the bottom of the page, and click Submit.

## Repositories using this template

- [https://dimitarnestorov.com/](https://dimitarnestorov.com/) ([Source code](https://github.com/dimitarnestorov/website))
- [https://yulkytulky.com/](https://yulkytulky.com/) ([Source code](https://github.com/YulkyTulky/Repo))
59 changes: 59 additions & 0 deletions components/Depiction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import Links from './Links'
import Page from './Page'
import Section, { SectionPadding } from './Section'

import { icons } from '../loader!../repo'

export default function Depiction({ children, name, subtitle, github }) {
return (
<Page title={name}>
<style jsx>{`
.title {
margin: 16px 0;
display: flex;
align-items: center;
justify-content: center;
}
.title > img {
width: 48px;
height: 48px;
}
.titles {
margin: 0 0 0 8px;
text-align: center;
}
.titles > h1 {
font-size: 24px;
margin: 0;
}
.titles > h2 {
font-size: 12px;
margin: 0;
font-weight: 400;
}
`}</style>
<div className="title">
<img src={icons[name]} alt={`${name} icon`} />
<div className="titles">
<h1>{name}</h1>
{subtitle && <h2>{subtitle}</h2>}
</div>
</div>
<Section>
<SectionPadding>{children}</SectionPadding>
</Section>
<Links>
{[
{ icon: '/assets/link-icons/PayPal.png', label: 'PayPal', href: 'https://www.paypal.me/' },
{ icon: '/assets/link-icons/Discord.png', label: 'Discord', href: 'https://discord.gg/' },
{ icon: '/assets/link-icons/Twitter.png', label: 'Twitter', href: 'https://twitter.com/' },
{ icon: '/assets/link-icons/GitHub.png', label: 'GitHub', href: github },
]}
</Links>
</Page>
)
}
40 changes: 40 additions & 0 deletions components/Links.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import Section from './Section'

export default function Links({ children }) {
return (
<Section>
<div className="links">
<style jsx>{`
.links > a {
height: 44px;
padding: 0 12px;
display: flex;
align-items: center;
border-bottom: 1px solid #333;
font-size: 16px;
font-weight: 300;
}
.links > a:last-child {
border-bottom: 0 none;
}
.links > a > img {
width: 29px;
height: 29px;
margin-right: 8px;
}
`}</style>
{children.map(
(link, i) =>
link.href && (
<a href={link.href} key={i} target="_blank">
<img src={link.icon} alt={`${link.label} icon`} />
<span>{link.label}</span>
</a>
),
)}
</div>
</Section>
)
}
41 changes: 41 additions & 0 deletions components/Page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import Head from 'next/head'

import { name as repoName } from '../loader!../repo'

export default function Page({ children, title }) {
return (
<>
<Head>
<title>{title ? `${title} - ${repoName}` : repoName}</title>
<link rel="icon" href="/favicon.ico" />
</Head>
<style jsx global>{`
* {
box-sizing: border-box;
}
html {
background-color: black;
color: white;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
'Open Sans', 'Helvetica Neue', sans-serif;
}
body {
margin: 0;
}
a {
color: #1687e9;
}
.container {
max-width: 400px;
width: 90%;
margin: 0 auto;
}
`}</style>
<div className="container">{children}</div>
</>
)
}
27 changes: 27 additions & 0 deletions components/Section.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export default function Section({ children }) {
return (
<div className="section">
<style jsx>{`
.section {
background-color: #222222;
margin: 16px 0;
border-radius: 8px;
}
`}</style>
{children}
</div>
)
}

export function SectionPadding({ children }) {
return (
<div className="padding">
<style jsx>{`
.padding {
padding: 12px;
}
`}</style>
{children}
</div>
)
}
Loading

0 comments on commit ed6b5ec

Please sign in to comment.