-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathgenerate.sh
executable file
·33 lines (25 loc) · 1.22 KB
/
generate.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
npm install @openapitools/openapi-generator-cli
rm *.ts -rf
./node_modules/\@openapitools/openapi-generator-cli/main.js generate \
-g typescript-axios \
--additional-properties=npmName=vrchat \
--git-user-id=vrchatapi \
--git-repo-id=vrchatapi-javascript \
-o . \
-i https://raw.githubusercontent.com/vrchatapi/specification/gh-pages/openapi.yaml \
--http-user-agent="vrchatapi-javascript"
# Modify package.json
sed -i 's/OpenAPI client for vrchat/🟡🔵 VRChat API Library for JavaScript and TypeScript/g' ./package.json
sed -i 's/Unlicense/MIT/g' ./package.json
# Enable global cookies
sed -i '/^import { BASE_PATH/a import axiosCookieJarSupport from "axios-cookiejar-support";axiosCookieJarSupport(globalAxios);import { CookieJar } from "tough-cookie";globalAxios.defaults.jar = new CookieJar();globalAxios.defaults.withCredentials = true;' ./api.ts
sed -i '/"dependencies"/a "@types/tough-cookie": "^4.0.1",' ./package.json
sed -i '/"dependencies"/a "axios-cookiejar-support": "^1.0.1",' ./package.json
sed -i '/"dependencies"/a "tough-cookie": "^4.0.0",' ./package.json
# Remove messily pasted markdown at top of every file
for i in *.ts; do
sed -i '/VRChat API Banner/d' $i
done
npm install
npm run build