Skip to content

Commit 781ede5

Browse files
authored
Merge pull request #121 from prabhuignoto/chore/modernize-build-vite-lib-eslint-ci
Summary Modernizes build to a single Vite lib pipeline (ESM/CJS/UMD), fully minified. Cleans legacy Rollup/Babel config, updates exports/peers/engines. Adds CI and release automation via Changesets. Changes Build: Vite lib mode with src/index.ts as entry; single CSS file. Minification: Rollup Terser for ESM/CJS/UMD with aggressive treeshaking and inlineDynamicImports. Types: vue-tsc emits .d.ts into dist/. Packaging: Updated exports map, sideEffects, unpkg/jsdelivr, Node engines. Linting: ESLint flat config with Vue SFC support (scoped to src/components). CI/Release: GitHub Actions for lint+build; Changesets workflow for versioning/publish. Removed: rollup.config.js and legacy Rollup/Babel deps.
2 parents aa39249 + 5ced98d commit 781ede5

File tree

18 files changed

+1790
-2986
lines changed

18 files changed

+1790
-2986
lines changed

.changeset/config.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json",
3+
"changelog": false,
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "master",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}
12+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: 'Setup Node and pnpm'
2+
description: 'Sets up Node.js with pnpm and enables pnpm cache via setup-node.'
3+
inputs:
4+
node-version:
5+
description: 'Node.js version'
6+
required: false
7+
default: '22'
8+
pnpm-version:
9+
description: 'pnpm version'
10+
required: false
11+
default: '9.0.0'
12+
registry-url:
13+
description: 'Node registry URL'
14+
required: false
15+
default: ''
16+
runs:
17+
using: 'composite'
18+
steps:
19+
- name: Install pnpm
20+
uses: pnpm/action-setup@v4
21+
with:
22+
version: ${{ inputs.pnpm-version }}
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: ${{ inputs.node-version }}
28+
cache: pnpm
29+
registry-url: ${{ inputs.registry-url }}
30+

.github/dependabot.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
11
version: 2
2+
updates:
3+
- package-ecosystem: 'npm'
4+
directory: '/'
5+
schedule:
6+
interval: 'weekly'
7+
open-pull-requests-limit: 10
8+
commit-message:
9+
prefix: 'deps'
10+
include: 'scope'
11+
- package-ecosystem: 'github-actions'
12+
directory: '/'
13+
schedule:
14+
interval: 'weekly'
15+
open-pull-requests-limit: 10
16+
commit-message:
17+
prefix: 'ci'
18+
include: 'scope'
19+
version: 2
220
updates:
321
- package-ecosystem: 'npm'
422
directory: '/'

.github/workflows/build-lint.yml

Lines changed: 14 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,39 @@
1-
name: CI
1+
name: Build & Lint
22

33
on:
44
push:
5-
branches: [master]
5+
branches: [master, main]
66
pull_request:
7-
branches: [master]
7+
branches: [master, main]
88

99
env:
10-
NODE_VERSION: '20'
11-
PNPM_VERSION: '9'
10+
NODE_VERSION: '22'
1211

1312
jobs:
14-
setup:
15-
runs-on: ubuntu-latest
16-
timeout-minutes: 10
17-
outputs:
18-
pnpm-cache-dir: ${{ steps.pnpm-cache.outputs.pnpm-cache-dir }}
19-
node-modules-cache-hit: ${{ steps.node-modules-cache.outputs.cache-hit }}
20-
steps:
21-
- name: Checkout
22-
uses: actions/checkout@v4
23-
24-
- name: Install Node.js
25-
uses: actions/setup-node@v4
26-
with:
27-
node-version: ${{ env.NODE_VERSION }}
28-
29-
- name: Install pnpm
30-
uses: pnpm/action-setup@v4
31-
with:
32-
version: ${{ env.PNPM_VERSION }}
33-
34-
- name: Get pnpm store directory
35-
id: pnpm-cache
36-
shell: bash
37-
run: |
38-
echo "pnpm-cache-dir=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
39-
40-
- name: Setup pnpm cache
41-
uses: actions/cache@v4
42-
with:
43-
path: ${{ steps.pnpm-cache.outputs.pnpm-cache-dir }}
44-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
45-
restore-keys: |
46-
${{ runner.os }}-pnpm-store-
47-
48-
- name: Cache node_modules
49-
id: node-modules-cache
50-
uses: actions/cache@v4
51-
with:
52-
path: node_modules
53-
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
54-
55-
- name: Install dependencies
56-
if: steps.node-modules-cache.outputs.cache-hit != 'true'
57-
run: pnpm install --frozen-lockfile
58-
5913
lint:
6014
runs-on: ubuntu-latest
6115
timeout-minutes: 10
62-
needs: setup
6316
strategy:
6417
matrix:
6518
lint-type: [js, css, types]
6619
steps:
6720
- name: Checkout
6821
uses: actions/checkout@v4
69-
70-
- name: Install Node.js
71-
uses: actions/setup-node@v4
22+
- name: Setup Node and pnpm
23+
uses: ./.github/actions/setup-node-pnpm
7224
with:
7325
node-version: ${{ env.NODE_VERSION }}
74-
75-
- name: Install pnpm
76-
uses: pnpm/action-setup@v4
77-
with:
78-
version: ${{ env.PNPM_VERSION }}
79-
80-
- name: Setup pnpm cache
81-
uses: actions/cache@v4
82-
with:
83-
path: ${{ needs.setup.outputs.pnpm-cache-dir }}
84-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
85-
restore-keys: |
86-
${{ runner.os }}-pnpm-store-
26+
pnpm-version: 9.0.0
8727

