Skip to content

Commit

Permalink
feat: configSchema
Browse files Browse the repository at this point in the history
  • Loading branch information
Eveeifyeve committed Jul 26, 2024
1 parent c5cbe3c commit cba8e04
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 58 deletions.
117 changes: 59 additions & 58 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,60 +1,61 @@
{
"name": "teaclient-website",
"type": "module",
"version": "0.0.2",
"scripts": {
"dev": "astro dev",
"preview": "astro preview",
"build": "astro build",
"astro": "astro",
"lint": "biome check --apply . && stylelint 'src/styles/**/*.css' --fix",
"fmt": "biome format ./ --write",
"biome": "bunx @biomejs/biome",
"check": "biome check ./ && stylelint 'src/styles/**/*.css' && bun astro check && bun test"
},
"trustedDependencies": ["sharp"],
"stylelint": {
"extends": "stylelint-config-standard",
"plugins": ["stylelint-scss"],
"customSyntax": "postcss-scss",
"rules": {
"at-rule-no-unknown": null,
"selector-class-pattern": null,
"scss/at-rule-no-unknown": true,
"custom-property-pattern": null
}
},
"commitlint": {
"extends": ["@commitlint/config-conventional"]
},
"dependencies": {
"@astrojs/mdx": "^2.0.2",
"@astrojs/rss": "^4.0.5",
"@astrojs/sitemap": "^3.1.1",
"@astrojs/tailwind": "^5.1.0",
"@astrojs/ts-plugin": "^1.3.1",
"astro-meta-tags": "^0.2.1",
"astro-page-insight": "^0.6.1",
"astro-seo": "^0.8.0",
"axios": "^1.6.5",
"sass": "^1.71.1",
"sharp": "^0.33.2",
"tailwind-merge": "^2.2.1",
"tailwindcss": "^3.4.1",
"web-vitals": "^3.5.0"
},
"devDependencies": {
"@astrojs/check": "^0.5.10",
"@biomejs/biome": "^1.5.3",
"@types/bun": "^1.0.12",
"astro": "^4.2.3",
"happy-dom": "^14.7.1",
"playwright": "^1.43.1",
"postcss-scss": "^4.0.9",
"stylelint": "^16.3.1",
"stylelint-config-standard": "^36.0.0",
"stylelint-scss": "^6.2.1",
"typescript": "^5.2.2"
},
"packageManager": "[email protected]"
"name": "teaclient-website",
"type": "module",
"version": "0.0.2",
"scripts": {
"dev": "astro dev",
"preview": "astro preview",
"build": "astro build",
"astro": "astro",
"lint": "biome check --apply . && stylelint 'src/styles/**/*.css' --fix",
"fmt": "biome format ./ --write",
"biome": "bunx @biomejs/biome",
"check": "biome check ./ && stylelint 'src/styles/**/*.css' && bun astro check && bun test"
},
"trustedDependencies": ["sharp"],
"stylelint": {
"extends": "stylelint-config-standard",
"plugins": ["stylelint-scss"],
"customSyntax": "postcss-scss",
"rules": {
"at-rule-no-unknown": null,
"selector-class-pattern": null,
"scss/at-rule-no-unknown": true,
"custom-property-pattern": null
}
},
"commitlint": {
"extends": ["@commitlint/config-conventional"]
},
"dependencies": {
"@astrojs/mdx": "^2.0.2",
"@astrojs/rss": "^4.0.5",
"@astrojs/sitemap": "^3.1.1",
"@astrojs/tailwind": "^5.1.0",
"@astrojs/ts-plugin": "^1.3.1",
"astro-meta-tags": "^0.2.1",
"astro-page-insight": "^0.6.1",
"astro-seo": "^0.8.0",
"axios": "^1.6.5",
"octokit": "^4.0.2",
"sass": "^1.71.1",
"sharp": "^0.33.2",
"tailwind-merge": "^2.2.1",
"tailwindcss": "^3.4.1",
"web-vitals": "^3.5.0"
},
"devDependencies": {
"@astrojs/check": "^0.5.10",
"@biomejs/biome": "^1.5.3",
"@types/bun": "^1.0.12",
"astro": "^4.2.3",
"happy-dom": "^14.7.1",
"playwright": "^1.43.1",
"postcss-scss": "^4.0.9",
"stylelint": "^16.3.1",
"stylelint-config-standard": "^36.0.0",
"stylelint-scss": "^6.2.1",
"typescript": "^5.2.2"
},
"packageManager": "[email protected]"
}
33 changes: 33 additions & 0 deletions src/pages/configSchema.json.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Octokit } from "octokit";

export const GET = async () => {
let octokit = new Octokit({

Check failure on line 4 in src/pages/configSchema.json.ts

View workflow job for this annotation

GitHub Actions / Quality

lint/style/useConst

This let declares a variable that is only assigned once.

Check failure on line 4 in src/pages/configSchema.json.ts

View workflow job for this annotation

GitHub Actions / Quality

lint/style/useConst

This let declares a variable that is only assigned once.
auth: import.meta.env.GITHUB_TOKEN,
});

try {
let data = await octokit.request('GET /repos/{owner}/{repo}/releases/latest', {

Check failure on line 9 in src/pages/configSchema.json.ts

View workflow job for this annotation

GitHub Actions / Quality

lint/style/useConst

This let declares a variable that is only assigned once.

Check failure on line 9 in src/pages/configSchema.json.ts

View workflow job for this annotation

GitHub Actions / Quality

lint/style/useConst

This let declares a variable that is only assigned once.
owner: 'TeaClientMC',
repo: 'ConfigSchema',
headers: {
'X-GitHub-Api-Version': '2022-11-28',
},
});

// Access the assets array from the response
const assets = data.data.assets;

// Find the JSON file and get its download URL
const jsonFileUrl = assets.find(asset => asset.name === 'configschema.json').browser_download_url;

// Download the JSON file content
const response = await fetch(jsonFileUrl);
const jsonContent = await response.text();

// Return the JSON content
return new Response(jsonContent);
} catch (error) {
console.error("Error fetching config schema:", error);
return new Response(JSON.stringify({ error: "Failed to load config schema" }), { status: 500 });
}
};

0 comments on commit cba8e04

Please sign in to comment.