Skip to content

Commit 28047a4

Browse files
committed
add more tools; remove outdated ones
1 parent 30fec37 commit 28047a4

File tree

10 files changed

+276
-711
lines changed

10 files changed

+276
-711
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
.env
22
data.json
33
makefile
4-
*.service
4+
*.service
5+
node_modules
6+
src/App.css

backend/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
# Backend
22

3+
Add .env file with secret key:
4+
5+
```
6+
> cat .env
7+
API_KEY=abcd1234
8+
```
9+
10+
This key is used to access github's [Octokit](https://github.com/octokit).
11+
312
## Getting Started
13+
414
Install dependencies:
15+
516
```
617
> yarn
718
```
19+
820
Start server:
21+
922
```
1023
> yarn start
1124
```

backend/githubData.ts

Lines changed: 47 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ const tools = [
1515
name: "conda",
1616
owner: "conda",
1717
},
18-
{
19-
name: "dephell",
20-
owner: "dephell",
21-
},
2218
{
2319
name: "flit",
2420
owner: "takluyver",
@@ -31,10 +27,6 @@ const tools = [
3127
name: "pdm",
3228
owner: "frostming",
3329
},
34-
{
35-
name: "python-build",
36-
owner: "FFY00",
37-
},
3830
{
3931
name: "tox",
4032
owner: "tox-dev",
@@ -83,6 +75,50 @@ const tools = [
8375
name: "pip-tools",
8476
owner: "jazzband",
8577
},
78+
{
79+
name: "pex",
80+
owner: "pantsbuild",
81+
},
82+
{
83+
name: "shiv",
84+
owner: "linkedin",
85+
},
86+
{
87+
name: "PyOxidizer",
88+
owner: "indygreg",
89+
},
90+
{
91+
name: "xar",
92+
owner: "facebookincubator",
93+
},
94+
{
95+
name: "pyinstaller",
96+
owner: "pyinstaller",
97+
},
98+
{
99+
name: "Nuitka",
100+
owner: "Nuitka",
101+
},
102+
{
103+
name: "packaging",
104+
owner: "pypa",
105+
},
106+
{
107+
name: "build",
108+
owner: "pypa",
109+
},
110+
{
111+
name: "pep517",
112+
owner: "pypa",
113+
},
114+
{
115+
name: "PyO3",
116+
owner: "PyO3",
117+
},
118+
{
119+
name: "pybind11",
120+
owner: "pybind",
121+
},
86122
];
87123

88124
function getQuery(name: string, owner: string) {
@@ -106,17 +142,14 @@ function getQuery(name: string, owner: string) {
106142
}
107143
url
108144
homepageUrl
145+
latestRelease {
146+
publishedAt
147+
}
109148
}
110149
}`;
111150
}
112151

113152
export async function fetchGithubData() {
114-
// try {
115-
// console.error("Attempting to read data");
116-
// return JSON.parse(String(fs.readFileSync("./data.json")));
117-
// } catch (e) {
118-
// console.error(e.message);
119-
// console.error("Failed to read, fetching...");
120153
const data = (
121154
await Promise.all(
122155
tools.map((t) => {
@@ -126,19 +159,9 @@ export async function fetchGithubData() {
126159
).map((d) => d["repository"]);
127160
fs.writeFileSync("./data.json", JSON.stringify(data, null, 4));
128161
return data;
129-
// }
130162
}
131163

132164
async function main() {
133165
const response = await fetchGithubData();
134166
console.error(response);
135167
}
136-
137-
// (async () => {
138-
// try {
139-
// var text = await main();
140-
// console.log(text);
141-
// } catch (e) {
142-
// console.error(e);
143-
// }
144-
// })();

backend/server.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,20 @@ const maxCacheAgeMs = hourInMs;
1717
const msToMinutes = (1 / msPerSec) * (1 / secPerMin);
1818

1919
app.use(function (req, res, next) {
20-
console.log(req.url)
21-
next()
22-
})
23-
20+
console.log(req.url);
21+
next();
22+
});
2423

2524
app.get("/package_data", async (req, res) => {
2625
const now = Date.now();
2726
const age = now - cachedData.cachedAt;
2827
const timeUntilRefetch = maxCacheAgeMs - age;
29-
console.error(
30-
`Cache is ${age * msToMinutes} minutes old. ${
31-
timeUntilRefetch * msToMinutes
32-
} minutes left until new data is used`
33-
);
3428
if (timeUntilRefetch <= 0) {
29+
console.info("fetching new data");
3530
cachedData.data = await fetchGithubData();
3631
cachedData.cachedAt = now;
3732
} else {
38-
console.error("using cached data");
33+
console.info("using cached data");
3934
}
4035
res.json(cachedData.data);
4136
});

0 commit comments

Comments
 (0)