mirror of
https://github.com/oven-sh/setup-bun.git
synced 2026-05-13 04:30:14 +02:00
Compare commits
42 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0c5077e514 | |||
| 1255e43b02 | |||
| 61861d1f6a | |||
| 6f5bd063f5 | |||
| e3914758a4 | |||
| ecf28ddc73 | |||
| 95edc153a3 | |||
| 4c32875876 | |||
| 0ff83bfc51 | |||
| ab8cb4e8f8 | |||
| 196aaa2bd2 | |||
| 3d267786b1 | |||
| db6bcf6eb8 | |||
| 4a638a4fad | |||
| 563911925f | |||
| b02f8a8a6e | |||
| 8c296f9cb7 | |||
| b7a1c7ccf2 | |||
| ad1208bf19 | |||
| bc6f04ce3b | |||
| 1dbab0699e | |||
| 635640504f | |||
| 22457c87c1 | |||
| 237a6a77d8 | |||
| 53e6487b6e | |||
| 68643ea879 | |||
| 56169ab7b0 | |||
| 34f777aec1 | |||
| 7c641390eb | |||
| 735343b667 | |||
| 27ecfffdee | |||
| fcc30ed971 | |||
| 56408e9a3f | |||
| 85cb7f6e7e | |||
| 54cb141c5c | |||
| 6fb6603cc1 | |||
| 9bdeab4320 | |||
| f09eb1edd0 | |||
| 8f1bc2eeb3 | |||
| a8913c42f4 | |||
| b9d34de66d | |||
| 1e54087d4f |
@@ -1,28 +1,86 @@
|
||||
name: Compare Bun Version
|
||||
description: Compare the version of Bun to a specified version
|
||||
name: ⚖️ Compare Bun Version
|
||||
description: Compare the installed Bun version against a version specification.
|
||||
|
||||
inputs:
|
||||
bun-version:
|
||||
description: "The version of Bun to compare against"
|
||||
description: The version spec to compare against (e.g., '1.1.0', 'canary', '>1.2.0', '1.x').
|
||||
required: true
|
||||
default: "1.1.0"
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
using: composite
|
||||
steps:
|
||||
- name: Get installed Bun version
|
||||
- name: 🛠️ Get installed Bun version and revision
|
||||
id: bun
|
||||
shell: bash
|
||||
run: |
|
||||
bun --version
|
||||
echo "version=$(bun --version)" >> $GITHUB_OUTPUT
|
||||
echo "version=$(bun --version | tr -d '\r\n')" >> $GITHUB_OUTPUT
|
||||
echo "revision=$(bun --revision 2>/dev/null || true)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Compare versions
|
||||
- name: ⚖️ Compare versions
|
||||
shell: bash
|
||||
env:
|
||||
REQUESTED_SPEC: ${{ inputs.bun-version }}
|
||||
ACTUAL_VERSION: ${{ steps.bun.outputs.version }}
|
||||
ACTUAL_REVISION: ${{ steps.bun.outputs.revision }}
|
||||
run: |
|
||||
if [[ "${{ steps.bun.outputs.version }}" == "${{ inputs.bun-version }}" ]]; then
|
||||
echo "Version is ${{ inputs.bun-version }}"
|
||||
else
|
||||
echo "Expected version to be ${{ inputs.bun-version }}, got ${{ steps.bun.outputs.version }}"
|
||||
exit 1
|
||||
set -euo pipefail
|
||||
|
||||
# Function to compare two semantic versions (e.g., version_compare 1.2.3 1.10.0)
|
||||
# Returns: 0 if v1 == v2, 1 if v1 > v2, 2 if v1 < v2
|
||||
version_compare() {
|
||||
if [[ "$1" == "$2" ]]; then return 0; fi
|
||||
local lowest=$(printf '%s\n' "$1" "$2" | sort -V | head -n1)
|
||||
if [[ "$1" == "$lowest" ]]; then return 2; else return 1; fi
|
||||
}
|
||||
|
||||
echo "Requested spec: ${REQUESTED_SPEC}"
|
||||
echo "Actual version: ${ACTUAL_VERSION}"
|
||||
|
||||
# Case 1: 'latest' - always passes
|
||||
if [[ "${REQUESTED_SPEC}" == "latest" ]]; then
|
||||
echo "OK: Skipping explicit version check for 'latest'."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Case 2: 'canary' - check for 'canary' in revision or version string
|
||||
if [[ "${REQUESTED_SPEC}" == "canary" ]]; then
|
||||
if [[ "${ACTUAL_REVISION}" == *canary* ]] || [[ "${ACTUAL_VERSION}" == *canary* ]]; then
|
||||
echo "OK: Detected canary build (version: ${ACTUAL_VERSION}, revision: ${ACTUAL_REVISION:-n/a})."
|
||||
exit 0
|
||||
else
|
||||
echo "Error: Expected a canary build, but got ${ACTUAL_VERSION} (revision: ${ACTUAL_REVISION:-n/a})."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Case 3: Semver ranges (e.g., >1.0.0, <2, 1.x, 1.1.0)
|
||||
op_part=$(echo "${REQUESTED_SPEC}" | sed -E 's/^([><=]*).*/\1/')
|
||||
version_part=$(echo "${REQUESTED_SPEC}" | sed -E 's/^[><= ]*//')
|
||||
|
||||
op="${op_part:-==}"
|
||||
version_base="${version_part//.x/}"
|
||||
|
||||
# Handle wildcards like '1.x' or '1'
|
||||
if [[ "${version_part}" == *.x* ]] || { [[ ! "${version_part}" == *.* ]] && [[ "${op}" == "==" ]]; }; then
|
||||
if [[ "${ACTUAL_VERSION}" == "${version_base}" || "${ACTUAL_VERSION}" == "${version_base}".* ]]; then
|
||||
echo "OK: Version ${ACTUAL_VERSION} matches wildcard spec '${REQUESTED_SPEC}'."
|
||||
exit 0
|
||||
else
|
||||
echo "Error: Version ${ACTUAL_VERSION} does not match wildcard spec '${REQUESTED_SPEC}'."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Perform comparison for >, <, >=, <=, ==
|
||||
version_compare "${ACTUAL_VERSION}" "${version_part}" && result=0 || result=$?
|
||||
|
||||
case "${op}" in
|
||||
'==') if [[ ${result} -ne 0 ]]; then echo "Error: Expected version ${version_part}, but got ${ACTUAL_VERSION}." && exit 1; fi ;;
|
||||
'>') if [[ ${result} -ne 1 ]]; then echo "Error: Expected version > ${version_part}, but got ${ACTUAL_VERSION}." && exit 1; fi ;;
|
||||
'<') if [[ ${result} -ne 2 ]]; then echo "Error: Expected version < ${version_part}, but got ${ACTUAL_VERSION}." && exit 1; fi ;;
|
||||
'>=') if [[ ${result} -eq 2 ]]; then echo "Error: Expected version >= ${version_part}, but got ${ACTUAL_VERSION}." && exit 1; fi ;;
|
||||
'<=') if [[ ${result} -eq 1 ]]; then echo "Error: Expected version <= ${version_part}, but got ${ACTUAL_VERSION}." && exit 1; fi ;;
|
||||
*) echo "Error: Unsupported operator '${op}' in spec '${REQUESTED_SPEC}'." && exit 1 ;;
|
||||
esac
|
||||
|
||||
echo "OK: Version ${ACTUAL_VERSION} satisfies spec '${REQUESTED_SPEC}'."
|
||||
|
||||
@@ -14,17 +14,19 @@ jobs:
|
||||
format:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20.x
|
||||
- name: Install Dependencies
|
||||
run: npm install
|
||||
- name: Format
|
||||
- name: 📥 Checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: 🛠️ Setup Bun
|
||||
uses: ./
|
||||
|
||||
- name: 📦 Install Dependencies
|
||||
run: bun install
|
||||
|
||||
- name: 🧹 Format
|
||||
run: |
|
||||
npm run format
|
||||
npm run build
|
||||
- name: Commit
|
||||
uses: autofix-ci/action@d3e591514b99d0fca6779455ff8338516663f7cc
|
||||
bun run format
|
||||
bun run build
|
||||
|
||||
- name: 💾 Commit
|
||||
uses: autofix-ci/action@635ffb0c9798bd160680f18fd73371e355b85f27 # v1.3.2
|
||||
|
||||
@@ -1,25 +1,27 @@
|
||||
name: Release new action version
|
||||
name: 🚀 Release new action version
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [released]
|
||||
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
TAG_NAME:
|
||||
description: 'Tag name that the major tag will point to'
|
||||
description: Tag name that the major tag will point to
|
||||
required: true
|
||||
|
||||
env:
|
||||
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
update_tag:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/publish-action@v0.3.0
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- uses: actions/publish-action@23f4c6f12633a2da8f44938b71fde9afec138fb4 # v0.4.0
|
||||
env:
|
||||
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
|
||||
with:
|
||||
source-tag: ${{ env.TAG_NAME }}
|
||||
|
||||
+199
-38
@@ -1,4 +1,4 @@
|
||||
name: Test
|
||||
name: 🧪 Test
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -15,109 +15,270 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
permissions: write-all
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: 📥 Checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Install github cli
|
||||
run: |
|
||||
(type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \
|
||||
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
|
||||
&& wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
|
||||
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
|
||||
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
|
||||
&& sudo apt update \
|
||||
&& sudo apt install gh -y
|
||||
|
||||
- run: |
|
||||
gh cache delete --all || true
|
||||
- name: 🗑️ Remove cache
|
||||
run: gh cache delete --all || true
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
|
||||
tests:
|
||||
name: Tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Setup Bun
|
||||
uses: ./
|
||||
with:
|
||||
no-cache: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install
|
||||
|
||||
- name: Run tests
|
||||
run: bun test --coverage
|
||||
|
||||
setup-bun:
|
||||
runs-on: ${{ matrix.os }}
|
||||
continue-on-error: true
|
||||
needs: [remove-cache]
|
||||
needs: [remove-cache, tests]
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- macos-latest
|
||||
- windows-latest
|
||||
- windows-11-arm
|
||||
bun-version:
|
||||
- latest
|
||||
- canary
|
||||
- "1.1.0"
|
||||
- "1.3.10"
|
||||
- "1.x"
|
||||
- "1"
|
||||
- "> 1.0.0"
|
||||
- "< 2"
|
||||
# https://github.com/oven-sh/setup-bun/issues/37
|
||||
# - "1.x"
|
||||
# - "1"
|
||||
# - "> 1.0.0"
|
||||
# - "< 2"
|
||||
# Disable <sha> support for now. This is because Github Artifacts
|
||||
# expire after 90 days, and we don't have another source of truth yet.
|
||||
# - "822a00c4d508b54f650933a73ca5f4a3af9a7983" # 1.0.0 commit
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Bun
|
||||
steps:
|
||||
- name: 📥 Checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: 🛠️ Setup Bun
|
||||
uses: ./
|
||||
id: setup_bun
|
||||
with:
|
||||
bun-version: ${{ matrix.bun-version }}
|
||||
no-cache: true
|
||||
|
||||
- name: Run Bun
|
||||
- name: ▶️ Run Bun
|
||||
id: run_bun
|
||||
run: |
|
||||
bun --version
|
||||
|
||||
- name: ⚖️ Verify Bun version
|
||||
uses: ./.github/actions/compare-bun-version
|
||||
with:
|
||||
bun-version: ${{ matrix.bun-version }}
|
||||
|
||||
setup-bun-from-file:
|
||||
name: setup-bun from (${{ matrix.os }}, ${{ matrix.file.name }})
|
||||
runs-on: ${{ matrix.os }}
|
||||
continue-on-error: true
|
||||
needs: [remove-cache]
|
||||
needs: [remove-cache, tests]
|
||||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- macos-latest
|
||||
- windows-latest
|
||||
- windows-11-arm
|
||||
|
||||
file:
|
||||
- name: package.json (bun@1.1.0)
|
||||
- name: package.json (packageManager bun@1.1.0)
|
||||
file: package.json
|
||||
run: |
|
||||
echo "$(jq '. += {"packageManager": "bun@1.1.0"}' package.json)" > package.json
|
||||
- name: package.json (yarn@bun@1.1.0)
|
||||
|
||||
- name: foo/package.json (packageManager bun@1.1.0)
|
||||
file: foo/package.json
|
||||
run: |
|
||||
mkdir -p foo
|
||||
echo "$(jq '. += {"packageManager": "bun@1.1.0"}' package.json)" > foo/package.json
|
||||
|
||||
- name: package.json (packageManager yarn@bun@1.1.0)
|
||||
file: package.json
|
||||
run: |
|
||||
echo "$(jq '. += {"packageManager": "yarn@bun@1.1.0"}' package.json)" > package.json
|
||||
|
||||
- name: package.json (engines bun@1.1.0)
|
||||
file: package.json
|
||||
run: |
|
||||
echo "$(jq '.engines = {"bun": "1.1.0"}' package.json)" > package.json
|
||||
|
||||
- name: .tool-versions (bun 1.1.0)
|
||||
file: .tool-versions
|
||||
run: |
|
||||
echo "bun 1.1.0" > .tool-versions
|
||||
run: echo "bun 1.1.0" > .tool-versions
|
||||
|
||||
- name: .tool-versions (bun1.1.0)
|
||||
file: .tool-versions
|
||||
run: |
|
||||
echo "bun1.1.0" > .tool-versions
|
||||
run: echo "bun1.1.0" > .tool-versions
|
||||
|
||||
- name: .tool-versions (bun 1.1.0)
|
||||
file: .tool-versions
|
||||
run: echo "bun 1.1.0" > .tool-versions
|
||||
|
||||
- name: .bumrc (1.1.0)
|
||||
file: .bumrc
|
||||
run: |
|
||||
echo "1.1.0" > .bumrc
|
||||
run: echo "1.1.0" > .bumrc
|
||||
|
||||
- name: .bun-version (1.1.0)
|
||||
file: .bun-version
|
||||
run: |
|
||||
echo "1.1.0" > .bun-version
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
run: echo "1.1.0" > .bun-version
|
||||
|
||||
- name: Setup file
|
||||
steps:
|
||||
- name: 📥 Checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: 📄 Setup file
|
||||
run: ${{ matrix.file.run }}
|
||||
|
||||
- name: Setup Bun
|
||||
- name: 🛠️ Setup Bun
|
||||
uses: ./
|
||||
with:
|
||||
bun-version-file: ${{ matrix.file.file }}
|
||||
no-cache: true
|
||||
|
||||
- name: Compare versions
|
||||
- name: ⚖️ Compare versions
|
||||
uses: ./.github/actions/compare-bun-version
|
||||
with:
|
||||
bun-version: "1.1.0"
|
||||
|
||||
setup-bun-from-package-json-without-specified-field:
|
||||
name: setup-bun from (${{ matrix.os }}, ${{ matrix.file.name }}) without specified field
|
||||
runs-on: ${{ matrix.os }}
|
||||
continue-on-error: true
|
||||
needs: [remove-cache, tests]
|
||||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- macos-latest
|
||||
- windows-latest
|
||||
- windows-11-arm
|
||||
|
||||
file:
|
||||
- name: package.json (packageManager bun@1.1.0)
|
||||
file: package.json
|
||||
run: |
|
||||
echo "$(jq '. += {"packageManager": "bun@1.1.0"}' package.json)" > package.json
|
||||
|
||||
- name: package.json (packageManager yarn@bun@1.1.0)
|
||||
file: package.json
|
||||
run: |
|
||||
echo "$(jq '. += {"packageManager": "yarn@bun@1.1.0"}' package.json)" > package.json
|
||||
|
||||
- name: package.json (engines bun@1.1.0)
|
||||
file: package.json
|
||||
run: |
|
||||
echo "$(jq '.engines = {"bun": "1.1.0"}' package.json)" > package.json
|
||||
|
||||
steps:
|
||||
- name: 📥 Checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: 📄 Setup file
|
||||
run: ${{ matrix.file.run }}
|
||||
|
||||
- name: 🛠️ Setup Bun
|
||||
uses: ./
|
||||
with:
|
||||
no-cache: true
|
||||
|
||||
- name: ⚖️ Compare versions
|
||||
uses: ./.github/actions/compare-bun-version
|
||||
with:
|
||||
bun-version: "1.1.0"
|
||||
|
||||
setup-bun-download-url:
|
||||
name: setup-bun from (${{ matrix.os }}, download url)
|
||||
runs-on: ${{ matrix.os }}
|
||||
continue-on-error: true
|
||||
needs: [remove-cache, tests]
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- macos-latest
|
||||
- windows-latest
|
||||
|
||||
steps:
|
||||
- name: 📥 Checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: 🛠️ Setup Bun
|
||||
uses: ./
|
||||
id: setup_bun
|
||||
with:
|
||||
bun-download-url: "https://github.com/oven-sh/bun/releases/latest/download/bun-${{runner.os == 'macOS' && 'darwin' || runner.os}}-${{ runner.arch == 'X64' && 'x64' || 'aarch64' }}.zip"
|
||||
|
||||
- name: ▶️ Run Bun
|
||||
id: run_bun
|
||||
run: |
|
||||
bun --version
|
||||
|
||||
test-custom-registries:
|
||||
name: test installing deps from custom registries (${{ matrix.os }})
|
||||
runs-on: ${{ matrix.os }}
|
||||
continue-on-error: true
|
||||
needs: [remove-cache, tests]
|
||||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: 📥 Checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: 🛠️ Setup Bun
|
||||
uses: ./
|
||||
id: setup_bun
|
||||
with:
|
||||
registries: |
|
||||
https://registry.npmjs.org
|
||||
@types:https://registry.yarnpkg.com
|
||||
|
||||
- name: ▶️ Install from default registry
|
||||
run: |
|
||||
output=$(bun add is-odd --verbose --force 2>&1)
|
||||
|
||||
if echo "$output" | grep -q "HTTP/1.1 GET https://registry.npmjs.org/is-odd"; then
|
||||
echo "Successfully installed from default registry"
|
||||
else
|
||||
echo "Failed to install from default registry"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: ▶️ Install from @types registry
|
||||
run: |
|
||||
output=$(bun add @types/bun --verbose --force 2>&1)
|
||||
|
||||
if echo "$output" | grep -q "HTTP/1.1 GET https://registry.yarnpkg.com/@types%2fbun"; then
|
||||
echo "Successfully installed from @types registry"
|
||||
else
|
||||
echo "Failed to install from @types registry"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"semi": true,
|
||||
"quoteProps": "preserve"
|
||||
}
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"recommendations": ["esbenp.prettier-vscode", "github.vscode-github-actions"]
|
||||
}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"search.exclude": {
|
||||
"dist/**": true
|
||||
},
|
||||
// Lock changes to these files
|
||||
"files.readonlyInclude": {
|
||||
"dist/**": true,
|
||||
"bun.lock": true,
|
||||
"package-lock.json": true
|
||||
},
|
||||
}
|
||||
@@ -4,6 +4,18 @@ Download, install, and setup [Bun](https://bun.sh) in GitHub Actions.
|
||||
|
||||
## Usage
|
||||
|
||||
```yaml
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
```
|
||||
|
||||
By default, if no version is specified, the action will:
|
||||
|
||||
1. Check `package.json` for the `packageManager` field (e.g., `"packageManager": "bun@1.0.25"`)
|
||||
2. If `packageManager` doesn't exist, check `package.json` for `engines.bun`
|
||||
3. If neither exists or `package.json` is not found, use `latest`
|
||||
|
||||
You can also explicitly specify a version:
|
||||
|
||||
```yaml
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
@@ -18,47 +30,63 @@ Download, install, and setup [Bun](https://bun.sh) in GitHub Actions.
|
||||
bun-version-file: ".bun-version"
|
||||
```
|
||||
|
||||
### Using a custom NPM registry
|
||||
## Using custom registries
|
||||
|
||||
You can configure multiple package registries using the `registries` input. This supports both default and scoped registries with various authentication methods.
|
||||
|
||||
### Registry configuration
|
||||
|
||||
```yaml
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
registry-url: "https://npm.pkg.github.com/"
|
||||
scope: "@foo"
|
||||
```
|
||||
registries: |
|
||||
https://registry.npmjs.org/
|
||||
@myorg:https://npm.pkg.github.com/|$GITHUB_TOKEN
|
||||
@internal:https://username:$INTERNAL_PASSWORD@registry.internal.com/
|
||||
|
||||
If you need to authenticate with a private registry, you can set the `BUN_AUTH_TOKEN` environment variable.
|
||||
|
||||
```yaml
|
||||
- name: Install Dependencies
|
||||
- name: Install dependencies
|
||||
env:
|
||||
BUN_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: bun install --frozen-lockfile
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
INTERNAL_PASSWORD: ${{ secrets.INTERNAL_PASSWORD }}
|
||||
run: bun install
|
||||
```
|
||||
|
||||
#### Registry format options
|
||||
|
||||
| Type | Format |
|
||||
| ------------------------------------ | --------------------------------------------------------- |
|
||||
| Default registry | `https://registry.example.com/` |
|
||||
| Default registry with token | `https://registry.example.com/\|$TOKEN` |
|
||||
| Scoped registry | `@scope:https://registry.example.com/` |
|
||||
| Scoped registry with token | `@scope:https://registry.example.com/\|$TOKEN` |
|
||||
| Scoped registry with URL credentials | `@scope:https://username:$PASSWORD@registry.example.com/` |
|
||||
|
||||
> [!IMPORTANT]
|
||||
> When using authentication, make sure to set the corresponding environment variables in your workflow steps that need access to the registries.
|
||||
|
||||
For more information about configuring registries in Bun, see the [official documentation](https://bun.sh/docs/install/registries).
|
||||
|
||||
### Override download url
|
||||
|
||||
If you need to override the download URL, you can use the `bun-download-url` input.
|
||||
|
||||
```yaml
|
||||
- uses: oven-sh/setup-bun
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-download-url: "https://github.com/oven-sh/bun/releases/latest/download/bun-linux-x64.zip"
|
||||
```
|
||||
|
||||
### Node.js not needed
|
||||
|
||||
In most cases, you shouldn't need to use the [setup-node](https://github.com/actions/setup-node) GitHub Action.
|
||||
|
||||
## Inputs
|
||||
|
||||
| Name | Description | Default | Examples |
|
||||
| ------------------ | ----------------------------------------------------- | ----------- | ------------------------------------------------ |
|
||||
| `bun-version` | The version of Bun to download and install. | `latest` | `canary`, `1.0.0`, `1.0.x` |
|
||||
| `bun-version-file` | The version of Bun to download and install from file. | `undefined` | `package.json`, `.bun-version`, `.tool-versions` |
|
||||
| `bun-download-url` | URL to download .zip file for Bun release | | |
|
||||
| `registry-url` | Registry URL where some private package is stored. | `undefined` | `"https://npm.pkg.github.com/"` |
|
||||
| `scope` | Scope for private packages. | `undefined` | `"@foo"`, `"@orgname"` |
|
||||
| Name | Description | Default | Examples |
|
||||
| ------------------ | --------------------------------------------------------------------------------- | ---------------------------------------- | ------------------------------------------------ |
|
||||
| `bun-version` | The version of Bun to download and install. | Version from `package.json`, or `latest` | `canary`, `1.0.0`, `1.0.x` |
|
||||
| `bun-version-file` | The version of Bun to download and install from file. | `undefined` | `package.json`, `.bun-version`, `.tool-versions` |
|
||||
| `bun-download-url` | URL to download .zip file for Bun release | | |
|
||||
| `registry-url` | Registry URL where some private package is stored. | `undefined` | `"https://npm.pkg.github.com/"` |
|
||||
| `scope` | Scope for private packages. | `undefined` | `"@foo"`, `"@orgname"` |
|
||||
| `no-cache` | Disable caching of the downloaded executable. | `false` | `true`, `false` |
|
||||
| `token` | Personal access token (PAT) used to fetch tags from the `oven-sh/bun` repository. | `${{ github.token }}` | `${{ secrets.GITHUB_TOKEN }}` |
|
||||
|
||||
## Outputs
|
||||
|
||||
|
||||
+24
-6
@@ -1,31 +1,49 @@
|
||||
name: Setup Bun
|
||||
description: Download, install, and setup Bun to your path.
|
||||
author: robobun
|
||||
|
||||
branding:
|
||||
icon: play-circle
|
||||
color: white
|
||||
|
||||
inputs:
|
||||
bun-version:
|
||||
description: 'The version of Bun to install. (e.g. "latest", "canary", "1.0.0", "1.0.x", <sha>)'
|
||||
description: The version of Bun to install. (e.g. "latest", "canary", "1.0.0", "1.0.x", <sha>)
|
||||
required: false
|
||||
bun-version-file:
|
||||
description: 'The version of Bun to install from file. (e.g. "package.json", ".bun-version", ".tool-versions")'
|
||||
description: The version of Bun to install from file. (e.g. "package.json", ".bun-version", ".tool-versions")
|
||||
default: null
|
||||
required: false
|
||||
bun-download-url:
|
||||
description: "Override the URL to download Bun from. This skips version resolution and verifying AVX2 support."
|
||||
description: Override the URL to download Bun from. This skips version resolution and verifying AVX2 support.
|
||||
required: false
|
||||
registries:
|
||||
description: |
|
||||
List of package registries with authentication support. Format:
|
||||
- Default registry: https://registry.npmjs.org/
|
||||
- Default with token: https://registry.npmjs.org/|token
|
||||
- Scoped registry: @scope:https://registry.example.com/
|
||||
- Scoped with token: @scope:https://registry.example.com/|token
|
||||
- Scoped with credentials: @scope:https://user:pass@registry.example.com/
|
||||
required: false
|
||||
registry-url:
|
||||
required: false
|
||||
description: "The URL of the package registry to use for installing Bun. Set the $BUN_AUTH_TOKEN environment variable to authenticate with the registry."
|
||||
description: The URL of the package registry to use for installing Bun. Set the $BUN_AUTH_TOKEN environment variable to authenticate with the registry.
|
||||
deprecationMessage: "Use 'registries' input instead."
|
||||
scope:
|
||||
required: false
|
||||
description: "The scope for authenticating with the package registry."
|
||||
deprecationMessage: "Use 'registries' input instead."
|
||||
no-cache:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Disable caching of bun executable."
|
||||
description: Disable caching of bun executable.
|
||||
token:
|
||||
required: false
|
||||
default: ${{ github.server_url == 'https://github.com' && github.token || '' }}
|
||||
description: Personal access token (PAT) used to fetch tags from oven-sh/bun repository. Recommended for resolving wildcard/range versions to avoid GitHub API rate limiting. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting.
|
||||
|
||||
outputs:
|
||||
bun-version:
|
||||
description: The version of Bun that was installed.
|
||||
@@ -39,7 +57,7 @@ outputs:
|
||||
description: If the version of Bun was cached.
|
||||
|
||||
runs:
|
||||
using: "node20"
|
||||
using: "node24"
|
||||
main: "dist/setup/index.js"
|
||||
post: "dist/cache-save/index.js"
|
||||
post-if: success()
|
||||
|
||||
@@ -0,0 +1,225 @@
|
||||
{
|
||||
"lockfileVersion": 1,
|
||||
"configVersion": 0,
|
||||
"workspaces": {
|
||||
"": {
|
||||
"name": "setup-bun",
|
||||
"dependencies": {
|
||||
"@actions/cache": "^5.0.5",
|
||||
"@actions/core": "^2.0.3",
|
||||
"@actions/exec": "^2.0.0",
|
||||
"@actions/glob": "^0.5.0",
|
||||
"@actions/io": "^2.0.0",
|
||||
"@actions/tool-cache": "^3.0.0",
|
||||
"@iarna/toml": "^2.2.5",
|
||||
"compare-versions": "^6.1.1",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/bun": "^1.3.10",
|
||||
"@types/node": "^24.0.0",
|
||||
"esbuild": "^0.19.12",
|
||||
"prettier": "^3.8.1",
|
||||
"typescript": "^4.9.5",
|
||||
},
|
||||
},
|
||||
},
|
||||
"patchedDependencies": {
|
||||
"compare-versions@6.1.1": "patches/compare-versions@6.1.1.patch",
|
||||
},
|
||||
"overrides": {
|
||||
"form-data": "^4.0.4",
|
||||
},
|
||||
"packages": {
|
||||
"@actions/cache": ["@actions/cache@5.0.5", "", { "dependencies": { "@actions/core": "^2.0.0", "@actions/exec": "^2.0.0", "@actions/glob": "^0.5.1", "@actions/http-client": "^3.0.2", "@actions/io": "^2.0.0", "@azure/abort-controller": "^1.1.0", "@azure/core-rest-pipeline": "^1.22.0", "@azure/storage-blob": "^12.29.1", "@protobuf-ts/runtime-rpc": "^2.11.1", "semver": "^6.3.1" } }, "sha512-jiQSg0gfd+C2KPgcmdCOq7dCuCIQQWQ4b1YfGIRaaA9w7PJbRwTOcCz4LiFEUnqZGf0ha/8OKL3BeNwetHzYsQ=="],
|
||||
|
||||
"@actions/core": ["@actions/core@2.0.3", "", { "dependencies": { "@actions/exec": "^2.0.0", "@actions/http-client": "^3.0.2" } }, "sha512-Od9Thc3T1mQJYddvVPM4QGiLUewdh+3txmDYHHxoNdkqysR1MbCT+rFOtNUxYAz+7+6RIsqipVahY2GJqGPyxA=="],
|
||||
|
||||
"@actions/exec": ["@actions/exec@2.0.0", "", { "dependencies": { "@actions/io": "^2.0.0" } }, "sha512-k8ngrX2voJ/RIN6r9xB82NVqKpnMRtxDoiO+g3olkIUpQNqjArXrCQceduQZCQj3P3xm32pChRLqRrtXTlqhIw=="],
|
||||
|
||||
"@actions/glob": ["@actions/glob@0.5.1", "", { "dependencies": { "@actions/core": "^2.0.3", "minimatch": "^3.0.4" } }, "sha512-+dv/t2aKQdKp9WWSp+1yIXVJzH5Q38M0Mta26pzIbeec14EcIleMB7UU6N7sNgbEuYfyuVGpE5pOKjl6j1WXkA=="],
|
||||
|
||||
"@actions/http-client": ["@actions/http-client@3.0.2", "", { "dependencies": { "tunnel": "^0.0.6", "undici": "^6.23.0" } }, "sha512-JP38FYYpyqvUsz+Igqlc/JG6YO9PaKuvqjM3iGvaLqFnJ7TFmcLyy2IDrY0bI0qCQug8E9K+elv5ZNfw62ZJzA=="],
|
||||
|
||||
"@actions/io": ["@actions/io@2.0.0", "", {}, "sha512-Jv33IN09XLO+0HS79aaODsvIRyduiF7NY/F6LYeK5oeUmrsz7aFdRphQjFoESF4jS7lMauDOttKALcpapVDIAg=="],
|
||||
|
||||
"@actions/tool-cache": ["@actions/tool-cache@3.0.1", "", { "dependencies": { "@actions/core": "^2.0.1", "@actions/exec": "^2.0.0", "@actions/http-client": "^3.0.2", "@actions/io": "^2.0.0", "semver": "^6.1.0" } }, "sha512-euK7sID37jMg1yWGkdXkLPI5Te7x/+2QMUPeHXogcpzUZ81mqlDZ+CgYhQo3LtB8LpVnnQyjs+hTTU0Ir4Y0RQ=="],
|
||||
|
||||
"@azure/abort-controller": ["@azure/abort-controller@1.1.0", "", { "dependencies": { "tslib": "^2.2.0" } }, ""],
|
||||
|
||||
"@azure/core-auth": ["@azure/core-auth@1.10.1", "", { "dependencies": { "@azure/abort-controller": "^2.1.2", "@azure/core-util": "^1.13.0", "tslib": "^2.6.2" } }, "sha512-ykRMW8PjVAn+RS6ww5cmK9U2CyH9p4Q88YJwvUslfuMmN98w/2rdGRLPqJYObapBCdzBVeDgYWdJnFPFb7qzpg=="],
|
||||
|
||||
"@azure/core-client": ["@azure/core-client@1.10.1", "", { "dependencies": { "@azure/abort-controller": "^2.1.2", "@azure/core-auth": "^1.10.0", "@azure/core-rest-pipeline": "^1.22.0", "@azure/core-tracing": "^1.3.0", "@azure/core-util": "^1.13.0", "@azure/logger": "^1.3.0", "tslib": "^2.6.2" } }, "sha512-Nh5PhEOeY6PrnxNPsEHRr9eimxLwgLlpmguQaHKBinFYA/RU9+kOYVOQqOrTsCL+KSxrLLl1gD8Dk5BFW/7l/w=="],
|
||||
|
||||
"@azure/core-http-compat": ["@azure/core-http-compat@2.3.2", "", { "dependencies": { "@azure/abort-controller": "^2.1.2" }, "peerDependencies": { "@azure/core-client": "^1.10.0", "@azure/core-rest-pipeline": "^1.22.0" } }, "sha512-Tf6ltdKzOJEgxZeWLCjMxrxbodB/ZeCbzzA1A2qHbhzAjzjHoBVSUeSl/baT/oHAxhc4qdqVaDKnc2+iE932gw=="],
|
||||
|
||||
"@azure/core-lro": ["@azure/core-lro@2.5.4", "", { "dependencies": { "@azure/abort-controller": "^1.0.0", "@azure/core-util": "^1.2.0", "@azure/logger": "^1.0.0", "tslib": "^2.2.0" } }, ""],
|
||||
|
||||
"@azure/core-paging": ["@azure/core-paging@1.6.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-YKWi9YuCU04B55h25cnOYZHxXYtEvQEbKST5vqRga7hWY9ydd3FZHdeQF8pyh+acWZvppw13M/LMGx0LABUVMA=="],
|
||||
|
||||
"@azure/core-rest-pipeline": ["@azure/core-rest-pipeline@1.23.0", "", { "dependencies": { "@azure/abort-controller": "^2.1.2", "@azure/core-auth": "^1.10.0", "@azure/core-tracing": "^1.3.0", "@azure/core-util": "^1.13.0", "@azure/logger": "^1.3.0", "@typespec/ts-http-runtime": "^0.3.4", "tslib": "^2.6.2" } }, "sha512-Evs1INHo+jUjwHi1T6SG6Ua/LHOQBCLuKEEE6efIpt4ZOoNonaT1kP32GoOcdNDbfqsD2445CPri3MubBy5DEQ=="],
|
||||
|
||||
"@azure/core-tracing": ["@azure/core-tracing@1.3.1", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-9MWKevR7Hz8kNzzPLfX4EAtGM2b8mr50HPDBvio96bURP/9C+HjdH3sBlLSNNrvRAr5/k/svoH457gB5IKpmwQ=="],
|
||||
|
||||
"@azure/core-util": ["@azure/core-util@1.13.1", "", { "dependencies": { "@azure/abort-controller": "^2.1.2", "@typespec/ts-http-runtime": "^0.3.0", "tslib": "^2.6.2" } }, "sha512-XPArKLzsvl0Hf0CaGyKHUyVgF7oDnhKoP85Xv6M4StF/1AhfORhZudHtOyf2s+FcbuQ9dPRAjB8J2KvRRMUK2A=="],
|
||||
|
||||
"@azure/core-xml": ["@azure/core-xml@1.5.0", "", { "dependencies": { "fast-xml-parser": "^5.0.7", "tslib": "^2.8.1" } }, "sha512-D/sdlJBMJfx7gqoj66PKVmhDDaU6TKA49ptcolxdas29X7AfvLTmfAGLjAcIMBK7UZ2o4lygHIqVckOlQU3xWw=="],
|
||||
|
||||
"@azure/logger": ["@azure/logger@1.3.0", "", { "dependencies": { "@typespec/ts-http-runtime": "^0.3.0", "tslib": "^2.6.2" } }, "sha512-fCqPIfOcLE+CGqGPd66c8bZpwAji98tZ4JI9i/mlTNTlsIWslCfpg48s/ypyLxZTump5sypjrKn2/kY7q8oAbA=="],
|
||||
|
||||
"@azure/storage-blob": ["@azure/storage-blob@12.31.0", "", { "dependencies": { "@azure/abort-controller": "^2.1.2", "@azure/core-auth": "^1.9.0", "@azure/core-client": "^1.9.3", "@azure/core-http-compat": "^2.2.0", "@azure/core-lro": "^2.2.0", "@azure/core-paging": "^1.6.2", "@azure/core-rest-pipeline": "^1.19.1", "@azure/core-tracing": "^1.2.0", "@azure/core-util": "^1.11.0", "@azure/core-xml": "^1.4.5", "@azure/logger": "^1.1.4", "@azure/storage-common": "^12.3.0", "events": "^3.0.0", "tslib": "^2.8.1" } }, "sha512-DBgNv10aCSxopt92DkTDD0o9xScXeBqPKGmR50FPZQaEcH4JLQ+GEOGEDv19V5BMkB7kxr+m4h6il/cCDPvmHg=="],
|
||||
|
||||
"@azure/storage-common": ["@azure/storage-common@12.3.0", "", { "dependencies": { "@azure/abort-controller": "^2.1.2", "@azure/core-auth": "^1.9.0", "@azure/core-http-compat": "^2.2.0", "@azure/core-rest-pipeline": "^1.19.1", "@azure/core-tracing": "^1.2.0", "@azure/core-util": "^1.11.0", "@azure/logger": "^1.1.4", "events": "^3.3.0", "tslib": "^2.8.1" } }, "sha512-/OFHhy86aG5Pe8dP5tsp+BuJ25JOAl9yaMU3WZbkeoiFMHFtJ7tu5ili7qEdBXNW9G5lDB19trwyI6V49F/8iQ=="],
|
||||
|
||||
"@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.19.12", "", { "os": "aix", "cpu": "ppc64" }, "sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA=="],
|
||||
|
||||
"@esbuild/android-arm": ["@esbuild/android-arm@0.19.12", "", { "os": "android", "cpu": "arm" }, "sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w=="],
|
||||
|
||||
"@esbuild/android-arm64": ["@esbuild/android-arm64@0.19.12", "", { "os": "android", "cpu": "arm64" }, "sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA=="],
|
||||
|
||||
"@esbuild/android-x64": ["@esbuild/android-x64@0.19.12", "", { "os": "android", "cpu": "x64" }, "sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew=="],
|
||||
|
||||
"@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.19.12", "", { "os": "darwin", "cpu": "arm64" }, "sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g=="],
|
||||
|
||||
"@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.19.12", "", { "os": "darwin", "cpu": "x64" }, "sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A=="],
|
||||
|
||||
"@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.19.12", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA=="],
|
||||
|
||||
"@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.19.12", "", { "os": "freebsd", "cpu": "x64" }, "sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg=="],
|
||||
|
||||
"@esbuild/linux-arm": ["@esbuild/linux-arm@0.19.12", "", { "os": "linux", "cpu": "arm" }, "sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w=="],
|
||||
|
||||
"@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.19.12", "", { "os": "linux", "cpu": "arm64" }, "sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA=="],
|
||||
|
||||
"@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.19.12", "", { "os": "linux", "cpu": "ia32" }, "sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA=="],
|
||||
|
||||
"@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.19.12", "", { "os": "linux", "cpu": "none" }, "sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA=="],
|
||||
|
||||
"@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.19.12", "", { "os": "linux", "cpu": "none" }, "sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w=="],
|
||||
|
||||
"@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.19.12", "", { "os": "linux", "cpu": "ppc64" }, "sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg=="],
|
||||
|
||||
"@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.19.12", "", { "os": "linux", "cpu": "none" }, "sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg=="],
|
||||
|
||||
"@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.19.12", "", { "os": "linux", "cpu": "s390x" }, "sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg=="],
|
||||
|
||||
"@esbuild/linux-x64": ["@esbuild/linux-x64@0.19.12", "", { "os": "linux", "cpu": "x64" }, "sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg=="],
|
||||
|
||||
"@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.19.12", "", { "os": "none", "cpu": "x64" }, "sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA=="],
|
||||
|
||||
"@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.19.12", "", { "os": "openbsd", "cpu": "x64" }, "sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw=="],
|
||||
|
||||
"@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.19.12", "", { "os": "sunos", "cpu": "x64" }, "sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA=="],
|
||||
|
||||
"@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.19.12", "", { "os": "win32", "cpu": "arm64" }, "sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A=="],
|
||||
|
||||
"@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.19.12", "", { "os": "win32", "cpu": "ia32" }, "sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ=="],
|
||||
|
||||
"@esbuild/win32-x64": ["@esbuild/win32-x64@0.19.12", "", { "os": "win32", "cpu": "x64" }, "sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA=="],
|
||||
|
||||
"@iarna/toml": ["@iarna/toml@2.2.5", "", {}, "sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg=="],
|
||||
|
||||
"@protobuf-ts/runtime": ["@protobuf-ts/runtime@2.11.1", "", {}, "sha512-KuDaT1IfHkugM2pyz+FwiY80ejWrkH1pAtOBOZFuR6SXEFTsnb/jiQWQ1rCIrcKx2BtyxnxW6BWwsVSA/Ie+WQ=="],
|
||||
|
||||
"@protobuf-ts/runtime-rpc": ["@protobuf-ts/runtime-rpc@2.11.1", "", { "dependencies": { "@protobuf-ts/runtime": "^2.11.1" } }, "sha512-4CqqUmNA+/uMz00+d3CYKgElXO9VrEbucjnBFEjqI4GuDrEQ32MaI3q+9qPBvIGOlL4PmHXrzM32vBPWRhQKWQ=="],
|
||||
|
||||
"@types/bun": ["@types/bun@1.3.10", "", { "dependencies": { "bun-types": "1.3.10" } }, "sha512-0+rlrUrOrTSskibryHbvQkDOWRJwJZqZlxrUs1u4oOoTln8+WIXBPmAuCF35SWB2z4Zl3E84Nl/D0P7803nigQ=="],
|
||||
|
||||
"@types/node": ["@types/node@24.12.0", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-GYDxsZi3ChgmckRT9HPU0WEhKLP08ev/Yfcq2AstjrDASOYCSXeyjDsHg4v5t4jOj7cyDX3vmprafKlWIG9MXQ=="],
|
||||
|
||||
"@typespec/ts-http-runtime": ["@typespec/ts-http-runtime@0.3.4", "", { "dependencies": { "http-proxy-agent": "^7.0.0", "https-proxy-agent": "^7.0.0", "tslib": "^2.6.2" } }, "sha512-CI0NhTrz4EBaa0U+HaaUZrJhPoso8sG7ZFya8uQoBA57fjzrjRSv87ekCjLZOFExN+gXE/z0xuN2QfH4H2HrLQ=="],
|
||||
|
||||
"agent-base": ["agent-base@7.1.4", "", {}, "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ=="],
|
||||
|
||||
"balanced-match": ["balanced-match@1.0.2", "", {}, ""],
|
||||
|
||||
"brace-expansion": ["brace-expansion@1.1.11", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, ""],
|
||||
|
||||
"bun-types": ["bun-types@1.3.10", "", { "dependencies": { "@types/node": "*" } }, "sha512-tcpfCCl6XWo6nCVnpcVrxQ+9AYN1iqMIzgrSKYMB/fjLtV2eyAVEg7AxQJuCq/26R6HpKWykQXuSOq/21RYcbg=="],
|
||||
|
||||
"compare-versions": ["compare-versions@6.1.1", "", {}, "sha512-4hm4VPpIecmlg59CHXnRDnqGplJFrbLG4aFEl5vl6cK1u76ws3LLvX7ikFnTDl5vo39sjWD6AaDPYodJp/NNHg=="],
|
||||
|
||||
"concat-map": ["concat-map@0.0.1", "", {}, ""],
|
||||
|
||||
"debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="],
|
||||
|
||||
"esbuild": ["esbuild@0.19.12", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.19.12", "@esbuild/android-arm": "0.19.12", "@esbuild/android-arm64": "0.19.12", "@esbuild/android-x64": "0.19.12", "@esbuild/darwin-arm64": "0.19.12", "@esbuild/darwin-x64": "0.19.12", "@esbuild/freebsd-arm64": "0.19.12", "@esbuild/freebsd-x64": "0.19.12", "@esbuild/linux-arm": "0.19.12", "@esbuild/linux-arm64": "0.19.12", "@esbuild/linux-ia32": "0.19.12", "@esbuild/linux-loong64": "0.19.12", "@esbuild/linux-mips64el": "0.19.12", "@esbuild/linux-ppc64": "0.19.12", "@esbuild/linux-riscv64": "0.19.12", "@esbuild/linux-s390x": "0.19.12", "@esbuild/linux-x64": "0.19.12", "@esbuild/netbsd-x64": "0.19.12", "@esbuild/openbsd-x64": "0.19.12", "@esbuild/sunos-x64": "0.19.12", "@esbuild/win32-arm64": "0.19.12", "@esbuild/win32-ia32": "0.19.12", "@esbuild/win32-x64": "0.19.12" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg=="],
|
||||
|
||||
"events": ["events@3.3.0", "", {}, ""],
|
||||
|
||||
"fast-xml-builder": ["fast-xml-builder@1.1.1", "", { "dependencies": { "path-expression-matcher": "^1.1.3" } }, "sha512-t2IsJo7bUteacw/QxmvjAJUGRWZZJHfj1/0tP3+tm5DteIIXEJb0rcasgFD81cxk4lhzcSzTBgTKlwfcKlB5tA=="],
|
||||
|
||||
"fast-xml-parser": ["fast-xml-parser@5.5.2", "", { "dependencies": { "fast-xml-builder": "^1.1.1", "path-expression-matcher": "^1.1.3", "strnum": "^2.1.2" }, "bin": { "fxparser": "src/cli/cli.js" } }, "sha512-kA6Txdt1cHsk+/qWKuV1jZUHBD6QUXWKhWVBuSmfP5YElW5HvJ/yC7eFCS+DQg7LphBPuUoEBMQ+m1z6UlF24w=="],
|
||||
|
||||
"http-proxy-agent": ["http-proxy-agent@7.0.2", "", { "dependencies": { "agent-base": "^7.1.0", "debug": "^4.3.4" } }, "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig=="],
|
||||
|
||||
"https-proxy-agent": ["https-proxy-agent@7.0.6", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "4" } }, "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw=="],
|
||||
|
||||
"minimatch": ["minimatch@3.0.8", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, ""],
|
||||
|
||||
"ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
|
||||
|
||||
"path-expression-matcher": ["path-expression-matcher@1.1.3", "", {}, "sha512-qdVgY8KXmVdJZRSS1JdEPOKPdTiEK/pi0RkcT2sw1RhXxohdujUlJFPuS1TSkevZ9vzd3ZlL7ULl1MHGTApKzQ=="],
|
||||
|
||||
"prettier": ["prettier@3.8.1", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg=="],
|
||||
|
||||
"semver": ["semver@6.3.1", "", { "bin": "bin/semver.js" }, ""],
|
||||
|
||||
"strnum": ["strnum@2.2.0", "", {}, "sha512-Y7Bj8XyJxnPAORMZj/xltsfo55uOiyHcU2tnAVzHUnSJR/KsEX+9RoDeXEnsXtl/CX4fAcrt64gZ13aGaWPeBg=="],
|
||||
|
||||
"tslib": ["tslib@2.6.2", "", {}, ""],
|
||||
|
||||
"tunnel": ["tunnel@0.0.6", "", {}, ""],
|
||||
|
||||
"typescript": ["typescript@4.9.5", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, ""],
|
||||
|
||||
"undici": ["undici@6.23.0", "", {}, "sha512-VfQPToRA5FZs/qJxLIinmU59u0r7LXqoJkCzinq3ckNJp3vKEh7jTWN589YQ5+aoAC/TGRLyJLCPKcLQbM8r9g=="],
|
||||
|
||||
"undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
|
||||
|
||||
"@azure/core-auth/@azure/abort-controller": ["@azure/abort-controller@2.1.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA=="],
|
||||
|
||||
"@azure/core-auth/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
||||
|
||||
"@azure/core-client/@azure/abort-controller": ["@azure/abort-controller@2.1.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA=="],
|
||||
|
||||
"@azure/core-client/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
||||
|
||||
"@azure/core-http-compat/@azure/abort-controller": ["@azure/abort-controller@2.1.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA=="],
|
||||
|
||||
"@azure/core-lro/@azure/core-util": ["@azure/core-util@1.4.0", "", { "dependencies": { "@azure/abort-controller": "^1.0.0", "tslib": "^2.2.0" } }, ""],
|
||||
|
||||
"@azure/core-lro/@azure/logger": ["@azure/logger@1.0.4", "", { "dependencies": { "tslib": "^2.2.0" } }, ""],
|
||||
|
||||
"@azure/core-paging/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
||||
|
||||
"@azure/core-rest-pipeline/@azure/abort-controller": ["@azure/abort-controller@2.1.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA=="],
|
||||
|
||||
"@azure/core-rest-pipeline/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
||||
|
||||
"@azure/core-tracing/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
||||
|
||||
"@azure/core-util/@azure/abort-controller": ["@azure/abort-controller@2.1.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA=="],
|
||||
|
||||
"@azure/core-util/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
||||
|
||||
"@azure/core-xml/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
||||
|
||||
"@azure/logger/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
||||
|
||||
"@azure/storage-blob/@azure/abort-controller": ["@azure/abort-controller@2.1.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA=="],
|
||||
|
||||
"@azure/storage-blob/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
||||
|
||||
"@azure/storage-common/@azure/abort-controller": ["@azure/abort-controller@2.1.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA=="],
|
||||
|
||||
"@azure/storage-common/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
||||
|
||||
"@typespec/ts-http-runtime/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
||||
|
||||
"bun-types/@types/node": ["@types/node@20.19.35", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-Uarfe6J91b9HAUXxjvSOdiO2UPOKLm07Q1oh0JHxoZ1y8HoqxDAu3gVrsrOHeiio0kSsoVBt4wFrKOm0dKxVPQ=="],
|
||||
|
||||
"@azure/core-http-compat/@azure/abort-controller/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
||||
|
||||
"bun-types/@types/node/undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
[install]
|
||||
saveTextLockfile = true
|
||||
+115
-60
File diff suppressed because one or more lines are too long
+135
-61
File diff suppressed because one or more lines are too long
Generated
-577
@@ -1,577 +0,0 @@
|
||||
{
|
||||
"name": "setup-bun",
|
||||
"version": "2.0.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "setup-bun",
|
||||
"version": "2.0.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/cache": "^3.1.4",
|
||||
"@actions/core": "^1.10.0",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/glob": "^0.4.0",
|
||||
"@actions/io": "^1.1.2",
|
||||
"@actions/tool-cache": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.8.2",
|
||||
"esbuild": "^0.19.2",
|
||||
"prettier": "^2.8.4",
|
||||
"typescript": "^4.9.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/cache": {
|
||||
"version": "3.2.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.0",
|
||||
"@actions/exec": "^1.0.1",
|
||||
"@actions/glob": "^0.1.0",
|
||||
"@actions/http-client": "^2.1.1",
|
||||
"@actions/io": "^1.0.1",
|
||||
"@azure/abort-controller": "^1.1.0",
|
||||
"@azure/ms-rest-js": "^2.6.0",
|
||||
"@azure/storage-blob": "^12.13.0",
|
||||
"semver": "^6.1.0",
|
||||
"uuid": "^3.3.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/cache/node_modules/@actions/glob": {
|
||||
"version": "0.1.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.6",
|
||||
"minimatch": "^3.0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/core": {
|
||||
"version": "1.10.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/http-client": "^2.0.1",
|
||||
"uuid": "^8.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/core/node_modules/uuid": {
|
||||
"version": "8.3.2",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/exec": {
|
||||
"version": "1.1.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/io": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/glob": {
|
||||
"version": "0.4.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.9.1",
|
||||
"minimatch": "^3.0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/http-client": {
|
||||
"version": "2.1.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tunnel": "^0.0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/io": {
|
||||
"version": "1.1.3",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@actions/tool-cache": {
|
||||
"version": "2.0.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/exec": "^1.0.0",
|
||||
"@actions/http-client": "^2.0.1",
|
||||
"@actions/io": "^1.1.1",
|
||||
"semver": "^6.1.0",
|
||||
"uuid": "^3.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/abort-controller": {
|
||||
"version": "1.1.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tslib": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/core-auth": {
|
||||
"version": "1.5.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^1.0.0",
|
||||
"@azure/core-util": "^1.1.0",
|
||||
"tslib": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/core-http": {
|
||||
"version": "3.0.3",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^1.0.0",
|
||||
"@azure/core-auth": "^1.3.0",
|
||||
"@azure/core-tracing": "1.0.0-preview.13",
|
||||
"@azure/core-util": "^1.1.1",
|
||||
"@azure/logger": "^1.0.0",
|
||||
"@types/node-fetch": "^2.5.0",
|
||||
"@types/tunnel": "^0.0.3",
|
||||
"form-data": "^4.0.0",
|
||||
"node-fetch": "^2.6.7",
|
||||
"process": "^0.11.10",
|
||||
"tslib": "^2.2.0",
|
||||
"tunnel": "^0.0.6",
|
||||
"uuid": "^8.3.0",
|
||||
"xml2js": "^0.5.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/core-http/node_modules/form-data": {
|
||||
"version": "4.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
"mime-types": "^2.1.12"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/core-http/node_modules/uuid": {
|
||||
"version": "8.3.2",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/core-lro": {
|
||||
"version": "2.5.4",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^1.0.0",
|
||||
"@azure/core-util": "^1.2.0",
|
||||
"@azure/logger": "^1.0.0",
|
||||
"tslib": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/core-paging": {
|
||||
"version": "1.5.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tslib": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/core-tracing": {
|
||||
"version": "1.0.0-preview.13",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@opentelemetry/api": "^1.0.1",
|
||||
"tslib": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/core-util": {
|
||||
"version": "1.4.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^1.0.0",
|
||||
"tslib": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/logger": {
|
||||
"version": "1.0.4",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tslib": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/ms-rest-js": {
|
||||
"version": "2.7.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@azure/core-auth": "^1.1.4",
|
||||
"abort-controller": "^3.0.0",
|
||||
"form-data": "^2.5.0",
|
||||
"node-fetch": "^2.6.7",
|
||||
"tslib": "^1.10.0",
|
||||
"tunnel": "0.0.6",
|
||||
"uuid": "^8.3.2",
|
||||
"xml2js": "^0.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/ms-rest-js/node_modules/tslib": {
|
||||
"version": "1.14.1",
|
||||
"license": "0BSD"
|
||||
},
|
||||
"node_modules/@azure/ms-rest-js/node_modules/uuid": {
|
||||
"version": "8.3.2",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/@azure/storage-blob": {
|
||||
"version": "12.15.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@azure/abort-controller": "^1.0.0",
|
||||
"@azure/core-http": "^3.0.0",
|
||||
"@azure/core-lro": "^2.2.0",
|
||||
"@azure/core-paging": "^1.1.1",
|
||||
"@azure/core-tracing": "1.0.0-preview.13",
|
||||
"@azure/logger": "^1.0.0",
|
||||
"events": "^3.0.0",
|
||||
"tslib": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/darwin-arm64": {
|
||||
"version": "0.19.2",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@opentelemetry/api": {
|
||||
"version": "1.5.0",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "20.9.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.1.tgz",
|
||||
"integrity": "sha512-HhmzZh5LSJNS5O8jQKpJ/3ZcrrlG6L70hpGqMIAoM9YVD0YBRNWYsfwcXq8VnSjlNpCpgLzMXdiPo+dxcvSmiA==",
|
||||
"dependencies": {
|
||||
"undici-types": "~5.26.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node-fetch": {
|
||||
"version": "2.6.4",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/node": "*",
|
||||
"form-data": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node-fetch/node_modules/form-data": {
|
||||
"version": "3.0.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
"mime-types": "^2.1.12"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/tunnel": {
|
||||
"version": "0.0.3",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/abort-controller": {
|
||||
"version": "3.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"event-target-shim": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/asynckit": {
|
||||
"version": "0.4.0",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/balanced-match": {
|
||||
"version": "1.0.2",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/combined-stream": {
|
||||
"version": "1.0.8",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"delayed-stream": "~1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/concat-map": {
|
||||
"version": "0.0.1",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild": {
|
||||
"version": "0.19.2",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"esbuild": "bin/esbuild"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@esbuild/android-arm": "0.19.2",
|
||||
"@esbuild/android-arm64": "0.19.2",
|
||||
"@esbuild/android-x64": "0.19.2",
|
||||
"@esbuild/darwin-arm64": "0.19.2",
|
||||
"@esbuild/darwin-x64": "0.19.2",
|
||||
"@esbuild/freebsd-arm64": "0.19.2",
|
||||
"@esbuild/freebsd-x64": "0.19.2",
|
||||
"@esbuild/linux-arm": "0.19.2",
|
||||
"@esbuild/linux-arm64": "0.19.2",
|
||||
"@esbuild/linux-ia32": "0.19.2",
|
||||
"@esbuild/linux-loong64": "0.19.2",
|
||||
"@esbuild/linux-mips64el": "0.19.2",
|
||||
"@esbuild/linux-ppc64": "0.19.2",
|
||||
"@esbuild/linux-riscv64": "0.19.2",
|
||||
"@esbuild/linux-s390x": "0.19.2",
|
||||
"@esbuild/linux-x64": "0.19.2",
|
||||
"@esbuild/netbsd-x64": "0.19.2",
|
||||
"@esbuild/openbsd-x64": "0.19.2",
|
||||
"@esbuild/sunos-x64": "0.19.2",
|
||||
"@esbuild/win32-arm64": "0.19.2",
|
||||
"@esbuild/win32-ia32": "0.19.2",
|
||||
"@esbuild/win32-x64": "0.19.2"
|
||||
}
|
||||
},
|
||||
"node_modules/event-target-shim": {
|
||||
"version": "5.0.1",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/events": {
|
||||
"version": "3.3.0",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.8.x"
|
||||
}
|
||||
},
|
||||
"node_modules/form-data": {
|
||||
"version": "2.5.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.6",
|
||||
"mime-types": "^2.1.12"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.12"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-db": {
|
||||
"version": "1.52.0",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-types": {
|
||||
"version": "2.1.35",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mime-db": "1.52.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/minimatch": {
|
||||
"version": "3.0.8",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/node-fetch": {
|
||||
"version": "2.7.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"whatwg-url": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.x || >=6.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"encoding": "^0.1.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"encoding": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/prettier": {
|
||||
"version": "2.8.8",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"prettier": "bin-prettier.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.13.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/prettier/prettier?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/process": {
|
||||
"version": "0.11.10",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/sax": {
|
||||
"version": "1.2.4",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/semver": {
|
||||
"version": "6.3.1",
|
||||
"license": "ISC",
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
}
|
||||
},
|
||||
"node_modules/tr46": {
|
||||
"version": "0.0.3",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/tslib": {
|
||||
"version": "2.6.2",
|
||||
"license": "0BSD"
|
||||
},
|
||||
"node_modules/tunnel": {
|
||||
"version": "0.0.6",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.6.11 <=0.7.0 || >=0.7.3"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "4.9.5",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "5.26.5",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
|
||||
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="
|
||||
},
|
||||
"node_modules/uuid": {
|
||||
"version": "3.4.0",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"uuid": "bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/webidl-conversions": {
|
||||
"version": "3.0.1",
|
||||
"license": "BSD-2-Clause"
|
||||
},
|
||||
"node_modules/whatwg-url": {
|
||||
"version": "5.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tr46": "~0.0.3",
|
||||
"webidl-conversions": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/xml2js": {
|
||||
"version": "0.5.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"sax": ">=0.6.0",
|
||||
"xmlbuilder": "~11.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/xmlbuilder": {
|
||||
"version": "11.0.1",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+19
-13
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "setup-bun",
|
||||
"version": "2.0.1",
|
||||
"version": "2.2.0",
|
||||
"description": "Setup Bun on GitHub Actions.",
|
||||
"keywords": [
|
||||
"bun",
|
||||
@@ -18,24 +18,30 @@
|
||||
"author": "xHyroM",
|
||||
"scripts": {
|
||||
"format": "prettier --write src *.yml *.json *.md",
|
||||
"build": "esbuild --target=node20 --outfile=dist/setup/index.js --bundle --minify --platform=node --format=cjs src/index.ts && esbuild --target=node20 --outfile=dist/cache-save/index.js --bundle --minify --platform=node --format=cjs src/cache-save.ts",
|
||||
"build": "esbuild --target=node24 --outfile=dist/setup/index.js --bundle --keep-names --minify --platform=node --format=cjs src/index.ts && esbuild --target=node24 --outfile=dist/cache-save/index.js --bundle --keep-names --minify --platform=node --format=cjs src/cache-save.ts",
|
||||
"start": "npm run build && node dist/setup/index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/cache": "^3.1.4",
|
||||
"@actions/core": "^1.10.0",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/glob": "^0.4.0",
|
||||
"@actions/io": "^1.1.2",
|
||||
"@actions/tool-cache": "^2.0.1"
|
||||
"@actions/cache": "^5.0.5",
|
||||
"@actions/core": "^2.0.3",
|
||||
"@actions/exec": "^2.0.0",
|
||||
"@actions/glob": "^0.5.0",
|
||||
"@actions/io": "^2.0.0",
|
||||
"@actions/tool-cache": "^3.0.0",
|
||||
"@iarna/toml": "^2.2.5",
|
||||
"compare-versions": "^6.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.8.2",
|
||||
"esbuild": "^0.19.2",
|
||||
"prettier": "^2.8.4",
|
||||
"@types/bun": "^1.3.10",
|
||||
"@types/node": "^24.0.0",
|
||||
"esbuild": "^0.19.12",
|
||||
"prettier": "^3.8.1",
|
||||
"typescript": "^4.9.5"
|
||||
},
|
||||
"prettier": {
|
||||
"quoteProps": "preserve"
|
||||
"patchedDependencies": {
|
||||
"compare-versions@6.1.1": "patches/compare-versions@6.1.1.patch"
|
||||
},
|
||||
"overrides": {
|
||||
"form-data": "^4.0.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
diff --git a/lib/esm/satisfies.js b/lib/esm/satisfies.js
|
||||
index 7586b71657332f855431c4dd4f05e9394fd9aac3..a6ec29bfc98907c67ed4af71fca73bd8bff88798 100644
|
||||
--- a/lib/esm/satisfies.js
|
||||
+++ b/lib/esm/satisfies.js
|
||||
@@ -40,8 +40,9 @@ export const satisfies = (version, range) => {
|
||||
// else range of either "~" or "^" is assumed
|
||||
const [v1, v2, v3, , vp] = validateAndParse(version);
|
||||
const [r1, r2, r3, , rp] = validateAndParse(range);
|
||||
- const v = [v1, v2, v3];
|
||||
+ const v = [v1, v2 !== null && v2 !== void 0 ? v2 : 'x', v3 !== null && v3 !== void 0 ? v3 : 'x'];
|
||||
const r = [r1, r2 !== null && r2 !== void 0 ? r2 : 'x', r3 !== null && r3 !== void 0 ? r3 : 'x'];
|
||||
+
|
||||
// validate pre-release
|
||||
if (rp) {
|
||||
if (!vp)
|
||||
diff --git a/lib/esm/utils.js b/lib/esm/utils.js
|
||||
index b5cc8b9927ab38fc67032c133b531e95ec4cec15..ec56105fd2d806aa922f1488a27b02c56aff1865 100644
|
||||
--- a/lib/esm/utils.js
|
||||
+++ b/lib/esm/utils.js
|
||||
@@ -28,7 +28,7 @@ const compareStrings = (a, b) => {
|
||||
};
|
||||
export const compareSegments = (a, b) => {
|
||||
for (let i = 0; i < Math.max(a.length, b.length); i++) {
|
||||
- const r = compareStrings(a[i] || '0', b[i] || '0');
|
||||
+ const r = compareStrings(a[i] || 'x', b[i] || 'x');
|
||||
if (r !== 0)
|
||||
return r;
|
||||
}
|
||||
diff --git a/lib/umd/index.js b/lib/umd/index.js
|
||||
index 2cfef261bca520e21ed41fc14950732b8aa6339b..1059784db86635f3aaaba83b5a72c5015e1d8490 100644
|
||||
--- a/lib/umd/index.js
|
||||
+++ b/lib/umd/index.js
|
||||
@@ -152,7 +152,7 @@
|
||||
// else range of either "~" or "^" is assumed
|
||||
const [v1, v2, v3, , vp] = validateAndParse(version);
|
||||
const [r1, r2, r3, , rp] = validateAndParse(range);
|
||||
- const v = [v1, v2, v3];
|
||||
+ const v = [v1, v2 !== null && v2 !== void 0 ? v2 : 'x', v3 !== null && v3 !== void 0 ? v3 : 'x'];
|
||||
const r = [r1, r2 !== null && r2 !== void 0 ? r2 : 'x', r3 !== null && r3 !== void 0 ? r3 : 'x'];
|
||||
// validate pre-release
|
||||
if (rp) {
|
||||
diff --git a/package.json b/package.json
|
||||
index b05b3daf706d7ba4e594233f8791fc3007a8e2cd..e51e76b86f95e9ebf0b5dba3b82aeb119628528d 100644
|
||||
--- a/package.json
|
||||
+++ b/package.json
|
||||
@@ -26,7 +26,7 @@
|
||||
"prepublishOnly": "npm run build",
|
||||
"test": "c8 --reporter=lcov mocha"
|
||||
},
|
||||
- "main": "./lib/umd/index.js",
|
||||
+ "main": "./lib/src/index.ts",
|
||||
"module": "./lib/esm/index.js",
|
||||
"types": "./lib/esm/index.d.ts",
|
||||
"sideEffects": false,
|
||||
diff --git a/src/satisfies.ts b/src/satisfies.ts
|
||||
index 66cb171d7f32e68fdda6929d2da223b97a053737..6b4973f037843f264338a01efdc4ace5dcf042cd 100644
|
||||
--- a/src/satisfies.ts
|
||||
+++ b/src/satisfies.ts
|
||||
@@ -43,7 +43,7 @@ export const satisfies = (version: string, range: string): boolean => {
|
||||
// else range of either "~" or "^" is assumed
|
||||
const [v1, v2, v3, , vp] = validateAndParse(version);
|
||||
const [r1, r2, r3, , rp] = validateAndParse(range);
|
||||
- const v = [v1, v2, v3];
|
||||
+ const v = [v1, v2 ?? 'x', v3 ?? 'x'];
|
||||
const r = [r1, r2 ?? 'x', r3 ?? 'x'];
|
||||
|
||||
// validate pre-release
|
||||
+79
-42
@@ -6,14 +6,18 @@ import {
|
||||
symlinkSync,
|
||||
renameSync,
|
||||
copyFileSync,
|
||||
existsSync,
|
||||
} from "node:fs";
|
||||
import { addPath, info, warning } from "@actions/core";
|
||||
import { isFeatureAvailable, restoreCache } from "@actions/cache";
|
||||
import { downloadTool, extractZip } from "@actions/tool-cache";
|
||||
import { getExecOutput } from "@actions/exec";
|
||||
import { Registry } from "./registry";
|
||||
import { writeBunfig } from "./bunfig";
|
||||
import { saveState } from "@actions/core";
|
||||
import { addExtension, retry } from "./utils";
|
||||
import { addExtension, extractVersionFromUrl, getCacheKey } from "./utils";
|
||||
import { getDownloadUrl } from "./download-url";
|
||||
import { cwd } from "node:process";
|
||||
|
||||
export type Input = {
|
||||
customUrl?: string;
|
||||
@@ -22,9 +26,9 @@ export type Input = {
|
||||
arch?: string;
|
||||
avx2?: boolean;
|
||||
profile?: boolean;
|
||||
scope?: string;
|
||||
registryUrl?: string;
|
||||
registries?: Registry[];
|
||||
noCache?: boolean;
|
||||
token?: string;
|
||||
};
|
||||
|
||||
export type Output = {
|
||||
@@ -43,10 +47,10 @@ export type CacheState = {
|
||||
};
|
||||
|
||||
export default async (options: Input): Promise<Output> => {
|
||||
const bunfigPath = join(process.cwd(), "bunfig.toml");
|
||||
writeBunfig(bunfigPath, options);
|
||||
const bunfigPath = join(cwd(), "bunfig.toml");
|
||||
writeBunfig(bunfigPath, options.registries);
|
||||
|
||||
const url = getDownloadUrl(options);
|
||||
const url = await getDownloadUrl(options);
|
||||
const cacheEnabled = isCacheEnabled(options);
|
||||
|
||||
const binPath = join(homedir(), ".bun", "bin");
|
||||
@@ -72,30 +76,58 @@ export default async (options: Input): Promise<Output> => {
|
||||
|
||||
let revision: string | undefined;
|
||||
let cacheHit = false;
|
||||
if (cacheEnabled) {
|
||||
const cacheRestored = await restoreCache([bunPath], url);
|
||||
if (cacheRestored) {
|
||||
revision = await getRevision(bunPath);
|
||||
if (revision) {
|
||||
cacheHit = true;
|
||||
info(`Using a cached version of Bun: ${revision}`);
|
||||
} else {
|
||||
warning(
|
||||
`Found a cached version of Bun: ${revision} (but it appears to be corrupted?)`
|
||||
);
|
||||
}
|
||||
|
||||
// Check if Bun executable already exists and matches requested version
|
||||
if (!options.customUrl && existsSync(bunPath)) {
|
||||
const existingRevision = await getRevision(bunPath);
|
||||
if (existingRevision && isVersionMatch(existingRevision, options.version)) {
|
||||
revision = existingRevision;
|
||||
cacheHit = true; // Treat as cache hit to avoid unnecessary network requests
|
||||
info(`Using existing Bun installation: ${revision}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (!cacheHit) {
|
||||
info(`Downloading a new version of Bun: ${url}`);
|
||||
// TODO: remove this, temporary fix for https://github.com/oven-sh/setup-bun/issues/73
|
||||
revision = await retry(async () => await downloadBun(url, bunPath), 3);
|
||||
if (!revision) {
|
||||
if (cacheEnabled) {
|
||||
const cacheKey = getCacheKey(url);
|
||||
|
||||
const cacheRestored = await restoreCache([bunPath], cacheKey);
|
||||
if (cacheRestored) {
|
||||
revision = await getRevision(bunPath);
|
||||
if (revision) {
|
||||
const expectedVersion = extractVersionFromUrl(url);
|
||||
const [actualVersion] = revision.split("+");
|
||||
if (!expectedVersion) {
|
||||
warning(
|
||||
`Could not parse expected version from URL: ${url}. Ignoring cache.`,
|
||||
);
|
||||
revision = undefined;
|
||||
} else if (actualVersion !== expectedVersion) {
|
||||
warning(
|
||||
`Cached Bun version ${revision} does not match expected version ${expectedVersion}. Re-downloading.`,
|
||||
);
|
||||
revision = undefined;
|
||||
} else {
|
||||
cacheHit = true;
|
||||
info(`Using a cached version of Bun: ${revision}`);
|
||||
}
|
||||
} else {
|
||||
warning(
|
||||
`Found a cached version of Bun: ${revision} (but it appears to be corrupted?)`,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!cacheHit) {
|
||||
info(`Downloading a new version of Bun: ${url}`);
|
||||
revision = await downloadBun(url, bunPath);
|
||||
}
|
||||
}
|
||||
|
||||
if (!revision) {
|
||||
throw new Error(
|
||||
"Downloaded a new version of Bun, but failed to check its version? Try again."
|
||||
"Downloaded a new version of Bun, but failed to check its version? Try again.",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -119,9 +151,32 @@ export default async (options: Input): Promise<Output> => {
|
||||
};
|
||||
};
|
||||
|
||||
function isVersionMatch(
|
||||
existingRevision: string,
|
||||
requestedVersion?: string,
|
||||
): boolean {
|
||||
// If no version specified, default is "latest" - don't match existing
|
||||
if (!requestedVersion) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Non-pinned versions should never match existing installations
|
||||
if (/^(latest|canary|action)$/i.test(requestedVersion)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const [existingVersion] = existingRevision.split("+");
|
||||
|
||||
const normalizeVersion = (v: string) => v.replace(/^v/i, "");
|
||||
|
||||
return (
|
||||
normalizeVersion(existingVersion) === normalizeVersion(requestedVersion)
|
||||
);
|
||||
}
|
||||
|
||||
async function downloadBun(
|
||||
url: string,
|
||||
bunPath: string
|
||||
bunPath: string,
|
||||
): Promise<string | undefined> {
|
||||
// Workaround for https://github.com/oven-sh/setup-bun/issues/79 and https://github.com/actions/toolkit/issues/1179
|
||||
const zipPath = addExtension(await downloadTool(url), ".zip");
|
||||
@@ -152,24 +207,6 @@ function isCacheEnabled(options: Input): boolean {
|
||||
return isFeatureAvailable();
|
||||
}
|
||||
|
||||
function getDownloadUrl(options: Input): string {
|
||||
const { customUrl } = options;
|
||||
if (customUrl) {
|
||||
return customUrl;
|
||||
}
|
||||
const { version, os, arch, avx2, profile } = options;
|
||||
const eversion = encodeURIComponent(version ?? "latest");
|
||||
const eos = encodeURIComponent(os ?? process.platform);
|
||||
const earch = encodeURIComponent(arch ?? process.arch);
|
||||
const eavx2 = encodeURIComponent(avx2 ?? true);
|
||||
const eprofile = encodeURIComponent(profile ?? false);
|
||||
const { href } = new URL(
|
||||
`${eversion}/${eos}/${earch}?avx2=${eavx2}&profile=${eprofile}`,
|
||||
"https://bun.sh/download/"
|
||||
);
|
||||
return href;
|
||||
}
|
||||
|
||||
async function extractBun(path: string): Promise<string> {
|
||||
for (const entry of readdirSync(path, { withFileTypes: true })) {
|
||||
const { name } = entry;
|
||||
|
||||
+72
-41
@@ -1,50 +1,81 @@
|
||||
import { EOL } from "node:os";
|
||||
import { appendFileSync } from "node:fs";
|
||||
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
||||
import { info } from "@actions/core";
|
||||
import { parse, stringify } from "@iarna/toml";
|
||||
import { Registry } from "./registry";
|
||||
|
||||
type BunfigOptions = {
|
||||
registryUrl?: string;
|
||||
scope?: string;
|
||||
type BunfigConfig = {
|
||||
install?: {
|
||||
registry?: {
|
||||
url: string;
|
||||
token?: string;
|
||||
};
|
||||
scopes?: Record<string, { url: string; token?: string }>;
|
||||
};
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
export function createBunfig(options: BunfigOptions): string | null {
|
||||
const { registryUrl, scope } = options;
|
||||
|
||||
let url: URL | undefined;
|
||||
if (registryUrl) {
|
||||
try {
|
||||
url = new URL(registryUrl);
|
||||
} catch {
|
||||
throw new Error(`Invalid registry-url: ${registryUrl}`);
|
||||
}
|
||||
}
|
||||
|
||||
let owner: string | undefined;
|
||||
if (scope) {
|
||||
owner = scope.startsWith("@")
|
||||
? scope.toLocaleLowerCase()
|
||||
: `@${scope.toLocaleLowerCase()}`;
|
||||
}
|
||||
|
||||
if (url && owner) {
|
||||
return `[install.scopes]${EOL}'${owner}' = { token = "$BUN_AUTH_TOKEN", url = "${url}"}${EOL}`;
|
||||
}
|
||||
|
||||
if (url && !owner) {
|
||||
return `[install]${EOL}registry = "${url}"${EOL}`;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
export function writeBunfig(path: string, options: BunfigOptions): void {
|
||||
const bunfig = createBunfig(options);
|
||||
if (!bunfig) {
|
||||
export function writeBunfig(path: string, registries: Registry[]): void {
|
||||
if (!registries.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
info(`Writing bunfig.toml to '${path}'.`);
|
||||
appendFileSync(path, bunfig, {
|
||||
encoding: "utf8",
|
||||
let globalRegistryCount = 0;
|
||||
registries.forEach((registry) => {
|
||||
try {
|
||||
new URL(registry.url);
|
||||
} catch {
|
||||
throw new Error(`Invalid registry URL: ${registry.url}`);
|
||||
}
|
||||
|
||||
if (!registry.scope) {
|
||||
globalRegistryCount++;
|
||||
}
|
||||
});
|
||||
|
||||
if (globalRegistryCount > 1) {
|
||||
throw new Error("You can't have more than one global registry.");
|
||||
}
|
||||
|
||||
info(`Writing bunfig.toml to '${path}'.`);
|
||||
|
||||
let config: BunfigConfig = {};
|
||||
if (existsSync(path)) {
|
||||
try {
|
||||
const content = readFileSync(path, { encoding: "utf-8" });
|
||||
config = parse(content) as BunfigConfig;
|
||||
} catch (error) {
|
||||
info(`Error reading existing bunfig: ${error.message}`);
|
||||
config = {};
|
||||
}
|
||||
}
|
||||
|
||||
config.install = config?.install || {};
|
||||
config.install.scopes = config?.install.scopes || {};
|
||||
|
||||
const globalRegistry = registries.find((r) => !r.scope);
|
||||
if (globalRegistry) {
|
||||
config.install.registry = {
|
||||
url: globalRegistry.url,
|
||||
...(globalRegistry.token ? { token: globalRegistry.token } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
for (const registry of registries) {
|
||||
if (registry.scope) {
|
||||
const scopeName = registry.scope.startsWith("@")
|
||||
? registry.scope.toLowerCase()
|
||||
: `@${registry.scope.toLowerCase()}`;
|
||||
|
||||
config.install.scopes[scopeName] = {
|
||||
url: registry.url,
|
||||
...(registry.token ? { token: registry.token } : {}),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (Object.keys(config.install.scopes).length === 0) {
|
||||
delete config.install.scopes;
|
||||
}
|
||||
|
||||
writeFileSync(path, stringify(config), { encoding: "utf8" });
|
||||
}
|
||||
|
||||
+4
-2
@@ -1,12 +1,14 @@
|
||||
import { saveCache } from "@actions/cache";
|
||||
import { getState, warning } from "@actions/core";
|
||||
import { CacheState } from "./action";
|
||||
|
||||
import { getCacheKey } from "./utils";
|
||||
(async () => {
|
||||
const state: CacheState = JSON.parse(getState("cache"));
|
||||
if (state.cacheEnabled && !state.cacheHit) {
|
||||
const cacheKey = getCacheKey(state.url);
|
||||
|
||||
try {
|
||||
await saveCache([state.bunPath], state.url);
|
||||
await saveCache([state.bunPath], cacheKey);
|
||||
process.exit(0);
|
||||
} catch (error) {
|
||||
warning("Failed to save Bun to cache.");
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
import {
|
||||
compareVersions,
|
||||
satisfies,
|
||||
validate,
|
||||
validateStrict,
|
||||
} from "compare-versions";
|
||||
import { Input } from "./action";
|
||||
import { getArchitecture, getAvx2, getPlatform, request } from "./utils";
|
||||
|
||||
export async function getDownloadUrl(options: Input): Promise<string> {
|
||||
const { customUrl } = options;
|
||||
if (customUrl) {
|
||||
return customUrl;
|
||||
}
|
||||
|
||||
return await getSemverDownloadUrl(options);
|
||||
}
|
||||
|
||||
async function getSemverDownloadUrl(options: Input): Promise<string> {
|
||||
const { version, os, arch, avx2, profile } = options;
|
||||
let tag: string | undefined;
|
||||
|
||||
if (validateStrict(version)) {
|
||||
tag = `bun-v${version}`;
|
||||
}
|
||||
|
||||
if (!tag) {
|
||||
const res = (await (
|
||||
await request("https://api.github.com/repos/oven-sh/bun/git/refs/tags", {
|
||||
headers: options.token
|
||||
? { "Authorization": `Bearer ${options.token}` }
|
||||
: {},
|
||||
})
|
||||
).json()) as { ref: string }[];
|
||||
|
||||
let tags = res
|
||||
.filter(
|
||||
(tag) =>
|
||||
tag.ref.startsWith("refs/tags/bun-v") ||
|
||||
tag.ref === "refs/tags/canary",
|
||||
)
|
||||
.map((item) => item.ref.replace(/refs\/tags\/(bun-v)?/g, ""))
|
||||
.filter(Boolean);
|
||||
|
||||
tag = tags.find((t) => t === version);
|
||||
if (!tag) {
|
||||
tags = tags.filter((t) => validate(t)).sort(compareVersions);
|
||||
|
||||
const matchedTag =
|
||||
version === "latest" || !version
|
||||
? tags.at(-1)
|
||||
: tags.filter((t) => satisfies(t, version)).at(-1);
|
||||
|
||||
if (!matchedTag) {
|
||||
throw new Error(`No Bun release found matching version '${version}'`);
|
||||
}
|
||||
|
||||
tag = `bun-v${matchedTag}`;
|
||||
} else if (validate(tag)) {
|
||||
tag = `bun-v${tag}`;
|
||||
}
|
||||
}
|
||||
|
||||
const resolvedTag = tag ?? version;
|
||||
const eversion = encodeURIComponent(resolvedTag);
|
||||
const eos = encodeURIComponent(os ?? getPlatform());
|
||||
const earch = encodeURIComponent(
|
||||
getArchitecture(os ?? getPlatform(), arch ?? process.arch, resolvedTag),
|
||||
);
|
||||
const eavx2 = encodeURIComponent(
|
||||
getAvx2(os ?? getPlatform(), arch ?? process.arch, avx2, resolvedTag) ===
|
||||
false
|
||||
? "-baseline"
|
||||
: "",
|
||||
);
|
||||
const eprofile = encodeURIComponent(profile === true ? "-profile" : "");
|
||||
|
||||
const { href } = new URL(
|
||||
`${eversion}/bun-${eos}-${earch}${eavx2}${eprofile}.zip`,
|
||||
"https://github.com/oven-sh/bun/releases/download/",
|
||||
);
|
||||
|
||||
return href;
|
||||
}
|
||||
+18
-2
@@ -2,20 +2,36 @@ import { tmpdir } from "node:os";
|
||||
import { getInput, setOutput, setFailed, getBooleanInput } from "@actions/core";
|
||||
import runAction from "./action.js";
|
||||
import { readVersionFromFile } from "./utils.js";
|
||||
import { parseRegistries } from "./registry.js";
|
||||
|
||||
if (!process.env.RUNNER_TEMP) {
|
||||
process.env.RUNNER_TEMP = tmpdir();
|
||||
}
|
||||
|
||||
const registries = parseRegistries(getInput("registries"));
|
||||
|
||||
// Backwards compatibility for the `registry-url` and `scope` inputs
|
||||
const registryUrl = getInput("registry-url");
|
||||
const scope = getInput("scope");
|
||||
|
||||
if (registryUrl) {
|
||||
registries.push({
|
||||
url: registryUrl,
|
||||
scope: scope,
|
||||
token: "$BUN_AUTH_TOKEN",
|
||||
});
|
||||
}
|
||||
|
||||
runAction({
|
||||
version:
|
||||
getInput("bun-version") ||
|
||||
readVersionFromFile(getInput("bun-version-file")) ||
|
||||
readVersionFromFile("package.json", true) ||
|
||||
undefined,
|
||||
customUrl: getInput("bun-download-url") || undefined,
|
||||
registryUrl: getInput("registry-url") || undefined,
|
||||
scope: getInput("scope") || undefined,
|
||||
registries: registries,
|
||||
noCache: getBooleanInput("no-cache") || false,
|
||||
token: getInput("token"),
|
||||
})
|
||||
.then(({ version, revision, bunPath, url, cacheHit }) => {
|
||||
setOutput("bun-version", version);
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
export type Registry = {
|
||||
url: string;
|
||||
scope: string;
|
||||
token?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse registries from the simplified format:
|
||||
* - Default registry: https://registry.npmjs.org/
|
||||
* - Default registry with token: https://registry.npmjs.org/|token123
|
||||
* - With scope and credentials in URL: @myorg:https://username:password@registry.myorg.com/
|
||||
* - With scope and separate token: @partner:https://registry.partner.com/|basic_token
|
||||
*/
|
||||
export function parseRegistries(input: string): Registry[] {
|
||||
if (!input?.trim()) return [];
|
||||
|
||||
return input
|
||||
.split("\n")
|
||||
.map((line) => line.trim())
|
||||
.filter(Boolean)
|
||||
.map(parseLine)
|
||||
.filter(Boolean) as Registry[];
|
||||
}
|
||||
|
||||
function parseLine(line: string): Registry | null {
|
||||
const scopeMatch = line.match(
|
||||
/^(@[a-z0-9-_.]+|[a-z0-9-_.]+(?=:[a-z]+:\/\/)):(.+)$/i,
|
||||
);
|
||||
|
||||
if (scopeMatch) {
|
||||
const scope = scopeMatch[1];
|
||||
const urlPart = scopeMatch[2].trim();
|
||||
|
||||
const [url, token] = urlPart.split("|", 2).map((p) => p?.trim());
|
||||
|
||||
try {
|
||||
new URL(url);
|
||||
|
||||
return {
|
||||
url,
|
||||
scope,
|
||||
...(token && { token }),
|
||||
};
|
||||
} catch (e) {
|
||||
throw new Error(`Invalid URL in registry configuration: ${url}`);
|
||||
}
|
||||
} else {
|
||||
const [url, token] = line.split("|", 2).map((p) => p?.trim());
|
||||
|
||||
try {
|
||||
new URL(url);
|
||||
|
||||
return {
|
||||
url,
|
||||
scope: "",
|
||||
...(token && { token }),
|
||||
};
|
||||
} catch (e) {
|
||||
throw new Error(`Invalid URL in registry configuration: ${url}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
+123
-21
@@ -1,21 +1,43 @@
|
||||
import { debug, warning } from "@actions/core";
|
||||
import { info } from "node:console";
|
||||
import { createHash } from "node:crypto";
|
||||
import { existsSync, readFileSync, renameSync } from "node:fs";
|
||||
import { join, basename } from "node:path";
|
||||
import { resolve, basename } from "node:path";
|
||||
import { compareVersions, validate } from "compare-versions";
|
||||
|
||||
export function retry<T>(
|
||||
fn: () => Promise<T>,
|
||||
retries: number,
|
||||
timeout = 10000
|
||||
): Promise<T> {
|
||||
return fn().catch((err) => {
|
||||
if (retries <= 0) {
|
||||
throw err;
|
||||
}
|
||||
return new Promise((resolve) => setTimeout(resolve, timeout)).then(() =>
|
||||
retry(fn, retries - 1, timeout)
|
||||
);
|
||||
// First Bun version that ships native Windows ARM64 binaries.
|
||||
const WINDOWS_ARM64_MIN_VERSION = "1.3.10";
|
||||
|
||||
export function getCacheKey(url: string): string {
|
||||
return `bun-${createHash("sha1").update(url).digest("base64")}`;
|
||||
}
|
||||
|
||||
export function extractVersionFromUrl(url: string): string | undefined {
|
||||
const match = url.match(/\/bun-v([^/]+)\//);
|
||||
return match?.[1];
|
||||
}
|
||||
|
||||
export async function request(
|
||||
url: string,
|
||||
init?: RequestInit,
|
||||
): Promise<Response> {
|
||||
const headers = new Headers(init?.headers);
|
||||
if (!headers.has("User-Agent")) {
|
||||
headers.set("User-Agent", "@oven-sh/setup-bun");
|
||||
}
|
||||
|
||||
const res = await fetch(url, {
|
||||
...init,
|
||||
headers,
|
||||
});
|
||||
if (!res.ok) {
|
||||
const body = await res.text().catch(() => "");
|
||||
throw new Error(
|
||||
`Failed to fetch url ${url}. (status code: ${res.status}, status text: ${res.statusText})${body ? `\n${body}` : ""}`,
|
||||
);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
export function addExtension(path: string, ext: string): string {
|
||||
@@ -27,16 +49,90 @@ export function addExtension(path: string, ext: string): string {
|
||||
return path;
|
||||
}
|
||||
|
||||
export function getPlatform(): string {
|
||||
const platform = process.platform;
|
||||
if (platform === "win32") return "windows";
|
||||
|
||||
return platform;
|
||||
}
|
||||
|
||||
export function hasNativeWindowsArm64(version?: string): boolean {
|
||||
if (!version) return false;
|
||||
const cleaned = version.replace(/^bun-v/, "");
|
||||
// Non-semver versions like "canary" represent latest builds which ship ARM64.
|
||||
if (!validate(cleaned)) return true;
|
||||
return compareVersions(cleaned, WINDOWS_ARM64_MIN_VERSION) >= 0;
|
||||
}
|
||||
|
||||
export function getArchitecture(
|
||||
os: string,
|
||||
arch: string,
|
||||
version?: string,
|
||||
): string {
|
||||
if (os === "windows" && (arch === "aarch64" || arch === "arm64")) {
|
||||
if (!hasNativeWindowsArm64(version)) {
|
||||
warning(
|
||||
[
|
||||
"⚠️ This version of Bun does not provide native arm64 builds for Windows.",
|
||||
"Using x64 baseline build which will run through Microsoft's x64 emulation layer.",
|
||||
"This may result in reduced performance and potential compatibility issues.",
|
||||
"💡 For best performance, consider using Bun >= 1.3.10, x64 Windows runners, or other platforms with native support.",
|
||||
].join("\n"),
|
||||
);
|
||||
|
||||
return "x64";
|
||||
}
|
||||
}
|
||||
|
||||
if (arch === "arm64") return "aarch64";
|
||||
return arch;
|
||||
}
|
||||
|
||||
export function getAvx2(
|
||||
os: string,
|
||||
arch: string,
|
||||
avx2?: boolean,
|
||||
version?: string,
|
||||
): boolean {
|
||||
// Workaround for absence of arm64 builds on Windows before 1.3.10 (#130)
|
||||
if (os === "windows" && (arch === "aarch64" || arch === "arm64")) {
|
||||
if (!hasNativeWindowsArm64(version)) {
|
||||
return false;
|
||||
}
|
||||
// Native ARM64 builds don't use AVX2 suffix
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check AVX2 support on x64 Linux
|
||||
if (os === "linux" && arch === "x64" && avx2 === undefined) {
|
||||
try {
|
||||
const cpuInfo = readFileSync("/proc/cpuinfo", "utf8");
|
||||
const hasAvx2 = cpuInfo.includes("avx2");
|
||||
return hasAvx2;
|
||||
} catch (error) {
|
||||
warning(`Failed to detect AVX2 support.`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return avx2 ?? true;
|
||||
}
|
||||
|
||||
const FILE_VERSION_READERS = {
|
||||
"package.json": (content: string) =>
|
||||
JSON.parse(content).packageManager?.split("bun@")?.[1],
|
||||
"package.json": (content: string) => {
|
||||
const pkg = JSON.parse(content);
|
||||
return pkg.packageManager?.split("bun@")?.[1] ?? pkg.engines?.bun;
|
||||
},
|
||||
".tool-versions": (content: string) =>
|
||||
content.match(/^bun\s?(?<version>.*?)$/m)?.groups?.version,
|
||||
content.match(/^bun\s*(?<version>.*?)$/m)?.groups?.version,
|
||||
".bumrc": (content: string) => content, // https://github.com/owenizedd/bum
|
||||
".bun-version": (content: string) => content,
|
||||
};
|
||||
|
||||
export function readVersionFromFile(file: string): string | undefined {
|
||||
export function readVersionFromFile(
|
||||
file: string,
|
||||
silent = false,
|
||||
): string | undefined {
|
||||
const cwd = process.env.GITHUB_WORKSPACE;
|
||||
if (!cwd) {
|
||||
return;
|
||||
@@ -48,11 +144,13 @@ export function readVersionFromFile(file: string): string | undefined {
|
||||
|
||||
debug(`Reading version from ${file}`);
|
||||
|
||||
const path = join(cwd, file);
|
||||
const path = resolve(cwd, file);
|
||||
const base = basename(file);
|
||||
|
||||
if (!existsSync(path)) {
|
||||
warning(`File ${path} not found`);
|
||||
if (!silent) {
|
||||
warning(`File ${path} not found`);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -63,12 +161,16 @@ export function readVersionFromFile(file: string): string | undefined {
|
||||
output = reader(readFileSync(path, "utf8"))?.trim();
|
||||
|
||||
if (!output) {
|
||||
warning(`Failed to read version from ${file}`);
|
||||
if (!silent) {
|
||||
warning(`Failed to read version from ${file}`);
|
||||
}
|
||||
return;
|
||||
}
|
||||
} catch (error) {
|
||||
const { message } = error as Error;
|
||||
warning(`Failed to read ${file}: ${message}`);
|
||||
if (!silent) {
|
||||
warning(`Failed to read ${file}: ${message}`);
|
||||
}
|
||||
} finally {
|
||||
if (output) {
|
||||
info(`Obtained version ${output} from ${file}`);
|
||||
|
||||
@@ -0,0 +1,291 @@
|
||||
import { afterEach, describe, expect, it } from "bun:test";
|
||||
import { existsSync, unlinkSync } from "node:fs";
|
||||
import { writeBunfig } from "../src/bunfig";
|
||||
import { EOL } from "os";
|
||||
|
||||
describe("writeBunfig", () => {
|
||||
const filePath = "bunfig_test.toml";
|
||||
|
||||
async function getFileAndContents() {
|
||||
const file = Bun.file(filePath);
|
||||
const contents = (await file.text()).split(EOL);
|
||||
|
||||
return { file, contents };
|
||||
}
|
||||
|
||||
afterEach(() => {
|
||||
if (existsSync(filePath)) unlinkSync(filePath);
|
||||
console.log(`${filePath} was deleted`);
|
||||
});
|
||||
|
||||
describe("when no bunfig_test.toml file exists", () => {
|
||||
it("should create a new file with scopes content", async () => {
|
||||
writeBunfig(filePath, [
|
||||
{
|
||||
url: "https://npm.pkg.github.com",
|
||||
scope: "foo-bar",
|
||||
token: "$BUN_AUTH_TOKEN",
|
||||
},
|
||||
]);
|
||||
|
||||
const { file, contents } = await getFileAndContents();
|
||||
|
||||
expect(file.exists()).resolves.toBeTrue();
|
||||
|
||||
const expectedContents = [
|
||||
'[install.scopes."@foo-bar"]',
|
||||
'url = "https://npm.pkg.github.com"',
|
||||
'token = "$BUN_AUTH_TOKEN"',
|
||||
"",
|
||||
];
|
||||
|
||||
contents.forEach((content, index) =>
|
||||
expect(content).toBe(expectedContents[index])
|
||||
);
|
||||
|
||||
expect(contents.length).toBe(expectedContents.length);
|
||||
});
|
||||
|
||||
it("should create a new file with global registry", async () => {
|
||||
writeBunfig(filePath, [
|
||||
{
|
||||
url: "https://npm.pkg.github.com",
|
||||
scope: "",
|
||||
},
|
||||
]);
|
||||
|
||||
const { file, contents } = await getFileAndContents();
|
||||
|
||||
expect(file.exists()).resolves.toBeTrue();
|
||||
|
||||
const expectedContents = [
|
||||
"[install.registry]",
|
||||
'url = "https://npm.pkg.github.com"',
|
||||
"",
|
||||
];
|
||||
|
||||
contents.forEach((content, index) =>
|
||||
expect(content).toBe(expectedContents[index])
|
||||
);
|
||||
|
||||
expect(contents.length).toBe(expectedContents.length);
|
||||
});
|
||||
|
||||
it("should create a new file with global registry & token", async () => {
|
||||
writeBunfig(filePath, [
|
||||
{
|
||||
url: "https://npm.pkg.github.com",
|
||||
scope: "",
|
||||
token: "$BUN_AUTH_TOKEN",
|
||||
},
|
||||
]);
|
||||
|
||||
const { file, contents } = await getFileAndContents();
|
||||
|
||||
expect(file.exists()).resolves.toBeTrue();
|
||||
|
||||
const expectedContents = [
|
||||
"[install.registry]",
|
||||
'url = "https://npm.pkg.github.com"',
|
||||
'token = "$BUN_AUTH_TOKEN"',
|
||||
"",
|
||||
];
|
||||
|
||||
contents.forEach((content, index) =>
|
||||
expect(content).toBe(expectedContents[index])
|
||||
);
|
||||
|
||||
expect(contents.length).toBe(expectedContents.length);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when local bunfig_test.toml file exists", () => {
|
||||
it("and no [install.scopes] exists, should concatenate file correctly", async () => {
|
||||
const bunfig = `[install]${EOL}optional = true${EOL}${EOL}[install.cache]${EOL}disable = true`;
|
||||
|
||||
await Bun.write(filePath, bunfig);
|
||||
|
||||
writeBunfig(filePath, [
|
||||
{
|
||||
url: "https://npm.pkg.github.com",
|
||||
scope: "foo-bar",
|
||||
token: "$BUN_AUTH_TOKEN",
|
||||
},
|
||||
]);
|
||||
|
||||
const { file, contents } = await getFileAndContents();
|
||||
|
||||
expect(file.exists()).resolves.toBeTrue();
|
||||
|
||||
const expectedContents = [
|
||||
"[install]",
|
||||
"optional = true",
|
||||
"",
|
||||
" [install.cache]",
|
||||
" disable = true",
|
||||
"",
|
||||
'[install.scopes."@foo-bar"]',
|
||||
'url = "https://npm.pkg.github.com"',
|
||||
'token = "$BUN_AUTH_TOKEN"',
|
||||
"",
|
||||
];
|
||||
|
||||
contents.forEach((content, index) =>
|
||||
expect(content).toBe(expectedContents[index])
|
||||
);
|
||||
|
||||
expect(contents.length).toBe(expectedContents.length);
|
||||
});
|
||||
|
||||
it("and [install.scopes] exists and it's not the same registry, should concatenate file correctly", async () => {
|
||||
const bunfig = `[install]${EOL}optional = true${EOL}${EOL}[install.scopes]${EOL}'@bla-ble' = { token = "$BUN_AUTH_TOKEN", url = "https://npm.pkg.github.com/" }${EOL}${EOL}[install.cache]${EOL}disable = true`;
|
||||
|
||||
await Bun.write(filePath, bunfig);
|
||||
|
||||
writeBunfig(filePath, [
|
||||
{
|
||||
url: "https://npm.pkg.github.com",
|
||||
scope: "foo-bar",
|
||||
token: "$BUN_AUTH_TOKEN",
|
||||
},
|
||||
]);
|
||||
|
||||
const { file, contents } = await getFileAndContents();
|
||||
|
||||
expect(file.exists()).resolves.toBeTrue();
|
||||
|
||||
const expectedContents = [
|
||||
"[install]",
|
||||
"optional = true",
|
||||
"",
|
||||
'[install.scopes."@bla-ble"]',
|
||||
'token = "$BUN_AUTH_TOKEN"',
|
||||
'url = "https://npm.pkg.github.com/"',
|
||||
"",
|
||||
'[install.scopes."@foo-bar"]',
|
||||
'url = "https://npm.pkg.github.com"',
|
||||
'token = "$BUN_AUTH_TOKEN"',
|
||||
"",
|
||||
" [install.cache]",
|
||||
" disable = true",
|
||||
"",
|
||||
];
|
||||
|
||||
contents.forEach((content, index) =>
|
||||
expect(content).toBe(expectedContents[index])
|
||||
);
|
||||
|
||||
expect(contents.length).toBe(expectedContents.length);
|
||||
});
|
||||
|
||||
it("and [install.scopes] exists and it's the same registry, should concatenate file correctly", async () => {
|
||||
const bunfig = `[install]${EOL}optional = true${EOL}${EOL}[install.scopes]${EOL}'@foo-bar' = { token = "$BUN_AUTH_TOKEN", url = "https://npm.pkg.github.com/" }${EOL}'@bla-ble' = { token = "$BUN_AUTH_TOKEN", url = "https://npm.pkg.github.com/" }${EOL}${EOL}[install.cache]${EOL}disable = true`;
|
||||
|
||||
await Bun.write(filePath, bunfig);
|
||||
|
||||
writeBunfig(filePath, [
|
||||
{
|
||||
url: "https://npm.pkg.github.com",
|
||||
scope: "foo-bar",
|
||||
token: "$BUN_AUTH_TOKEN",
|
||||
},
|
||||
]);
|
||||
|
||||
const { file, contents } = await getFileAndContents();
|
||||
|
||||
expect(file.exists()).resolves.toBeTrue();
|
||||
|
||||
const expectedContents = [
|
||||
"[install]",
|
||||
"optional = true",
|
||||
"",
|
||||
'[install.scopes."@foo-bar"]',
|
||||
'url = "https://npm.pkg.github.com"',
|
||||
'token = "$BUN_AUTH_TOKEN"',
|
||||
"",
|
||||
'[install.scopes."@bla-ble"]',
|
||||
'token = "$BUN_AUTH_TOKEN"',
|
||||
'url = "https://npm.pkg.github.com/"',
|
||||
"",
|
||||
" [install.cache]",
|
||||
" disable = true",
|
||||
"",
|
||||
];
|
||||
|
||||
contents.forEach((content, index) =>
|
||||
expect(content).toBe(expectedContents[index])
|
||||
);
|
||||
|
||||
expect(contents.length).toBe(expectedContents.length);
|
||||
});
|
||||
|
||||
it("and [install.scopes] and [install] exists, should concantenate file correctly", async () => {
|
||||
const bunfig = `[install]${EOL}optional = true${EOL}${EOL}[install.scopes]${EOL}'@foo-bar' = { token = "$BUN_AUTH_TOKEN", url = "https://npm.pkg.github.com/" }${EOL}'@bla-ble' = { token = "$BUN_AUTH_TOKEN", url = "https://npm.pkg.github.com/" }${EOL}${EOL}[install.cache]${EOL}disable = true`;
|
||||
|
||||
await Bun.write(filePath, bunfig);
|
||||
|
||||
writeBunfig(filePath, [
|
||||
{
|
||||
url: "https://npm.pkg.github.com",
|
||||
scope: "foo-bar",
|
||||
token: "$BUN_AUTH_TOKEN",
|
||||
},
|
||||
{
|
||||
url: "https://bun.sh",
|
||||
scope: "",
|
||||
token: "$BUN_AUTH_TOKEN",
|
||||
}, // global registry
|
||||
]);
|
||||
|
||||
const { file, contents } = await getFileAndContents();
|
||||
|
||||
expect(file.exists()).resolves.toBeTrue();
|
||||
|
||||
const expectedContents = [
|
||||
"[install]",
|
||||
"optional = true",
|
||||
"",
|
||||
'[install.scopes."@foo-bar"]',
|
||||
'url = "https://npm.pkg.github.com"',
|
||||
'token = "$BUN_AUTH_TOKEN"',
|
||||
"",
|
||||
'[install.scopes."@bla-ble"]',
|
||||
'token = "$BUN_AUTH_TOKEN"',
|
||||
'url = "https://npm.pkg.github.com/"',
|
||||
"",
|
||||
" [install.cache]",
|
||||
" disable = true",
|
||||
"",
|
||||
" [install.registry]",
|
||||
' url = "https://bun.sh"',
|
||||
' token = "$BUN_AUTH_TOKEN"',
|
||||
"",
|
||||
];
|
||||
|
||||
contents.forEach((content, index) =>
|
||||
expect(content).toBe(expectedContents[index])
|
||||
);
|
||||
|
||||
expect(contents.length).toBe(expectedContents.length);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when multiple global registries are provided", () => {
|
||||
it("should throw an error", () => {
|
||||
expect(() => {
|
||||
writeBunfig(filePath, [
|
||||
{
|
||||
url: "https://npm.pkg.github.com",
|
||||
scope: "",
|
||||
token: "$BUN_AUTH_TOKEN",
|
||||
},
|
||||
{
|
||||
url: "https://bun.sh",
|
||||
scope: "",
|
||||
token: "$BUN_AUTH_TOKEN",
|
||||
},
|
||||
]);
|
||||
}).toThrow("You can't have more than one global registry.");
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,244 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, spyOn } from "bun:test";
|
||||
import { getDownloadUrl } from "../src/download-url";
|
||||
import * as utils from "../src/utils";
|
||||
|
||||
const MOCK_TAGS = [
|
||||
{ ref: "refs/tags/bun-v0.5.0" },
|
||||
{ ref: "refs/tags/bun-v1.0.0" },
|
||||
{ ref: "refs/tags/bun-v1.0.1" },
|
||||
{ ref: "refs/tags/bun-v1.1.0" },
|
||||
{ ref: "refs/tags/bun-v1.3.9" },
|
||||
{ ref: "refs/tags/bun-v1.3.10" },
|
||||
{ ref: "refs/tags/bun-v1.4.0" },
|
||||
{ ref: "refs/tags/canary" },
|
||||
];
|
||||
|
||||
describe("getDownloadUrl", () => {
|
||||
let requestSpy: ReturnType<typeof spyOn>;
|
||||
|
||||
beforeEach(() => {
|
||||
requestSpy = spyOn(utils, "request").mockResolvedValue({
|
||||
json: async () => MOCK_TAGS,
|
||||
} as Response);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
requestSpy.mockRestore();
|
||||
});
|
||||
|
||||
describe("Custom URL", () => {
|
||||
it("should return customUrl if provided", async () => {
|
||||
const url = await getDownloadUrl({
|
||||
customUrl: "https://example.com/bun.zip",
|
||||
});
|
||||
expect(url).toBe("https://example.com/bun.zip");
|
||||
expect(requestSpy).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Optimization (No API Call)", () => {
|
||||
it("should construct URL directly for specific version 1.0.0", async () => {
|
||||
const url = await getDownloadUrl({
|
||||
version: "1.0.0",
|
||||
os: "linux",
|
||||
arch: "x64",
|
||||
});
|
||||
|
||||
expect(url).toBe(
|
||||
"https://github.com/oven-sh/bun/releases/download/bun-v1.0.0/bun-linux-x64.zip",
|
||||
);
|
||||
expect(requestSpy).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
it("should construct URL directly for specific version 0.5.0", async () => {
|
||||
const url = await getDownloadUrl({
|
||||
version: "0.5.0",
|
||||
os: "darwin",
|
||||
arch: "aarch64",
|
||||
});
|
||||
|
||||
expect(url).toBe(
|
||||
"https://github.com/oven-sh/bun/releases/download/bun-v0.5.0/bun-darwin-aarch64.zip",
|
||||
);
|
||||
expect(requestSpy).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
it("should handle avx2=false (baseline) without API call", async () => {
|
||||
const url = await getDownloadUrl({
|
||||
version: "1.1.0",
|
||||
os: "linux",
|
||||
arch: "x64",
|
||||
avx2: false,
|
||||
});
|
||||
|
||||
expect(url).toBe(
|
||||
"https://github.com/oven-sh/bun/releases/download/bun-v1.1.0/bun-linux-x64-baseline.zip",
|
||||
);
|
||||
expect(requestSpy).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
it("should handle profile=true without API call", async () => {
|
||||
const url = await getDownloadUrl({
|
||||
version: "1.1.0",
|
||||
os: "linux",
|
||||
arch: "x64",
|
||||
profile: true,
|
||||
});
|
||||
|
||||
expect(url).toBe(
|
||||
"https://github.com/oven-sh/bun/releases/download/bun-v1.1.0/bun-linux-x64-profile.zip",
|
||||
);
|
||||
expect(requestSpy).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe("API Lookup (Dynamic Versions)", () => {
|
||||
it("should call API and resolve 'latest' to the newest version", async () => {
|
||||
const url = await getDownloadUrl({
|
||||
version: "latest",
|
||||
os: "linux",
|
||||
arch: "x64",
|
||||
});
|
||||
|
||||
expect(url).toBe(
|
||||
"https://github.com/oven-sh/bun/releases/download/bun-v1.4.0/bun-linux-x64.zip",
|
||||
);
|
||||
expect(requestSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("should call API and resolve semver range '^1.0.0'", async () => {
|
||||
const url = await getDownloadUrl({
|
||||
version: "^1.0.0",
|
||||
os: "linux",
|
||||
arch: "x64",
|
||||
});
|
||||
|
||||
expect(url).toBe(
|
||||
"https://github.com/oven-sh/bun/releases/download/bun-v1.4.0/bun-linux-x64.zip",
|
||||
);
|
||||
expect(requestSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("should call API and resolve 'canary'", async () => {
|
||||
const url = await getDownloadUrl({
|
||||
version: "canary",
|
||||
os: "linux",
|
||||
arch: "x64",
|
||||
});
|
||||
|
||||
expect(url).toBe(
|
||||
"https://github.com/oven-sh/bun/releases/download/canary/bun-linux-x64.zip",
|
||||
);
|
||||
expect(requestSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("should throw error if semver range matches nothing", async () => {
|
||||
expect(
|
||||
getDownloadUrl({
|
||||
version: "^2.0.0",
|
||||
os: "linux",
|
||||
arch: "x64",
|
||||
}),
|
||||
).rejects.toThrow("No Bun release found matching version '^2.0.0'");
|
||||
expect(requestSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Windows ARM64", () => {
|
||||
it("should use native aarch64 binary for Bun >= 1.3.10", async () => {
|
||||
const url = await getDownloadUrl({
|
||||
version: "1.3.10",
|
||||
os: "windows",
|
||||
arch: "arm64",
|
||||
});
|
||||
|
||||
expect(url).toBe(
|
||||
"https://github.com/oven-sh/bun/releases/download/bun-v1.3.10/bun-windows-aarch64.zip",
|
||||
);
|
||||
expect(requestSpy).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
it("should use native aarch64 binary for Bun 1.4.0", async () => {
|
||||
const url = await getDownloadUrl({
|
||||
version: "1.4.0",
|
||||
os: "windows",
|
||||
arch: "arm64",
|
||||
});
|
||||
|
||||
expect(url).toBe(
|
||||
"https://github.com/oven-sh/bun/releases/download/bun-v1.4.0/bun-windows-aarch64.zip",
|
||||
);
|
||||
expect(requestSpy).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
it("should fall back to x64-baseline for Bun < 1.3.10", async () => {
|
||||
const url = await getDownloadUrl({
|
||||
version: "1.1.0",
|
||||
os: "windows",
|
||||
arch: "arm64",
|
||||
});
|
||||
|
||||
expect(url).toBe(
|
||||
"https://github.com/oven-sh/bun/releases/download/bun-v1.1.0/bun-windows-x64-baseline.zip",
|
||||
);
|
||||
expect(requestSpy).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
it("should fall back to x64-baseline for Bun 1.3.9", async () => {
|
||||
const url = await getDownloadUrl({
|
||||
version: "1.3.9",
|
||||
os: "windows",
|
||||
arch: "arm64",
|
||||
});
|
||||
|
||||
expect(url).toBe(
|
||||
"https://github.com/oven-sh/bun/releases/download/bun-v1.3.9/bun-windows-x64-baseline.zip",
|
||||
);
|
||||
expect(requestSpy).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
it("should use native aarch64 for dynamic version resolving to >= 1.3.10", async () => {
|
||||
const url = await getDownloadUrl({
|
||||
version: "^1.3.0",
|
||||
os: "windows",
|
||||
arch: "arm64",
|
||||
});
|
||||
|
||||
expect(url).toBe(
|
||||
"https://github.com/oven-sh/bun/releases/download/bun-v1.4.0/bun-windows-aarch64.zip",
|
||||
);
|
||||
expect(requestSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("should use native aarch64 for canary on Windows ARM64", async () => {
|
||||
const url = await getDownloadUrl({
|
||||
version: "canary",
|
||||
os: "windows",
|
||||
arch: "arm64",
|
||||
});
|
||||
|
||||
expect(url).toBe(
|
||||
"https://github.com/oven-sh/bun/releases/download/canary/bun-windows-aarch64.zip",
|
||||
);
|
||||
expect(requestSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Token Handling", () => {
|
||||
it("should pass token to API request when resolving dynamic versions", async () => {
|
||||
await getDownloadUrl({
|
||||
version: "latest",
|
||||
token: "my-secret-token",
|
||||
os: "linux",
|
||||
arch: "x64",
|
||||
});
|
||||
|
||||
expect(requestSpy).toHaveBeenCalledWith(
|
||||
expect.stringContaining("api.github.com"),
|
||||
expect.objectContaining({
|
||||
headers: { Authorization: "Bearer my-secret-token" },
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,170 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { parseRegistries } from "../src/registry";
|
||||
|
||||
describe("registry", () => {
|
||||
describe("parseRegistries", () => {
|
||||
it("should return an empty array for empty input", () => {
|
||||
expect(parseRegistries("")).toEqual([]);
|
||||
expect(parseRegistries(" ")).toEqual([]);
|
||||
expect(parseRegistries(null as any)).toEqual([]);
|
||||
expect(parseRegistries(undefined as any)).toEqual([]);
|
||||
});
|
||||
|
||||
it("should parse default registry without token", () => {
|
||||
const input = "https://registry.npmjs.org/";
|
||||
const result = parseRegistries(input);
|
||||
|
||||
expect(result).toEqual([
|
||||
{
|
||||
url: "https://registry.npmjs.org/",
|
||||
scope: "",
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("should parse default registry with token", () => {
|
||||
const input = "https://registry.npmjs.org/|npm_token123";
|
||||
const result = parseRegistries(input);
|
||||
|
||||
expect(result).toEqual([
|
||||
{
|
||||
url: "https://registry.npmjs.org/",
|
||||
scope: "",
|
||||
token: "npm_token123",
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("should parse scoped registry with URL credentials", () => {
|
||||
const input = "@myorg:https://username:password@registry.myorg.com/";
|
||||
const result = parseRegistries(input);
|
||||
|
||||
expect(result).toEqual([
|
||||
{
|
||||
url: "https://username:password@registry.myorg.com/",
|
||||
scope: "@myorg",
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("should parse scoped registry with separate token", () => {
|
||||
const input = "@partner:https://registry.partner.com/|token_abc123";
|
||||
const result = parseRegistries(input);
|
||||
|
||||
expect(result).toEqual([
|
||||
{
|
||||
url: "https://registry.partner.com/",
|
||||
scope: "@partner",
|
||||
token: "token_abc123",
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("should parse multiple registries", () => {
|
||||
const input = `
|
||||
https://registry.npmjs.org/
|
||||
@myorg:https://username:password@registry.myorg.com/
|
||||
@partner:https://registry.partner.com/|token_abc123
|
||||
`;
|
||||
|
||||
const result = parseRegistries(input);
|
||||
|
||||
expect(result).toEqual([
|
||||
{
|
||||
url: "https://registry.npmjs.org/",
|
||||
scope: "",
|
||||
},
|
||||
{
|
||||
url: "https://username:password@registry.myorg.com/",
|
||||
scope: "@myorg",
|
||||
},
|
||||
{
|
||||
url: "https://registry.partner.com/",
|
||||
scope: "@partner",
|
||||
token: "token_abc123",
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("should handle scope names without @ prefix", () => {
|
||||
const input = "myorg:https://registry.myorg.com/|token123";
|
||||
const result = parseRegistries(input);
|
||||
|
||||
expect(result).toEqual([
|
||||
{
|
||||
url: "https://registry.myorg.com/",
|
||||
scope: "myorg",
|
||||
token: "token123",
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("should throw error for invalid URLs", () => {
|
||||
expect(() => {
|
||||
parseRegistries("@myorg:not-a-valid-url");
|
||||
}).toThrow("Invalid URL in registry configuration: not-a-valid-url");
|
||||
|
||||
expect(() => {
|
||||
parseRegistries("also-not-a-valid-url");
|
||||
}).toThrow("Invalid URL in registry configuration: also-not-a-valid-url");
|
||||
});
|
||||
|
||||
it("should handle whitespace and empty lines", () => {
|
||||
const input = `
|
||||
|
||||
https://registry.npmjs.org/
|
||||
|
||||
@myorg:https://registry.myorg.com/|token123
|
||||
|
||||
`;
|
||||
|
||||
const result = parseRegistries(input);
|
||||
|
||||
expect(result).toEqual([
|
||||
{
|
||||
url: "https://registry.npmjs.org/",
|
||||
scope: "",
|
||||
},
|
||||
{
|
||||
url: "https://registry.myorg.com/",
|
||||
scope: "@myorg",
|
||||
token: "token123",
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("should handle URLs with paths and query parameters", () => {
|
||||
const input =
|
||||
"@myorg:https://registry.myorg.com/npm/registry/?timeout=5000|token123";
|
||||
const result = parseRegistries(input);
|
||||
|
||||
expect(result).toEqual([
|
||||
{
|
||||
url: "https://registry.myorg.com/npm/registry/?timeout=5000",
|
||||
scope: "@myorg",
|
||||
token: "token123",
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("should correctly handle scopes with hyphens and underscores", () => {
|
||||
const input = `
|
||||
@my-org:https://registry.myorg.com/
|
||||
@my_org:https://registry.myorg.com/
|
||||
`;
|
||||
|
||||
const result = parseRegistries(input);
|
||||
|
||||
expect(result).toEqual([
|
||||
{
|
||||
url: "https://registry.myorg.com/",
|
||||
scope: "@my-org",
|
||||
},
|
||||
{
|
||||
url: "https://registry.myorg.com/",
|
||||
scope: "@my_org",
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"types": [
|
||||
"bun"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
import { afterEach, describe, expect, it, spyOn } from "bun:test";
|
||||
import { extractVersionFromUrl, getArchitecture, getAvx2, hasNativeWindowsArm64 } from "../src/utils";
|
||||
import * as core from "@actions/core";
|
||||
|
||||
describe("extractVersionFromUrl", () => {
|
||||
it("should extract version from standard download URL", () => {
|
||||
expect(extractVersionFromUrl("https://github.com/oven-sh/bun/releases/download/bun-v1.3.1/bun-linux-x64.zip")).toBe("1.3.1");
|
||||
expect(extractVersionFromUrl("https://github.com/oven-sh/bun/releases/download/bun-v1.0.0/bun-darwin-aarch64.zip")).toBe("1.0.0");
|
||||
expect(extractVersionFromUrl("https://github.com/oven-sh/bun/releases/download/bun-v0.5.0/bun-linux-x64-baseline.zip")).toBe("0.5.0");
|
||||
});
|
||||
|
||||
it("should extract version from URL with profile suffix", () => {
|
||||
expect(extractVersionFromUrl("https://github.com/oven-sh/bun/releases/download/bun-v1.1.0/bun-linux-x64-profile.zip")).toBe("1.1.0");
|
||||
});
|
||||
|
||||
it("should return undefined for canary URL", () => {
|
||||
expect(extractVersionFromUrl("https://github.com/oven-sh/bun/releases/download/canary/bun-linux-x64.zip")).toBeUndefined();
|
||||
});
|
||||
|
||||
it("should return undefined for custom/non-standard URL", () => {
|
||||
expect(extractVersionFromUrl("https://example.com/bun.zip")).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("hasNativeWindowsArm64", () => {
|
||||
it("should return true for version >= 1.3.10", () => {
|
||||
expect(hasNativeWindowsArm64("bun-v1.3.10")).toBe(true);
|
||||
expect(hasNativeWindowsArm64("bun-v1.3.11")).toBe(true);
|
||||
expect(hasNativeWindowsArm64("bun-v1.4.0")).toBe(true);
|
||||
expect(hasNativeWindowsArm64("bun-v2.0.0")).toBe(true);
|
||||
});
|
||||
|
||||
it("should return false for version < 1.3.10", () => {
|
||||
expect(hasNativeWindowsArm64("bun-v1.3.9")).toBe(false);
|
||||
expect(hasNativeWindowsArm64("bun-v1.2.0")).toBe(false);
|
||||
expect(hasNativeWindowsArm64("bun-v1.0.0")).toBe(false);
|
||||
expect(hasNativeWindowsArm64("bun-v0.5.0")).toBe(false);
|
||||
});
|
||||
|
||||
it("should return true for non-semver versions like canary", () => {
|
||||
expect(hasNativeWindowsArm64("canary")).toBe(true);
|
||||
expect(hasNativeWindowsArm64("latest")).toBe(true);
|
||||
});
|
||||
|
||||
it("should return false for undefined version", () => {
|
||||
expect(hasNativeWindowsArm64(undefined)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("getArchitecture", () => {
|
||||
let warningSpy: ReturnType<typeof spyOn>;
|
||||
|
||||
afterEach(() => {
|
||||
warningSpy?.mockRestore();
|
||||
});
|
||||
|
||||
it("should return aarch64 for Windows arm64 with Bun >= 1.3.10", () => {
|
||||
warningSpy = spyOn(core, "warning");
|
||||
const result = getArchitecture("windows", "arm64", "bun-v1.3.10");
|
||||
|
||||
expect(result).toBe("aarch64");
|
||||
expect(warningSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should return aarch64 for Windows aarch64 with Bun >= 1.3.10", () => {
|
||||
warningSpy = spyOn(core, "warning");
|
||||
const result = getArchitecture("windows", "aarch64", "bun-v1.4.0");
|
||||
|
||||
expect(result).toBe("aarch64");
|
||||
expect(warningSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should return x64 for Windows arm64 with Bun < 1.3.10", () => {
|
||||
warningSpy = spyOn(core, "warning");
|
||||
const result = getArchitecture("windows", "arm64", "bun-v1.2.0");
|
||||
|
||||
expect(result).toBe("x64");
|
||||
expect(warningSpy).toHaveBeenCalledTimes(1);
|
||||
expect(warningSpy).toHaveBeenCalledWith(
|
||||
expect.stringContaining(
|
||||
"⚠️ This version of Bun does not provide native arm64 builds for Windows."
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
it("should return x64 for Windows aarch64 with Bun < 1.3.10", () => {
|
||||
warningSpy = spyOn(core, "warning");
|
||||
const result = getArchitecture("windows", "aarch64", "bun-v1.0.0");
|
||||
|
||||
expect(result).toBe("x64");
|
||||
expect(warningSpy).toHaveBeenCalledTimes(1);
|
||||
expect(warningSpy).toHaveBeenCalledWith(
|
||||
expect.stringContaining(
|
||||
"⚠️ This version of Bun does not provide native arm64 builds for Windows."
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
it("should return x64 for Windows arm64 with no version (fallback)", () => {
|
||||
warningSpy = spyOn(core, "warning");
|
||||
const result = getArchitecture("windows", "arm64");
|
||||
|
||||
expect(result).toBe("x64");
|
||||
expect(warningSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("should return aarch64 for non-Windows platforms with arm64", () => {
|
||||
warningSpy = spyOn(core, "warning");
|
||||
const result = getArchitecture("linux", "arm64");
|
||||
|
||||
expect(result).toBe("aarch64");
|
||||
expect(warningSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should return aarch64 for macOS with arm64", () => {
|
||||
warningSpy = spyOn(core, "warning");
|
||||
const result = getArchitecture("darwin", "arm64");
|
||||
|
||||
expect(result).toBe("aarch64");
|
||||
expect(warningSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should return original arch value for x64", () => {
|
||||
warningSpy = spyOn(core, "warning");
|
||||
const result = getArchitecture("windows", "x64");
|
||||
|
||||
expect(result).toBe("x64");
|
||||
expect(warningSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should return original arch value for x86", () => {
|
||||
warningSpy = spyOn(core, "warning");
|
||||
const result = getArchitecture("linux", "x86");
|
||||
|
||||
expect(result).toBe("x86");
|
||||
expect(warningSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should return original arch value for aarch64 on Linux", () => {
|
||||
warningSpy = spyOn(core, "warning");
|
||||
const result = getArchitecture("linux", "aarch64");
|
||||
|
||||
expect(result).toBe("aarch64");
|
||||
expect(warningSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe("getAvx2", () => {
|
||||
it("should return false for Windows arm64 with Bun < 1.3.10", () => {
|
||||
expect(getAvx2("windows", "arm64", undefined, "bun-v1.2.0")).toBe(false);
|
||||
});
|
||||
|
||||
it("should return false for Windows aarch64 with Bun < 1.3.10", () => {
|
||||
expect(getAvx2("windows", "aarch64", undefined, "bun-v1.0.0")).toBe(false);
|
||||
});
|
||||
|
||||
it("should return false for Windows arm64 with no version (fallback)", () => {
|
||||
expect(getAvx2("windows", "arm64")).toBe(false);
|
||||
});
|
||||
|
||||
it("should return false for Windows aarch64 with no version (fallback)", () => {
|
||||
expect(getAvx2("windows", "aarch64")).toBe(false);
|
||||
});
|
||||
|
||||
it("should return true for Windows arm64 with Bun >= 1.3.10", () => {
|
||||
expect(getAvx2("windows", "arm64", undefined, "bun-v1.3.10")).toBe(true);
|
||||
});
|
||||
|
||||
it("should return true for Windows aarch64 with Bun >= 1.3.10", () => {
|
||||
expect(getAvx2("windows", "aarch64", undefined, "bun-v1.4.0")).toBe(true);
|
||||
});
|
||||
|
||||
it("should return the provided avx2 value (true) when specified and not on Windows ARM64", () => {
|
||||
expect(getAvx2("linux", "x64", true)).toBe(true);
|
||||
expect(getAvx2("darwin", "x64", true)).toBe(true);
|
||||
expect(getAvx2("windows", "x64", true)).toBe(true);
|
||||
});
|
||||
|
||||
it("should return the provided avx2 value (false) when specified and not on Windows ARM64", () => {
|
||||
expect(getAvx2("linux", "x64", false)).toBe(false);
|
||||
expect(getAvx2("darwin", "x64", false)).toBe(false);
|
||||
expect(getAvx2("windows", "x64", false)).toBe(false);
|
||||
});
|
||||
|
||||
it("should return true by default when avx2 is not specified and not on Windows ARM64", () => {
|
||||
// x64 architecture on various platforms
|
||||
expect(getAvx2("linux", "x64")).toBe(true);
|
||||
expect(getAvx2("darwin", "x64")).toBe(true);
|
||||
expect(getAvx2("windows", "x64")).toBe(true);
|
||||
|
||||
// ARM architecture on non-Windows platforms
|
||||
expect(getAvx2("linux", "arm64")).toBe(true);
|
||||
expect(getAvx2("linux", "aarch64")).toBe(true);
|
||||
expect(getAvx2("darwin", "arm64")).toBe(true);
|
||||
expect(getAvx2("darwin", "aarch64")).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user