Skip to content

Commit

Permalink
refactor!: use bun 🐇
Browse files Browse the repository at this point in the history
Signed-off-by: Vinayak Kulkarni <[email protected]>
  • Loading branch information
vinayakkulkarni committed May 19, 2024
1 parent 1c05b47 commit d91544f
Show file tree
Hide file tree
Showing 25 changed files with 234 additions and 13,105 deletions.
46 changes: 46 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: 2
updates:
- package-ecosystem: npm
versioning-strategy: increase
directory: '/'
schedule:
interval: daily
time: '00:00'
timezone: Asia/Calcutta
groups:
npm-development:
dependency-type: development
update-types:
- minor
- patch
npm-production:
dependency-type: production
update-types:
- patch
reviewers:
- vinayakkulkarni
assignees:
- vinayakkulkarni
commit-message:
prefix: fix
prefix-development: chore
include: scope
- package-ecosystem: github-actions
directory: '/'
schedule:
interval: daily
time: '00:00'
timezone: Asia/Calcutta
groups:
actions-minor:
update-types:
- minor
- patch
reviewers:
- vinayakkulkarni
assignees:
- vinayakkulkarni
commit-message:
prefix: fix
prefix-development: chore
include: scope
36 changes: 36 additions & 0 deletions .github/workflows/automerger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'Automerge Dependabot PRs'

on: pull_request_target

permissions:
pull-requests: write
contents: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata 🤖
id: metadata
uses: dependabot/[email protected]
with:
alert-lookup: true
compat-lookup: true
github-token: ${{ secrets.DEPENDABOT_TOKEN }}

- name: Authenticate CLI with PAT 🔐
run: echo "${{ secrets.DEPENDABOT_TOKEN }}" | gh auth login --with-token

- name: Approve Dependabot PRs 👍
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.DEPENDABOT_TOKEN }}

- name: Auto-merge Dependabot PRs 🕺
if: steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch'
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.DEPENDABOT_TOKEN }}
23 changes: 9 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,37 @@ permissions:

jobs:
ci:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
name: 'CI'
runs-on: ubuntu-latest
steps:
- name: Check out repository 🎉
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup node env 📦
uses: actions/setup-node@v4
- name: Setup bun env 🐰
uses: oven-sh/setup-bun@v1
with:
node-version-file: 'package.json'
check-latest: true
cache: 'npm'
bun-version: latest

- name: Install dependencies 🚀
run: npm ci --prefer-offline --no-audit
run: bun install

- name: Run linter(s) 👀
uses: wearerequired/lint-action@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
continue_on_error: false
git_name: github-actions[bot]
git_email: github-actions[bot]@users.noreply.github.com
auto_fix: false
continue_on_error: false
neutral_check_on_warning: true
stylelint: true
stylelint: false
stylelint_extensions: css,scss,vue
eslint: true
eslint_extensions: js,ts,vue
prettier: true
prettier_extensions: js,ts,vue

- name: Build the package 🎉
run: npm run build
run: bun run build
12 changes: 8 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: 'CodeQL'
name: CodeQL

on:
push:
branches: [main]
branches:
- main
pull_request:
branches: [main]
branches:
- main
schedule:
- cron: '45 23 * * 2'

Expand All @@ -20,7 +22,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: ['javascript']
language: [javascript]

steps:
- name: Checkout repository
Expand All @@ -37,3 +39,5 @@ jobs:

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: /language:${{ matrix.language }}
21 changes: 8 additions & 13 deletions .github/workflows/ct.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,24 @@ permissions:

jobs:
ct:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
name: 'CT'
runs-on: ubuntu-latest
steps:
- name: Check out repository 🎉
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup node env 📦
uses: actions/setup-node@v4
- name: Setup bun env 🐰
uses: oven-sh/setup-bun@v1
with:
node-version-file: 'package.json'
check-latest: true
cache: 'npm'
bun-version: latest

- name: Install dependencies 🚀
run: npm ci --prefer-offline --no-audit
run: bun install

- name: Run tests 🧪
run: npm run test
run: bun run test

- name: Run coverage 🧪
run: npm run test:coverage
run: bun run test:coverage
2 changes: 1 addition & 1 deletion .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5.4.0
- uses: amannn/action-semantic-pull-request@v5.5.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
48 changes: 37 additions & 11 deletions .github/workflows/shipjs-trigger.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: 'Ship js trigger'
name: Ship js trigger

on:
pull_request:
types:
- closed

jobs:
build:
name: Release
publish-to-npm:
name: 'Publishing to NPM ✨'
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'releases/v')
steps:
Expand All @@ -22,19 +22,45 @@ jobs:
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
- name: Setup node environment 📦
uses: actions/setup-node@v4
- name: Setup bun env 🐰
uses: oven-sh/setup-bun@v1
with:
node-version-file: 'package.json'
check-latest: true
cache: 'npm'
bun-version: 1.0.25+a8ff7be64

- name: Install dependencies 🚀
run: npm ci --prefer-offline --no-audit
run: bun install

- name: Trigger a release 🥳
run: npx shipjs trigger
- name: Trigger a release (NPM) 🥳
run: bunx shipjs trigger
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
SLACK_INCOMING_HOOK: ${{ secrets.SLACK_INCOMING_HOOK }}

publish-to-jsr:
name: 'Publishing to JSR ✨'
runs-on: ubuntu-latest
needs: publish-to-npm
permissions:
contents: read
id-token: write
steps:
- name: Checkout code 🛎
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main

- name: Setup bun env 🐰
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Install dependencies 🚀
run: bun install

- name: Build the package 🎉
run: bun run build

- name: Trigger a release (JSR) 🥳
run: bunx jsr publish
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ git interpret-trailers --if-exists doNothing --trailer \
"Signed-off-by: $NAME <$EMAIL>" \
--in-place "$1"

npm exec --no -- commitlint --edit $1
bun commitlint --edit $1
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npm exec --no -- lint-staged --no-stash
bun lint-staged --no-stash
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
registry=https://registry.npmjs.org
@jsr:registry=https://npm.jsr.io
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
node
20
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"Vue.volar",
"Vue.vscode-typescript-vue-plugin"
]
}
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"files.eol": "\n",
"editor.formatOnSave": true
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
},
}
Binary file added bun.lockb
Binary file not shown.
10 changes: 10 additions & 0 deletions jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "@vinayakkulkarni/v-mapbox",
"version": "5.0.0",
"exports": "./dist/v-mapbox.js",
"publish": {
"exclude": [
"!dist"
]
}
}
4 changes: 2 additions & 2 deletions lint-staged.config.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
'*.{js,ts,vue}': 'npm run lint:js',
'*.{css,vue}': 'npm run lint:css',
'*.{js,ts,vue}': 'bun run lint:js',
'*.{css,vue}': 'bun run lint:css',
};
6 changes: 3 additions & 3 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[dev]
command = "npm run docs:dev"
command = "bun run docs:dev"

[build]
command = "npm run docs:build"
publish = "docs/.vitepress/dist"
command = "./scripts/build.sh"
publish = "docs/.vitepress/dist"
Loading

0 comments on commit d91544f

Please sign in to comment.