Purge axios because it's stinky
All checks were successful
continuous-integration/drone/push Build is passing

and add PNPM instead of yarn

Signed-off-by: Sam Therapy <sam@samtherapy.net>
This commit is contained in:
Sam Therapy 2022-10-24 23:26:46 +02:00
parent 4e50d38fc7
commit dd6144ed41
Signed by: sam
GPG key ID: 4D8B07C18F31ACBD
8 changed files with 2125 additions and 3958 deletions

View file

@ -6,16 +6,17 @@ steps:
- name: dependencies
image: node
commands:
- yarn
- curl -L https://pnpm.js.org/pnpm.js | node - add --global pnpm@7
- pnpm i
- name: lint
image: node
commands:
- yarn lint:ci
- npm run lint:ci
depends: [dependencies]
- name: test
image: node
commands:
- yarn test
- npm run test
depends: [lint]

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,5 +0,0 @@
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
yarnPath: .yarn/releases/yarn-3.2.4.cjs

View file

@ -3,9 +3,6 @@ import { readFileSync } from "fs";
let template = compile(readFileSync("./lib/template.ejs", "utf8"));
import { format } from "timeago.js";
import axios from "axios";
const map = new Map();
// get JSON for an AP URL, by either fetching it or grabbing it from a cache.
// note: rejects on HTTP 4xx or 5xx
@ -16,16 +13,29 @@ async function apGet(url) {
reject(new Error("URL is invalid"));
}
axios({
url: url,
cache: map,
fetch(url, {
headers: {
accept: "application/activity+json",
Accept: "application/activity+json",
"User-Agent":
"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0",
},
})
.then((response) => JSON.parse(JSON.stringify(response.data, null, 2)))
// axios({
// url: url,
// cache: map,
// headers: {
// accept: "application/activity+json",
// "User-Agent":
// "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0",
// },
// })
// .then((response) => JSON.parse(JSON.stringify(response.data, null, 2)))
.then((response) => {
if (response.ok) {
return response.json();
}
return reject(response);
})
.then(resolve)
.catch(reject);
});

View file

@ -1,6 +1,5 @@
{
"dependencies": {
"axios": "1.1.3",
"cors": "2.8.5",
"ejs": "3.1.8",
"express": "4.18.2",
@ -10,13 +9,14 @@
"timeago.js": "4.0.2"
},
"main": "index.js",
"private": true,
"type": "module",
"license": "GPL-3.0",
"scripts": {
"start": "yarn node index.js",
"start": "node index.js",
"lint": "eslint --fix . && prettier --write .",
"lint:ci": "eslint . && prettier . --check",
"test": "echo \"Error: no test specified\" && exit 0"
"test": "true"
},
"devDependencies": {
"eslint": "8.26.0",

2100
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load diff

2592
yarn.lock

File diff suppressed because it is too large Load diff