Compare commits

...

5 Commits

4 changed files with 1901 additions and 3 deletions

View File

@ -5,7 +5,25 @@ The official library for the LfK [backend server](https://git.odit.services/lfk/
Automagicly™ generated by [openapi-typescript-codegen](https://www.npmjs.com/package/openapi-typescript-codegen)
## 🛠 Building
Get's automagicly™ build by drone for every new backend release.
### Setup ⬇️
```bash
git clone https://git.odit.services/lfk/lfk-client-js.git
cd lfk-client-js
pnpm i
```
### Build 🔨
```bash
pnpm update:openapi # Update the openapi.json file
pnpm build # Build the project
pnpm release # Bump and release to npm
# Or just do it all in one command
pnpm update:auto
```
## Use

View File

@ -25,7 +25,10 @@
"build:prepare": "rimraf ./lib ./dist",
"build:lib": "openapi --input ./openapi.json --output ./lib --client fetch",
"build:compile": "tsc",
"build:cleanup": "rimraf ./lib"
"build:cleanup": "rimraf ./lib",
"update:openapi": "rimraf ./openapi.json && node ./scripts/getliveopenapi.js",
"update:auto": "npm run update:openapi && npm run build && npm run release",
"release": "release-it"
},
"bugs": {
"url": "https://git.odit.services/lfk/lfk-client-js/issues"
@ -33,7 +36,22 @@
"homepage": "https://git.odit.services/lfk/lfk-client-js/",
"devDependencies": {
"openapi-typescript-codegen": "0.7.0",
"release-it": "17.10.0",
"rimraf": "6.0.1",
"typescript": "4.9.5"
},
"release-it": {
"git": {
"commit": true,
"requireCleanWorkingDir": false,
"commitMessage": "chore(release): ${version}",
"push": true,
"tag": true,
"tagName": "${version}",
"tagAnnotation": "${version}"
},
"npm": {
"publish": true
}
}
}
}

1835
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

27
scripts/getliveopenapi.js Normal file
View File

@ -0,0 +1,27 @@
const https = require('https');
const fs = require('fs');
const url = 'https://run.lauf-fuer-kaya.de/api/docs/openapi.json';
const output = 'openapi.json';
https.get(url, (res) => {
if (res.statusCode !== 200) {
console.error(`Request Failed. Status Code: ${res.statusCode}`);
res.resume();
return;
}
let data = '';
res.on('data', chunk => data += chunk);
res.on('end', () => {
fs.writeFile(output, data, (err) => {
if (err) {
console.error('Error writing file:', err);
} else {
console.log(`Saved latest OpenAPI JSON to ${output}`);
}
});
});
}).on('error', (e) => {
console.error(`Got error: ${e.message}`);
});