Skip to content

Commit ec1c389

Browse files
authored
🔧 chore: Update deps, migrate to pnpm (#55)
1 parent ae233b6 commit ec1c389

12 files changed

Lines changed: 3635 additions & 5077 deletions

File tree

.github/workflows/qa.yml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,54 @@ on:
55
branches:
66
- main
77

8+
env:
9+
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN_PUBLIC }}
10+
811
jobs:
912
qa:
1013
name: Code Quality Node ${{ matrix.node }}
11-
runs-on: [self-hosted, Linux]
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 30
1216
strategy:
1317
fail-fast: false
1418
matrix:
1519
node: [20, 22, 24]
1620
steps:
1721
- name: Checkout repository
18-
uses: actions/checkout@v4
22+
uses: actions/checkout@v6
23+
24+
- name: Clean pnpm setup cache
25+
run: rm -rf ~/setup-pnpm
26+
27+
- name: Setup pnpm
28+
uses: pnpm/action-setup@v5
1929

2030
- name: Setup Node ${{ matrix.node }}
21-
uses: actions/setup-node@v4
31+
uses: actions/setup-node@v6
2232
with:
2333
node-version: ${{ matrix.node }}
34+
registry-url: https://registry.npmjs.org
2435

2536
- name: Install dependencies
26-
run: npm ci
37+
run: pnpm install --frozen-lockfile
2738

2839
- name: Run Format
2940
if: matrix.node == 22
30-
run: npm run format
41+
run: pnpm run format
3142

3243
- name: Lint source files
3344
if: matrix.node == 22
34-
run: npm run lint
45+
run: pnpm run lint
3546

3647
- name: Check types
3748
if: matrix.node == 22
38-
run: npm run typecheck
49+
run: pnpm run typecheck
3950

4051
- name: Build package
41-
run: npm run build
52+
run: pnpm run build
4253

4354
- name: Run tests with coverage
44-
run: npm run test:coverage
55+
run: pnpm run test:coverage
4556

4657
- name: 'Report Coverage'
4758
if: matrix.node == 22 && always()

.github/workflows/release.yml

Lines changed: 100 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,116 @@
1-
name: Release CI
1+
name: Release
22

33
on:
44
push:
55
branches:
66
- main
77

8-
permissions:
9-
contents: write
10-
pull-requests: write
8+
env:
9+
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN_PUBLIC }}
10+
FORCE_COLOR: '3'
1111

1212
jobs:
13-
ci:
14-
name: CI Init
15-
runs-on: [self-hosted, Linux]
16-
outputs:
17-
action: ${{ steps.init.outputs.action }}
13+
release:
14+
name: Create Release PR
15+
runs-on: ubuntu-latest
16+
if: "!contains(github.event.head_commit.message, '🚀 release:')"
17+
timeout-minutes: 10
1818
steps:
19-
- id: init
20-
uses: localazy/release/init@v2
21-
22-
prepare:
23-
name: Prepare Release PR
24-
needs: ci
25-
if: needs.ci.outputs.action == 'prepare'
26-
runs-on: [self-hosted, Linux]
27-
steps:
28-
- uses: localazy/release/prepare@v2
19+
- name: Checkout repository
20+
uses: actions/checkout@v6
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Generate token
25+
id: auth
26+
uses: actions/create-github-app-token@v3
2927
with:
30-
node-version-file: .nvmrc
3128
app-id: ${{ secrets.AUTH_APP_ID }}
32-
app-key: ${{ secrets.AUTH_APP_KEY }}
33-
badges: true
34-
badges-size: dist/browser/localazy-api-client.umd.min.js
29+
private-key: ${{ secrets.AUTH_APP_KEY }}
30+
31+
- name: Clean pnpm setup cache
32+
run: rm -rf ~/setup-pnpm
33+
34+
- name: Setup pnpm
35+
uses: pnpm/action-setup@v5
36+
37+
- name: Setup Node
38+
uses: actions/setup-node@v6
39+
with:
40+
node-version-file: .nvmrc
41+
registry-url: https://registry.npmjs.org
42+
43+
- name: Install dependencies
44+
run: pnpm install --frozen-lockfile
45+
46+
- name: Run release script
47+
run: pnpx @localazy/workflow-scripts create-release-pr .
48+
env:
49+
GITHUB_TOKEN: ${{ steps.auth.outputs.token }}
3550

3651
publish:
37-
name: Publish Release
38-
needs: ci
39-
if: needs.ci.outputs.action == 'publish'
40-
runs-on: [self-hosted, Linux]
52+
name: Publish to npm
53+
runs-on: ubuntu-latest
54+
if: "contains(github.event.head_commit.message, '🚀 release:')"
55+
timeout-minutes: 10
56+
permissions:
57+
contents: write
4158
steps:
42-
- uses: localazy/release/publish@v2
59+
- name: Generate token
60+
id: auth
61+
uses: actions/create-github-app-token@v3
4362
with:
44-
node-version-file: .nvmrc
4563
app-id: ${{ secrets.AUTH_APP_ID }}
46-
app-key: ${{ secrets.AUTH_APP_KEY }}
47-
npm-publish: public
48-
npm-token: ${{ secrets.NPM_AUTH_TOKEN_PUBLIC }}
64+
private-key: ${{ secrets.AUTH_APP_KEY }}
65+
66+
- name: Checkout repository
67+
uses: actions/checkout@v6
68+
with:
69+
fetch-depth: 0
70+
71+
- name: Clean pnpm setup cache
72+
run: rm -rf ~/setup-pnpm
73+
74+
- name: Setup pnpm
75+
uses: pnpm/action-setup@v5
76+
77+
- name: Setup Node
78+
uses: actions/setup-node@v6
79+
with:
80+
node-version-file: .nvmrc
81+
registry-url: https://registry.npmjs.org
82+
83+
- name: Install dependencies
84+
run: pnpm install --frozen-lockfile
85+
86+
- name: Build
87+
run: pnpm run build
88+
89+
- name: Determine npm tag
90+
id: npm-tag
91+
run: |
92+
VERSION=$(node -p "require('./package.json').version")
93+
if echo "$VERSION" | grep -q '-'; then
94+
echo "tag=${VERSION#*-}" | sed 's/\..*//' >> "$GITHUB_OUTPUT"
95+
else
96+
echo "tag=latest" >> "$GITHUB_OUTPUT"
97+
fi
98+
99+
- name: Publish to npm
100+
run: pnpm publish --no-git-checks --tag ${{ steps.npm-tag.outputs.tag }} --access public
101+
102+
- name: Create and push git tag
103+
id: git-tag
104+
run: |
105+
NAME=$(node -p "require('./package.json').name")
106+
VERSION=$(node -p "require('./package.json').version")
107+
TAG="${NAME}@${VERSION}"
108+
git tag "${TAG}"
109+
git push origin "${TAG}"
110+
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
111+
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
112+
113+
- name: Create GitHub Release
114+
run: pnpx @localazy/workflow-scripts create-github-release "${{ steps.git-tag.outputs.version }}"
115+
env:
116+
GITHUB_TOKEN: ${{ steps.auth.outputs.token }}

.husky/pre-push

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
npm run check
1+
pnpm run check

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
22
1+
24

.oxlintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"unicorn/numeric-separators-style": "off",
5656
"unicorn/prefer-module": "off",
5757
"unicorn/catch-error-name": "off",
58+
"typescript/no-unnecessary-type-arguments": "off",
5859
// custom config
5960
// "eslint/func-style": ["error", "declaration"],
6061
"typescript/return-await": ["error", "error-handling-correctness-only"],

0 commit comments

Comments
 (0)