Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use bun instead of npm to install packages #228

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions .github/actions/setup-project/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: Setup project
description: Prepare the project for any CI action

inputs:
bun-version:
description: Version of Bun to install
default: 1.x

node-version:
description: Version of Node to install
default: 18.x
Expand All @@ -17,28 +21,22 @@ inputs:
runs:
using: composite
steps:
- name: 🏗 Setup Node with cache
if: ${{ inputs.without-cache != 'true' }}
uses: actions/setup-node@v3
- name: 🏗 Setup Bun
uses: oven-sh/setup-bun@v1
with:
node-version: ${{ inputs.node-version }}
cache: npm
cache-dependency-path: |
package-lock.json
test/fixture/package-lock.json
bun-version: ${{ inputs.bun-version }}

- name: 🏗 Setup Node without cache
if: ${{ inputs.without-cache == 'true' }}
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}

- name: 📦 Install dependencies
run: npm ci
run: bun install --frozen-lockfile
shell: bash

- name: 📦 Install fixture
if: ${{ inputs.with-fixture == 'true' }}
run: npm ci
run: bun install --frozen-lockfile
working-directory: test/fixture
shell: bash
12 changes: 6 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: ./.github/actions/setup-project

- name: 🎁 Package extension
run: npx vsce package --no-dependencies
run: bunx vsce package --no-dependencies
env:
VSCODE_EXPO_TELEMETRY_KEY: ${{ secrets.TELEMETRY_KEY }}

Expand All @@ -38,14 +38,14 @@ jobs:

- name: 🚀 Publish release to marketplace
if: ${{ !github.event.release.prerelease }}
run: npx vsce publish --no-dependencies
run: bunx vsce publish --no-dependencies
env:
VSCODE_EXPO_TELEMETRY_KEY: ${{ secrets.TELEMETRY_KEY }}
VSCE_PAT: ${{ secrets.VSCE_TOKEN }}

- name: 🚀 Publish pre-release to marketplace
if: ${{ github.event.release.prerelease }}
run: npx vsce publish --no-dependencies --pre-release
run: bunx vsce publish --no-dependencies --pre-release
env:
VSCODE_EXPO_TELEMETRY_KEY: ${{ secrets.TELEMETRY_KEY }}
VSCE_PAT: ${{ secrets.VSCE_TOKEN }}
Expand All @@ -60,18 +60,18 @@ jobs:
uses: ./.github/actions/setup-project

- name: 🎁 Package extension
run: npx vsce package --no-dependencies --out ./vscode-expo.vsix
run: bunx vsce package --no-dependencies --out ./vscode-expo.vsix
env:
VSCODE_EXPO_TELEMETRY_KEY: ${{ secrets.TELEMETRY_KEY }}

- name: 🚀 Publish release to open-vsx
if: ${{ !github.event.release.prerelease }}
run: npx ovsx publish --no-dependencies ./vscode-expo.vsix
run: bunx ovsx publish --no-dependencies ./vscode-expo.vsix
env:
OVSX_PAT: ${{ secrets.OPENVSX_TOKEN }}

- name: 🚀 Publish pre-release to open-vsx
if: ${{ github.event.release.prerelease }}
run: npx ovsx publish --no-dependencies --pre-release ./vscode-expo.vsix
run: bunx ovsx publish --no-dependencies --pre-release ./vscode-expo.vsix
env:
OVSX_PAT: ${{ secrets.OPENVSX_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
uses: ./.github/actions/setup-project

- name: 📋 Dry-running release
run: npx semantic-release --dry-run
run: bunx semantic-release --dry-run
env:
GITHUB_TOKEN: ${{ github.token }}

Expand All @@ -46,7 +46,7 @@ jobs:
uses: ./.github/actions/setup-project

- name: 📋 Release code
run: npx semantic-release
run: bunx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.EXPOBOT_GITHUB_TOKEN }}
GIT_AUTHOR_NAME: Expo CI
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: ./.github/actions/setup-project

- name: ✅ Lint project
run: npm run lint -- --max-warnings 0
run: bun run lint --max-warnings 0

scripts:
runs-on: ubuntu-latest
Expand All @@ -34,7 +34,7 @@ jobs:
uses: ./.github/actions/setup-project

- name: 🧪 Test scripts
run: npm run test:scripts
run: bun run test:scripts

bundled:
# This extension is bundled before publishing to the stores,
Expand All @@ -51,22 +51,22 @@ jobs:
with-fixture: true

- name: 👷 Build tests
run: npm run build
run: bun run build

- name: 📦 Bundle extension
run: npm run build:production
run: bun run build:production

# When bundled, these dependencies aren't available in normal environments.
# This drops all "dependencies" from the project, to only rely on the bundle itself.
- name: 🧹 Remove bundled dependencies
run: |
echo "$(jq 'del(.dependencies)' package.json)" > package.json
npm install --no-package-lock --ignore-scripts
bun install --ignore-scripts

- name: 🧪 Test project
uses: ./.github/actions/test-vscode
with:
command: npm run test:vscode
command: bun run test:vscode
env:
VSCODE_VERSION: stable

Expand All @@ -87,7 +87,7 @@ jobs:
with-fixture: true

- name: 👷 Build project
run: npm run build
run: bun run build

# This handles the "oldest" vscode version by looking up our "oldest supported version"
- name: 🕵️ Set vscode version
Expand All @@ -104,4 +104,4 @@ jobs:
- name: 🧪 Test project
uses: ./.github/actions/test-vscode
with:
command: npm run test:vscode
command: bun run test:vscode
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ lerna-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
package-lock.json

# editors
.idea
Expand Down
Binary file added bun.lockb
Binary file not shown.
Loading