@lunch-money/v2-api-spec 2.11.1-preview.3 → 2.11.1-preview.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "@lunch-money/v2-api-spec",
3
- "version": "2.11.1-preview.3",
3
+ "version": "2.11.1-preview.4",
4
4
  "description": "OpenAPI specification and version history for the Lunch Money v2 API",
5
5
  "main": "lunch-money-api-v2.yaml",
6
6
  "files": [
7
7
  "lunch-money-api-v2.yaml",
8
8
  "version-history.md",
9
- "README.md",
10
- "update-urls.sh"
9
+ "README.md"
11
10
  ],
12
11
  "scripts": {
13
12
  "prepare": "husky install",
package/update-urls.sh DELETED
@@ -1,135 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Script to update URLs in the OpenAPI specification file
4
- # This is useful for switching the docs/mock server URL between local development and production
5
- # Note: All references to DOCS_DEPLOY_URL throughout the file are toggled; the API server URL remains unchanged
6
- #
7
- # Usage:
8
- # # In git repo:
9
- # ./scripts/update-urls.sh --local|--production
10
- #
11
- # # In npm package:
12
- # ./update-urls.sh --local|--production
13
- #
14
- # Flags:
15
- # --local Switch docs/mock server URL to local development (http://localhost:3000/v2)
16
- # --production Switch docs/mock server URL to production deployment URL
17
- #
18
- # Environment variables (optional, with defaults):
19
- # LOCAL_URL - Local development URL (default: http://localhost:3000/v2)
20
- # DOCS_DEPLOY_URL - Docs/mock deployment URL (default: https://alpha.lunchmoney.dev/v2)
21
- #
22
- # Examples:
23
- # # Switch to production URL (using defaults)
24
- # ./update-urls.sh --production
25
- #
26
- # # Switch to production URL (with custom URL)
27
- # DOCS_DEPLOY_URL=https://alpha.lunchmoney.dev/v2 ./update-urls.sh --production
28
- #
29
- # # Switch to local URL
30
- # ./update-urls.sh --local
31
- #
32
- # # Switch to local URL (with custom local URL)
33
- # LOCAL_URL=http://localhost:4000/v2 ./update-urls.sh --local
34
-
35
- set -e
36
-
37
- # Get the directory where the script is located
38
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
39
-
40
- # Determine if we're in the git repo or npm package
41
- # In git repo: script is in scripts/ subdirectory, spec is in v2/spec/
42
- # In npm package: script is at root, spec is at root
43
- if [ -f "$SCRIPT_DIR/../v2/spec/lunch-money-api-v2.yaml" ]; then
44
- # In the git repo (script is in scripts/ subdirectory)
45
- REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
46
- SPEC_FILE="$REPO_ROOT/v2/spec/lunch-money-api-v2.yaml"
47
- elif [ -f "$SCRIPT_DIR/lunch-money-api-v2.yaml" ]; then
48
- # In the npm package (script is at root, spec is in same directory)
49
- REPO_ROOT="$SCRIPT_DIR"
50
- SPEC_FILE="$REPO_ROOT/lunch-money-api-v2.yaml"
51
- else
52
- echo "Error: Could not find lunch-money-api-v2.yaml"
53
- echo " Looked in: $SCRIPT_DIR/v2/spec/"
54
- echo " Looked in: $SCRIPT_DIR/"
55
- exit 1
56
- fi
57
-
58
- # Load environment variables from .env file if it exists and variables are not already set
59
- if [ -f "$REPO_ROOT/.env" ]; then
60
- export $(grep -v '^#' "$REPO_ROOT/.env" | xargs)
61
- fi
62
-
63
- # Set default values for the URLs if not provided
64
- LOCAL_URL=${LOCAL_URL:-"http://localhost:3000/v2"}
65
- DOCS_DEPLOY_URL=${DOCS_DEPLOY_URL:-"https://alpha.lunchmoney.dev/v2"}
66
-
67
- # Function to show help and exit
68
- show_help() {
69
- echo "Usage: $0 --local|--production"
70
- echo ""
71
- echo "Flags (required):"
72
- echo " --local Switch docs/mock server URL to local development"
73
- echo " --production Switch docs/mock server URL to production deployment"
74
- echo ""
75
- echo "Environment variables (optional, with defaults):"
76
- echo " LOCAL_URL Local development URL (default: http://localhost:3000/v2)"
77
- echo " DOCS_DEPLOY_URL Docs/mock deployment URL (default: https://alpha.lunchmoney.dev/v2)"
78
- echo ""
79
- echo "Examples:"
80
- echo " # Switch to production URL (using defaults)"
81
- echo " $0 --production"
82
- echo ""
83
- echo " # Switch to production URL (with custom URL)"
84
- echo " DOCS_DEPLOY_URL=https://alpha.lunchmoney.dev/v2 $0 --production"
85
- echo ""
86
- echo " # Switch to local URL"
87
- echo " $0 --local"
88
- echo ""
89
- echo " # Switch to local URL (with custom local URL)"
90
- echo " LOCAL_URL=http://localhost:4000/v2 $0 --local"
91
- echo ""
92
- echo "Note: Environment variables can also be set in a .env file in the repository root."
93
- echo "Note: All references to DOCS_DEPLOY_URL throughout the file are updated; the API server URL remains unchanged."
94
- exit 1
95
- }
96
-
97
- # Function to replace all occurrences of the docs/mock server URL in the spec file
98
- replace_docs_url() {
99
- local from_url=$1
100
- local to_url=$2
101
-
102
- if [ ! -f "$SPEC_FILE" ]; then
103
- echo "Error: Spec file not found at $SPEC_FILE"
104
- exit 1
105
- fi
106
-
107
- echo "Updating all references to docs/mock server URL in $SPEC_FILE..."
108
- echo " From: $from_url"
109
- echo " To: $to_url"
110
-
111
- # Replace all occurrences of the URL throughout the entire file
112
- # Using sed with proper escaping for URLs
113
- # Escape special regex characters in from_url
114
- escaped_from_url=$(echo "$from_url" | sed 's/[[\.*^$()+?{|]/\\&/g')
115
- # Use a temporary file for cross-platform compatibility
116
- sed "s|$escaped_from_url|$to_url|g" "$SPEC_FILE" > "$SPEC_FILE.tmp" && mv "$SPEC_FILE.tmp" "$SPEC_FILE"
117
-
118
- echo "✓ URLs updated successfully"
119
- }
120
-
121
- # Check for required flag
122
- if [ "$1" == "--local" ]; then
123
- echo "Switching docs/mock server URL to local development..."
124
- echo " Using LOCAL_URL: $LOCAL_URL"
125
- replace_docs_url "$DOCS_DEPLOY_URL" "$LOCAL_URL"
126
- elif [ "$1" == "--production" ]; then
127
- echo "Switching docs/mock server URL to production..."
128
- echo " Using DOCS_DEPLOY_URL: $DOCS_DEPLOY_URL"
129
- replace_docs_url "$LOCAL_URL" "$DOCS_DEPLOY_URL"
130
- else
131
- echo "Error: A flag is required (--local or --production)"
132
- echo ""
133
- show_help
134
- fi
135
-