Skip to content

Commit 6a31a27

Browse files
authored
merge components with hyperparam (#166)
* move components to the new root * simplify vite config * fix ci * fix lint config * remove dead code * move cli to bin/ * fix lint for bin/ * fix favicon route * ditribute bin * fix test * fix css * rework npm scripts + export lib + remove obsolete component * distribute CSS files + allow importing from 'hyperparam' * bundle the library with vite, because the worker requires being bundled * fix the creation of types * just in case
1 parent e420204 commit 6a31a27

File tree

100 files changed

+259
-1139
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+259
-1139
lines changed

.gitattributes

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/workflows/check_dependencies.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,34 @@
1-
name: Launch CI jobs for a package or app
1+
name: CI
22
on:
3-
workflow_call:
4-
inputs:
5-
workspace:
6-
required: true
7-
type: string
3+
push:
4+
branches: ["master"]
5+
pull_request:
86
jobs:
97
lint:
108
runs-on: ubuntu-latest
119
steps:
1210
- uses: actions/checkout@v4
1311
- run: npm i
14-
- run: npm run lint -w ${{ inputs.workspace }}
12+
- run: npm run lint
1513

1614
typecheck:
1715
runs-on: ubuntu-latest
1816
steps:
1917
- uses: actions/checkout@v4
2018
- run: npm i
21-
- run: npm run typecheck -w ${{ inputs.workspace }}
19+
- run: npm run typecheck
2220

2321
test:
2422
runs-on: ubuntu-latest
2523
steps:
2624
- uses: actions/checkout@v4
2725
- run: npm i
28-
- run: npm run coverage -w ${{ inputs.workspace }}
26+
- run: npm run coverage
2927

3028
buildcheck:
3129
runs-on: ubuntu-latest
3230
steps:
3331
- uses: actions/checkout@v4
3432
- run: npm i
35-
- run: npm run build -w ${{ inputs.workspace }}
33+
- run: npm run build
3634

.github/workflows/ci_packages_cli.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/ci_packages_components.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/workflows/ci_root.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.gitignore

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,34 @@
1-
package-lock.json
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
210
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
coverage
15+
16+
# Editor directories and files
17+
.vscode/*
18+
!.vscode/extensions.json
19+
.idea
20+
.DS_Store
21+
*.suo
22+
*.ntvs*
23+
*.njsproj
24+
*.sln
25+
*.sw?
26+
27+
package-lock.json
328
*.tgz
429
.vscode
530
*.parquet
6-
coverage
7-
.DS_Store
31+
/coverage/
32+
33+
/lib/
34+
tsconfig.tsbuildinfo

README.md

Lines changed: 45 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,75 @@
1-
# Hyperparam monorepo
1+
# hyperparam
22

3-
This is a monorepo for the Hyperparam project.
3+
[![npm](https://img.shields.io/npm/v/hyperparam)](https://www.npmjs.com/package/hyperparam)
4+
[![workflow status](https://github.com/hyparam/hyperparam-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/hyparam/hyperparam-cli/actions)
5+
[![mit license](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
6+
![coverage](https://img.shields.io/badge/Coverage-35-darkred)
47

5-
It contains the following packages, published to npm:
8+
This is the hyperparam cli tool.
69

7-
- [`@hyparam/components`](./packages/components): a library of React components and utilities for building Hyperparam UIs.
8-
- [`hyperparam`](./packages/cli): a cli tool for viewing arbitrarily large datasets in the browser.
10+
The hyperparam cli tool is for viewing arbitrarily large datasets in the browser.
911

10-
## Use
12+
## Viewer
1113

12-
Install all the workspaces with:
14+
To open a file browser in your current local directory run:
1315

14-
```bash
15-
npm install
16+
```sh
17+
npx hyperparam
1618
```
1719

18-
Lint all the workspaces:
20+
You can also pass a specific file, folder, or url:
1921

20-
```bash
21-
npm run lint -ws
22+
```sh
23+
npx hyperparam example.parquet
24+
npx hyperparam directory/
25+
npx hyperparam https://hyperparam-public.s3.amazonaws.com/bunnies.parquet
2226
```
2327

24-
Test all the workspaces:
28+
## Chat
2529

26-
```bash
27-
npm test -ws
30+
To start a chat with hyperparam:
31+
32+
```sh
33+
npx hyperparam chat
2834
```
2935

30-
Compute the coverage for all the workspaces:
36+
## Installation
37+
38+
Install for all users:
3139

32-
```bash
33-
npm run coverage -ws
40+
```sh
41+
sudo npm i -g hyperparam
3442
```
3543

36-
Build all the workspaces (they are built in order, so the dependencies are built first - it's defined manually by the order of the workspaces in the `package.json`):
44+
Now you can just run:
3745

38-
```bash
39-
npm run build -ws
46+
```sh
47+
hyperparam
4048
```
4149

42-
- `hyperparam`:
50+
or:
4351

44-
```bash
45-
npm run dev -w hyperparam
52+
```sh
53+
hyp
4654
```
4755

48-
- `components`:
56+
## Developers
4957

50-
```bash
51-
npm run dev -w @hyparam/components
52-
```
58+
To develop the CLI locally:
5359

54-
## Development
60+
```sh
61+
npm i
62+
npm run dev
63+
```
5564

56-
The monorepo is managed with [npm workspaces](https://docs.npmjs.com/cli/v10/using-npm/workspaces). Some workspaces are dependencies of others. Currently:
65+
The application will be rebuild automatically when you make changes, and the browser will refresh.
5766

58-
- `@hyparam/components` is a dependency of `hyperparam`.
67+
### Library and application
5968

60-
It means that if you make a change to `@hyparam/components`, you need to rebuild it before developing `hyperparam`.
69+
Hyperparam is an application that relies on node.js scripts in the `bin/` directory and serves the static web application built in the `dist/` directory.
6170

62-
Also, if you increment the version of `@hyparam/components`, you need to update the version of `@hyparam/components` in the `package.json` of `hyperparam`, as we use exact versions in the `package.json` of the workspaces. Note that we don't have to increment the version after every change, only when we want to publish a new version with a significant batch of changes.
71+
The `hyperparam` package also includes a library that can be used in other applications. The library is in the `lib/` directory. For example:
6372

64-
The root package.json contains a special field, `overrides`, which sets the shared dependencies versions we want to have in all the workspaces. The "check_dependencies" GitHub action checks that the dependencies are the same in all the workspaces (`npm ls` would fail if dependency version mismatch).
73+
```js
74+
import { asyncBufferFrom, AsyncBufferFrom, parquetDataFrame } from "hyperparam";
75+
```
File renamed without changes.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ if (arg === 'chat') {
4949
*/
5050
function checkForUpdates() {
5151
const currentVersion = packageJson.version
52-
return fetch('https://registry.npmjs.org/hyperparam/latest')
52+
return void fetch('https://registry.npmjs.org/hyperparam/latest')
5353
.then(response => response.json())
5454
.then(data => {
5555
const latestVersion = data.version
@@ -58,5 +58,4 @@ function checkForUpdates() {
5858
console.log('\x1b[33mRun \'npm install -g hyperparam\' to update\x1b[0m')
5959
}
6060
})
61-
.catch(() => {}) // ignore errors
6261
}

0 commit comments

Comments
 (0)