Skip to content

Commit e22d4bd

Browse files
committed
refactor: generate in bash
1 parent a0eec19 commit e22d4bd

File tree

3 files changed

+327
-2446
lines changed

3 files changed

+327
-2446
lines changed

package.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,7 @@
2828
"check:lint": "eslint .",
2929
"check:format": "prettier -c .",
3030
"reformat": "prettier --write .",
31-
"generate:download": "curl -Lo ./scripts/spec.json https://github.com/mongodb/openapi/raw/refs/heads/main/openapi/v2/openapi-2025-03-12.json",
32-
"generate:filter": "tsx ./scripts/filter.ts > ./scripts/filteredSpec.json < ./scripts/spec.json",
33-
"generate:bundle": "redocly bundle --ext json --remove-unused-components ./scripts/filteredSpec.json --output ./scripts/bundledSpec.json",
34-
"generate:openapi": "openapi-typescript ./scripts/bundledSpec.json --root-types-no-schema-prefix --root-types --output ./src/common/atlas/openapi.d.ts",
35-
"generate:clear": "rm -rf ./scripts/bundledSpec.json ./scripts/filteredSpec.json ./scripts/spec.json",
36-
"generate": "npm run generate:download && npm run generate:filter && npm run generate:bundle && npm run generate:openapi && npm run generate:clear"
31+
"generate": "./scripts/generate.sh"
3732
},
3833
"license": "Apache-2.0",
3934
"devDependencies": {

scripts/generate.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
3+
set -Eeou pipefail
4+
5+
curl -Lo ./scripts/spec.json https://github.com/mongodb/openapi/raw/refs/heads/main/openapi/v2/openapi-2025-03-12.json
6+
tsx ./scripts/filter.ts > ./scripts/filteredSpec.json < ./scripts/spec.json
7+
redocly bundle --ext json --remove-unused-components ./scripts/filteredSpec.json --output ./scripts/bundledSpec.json
8+
openapi-typescript ./scripts/bundledSpec.json --root-types-no-schema-prefix --root-types --output ./src/common/atlas/openapi.d.ts
9+
rm -rf ./scripts/bundledSpec.json ./scripts/filteredSpec.json ./scripts/spec.json

0 commit comments

Comments
 (0)