Skip to content

Commit 663bfe1

Browse files
feat: update prettier plugin and CI pulls main and release pulls latest version tag
1 parent 5d3b169 commit 663bfe1

3 files changed

Lines changed: 44 additions & 7 deletions

File tree

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
}
131131
},
132132
"scripts": {
133-
"vscode:prepublish": "pnpm run bundle-deps && pnpm run package",
133+
"vscode:prepublish": "pnpm run sync-node-deps && pnpm run bundle-deps && pnpm run package",
134134
"compile": "pnpm run check-types && node build.js",
135135
"watch": "concurrently \"pnpm run watch:esbuild\" \"pnpm run watch:tsc\"",
136136
"watch:esbuild": "node build.js --watch",
@@ -139,6 +139,7 @@
139139
"vsix": "pnpm run vscode:prepublish && npx @vscode/vsce package --no-dependencies",
140140
"check-types": "tsc --noEmit -p ./",
141141
"bundle-deps": "./scripts/bundle-deps",
142+
"sync-node-deps": "./scripts/sync-node-deps",
142143
"lint": "eslint .",
143144
"lint:fix": "eslint . --fix",
144145
"format": "prettier --write .",
@@ -163,7 +164,7 @@
163164
"dependencies": {
164165
"@wasm-fmt/ruff_fmt": "^0.9.0",
165166
"prettier": "^3.6.2",
166-
"prettier-plugin-pywire": "git+https://github.com/pywire/prettier-plugin-pywire.git",
167+
"prettier-plugin-pywire": "github:pywire/prettier-plugin-pywire#main",
167168
"vscode-languageclient": "^9.0.1",
168169
"web-tree-sitter": "^0.26.3"
169170
}

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/sync-node-deps

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/sh -e
2+
3+
# This script ensures that prettier-plugin-pywire is pinned to the correct version
4+
# (tag for release, main for development/nightly).
5+
6+
REPO_URL="https://github.com/pywire/prettier-plugin-pywire.git"
7+
8+
get_latest_tag() {
9+
# Get the latest tag matching v* sorted by version number
10+
TAG=$(git ls-remote --tags --sort='v:refname' "$REPO_URL" 'refs/tags/v*' | tail -n1 | sed 's|.*refs/tags/||')
11+
if [ -z "$TAG" ]; then
12+
echo "main"
13+
else
14+
echo "$TAG"
15+
fi
16+
}
17+
18+
if [ "$PYWIRE_RELEASE" = "1" ]; then
19+
echo "Release mode detected for Node dependencies. Fetching latest tag..."
20+
REF=$(get_latest_tag)
21+
echo "Using prettier-plugin-pywire@$REF"
22+
else
23+
REF="main"
24+
echo "Dev/CI mode. Using prettier-plugin-pywire@main"
25+
fi
26+
27+
# Check current version in package.json to avoid unnecessary pnpm add
28+
CURRENT=$(grep -o "prettier-plugin-pywire\": \"git+$REPO_URL#[^\"]*" package.json | sed "s|.*#||" || echo "")
29+
30+
if [ "$CURRENT" != "$REF" ]; then
31+
echo "Updating prettier-plugin-pywire dependency to #$REF..."
32+
# We use pnpm add to update package.json and pnpm-lock.yaml
33+
pnpm add "git+$REPO_URL#$REF"
34+
else
35+
echo "prettier-plugin-pywire is already at #$REF."
36+
fi

0 commit comments

Comments
 (0)