Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitattributes

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/check_dependencies.yml

This file was deleted.

18 changes: 8 additions & 10 deletions .github/workflows/_common_jobs.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
name: Launch CI jobs for a package or app
name: CI
on:
workflow_call:
inputs:
workspace:
required: true
type: string
push:
branches: ["master"]
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm i
- run: npm run lint -w ${{ inputs.workspace }}
- run: npm run lint

typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm i
- run: npm run typecheck -w ${{ inputs.workspace }}
- run: npm run typecheck

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm i
- run: npm run coverage -w ${{ inputs.workspace }}
- run: npm run coverage

buildcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm i
- run: npm run build -w ${{ inputs.workspace }}
- run: npm run build

27 changes: 0 additions & 27 deletions .github/workflows/ci_packages_cli.yml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/ci_packages_components.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/ci_root.yml

This file was deleted.

33 changes: 30 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,34 @@
package-lock.json
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local
coverage

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

package-lock.json
*.tgz
.vscode
*.parquet
coverage
.DS_Store
/coverage/

/lib/
tsconfig.tsbuildinfo
79 changes: 45 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,75 @@
# Hyperparam monorepo
# hyperparam

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

It contains the following packages, published to npm:
This is the hyperparam cli tool.

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

## Use
## Viewer

Install all the workspaces with:
To open a file browser in your current local directory run:

```bash
npm install
```sh
npx hyperparam
```

Lint all the workspaces:
You can also pass a specific file, folder, or url:

```bash
npm run lint -ws
```sh
npx hyperparam example.parquet
npx hyperparam directory/
npx hyperparam https://hyperparam-public.s3.amazonaws.com/bunnies.parquet
```

Test all the workspaces:
## Chat

```bash
npm test -ws
To start a chat with hyperparam:

```sh
npx hyperparam chat
```

Compute the coverage for all the workspaces:
## Installation

Install for all users:

```bash
npm run coverage -ws
```sh
sudo npm i -g hyperparam
```

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`):
Now you can just run:

```bash
npm run build -ws
```sh
hyperparam
```

- `hyperparam`:
or:

```bash
npm run dev -w hyperparam
```sh
hyp
```

- `components`:
## Developers

```bash
npm run dev -w @hyparam/components
```
To develop the CLI locally:

## Development
```sh
npm i
npm run dev
```

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

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

It means that if you make a change to `@hyparam/components`, you need to rebuild it before developing `hyperparam`.
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.

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.
The `hyperparam` package also includes a library that can be used in other applications. The library is in the `lib/` directory. For example:

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).
```js
import { asyncBufferFrom, AsyncBufferFrom, parquetDataFrame } from "hyperparam";
```
File renamed without changes.
3 changes: 1 addition & 2 deletions packages/cli/src/cli.js → bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ if (arg === 'chat') {
*/
function checkForUpdates() {
const currentVersion = packageJson.version
return fetch('https://registry.npmjs.org/hyperparam/latest')
return void fetch('https://registry.npmjs.org/hyperparam/latest')
.then(response => response.json())
.then(data => {
const latestVersion = data.version
Expand All @@ -58,5 +58,4 @@ function checkForUpdates() {
console.log('\x1b[33mRun \'npm install -g hyperparam\' to update\x1b[0m')
}
})
.catch(() => {}) // ignore errors
}
11 changes: 7 additions & 4 deletions packages/cli/src/serve.js → bin/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,20 @@ function handleRequest(req, serveDirectory) {
// get location of hyperparam assets
const hyperparamPath = decodeURIComponent(import.meta.url)
.replace('file://', '')
.replace('/src/serve.js', '')
.replace('/bin/serve.js', '')

if (pathname === '/' || pathname === '/files/') {
// redirect to /files
return { status: 301, content: '/files' }
} else if (pathname.startsWith('/files')) {
// serve index.html
return handleStatic(`${hyperparamPath}/public/index.html`)
} else if (pathname.startsWith('/public/')) {
return handleStatic(`${hyperparamPath}/dist/index.html`)
} else if (pathname.startsWith('/assets/') || pathname.startsWith('/favicon') ) {
// serve static files
return handleStatic(`${hyperparamPath}${pathname}`)
return handleStatic(`${hyperparamPath}/dist${pathname}`)
// else if (pathname.startsWith('/public/')) {
// // serve static files
// return handleStatic(`${hyperparamPath}${pathname.replace(/^(\/public).*/, '/dist')}`)
} else if (serveDirectory && pathname === '/api/store/list') {
// serve file list
const prefix = parsedUrl.query.prefix || ''
Expand Down
File renamed without changes.
Loading