Skip to content

Commit

Permalink
feat: env SPONSOR_TIERS_UPDATE_URL allows accepting unresolvable URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
gizmo-ds committed Jul 25, 2023
1 parent 00cb409 commit 326124d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

| Name | Deploy |
| ----------- | ------------------------------------------------------------------------------------------------------------------- |
| Vercel | [![Deploy with Vercel](https://vercel.com/button)](http://gg.gg/15thba) |
| Vercel | [![Deploy with Vercel](https://vercel.com/button)](http://gg.gg/15tho7) |
| Deno Deploy | [Deploy to Deno Deploy](https://nitro.unjs.io/deploy/providers/deno) / [Example](.github/workflows/deno-deploy.yml) |
| Cloudflare | [Deploy to Cloudflare](https://nitro.unjs.io/deploy/providers/cloudflare) |
| Netlify | [Deploy to Netlify](https://nitro.unjs.io/deploy/providers/netlify) |
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
},
"dependencies": {
"base64-js": "^1.5.1",
"core-js": "^3.31.1",
"lodash-es": "^4.17.21",
"nano-jsx": "^0.0.37",
"nitropack": "latest",
Expand Down
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion scripts/update-sponsor-tiers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { resolve } from 'node:path';
import { writeFileSync, copyFileSync } from 'node:fs';
import { config } from 'dotenv';
import 'core-js/actual/url';

config({ path: resolve(process.cwd(), '.env') });
const u = process.env.SPONSOR_TIERS_UPDATE_URL;
Expand All @@ -11,7 +12,8 @@ const exampleFilename = resolve(
'afdian/sponsor-tiers-example.ts'
);

if (u)
// @ts-ignore
if (URL.canParse(u))
fetch(u)
.then(resp => {
if (resp.status !== 200) throw new Error(resp.statusText);
Expand Down

0 comments on commit 326124d

Please sign in to comment.