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 Mar 21, 2024
1 parent 8b69e77 commit 22f3933
Show file tree
Hide file tree
Showing 23 changed files with 175 additions and 10,829 deletions.
19 changes: 14 additions & 5 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
root: true,
env: {
browser: true,
node: true,
node: false,
es2022: true,
},
parserOptions: {
Expand All @@ -16,18 +16,27 @@ module.exports = {
},
extraFileExtensions: ['.vue'],
},
plugins: ['vue', 'jsdoc', 'security', '@typescript-eslint', 'prettier'],
plugins: [
'@typescript-eslint',
'import',
'jsdoc',
'prettier',
'security',
'vue',
],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:jsdoc/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:vue/vue3-recommended',
'plugin:security/recommended',
'plugin:prettier/recommended',
'plugin:vue/vue3-recommended',
'prettier',
],
// add your custom rules here
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'import/no-unresolved': 'off',
},
};
31 changes: 28 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
version: 2
updates:
# Fetch and update latest `npm` packages
- 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:
Expand All @@ -15,13 +25,23 @@ updates:
prefix: fix
prefix-development: chore
include: scope
# Fetch and update latest `npm` packages
- package-ecosystem: npm
versioning-strategy: increase
directory: '/example'
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:
Expand All @@ -30,12 +50,17 @@ updates:
prefix: fix
prefix-development: chore
include: scope
# Fetch and update latest `github-actions` pkgs
- package-ecosystem: github-actions
directory: '/'
schedule:
interval: daily
time: '00:00'
timezone: Asia/Calcutta
groups:
actions-minor:
update-types:
- minor
- patch
reviewers:
- vinayakkulkarni
assignees:
Expand Down
24 changes: 9 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,37 @@ permissions:

jobs:
ci:
name: 'CI'
runs-on: ubuntu-latest
steps:
- name: Check out repository ✨ (non dependabot)
if: ${{ github.actor != 'dependabot[bot]' }}
uses: actions/checkout@v4

- name: Check out repository 🎉 (dependabot)
if: ${{ github.actor == 'dependabot[bot]' }}
- 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
8 changes: 5 additions & 3 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 Down
13 changes: 4 additions & 9 deletions .github/workflows/demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,14 @@ jobs:
with:
persist-credentials: false

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

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

- name: Run build 🏁
run: npm run build
run: bun run build

- name: Deploy to GitHub Pages 🚀
uses: peaceiris/[email protected]
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
5 changes: 1 addition & 4 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

NAME=$(git config user.name)
EMAIL=$(git config user.email)

Expand All @@ -18,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
5 changes: 1 addition & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm exec --no -- lint-staged --no-stash
bun lint-staged --no-stash
5 changes: 4 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"recommendations": ["Vue.volar"]
"recommendations": [
"Vue.volar",
"heybourn.headwind"
]
}
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"files.eol": "\n",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true
"source.fixAll": "explicit",
"source.organizeImports": "never"
},
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
Expand Down
Binary file added bun.lockb
Binary file not shown.
Binary file added example/bun.lockb
Binary file not shown.
Loading

0 comments on commit 22f3933

Please sign in to comment.