Skip to content

Commit b9c0358

Browse files
GvieveGenevieve Nuebel
andauthored
Fix dependency version issues with version 1.12.1 (#68)
Co-authored-by: Genevieve Nuebel <genevieve.nuebel@mx.com>
1 parent a530650 commit b9c0358

8 files changed

Lines changed: 129 additions & 12 deletions

File tree

.github/clean.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
".openapi-generator-ignore",
77
"LICENSE",
88
"openapi",
9-
"openapitools.json"
9+
"openapitools.json",
10+
"tmp"
1011
].freeze
1112

1213
::Dir.each_child(::Dir.pwd) do |source|
1314
next if ALLOW_LIST.include?(source)
14-
15+
1516
# Preserve test-output directories for multi-version POC testing
1617
next if source.start_with?("test-output-")
1718

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Validate Template Sync
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '**/package.json'
7+
- 'openapi/templates/package.mustache'
8+
push:
9+
branches: [master]
10+
workflow_dispatch:
11+
12+
jobs:
13+
validate:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Find all package.json files
19+
id: find_packages
20+
run: |
21+
# Find all package.json files in version directories and root
22+
PACKAGES=$(find . -maxdepth 2 -name "package.json" \( -path "./*/package.json" -o -path "./package.json" \) ! -path "*/node_modules/*" || true)
23+
echo "Found package.json files:"
24+
echo "$PACKAGES"
25+
echo "packages<<EOF" >> $GITHUB_OUTPUT
26+
echo "$PACKAGES" >> $GITHUB_OUTPUT
27+
echo "EOF" >> $GITHUB_OUTPUT
28+
29+
- name: Extract dependencies from template
30+
id: template
31+
run: |
32+
AXIOS_VERSION=$(grep -A 1 '"dependencies"' openapi/templates/package.mustache | grep axios | sed 's/.*"axios": "\(.*\)".*/\1/')
33+
TS_VERSION=$(grep '"typescript"' openapi/templates/package.mustache | sed 's/.*"typescript": "\(.*\)".*/\1/')
34+
NODE_VERSION=$(grep '@types/node' openapi/templates/package.mustache | sed 's/.*"@types\/node": "\(.*\)".*/\1/')
35+
36+
echo "axios=$AXIOS_VERSION" >> $GITHUB_OUTPUT
37+
echo "typescript=$TS_VERSION" >> $GITHUB_OUTPUT
38+
echo "node=$NODE_VERSION" >> $GITHUB_OUTPUT
39+
40+
echo "📄 Template versions:"
41+
echo " axios: $AXIOS_VERSION"
42+
echo " typescript: $TS_VERSION"
43+
echo " @types/node: $NODE_VERSION"
44+
45+
- name: Validate all package.json files
46+
run: |
47+
TEMPLATE_AXIOS="${{ steps.template.outputs.axios }}"
48+
TEMPLATE_TS="${{ steps.template.outputs.typescript }}"
49+
TEMPLATE_NODE="${{ steps.template.outputs.node }}"
50+
51+
MISMATCH=false
52+
MISMATCH_DETAILS=""
53+
54+
# Check each package.json file
55+
while IFS= read -r package_file; do
56+
[ -z "$package_file" ] && continue
57+
58+
# Get directory name for clearer output
59+
DIR=$(dirname "$package_file")
60+
[ "$DIR" = "." ] && DIR="root"
61+
62+
echo ""
63+
echo "🔍 Checking $DIR/package.json..."
64+
65+
# Extract versions from this package.json
66+
PKG_AXIOS=$(jq -r '.dependencies.axios // empty' "$package_file")
67+
PKG_TS=$(jq -r '.devDependencies.typescript // empty' "$package_file")
68+
PKG_NODE=$(jq -r '.devDependencies["@types/node"] // empty' "$package_file")
69+
70+
echo " axios: $PKG_AXIOS"
71+
echo " typescript: $PKG_TS"
72+
echo " @types/node: $PKG_NODE"
73+
74+
# Compare versions
75+
if [ -n "$PKG_AXIOS" ] && [ "$PKG_AXIOS" != "$TEMPLATE_AXIOS" ]; then
76+
echo " ❌ MISMATCH: axios ($PKG_AXIOS vs template $TEMPLATE_AXIOS)"
77+
MISMATCH=true
78+
MISMATCH_DETAILS="${MISMATCH_DETAILS}\n - $DIR: axios $PKG_AXIOS (expected $TEMPLATE_AXIOS)"
79+
fi
80+
81+
if [ -n "$PKG_TS" ] && [ "$PKG_TS" != "$TEMPLATE_TS" ]; then
82+
echo " ❌ MISMATCH: typescript ($PKG_TS vs template $TEMPLATE_TS)"
83+
MISMATCH=true
84+
MISMATCH_DETAILS="${MISMATCH_DETAILS}\n - $DIR: typescript $PKG_TS (expected $TEMPLATE_TS)"
85+
fi
86+
87+
if [ -n "$PKG_NODE" ] && [ "$PKG_NODE" != "$TEMPLATE_NODE" ]; then
88+
echo " ❌ MISMATCH: @types/node ($PKG_NODE vs template $TEMPLATE_NODE)"
89+
MISMATCH=true
90+
MISMATCH_DETAILS="${MISMATCH_DETAILS}\n - $DIR: @types/node $PKG_NODE (expected $TEMPLATE_NODE)"
91+
fi
92+
93+
if [ "$MISMATCH" = false ]; then
94+
echo " ✅ All versions match template"
95+
fi
96+
done <<< "${{ steps.find_packages.outputs.packages }}"
97+
98+
if [ "$MISMATCH" = true ]; then
99+
echo ""
100+
echo "❌ ERROR: Template and generated files are out of sync!"
101+
echo ""
102+
echo "Mismatches found:"
103+
echo -e "$MISMATCH_DETAILS"
104+
echo ""
105+
echo "📝 To fix:"
106+
echo " 1. Update openapi/templates/package.mustache with the correct versions"
107+
echo " 2. Regenerate all versions to sync package.json files"
108+
echo " 3. Or manually update all package.json files to match the template"
109+
exit 1
110+
fi
111+
112+
echo ""
113+
echo "✅ All package.json files match the template!"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ wwwroot/*.js
22
node_modules
33
typings
44
dist
5+
package-lock.json
56

67
# Ignore all tempfiles.
78
/tmp/*

openapi/config-latest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
---
44
generatorName: typescript-axios
55
npmName: mx-platform-node
6-
npmVersion: 1.12.0
6+
npmVersion: 1.12.1
77
supportsES6: true

openapi/config-v20111101.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
22
generatorName: typescript-axios
33
npmName: mx-platform-node-v20111101
4-
npmVersion: 1.12.0
4+
npmVersion: 1.12.1
55
supportsES6: true

openapi/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
npmName: mx-platform-node
3-
npmVersion: 1.12.0
3+
npmVersion: 1.12.1
44
supportsES6: true

openapi/templates/package.mustache

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@
1616
"build": "tsc --outDir dist/",
1717
"prepare": "npm run build"
1818
},
19+
"_comment": "IMPORTANT: Keep these dependency versions in sync with security updates. If package.json is manually updated for security fixes, this template MUST also be updated to prevent automated generation from overwriting the fixes.",
1920
"dependencies": {
20-
"axios": "^0.21.4"
21+
"axios": "^1.6.8"
2122
},
2223
"devDependencies": {
23-
"@types/node": "^12.11.5",
24-
"typescript": "^3.6.4"
24+
"@types/node": "^20.12.7",
25+
"typescript": "^5.4.5"
2526
}{{#npmRepository}},{{/npmRepository}}
2627
{{#npmRepository}}
2728
"publishConfig": {

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mx-platform-node",
3-
"version": "1.12.0",
3+
"version": "1.12.1",
44
"description": "A Node library for the MX Platform API.",
55
"author": "MX",
66
"keywords": [
@@ -16,11 +16,12 @@
1616
"build": "tsc --outDir dist/",
1717
"prepare": "npm run build"
1818
},
19+
"_comment": "IMPORTANT: Keep these dependency versions in sync with security updates. If package.json is manually updated for security fixes, this template MUST also be updated to prevent automated generation from overwriting the fixes.",
1920
"dependencies": {
20-
"axios": "^0.21.4"
21+
"axios": "^1.6.8"
2122
},
2223
"devDependencies": {
23-
"@types/node": "^12.11.5",
24-
"typescript": "^3.6.4"
24+
"@types/node": "^20.12.7",
25+
"typescript": "^5.4.5"
2526
}
2627
}

0 commit comments

Comments
 (0)