Skip to content

Commit

Permalink
Merge branch 'nacos-group:develop-astro-nacos' into develop-astro-nacos
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinie13 authored Jan 24, 2024
2 parents 71b695f + fc2385d commit 923bc53
Show file tree
Hide file tree
Showing 23 changed files with 7,248 additions and 27 deletions.
4 changes: 2 additions & 2 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ export default defineConfig({
},
redirects: {
'/zh-cn/': '/',
'/en-us/': '/en',
'/zh-cn/[...slug].html': '/[...slug]',
'/en-us/': '/en/',
'/[...slug].html': '/[...slug]',
'/zh-cn/[...slug]': '/[...slug]',
'/docs/': '/docs/latest/what-is-nacos/',
}
});
29 changes: 29 additions & 0 deletions gitHubData.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import fs from "fs/promises";
import path from "path";
import { fileURLToPath } from 'url';

const request = async (url, headers={}) => {
const res = await fetch(url, {headers});
if (!res.ok) throw new Error(res.statusText);
const data = await res.json();
if (data.error) {
throw new Error(data.error)
} else {
return data;
}
};

let res = await request("https://api.github.com/repos/alibaba/nacos/contributors?per_page=100")

let contributors = res.map(v => {
return {
login: v.login,
avatar_url: v.avatar_url
}
})


const curFilename = fileURLToPath(import.meta.url);
const curDirname = path.dirname(curFilename);
const runtimePath = path.join(curDirname, 'src/components/contributors/gitHubData.json');
await fs.writeFile(runtimePath, JSON.stringify(contributors));
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "node runtime.js && astro build",
"build": "node runtime.js && node gitHubData.js && astro build",
"preview": "astro preview",
"astro": "astro"
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/Header/navbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default [
en: "NACOS CLOUD"
},
trigger: "click",
route: "/cloud",
route: "/cloud/",
target: "_self",
activePath: ['/cloud'],
},
Expand Down
Loading

0 comments on commit 923bc53

Please sign in to comment.