Skip to content

Commit 028eeb2

Browse files
committed
factor code in packages/utils
1 parent 556fd03 commit 028eeb2

32 files changed

+793
-18
lines changed

.github/workflows/ci_apps_cli.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ jobs:
2626
steps:
2727
- uses: actions/checkout@v4
2828
- run: npm i
29+
- run: npm run build
30+
working-directory: ./packages/utils
2931
- run: npm run build
3032
working-directory: ./packages/components
3133
- run: tsc
@@ -46,6 +48,8 @@ jobs:
4648
steps:
4749
- uses: actions/checkout@v4
4850
- run: npm i
51+
- run: npm run build
52+
working-directory: ./packages/utils
4953
- run: npm run build
5054
working-directory: ./packages/components
5155
- run: npm run build

.github/workflows/ci_apps_hyparquet_demo.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,15 @@ jobs:
2222
steps:
2323
- uses: actions/checkout@v4
2424
- run: npm i
25+
- run: npm run build
26+
working-directory: ./packages/utils
2527
- run: tsc
2628

2729
buildcheck:
2830
runs-on: ubuntu-latest
2931
steps:
3032
- uses: actions/checkout@v4
3133
- run: npm i
34+
- run: npm run build
35+
working-directory: ./packages/utils
3236
- run: npm run build

.github/workflows/ci_packages_components.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ jobs:
2222
steps:
2323
- uses: actions/checkout@v4
2424
- run: npm i
25+
- run: npm run build
26+
working-directory: ./packages/utils
2527
- run: tsc
2628

2729
test:
@@ -37,3 +39,5 @@ jobs:
3739
- uses: actions/checkout@v4
3840
- run: npm i
3941
- run: npm run build
42+
working-directory: ./packages/utils
43+
- run: npm run build
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: packages/utils
2+
on:
3+
push:
4+
paths:
5+
- 'packages/utils/**'
6+
- '.github/workflows/ci_packages_utils.yml'
7+
8+
defaults:
9+
run:
10+
working-directory: ./packages/utils
11+
12+
jobs:
13+
lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- run: npm i
18+
- run: npm run lint
19+
20+
typecheck:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
- run: npm i
25+
- run: tsc
26+
27+
test:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v4
31+
- run: npm i
32+
- run: npm run coverage
33+
34+
buildcheck:
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
- run: npm i
39+
- run: npm run build

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ This is a monorepo for the Hyperparam project.
44

55
It contains the following package:
66
- [`@hyparam/components`](./packages/components): a library of React components for building Hyperparam UIs.
7+
- [`@hyparam/utils`](./packages/utils): a library of utils.
78

89
It also contains the following applications:
910
- [`hyperparam`](./apps/cli): a cli tool for viewing arbitrarily large datasets in the browser.

apps/hyparquet-demo/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"preview": "vite preview"
1111
},
1212
"dependencies": {
13+
"@hyparam/utils": "file:../../packages/utils",
1314
"hyparquet": "1.5.0",
1415
"hyparquet-compressors": "0.1.4",
1516
"hightable": "0.7.0",

apps/hyparquet-demo/src/Dropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { cn } from '@hyparam/utils'
12
import { ReactNode, useEffect, useRef, useState } from 'react'
2-
import { cn } from './utils.js'
33

44
interface DropdownProps {
55
label?: string

apps/hyparquet-demo/src/Layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { cn } from '@hyparam/utils'
12
import { ReactNode, useEffect } from 'react'
2-
import { cn } from './utils.js'
33

44
interface LayoutProps {
55
children: ReactNode

apps/hyparquet-demo/src/utils.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
11
import { AsyncBuffer, asyncBufferFromUrl, cachedAsyncBuffer } from 'hyparquet'
22
import { AsyncBufferFrom } from './workers/types'
33

4-
/**
5-
* Helper function to join class names.
6-
* Filters out falsy values and joins the rest.
7-
*
8-
* @param {...string | undefined | false} names - class name(s) to join
9-
* @returns {string}
10-
*/
11-
export function cn(...names: (string | undefined | false)[]): string {
12-
return names.filter(n => n).join(' ')
13-
}
14-
154
/**
165
* Convert AsyncBufferFromUrl to AsyncBuffer.
176
*/

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"apps/cli",
99
"apps/hightable-demo",
1010
"apps/hyparquet-demo",
11-
"packages/components"
11+
"packages/components",
12+
"packages/utils"
1213
]
1314
}

0 commit comments

Comments
 (0)