cloudflare/cloudflare-typescript

Public

mirrored from https://github.com/cloudflare/cloudflare-typescriptAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v4.4.1

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

scripts/mock

41lines · modeblame

2157ac0dstainless-app[bot]2 years ago1#!/usr/bin/env bash
2
dbae3674stainless-app[bot]2 years ago3set -e
4
5cd "$(dirname "$0")/.."
6
ce41a479stainless-app[bot]2 years ago7if [[ -n "$1" && "$1" != '--'* ]]; then
2157ac0dstainless-app[bot]2 years ago8URL="$1"
9shift
10else
11URL="$(grep 'openapi_spec_url' .stats.yml | cut -d' ' -f2)"
12fi
13
14# Check if the URL is empty
15if [ -z "$URL" ]; then
16echo "Error: No OpenAPI spec path/url provided or found in .stats.yml"
17exit 1
18fi
19
ce41a479stainless-app[bot]2 years ago20echo "==> Starting mock server with URL ${URL}"
21
2157ac0dstainless-app[bot]2 years ago22# Run prism mock on the given spec
23if [ "$1" == "--daemon" ]; then
598c552astainless-app[bot]1 years ago24npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" &> .prism.log &
2157ac0dstainless-app[bot]2 years ago25
26# Wait for server to come online
ce41a479stainless-app[bot]2 years ago27echo -n "Waiting for server"
2157ac0dstainless-app[bot]2 years ago28while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do
29echo -n "."
30sleep 0.1
31done
32
33if grep -q "✖ fatal" ".prism.log"; then
34cat .prism.log
35exit 1
36fi
37
38echo
39else
598c552astainless-app[bot]1 years ago40npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL"
2157ac0dstainless-app[bot]2 years ago41fi