Skip to content

Commit 34c4936

Browse files
authored
feat(ref: #112): bun+nodejs, lint-staged (#113)
feat(ref: #112): bun+nodejs, lint-staged (#113)
1 parent 34c06c5 commit 34c4936

File tree

9 files changed

+69
-45
lines changed

9 files changed

+69
-45
lines changed

.github/hooks/commit-msg

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
set -e
44

55
commit_msg=$(cat .git/COMMIT_EDITMSG)
6-
echo "$commit_msg" | npx commitlint
6+
echo "$commit_msg" | bun commitlint

.github/hooks/pre-commit

+7-6
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,22 @@
22

33
set -e
44

5-
npm run lint
5+
bun run lint-staged
6+
bun run lint
67

7-
npm run snyk:test
8+
# bun run snyk:test
89

9-
output=$(npm run type-coverage)
10+
output=$(bun run type-coverage)
1011
if echo "$output" | grep -q "lower than "; then
1112
echo "$output"
1213
exit 1 # Terminate the hook script with a non-zero exit code
1314
else
1415
echo "Type coverage is good! 🎉"
1516
fi
1617

17-
npm run test
18+
bun run test
1819

19-
npm run build
20+
bun run build
2021

21-
npm run build:lib
22+
bun run build:lib
2223

.github/workflows/gh-pages.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,20 @@ jobs:
1212
contents: write
1313
steps:
1414
- uses: actions/checkout@v4
15+
with:
16+
submodules: true
1517

1618
- uses: actions/setup-node@v4
1719
with:
1820
node-version: 20
1921

22+
- uses: oven-sh/setup-bun@v1
23+
with:
24+
bun-version: latest
25+
2026
- name: Install deps
2127
run: |
22-
npm ci --force
23-
git submodule update --init --recursive --remote
28+
bun i
2429
2530
- name: Semantic Release
2631
id: semantic-release
@@ -37,7 +42,7 @@ jobs:
3742
echo "RELEASE_VERSION: $RELEASE_VERSION"
3843
echo '********'
3944
bash .github/workflows/scripts/replace_template.sh $RELEASE_VERSION
40-
npm run build
45+
bun run build
4146
4247
- name: Deploy demo
4348
uses: peaceiris/actions-gh-pages@v3

.github/workflows/publish.yml

+9-5
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,21 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
13+
with:
14+
submodules: true
15+
- uses: oven-sh/setup-bun@v1
16+
with:
17+
bun-version: latest
1318
- uses: actions/setup-node@v4
1419
with:
1520
node-version: 20
16-
registry-url: https://registry.npmjs.org/
21+
registry-url: 'https://registry.npmjs.org'
1722
- name: Build library
1823
run: |
19-
npm ci --force
20-
git submodule update --init --recursive --remote
21-
npm run build:lib
24+
bun i
25+
bun run build:lib
2226
- name: Publish library
23-
run: npm run publish:lib
27+
run: bun run publish:lib
2428
env:
2529
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
2630

.github/workflows/quality-check.yml

+26-20
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
11
name: build and quality
22

33
on:
4-
push:
5-
branches:
6-
- develop
7-
pull_request:
8-
branches:
9-
- develop
4+
push:
5+
branches:
6+
- develop
7+
pull_request:
8+
branches:
9+
- develop
1010

1111
env:
1212
snyk_token: ${{ secrets.SNYK_TOKEN }}
13+
REF: ${{ github.head_ref || github.ref_name }}
1314

1415
jobs:
15-
quality-check:
16-
runs-on: ubuntu-latest
17-
permissions:
18-
contents: write
19-
steps:
20-
- uses: actions/checkout@v4
21-
- uses: actions/setup-node@v4
22-
with:
23-
node-version: 20
24-
- name: Check quality
25-
run: |
26-
npm ci --force
27-
git submodule update --init --recursive --remote
28-
bash .github/workflows/scripts/quality.sh
16+
quality-check:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: write
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
submodules: true
24+
ref: ${{ env.REF }}
25+
- uses: oven-sh/setup-bun@v1
26+
with:
27+
bun-version: latest
28+
- uses: actions/setup-node@v4
29+
with:
30+
node-version: 20
31+
- name: Check quality
32+
run: |
33+
bun i
34+
bash .github/workflows/scripts/quality.sh

.github/workflows/scripts/quality.sh

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22

33
set -e
44

5-
npm run lint
5+
bun run lint
66

7-
npm run snyk:auth -- $snyk_token
8-
npm run snyk:test
7+
# bun run snyk:auth -- $snyk_token
8+
# bun run snyk:test
99

10-
output=$(npm run type-coverage)
10+
output=$(bun run type-coverage)
1111
if echo "$output" | grep -q "lower than "; then
1212
echo "$output"
1313
exit 1 # Terminate the hook script with a non-zero exit code
1414
else
1515
echo "Type coverage is good! 🎉"
1616
fi
1717

18-
npm run test
18+
bun run test
1919

20-
npm run build
20+
bun run build
2121

22-
npm run build:lib
22+
bun run build:lib

.lintstagedrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"*.{ts,js,json}": [
3+
"eslint --report-unused-disable-directives --max-warnings 0 --fix",
4+
"prettier --write"
5+
],
6+
"*.scss": "stylelint --fix"
7+
}

bun.lockb

746 KB
Binary file not shown.

package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
"ng": "ng",
1717
"start": "ng serve",
1818
"build": "ng build angular-loader --base-href /ngx-loader-indicator/ --configuration production",
19-
"build:lib": "ng build --configuration production ngx-loader-indicator-lib && npm run copy-libdocs",
19+
"build:lib": "ng build --configuration production ngx-loader-indicator-lib && bun run copy-libdocs",
2020
"copy-libdocs": "cp README.md LICENSE dist/ngx-loader-indicator-lib",
2121
"publish:lib": "cd dist/ngx-loader-indicator-lib && npm publish",
2222
"test": "ng test",
2323
"test:pre-commit": "ng test --watch=false",
24-
"lint": "npx eslint . && npm run lint:scss",
24+
"lint": "npx eslint . && bun run lint:scss",
2525
"lint:scss": "stylelint \"**/*.scss\"",
2626
"lint:scss:fix": "stylelint \"**/*.scss\" --fix",
27-
"lint:fix": "ng lint --fix && npm run lint:scss:fix",
27+
"lint:fix": "ng lint --fix && bun run lint:scss:fix",
2828
"prettier:fix": "npx prettier --write .",
2929
"type-coverage": "type-coverage",
3030
"init:git:hooks": ".github/scripts/setup_hooks.sh",
@@ -74,6 +74,7 @@
7474
"eslint-plugin-prettier": "5.1.3",
7575
"jasmine-core": "5.1.2",
7676
"jasmine-spec-reporter": "7.0.0",
77+
"lint-staged": "15.2.7",
7778
"ng-packagr": "18.0.0",
7879
"npm-check-updates": "^16.14.20",
7980
"postcss-scss": "4.0.9",

0 commit comments

Comments
 (0)