Skip to content

Commit de4e597

Browse files
authored
ci: add github actions (#166)
* build: tune build config * chore: tune size testing and add github actions * chore: remove umd bundlr
1 parent 6c6f7ec commit de4e597

File tree

7 files changed

+80
-58
lines changed

7 files changed

+80
-58
lines changed

.github/workflows/checks.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Checks
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
jobs:
7+
size:
8+
runs-on: ubuntu-latest
9+
name: Checking size
10+
if: "!contains(github.event.head_commit.message, '[ci skip]')"
11+
env:
12+
CI_JOB_NUMBER: 1
13+
steps:
14+
- name: Checkout the repository
15+
uses: actions/checkout@v3
16+
- name: Install pnpm
17+
uses: pnpm/action-setup@v2.2.1
18+
with:
19+
version: 6
20+
- name: Install Node.js
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: 16
24+
cache: 'pnpm'
25+
- name: Check size
26+
uses: andresz1/size-limit-action@master
27+
with:
28+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: CI
2+
on:
3+
push:
4+
pull_request:
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
name: Running tests
9+
if: "!contains(github.event.head_commit.message, '[ci skip]')"
10+
steps:
11+
- name: Checkout the repository
12+
uses: actions/checkout@v3
13+
- name: Install pnpm
14+
uses: pnpm/action-setup@v2.2.1
15+
with:
16+
version: 6
17+
- name: Install Node.js
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: 12
21+
cache: 'pnpm'
22+
- name: Install dependencies
23+
run: pnpm install
24+
- name: Run tests
25+
run: pnpm test

.github/workflows/commit.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Commit
2+
on:
3+
push:
4+
jobs:
5+
conventional-commit:
6+
runs-on: ubuntu-latest
7+
name: Checking commit name
8+
steps:
9+
- name: Checkout the repository
10+
uses: actions/checkout@v3
11+
with:
12+
fetch-depth: 0
13+
- name: Run commitlint
14+
uses: wagoid/commitlint-github-action@v4

.size-limit.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
[
22
{
33
"path": "dist/index.cjs",
4-
"limit": "2.24 KB",
4+
"limit": "2.3 KB",
55
"webpack": false,
66
"running": false
77
},
88
{
99
"path": "dist/index.cjs",
10-
"limit": "2.06 KB",
10+
"limit": "2.1 KB",
1111
"import": "{ GChart }"
1212
},
13-
{
14-
"path": "dist/umd.js",
15-
"limit": "3.28 KB",
16-
"webpack": false,
17-
"running": false
18-
},
1913
{
2014
"path": "dist/index.js",
21-
"limit": "1.93 KB",
15+
"limit": "1.95 KB",
2216
"import": "{ GChart }"
2317
}
2418
]

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
"publishConfig": {
2020
"main": "./dist/index.cjs",
2121
"module": "./dist/index.js",
22-
"unpkg": "./dist/umd.js",
2322
"directory": "package"
2423
},
2524
"scripts": {
2625
"prepublishOnly": "pnpm build && del ./package && clean-publish",
2726
"postpublish": "del ./package",
2827
"build": "rollup -c",
29-
"lint": "eslint --ext .js,.vue src rollup.config.js --fix",
28+
"lint": "eslint --ext .js,.vue src",
29+
"test": "pnpm lint",
3030
"format": "prettier --write src rollup.config.js",
3131
"test:size": "size-limit",
3232
"commit": "cz",
@@ -52,10 +52,9 @@
5252
"@commitlint/cli": "^16.0.0",
5353
"@commitlint/config-conventional": "^16.0.0",
5454
"@commitlint/cz-commitlint": "^16.0.0",
55-
"@rollup/plugin-commonjs": "^21.0.1",
5655
"@rollup/plugin-node-resolve": "^13.1.1",
5756
"@rollup/plugin-replace": "^3.0.1",
58-
"@size-limit/preset-big-lib": "^7.0.5",
57+
"@size-limit/preset-big-lib": "^7.0.8",
5958
"@swc/core": "^1.2.124",
6059
"@swc/helpers": "^0.3.2",
6160
"@vue/compiler-sfc": "^3.2.26",
@@ -74,7 +73,7 @@
7473
"rollup-plugin-vue": "^5.0.0",
7574
"simple-git-hooks": "^2.7.0",
7675
"simple-github-release": "^1.0.0",
77-
"size-limit": "^7.0.5",
76+
"size-limit": "^7.0.8",
7877
"standard-version": "^9.3.2",
7978
"vue-template-compiler": "^2.1.6"
8079
},

pnpm-lock.yaml

Lines changed: 2 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rollup.config.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import vue from 'rollup-plugin-vue';
22
import swc from 'rollup-plugin-swc';
33
import replace from '@rollup/plugin-replace';
4-
import commonjs from '@rollup/plugin-commonjs';
54
import { nodeResolve } from '@rollup/plugin-node-resolve';
65
import pkg from './package.json';
76

@@ -35,8 +34,9 @@ export default [
3534
plugins: plugins('defaults and supports es6-module'),
3635
external,
3736
output: {
38-
format: 'esm',
37+
format: 'es',
3938
file: pkg.publishConfig.module,
39+
sourcemap: true,
4040
},
4141
},
4242
{
@@ -50,14 +50,8 @@ export default [
5050
output: {
5151
format: 'cjs',
5252
file: pkg.publishConfig.main,
53-
},
54-
},
55-
{
56-
input: pkg.main,
57-
plugins: [...plugins('defaults, not ie 11, not ie_mob 11'), commonjs()],
58-
output: {
59-
format: 'umd',
60-
file: pkg.publishConfig.unpkg,
53+
exports: 'named',
54+
sourcemap: true,
6155
},
6256
},
6357
];

0 commit comments

Comments
 (0)