Skip to content

Commit 756615b

Browse files
Adjust CI
1 parent c80932d commit 756615b

5 files changed

Lines changed: 49 additions & 31 deletions

File tree

.github/workflows/ci.yml

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,51 @@
1-
name: Test
1+
name: CI
22

33
on: [push]
44

55
jobs:
6-
tsc:
6+
lint:
77
runs-on: ubuntu-latest
8-
name: TypeScript
8+
name: ESLint & Prettier
99
steps:
1010
- uses: actions/checkout@v6
1111

1212
- uses: ./.github/actions/setup-node
1313

14-
- name: 🧪 tsc
15-
run: yarn types
14+
- run: yarn lint
1615

17-
test:
16+
build:
1817
runs-on: ubuntu-latest
19-
name: Lint & test with Node
18+
name: Build & Validate
2019
steps:
2120
- uses: actions/checkout@v6
2221

2322
- uses: ./.github/actions/setup-node
2423

25-
- name: Build SDK
26-
run: yarn build
24+
- run: yarn build
25+
26+
- name: Validate CJS bundle with Node ${{ env.NODE_VERSION }}
27+
run: yarn validate-cjs
2728

28-
- name: 🧪 Lint and test with Node ${{ env.NODE_VERSION }}
29-
run: |
30-
yarn lint
31-
yarn coverage
32-
yarn validate-translations
29+
- name: Validate translations
30+
run: yarn validate-translations
31+
32+
test:
33+
runs-on: ubuntu-latest
34+
name: Test
35+
steps:
36+
- uses: actions/checkout@v6
37+
38+
- uses: ./.github/actions/setup-node
39+
40+
- name: Test with Node ${{ env.NODE_VERSION }}
41+
run: yarn coverage
3342

3443
- name: Upload coverage to Codecov
3544
uses: codecov/codecov-action@v5
3645
with:
46+
verbose: true
3747
token: ${{ secrets.CODECOV_TOKEN }}
3848

39-
- name: 🧪 Validate CommonJS bundle with Node ${{ env.NODE_VERSION }}
40-
run: yarn validate-cjs
41-
4249
deploy-vite-example:
4350
runs-on: ubuntu-latest
4451
name: Deploy Vite Example to Vercel

.github/workflows/pr-check.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
name: Check PR title
1+
name: PR Check
22

33
on:
44
pull_request:
55
types: [opened, edited, synchronize, reopened]
66

77
jobs:
88
pr-title:
9+
name: Validate PR Title
910
runs-on: ubuntu-latest
1011
steps:
1112
- uses: actions/checkout@v6
1213

1314
- uses: ./.github/actions/setup-node
1415

15-
- name: commitlint
16-
run: echo "${{ github.event.pull_request.title }}" | npx commitlint --verbose
16+
- run: echo "${{ github.event.pull_request.title }}" | npx commitlint --verbose

.github/workflows/size.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Compressed Size
1+
name: Size
22

33
on:
44
pull_request:
@@ -11,14 +11,16 @@ env:
1111
NODE_OPTIONS: --max_old_space_size=4096
1212

1313
jobs:
14-
build:
14+
compressed-size:
15+
name: Compressed Size
1516
runs-on: ubuntu-latest
1617
steps:
1718
- uses: actions/checkout@v6
1819
- uses: preactjs/compressed-size-action@v2
1920
env:
2021
NODE_OPTIONS: --max_old_space_size=4096
21-
YARN_IGNORE_ENGINES: 'true' # Skip validation for node20 requirement
22+
YARN_IGNORE_ENGINES: 'true' # skip validation for node20 requirement
2223
with:
2324
repo-token: '${{ secrets.GITHUB_TOKEN }}'
24-
pattern: './dist/**/*.{js,cjs,css,json}'
25+
pattern: './dist/**/*.{?(c|m)js,css,json}'
26+
strip-hash: "\\b\\w{8}\\."

vite.config.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { resolve } from 'path';
2-
import { defineConfig } from 'vite';
3-
import { name, dependencies, peerDependencies } from './package.json';
2+
import { defineConfig, type LibraryFormats } from 'vite';
3+
import { dependencies, peerDependencies } from './package.json';
44
import { compilerOptions } from './tsconfig.lib.json';
55
import getPackageVersion from './scripts/get-package-version.mjs';
66

@@ -11,6 +11,8 @@ const external = [
1111
// e.g. @stream-io/abc and @stream-io/abc/xyz (without this, Vite bundles subpaths)
1212
].map((dependency) => new RegExp(`^${dependency}(\\/[\\w-]+)?$`));
1313

14+
const formats: LibraryFormats[] = ['es', 'cjs'];
15+
1416
export default defineConfig({
1517
build: {
1618
lib: {
@@ -19,10 +21,6 @@ export default defineConfig({
1921
emojis: resolve(__dirname, './src/plugins/Emojis/index.ts'),
2022
'mp3-encoder': resolve(__dirname, './src/plugins/encoders/mp3.ts'),
2123
},
22-
fileName(format, entryName) {
23-
return `${format}/${entryName}.${format === 'cjs' ? 'js' : 'mjs'}`;
24-
},
25-
name,
2624
},
2725
emptyOutDir: false,
2826
outDir: 'dist',
@@ -31,6 +29,16 @@ export default defineConfig({
3129
target: compilerOptions.target,
3230
rollupOptions: {
3331
external,
32+
output: formats.map((format) => {
33+
const extension = format === 'es' ? 'mjs' : 'js';
34+
35+
return {
36+
format,
37+
chunkFileNames: `[format]/[name].[hash].${extension}`,
38+
entryFileNames: `[format]/[name].${extension}`,
39+
hashCharacters: 'hex',
40+
};
41+
}),
3442
},
3543
},
3644
define: {

vitest.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ export default defineConfig({
2020
pool: 'forks',
2121
watch: false,
2222
testTimeout: 15000,
23+
fileParallelism: true,
2324
css: false,
2425
coverage: {
2526
provider: 'v8',
26-
reporter: ['text', 'json', 'lcov'],
27+
reporter: ['json', 'text-summary'],
2728
include: ['src/**/*.{ts,tsx,js,jsx}'],
2829
exclude: [
2930
'src/**/__tests__/**',

0 commit comments

Comments
 (0)