Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions .github/release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@
"release-type": "node",
"packages": {
".": {
"package-name": "@mulham28/pkgmap",
"extra-files": [
{
"type": "generic",
"path": "src/version.js",
"search-by-line": true
}
]
"package-name": "@mulham28/pkgmap"
}
}
}
9 changes: 6 additions & 3 deletions .github/workflows/update-homebrew-tap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,18 @@ jobs:
URL="https://registry.npmjs.org/@mulham28/pkgmap/-/pkgmap-${VERSION}.tgz"

# Retry up to 5x — npm CDN may lag slightly after publish
SHA=""
for i in $(seq 1 5); do
SHA=$(curl -fsSL "$URL" | sha256sum | awk '{print $1}')
[ -n "$SHA" ] && break
if curl -fsSL "$URL" -o /tmp/pkgmap.tgz 2>/dev/null; then
SHA=$(sha256sum /tmp/pkgmap.tgz | awk '{print $1}')
break
fi
echo "Attempt $i failed, retrying in 15s..."
sleep 15
done

if [ -z "$SHA" ]; then
echo "Failed to compute sha256 for $URL"
echo "Failed to download tarball from $URL"
exit 1
fi

Expand Down
8 changes: 0 additions & 8 deletions scripts/sync-version-check.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import fs from 'node:fs'

const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'))
const lock = JSON.parse(fs.readFileSync('package-lock.json', 'utf8'))
const srcVersion = fs.readFileSync('src/version.js', 'utf8')

const pkgVersion = pkg.version
const mismatches = []
Expand All @@ -12,13 +11,6 @@ if (lock.packages?.['']?.version !== pkgVersion) {
mismatches.push(`package-lock.json packages[""].version=${lock.packages?.['']?.version}`)
}

const versionMatch = srcVersion.match(/APP_VERSION\s*=\s*'([^']+)'/)
if (!versionMatch) {
mismatches.push('src/version.js APP_VERSION not found')
} else if (versionMatch[1] !== pkgVersion) {
mismatches.push(`src/version.js APP_VERSION=${versionMatch[1]}`)
}

if (mismatches.length) {
console.error(`Version drift detected. package.json=${pkgVersion}`)
for (const item of mismatches) console.error(`- ${item}`)
Expand Down
7 changes: 6 additions & 1 deletion src/version.js
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
export const APP_VERSION = '1.2.0'
import { createRequire } from 'module'

const require = createRequire(import.meta.url)
const { version } = require('../package.json')

export const APP_VERSION = version
Loading