8828
- name: Cache node_modules
29+
id: node-modules-cache
8930
uses: actions/cache@v4
9031
with:
9132
path: node_modules
9233
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
9334

9435
- name: Install dependencies
95-
if: needs.setup.outputs.node-modules-cache-hit != 'true'
36+
if: steps.node-modules-cache.outputs.cache-hit != 'true'
9637
run: pnpm install --frozen-lockfile
9738

9839
- name: Run JS/TS lint
@@ -110,37 +51,24 @@ jobs:
11051
build:
11152
runs-on: ubuntu-latest
11253
timeout-minutes: 15
113-
needs: setup
11454
steps:
11555
- name: Checkout
11656
uses: actions/checkout@v4
117-
118-
- name: Install Node.js
119-
uses: actions/setup-node@v4
57+
- name: Setup Node and pnpm
58+
uses: ./.github/actions/setup-node-pnpm
12059
with:
12160
node-version: ${{ env.NODE_VERSION }}
122-
123-
- name: Install pnpm
124-
uses: pnpm/action-setup@v4
125-
with:
126-
version: ${{ env.PNPM_VERSION }}
127-
128-
- name: Setup pnpm cache
129-
uses: actions/cache@v4
130-
with:
131-
path: ${{ needs.setup.outputs.pnpm-cache-dir }}
132-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
133-
restore-keys: |
134-
${{ runner.os }}-pnpm-store-
61+
pnpm-version: 9.0.0
13562

13663
- name: Cache node_modules
64+
id: node-modules-cache
13765
uses: actions/cache@v4
13866
with:
13967
path: node_modules
14068
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
14169

14270
- name: Install dependencies
143-
if: needs.setup.outputs.node-modules-cache-hit != 'true'
71+
if: steps.node-modules-cache.outputs.cache-hit != 'true'
14472
run: pnpm install --frozen-lockfile
14573

14674
- name: Run build

.github/workflows/ci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
branches: [master, main]
5+
paths-ignore:
6+
- 'README.md'
7+
- 'readme-assets/**'
8+
- '.github/ISSUE_TEMPLATE/**'
9+
- '.github/PULL_REQUEST_TEMPLATE.md'
10+
push:
11+
branches: [master, main]
12+
paths-ignore:
13+
- 'README.md'
14+
- 'readme-assets/**'
15+
workflow_dispatch: {}
16+
17+
permissions:
18+
contents: read
19+
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.ref }}
22+
cancel-in-progress: true
23+
24+
jobs:
25+
build-and-check:
26+
runs-on: ubuntu-latest
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
node-version: [22]
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
35+
- name: Setup Node and pnpm
36+
uses: ./.github/actions/setup-node-pnpm
37+
with:
38+
node-version: ${{ matrix.node-version }}
39+
pnpm-version: 9.0.0
40+
41+
- name: Install dependencies
42+
run: pnpm install --frozen-lockfile
43+
44+
- name: Lint (JS only)
45+
run: pnpm lint:js
46+
47+
- name: Type check
48+
run: pnpm type-check
49+
50+
- name: Build library
51+
run: pnpm build
52+

.github/workflows/cross-platform.yml

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@ name: Cross-Platform Build
22

33
on:
44
push:
5-
branches: [master]
5+
branches: [master, main]
66
pull_request:
7-
branches: [master]
7+
branches: [master, main]
88
schedule:
99
- cron: '0 6 * * 1' # Weekly on Monday at 6 AM
1010

11-
env:
12-
PNPM_VERSION: '9'
1311

1412
jobs:
1513
build-matrix:
@@ -18,38 +16,22 @@ jobs:
1816
strategy:
1917
fail-fast: false
2018
matrix:
21-
os: [ubuntu-latest, windows-latest, macos-latest]
22-
node-version: ['18', '20', '22']
23-
exclude:
24-
# Reduce matrix for PRs
25-
- os: windows-latest
26-
node-version: '18'
27-
- os: macos-latest
28-
node-version: '18'
19+
os: [ubuntu-latest]
20+
node-version: ['22']
2921
steps:
3022
- name: Checkout
3123
uses: actions/checkout@v4
3224

33-
- name: Install Node.js ${{ matrix.node-version }}
34-
uses: actions/setup-node@v4
25+
- name: Setup Node and pnpm
26+
uses: ./.github/actions/setup-node-pnpm
3527
with:
3628
node-version: ${{ matrix.node-version }}
37-
38-
- name: Install pnpm
39-
uses: pnpm/action-setup@v4
40-
with:
41-
version: ${{ env.PNPM_VERSION }}
42-
43-
- name: Get pnpm store directory
44-
id: pnpm-cache
45-
shell: bash
46-
run: |
47-
echo "pnpm-cache-dir=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
29+
pnpm-version: 9.0.0
4830

4931
- name: Setup pnpm cache
5032
uses: actions/cache@v4
5133
with:
52-
path: ${{ steps.pnpm-cache.outputs.pnpm-cache-dir }}
34+
path: ~/.pnpm-store
5335
key: ${{ runner.os }}-pnpm-store-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
5436
restore-keys: |
5537
${{ runner.os }}-pnpm-store-${{ matrix.node-version }}-
@@ -65,7 +47,7 @@ jobs:
6547
run: pnpm lint
6648

6749
- name: Build library
68-
run: pnpm build:lib
50+
run: pnpm build
6951

7052
- name: Build demo
7153
run: pnpm build

0 commit comments

Comments
 (0)