Skip to content

Commit 23b5700

Browse files
committed
move cli to bin/
1 parent 07f49d2 commit 23b5700

30 files changed

+151
-651
lines changed

README.md

Lines changed: 68 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,72 @@
1-
# React components for hyparam apps
1+
# hyperparam
22

3-
This package contains the React components for the hyparam apps.
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 depends on [hyparquet](https://github.com/hyparam/hyparquet), [hyparquet-compressors](https://github.com/hyparam/hyparquet-compressors), [hightable](https://github.com/hyparam/hightable/), and requires React to be installed (peer-dependency).
8+
This is the hyperparam cli tool.
69

7-
It is used in [hyperparam](https://github.com/hyparam/hyperparam-cli/tree/master/packages/cli).
10+
The hyperparam cli tool is for viewing arbitrarily large datasets in the browser.
811

9-
It also contains utilities, in the lib/ subdirectory, that can be used without React. They are used in [hyparquet-demo](https://github.com/hyparam/hyperparam-cli/tree/master/apps/hyparquet-demo).
12+
## Viewer
13+
14+
To open a file browser in your current local directory run:
15+
16+
```sh
17+
npx hyperparam
18+
```
19+
20+
You can also pass a specific file, folder, or url:
21+
22+
```sh
23+
npx hyperparam example.parquet
24+
npx hyperparam directory/
25+
npx hyperparam https://hyperparam-public.s3.amazonaws.com/bunnies.parquet
26+
```
27+
28+
## Chat
29+
30+
To start a chat with hyperparam:
31+
32+
```sh
33+
npx hyperparam chat
34+
```
35+
36+
## Installation
37+
38+
Install for all users:
39+
40+
```sh
41+
sudo npm i -g hyperparam
42+
```
43+
44+
Now you can just run:
45+
46+
```sh
47+
hyperparam
48+
```
49+
50+
or:
51+
52+
```sh
53+
hyp
54+
```
55+
56+
## Developers
57+
58+
To develop the CLI locally:
59+
60+
```sh
61+
npm i
62+
npm run build
63+
npm run serve
64+
```
65+
66+
When you make changes, make sure to rebuild:
67+
68+
```sh
69+
npm run build
70+
```
71+
72+
Then refresh the browser.
File renamed without changes.
File renamed without changes.
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,20 @@ function handleRequest(req, serveDirectory) {
8080
// get location of hyperparam assets
8181
const hyperparamPath = decodeURIComponent(import.meta.url)
8282
.replace('file://', '')
83-
.replace('/src/serve.js', '')
83+
.replace('/bin/serve.js', '')
8484

8585
if (pathname === '/' || pathname === '/files/') {
8686
// redirect to /files
8787
return { status: 301, content: '/files' }
8888
} else if (pathname.startsWith('/files')) {
8989
// serve index.html
90-
return handleStatic(`${hyperparamPath}/public/index.html`)
91-
} else if (pathname.startsWith('/public/')) {
90+
return handleStatic(`${hyperparamPath}/dist/index.html`)
91+
} else if (pathname.startsWith('/assets/')) {
9292
// serve static files
93-
return handleStatic(`${hyperparamPath}${pathname}`)
93+
return handleStatic(`${hyperparamPath}/dist${pathname}`)
94+
// else if (pathname.startsWith('/public/')) {
95+
// // serve static files
96+
// return handleStatic(`${hyperparamPath}${pathname.replace(/^(\/public).*/, '/dist')}`)
9497
} else if (serveDirectory && pathname === '/api/store/list') {
9598
// serve file list
9699
const prefix = parsedUrl.query.prefix || ''

eslint.config.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,21 @@ export default tseslint.config(
100100
files: ['**/*.js'],
101101
...tseslint.configs.disableTypeChecked,
102102
},
103+
// {
104+
// files: ['bin/**/*.js'],
105+
// plugins: {
106+
// typescript,
107+
// },
108+
// languageOptions: {
109+
// globals: {
110+
// ...globals.browser,
111+
// ...globals.node,
112+
// },
113+
// },
114+
// rules: {
115+
// ...javascript.configs.recommended.rules,
116+
// ...typescript.configs.recommended.rules,
117+
// ...sharedJsRules,
118+
// },
119+
// }
103120
)

index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<title>hyperparam</title>
66
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Mulish:wght@400;600&display=swap"/>
77
<link href="favicon.png" rel="icon" />
8-
<meta name="description" content="demo for the Hyperparam components" />
8+
<meta name="description" content="hyperparam is the missing UI for machine learning" />
99
<meta name="theme-color" content="#6b00ff">
1010
<meta name="viewport" content="width=device-width, initial-scale=1" />
1111
</head>
1212
<body>
13-
<div id="root"></div>
14-
<script type="module" src="./src/demo.tsx"></script>
13+
<div id="app"></div>
14+
<script type="module" src="./src/app.tsx"></script>
1515
</body>
1616
</html>

package.json

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
{
2-
"name": "@hyparam/components",
3-
"version": "0.1.19",
4-
"description": "React components for hyparam apps",
5-
"keywords": [
6-
"component",
7-
"data",
8-
"javascript",
9-
"react"
10-
],
2+
"name": "hyperparam",
3+
"version": "0.2.23",
4+
"description": "Hyperparam CLI",
5+
"author": "Hyperparam",
6+
"homepage": "https://hyperparam.app",
117
"license": "MIT",
128
"repository": {
139
"type": "git",
1410
"url": "git+https://github.com/hyparam/hyperparam-cli.git",
15-
"directory": "packages/components"
1611
},
1712
"type": "module",
1813
"types": "lib/index.d.ts",
@@ -29,13 +24,17 @@
2924
],
3025
"scripts": {
3126
"build": "tsc -b && vite build",
32-
"coverage": "vitest run --coverage --coverage.include=src",
33-
"dev": "vite",
27+
"coverage": "vitest run --coverage --coverage.include=src --coverage.include=bin",
28+
"dev:vite": "vite",
29+
"dev:serve": "npm run serve",
30+
"dev:url": "npm run dev:serve -- https://hyperparam.blob.core.windows.net/hyperparam/starcoderdata-js-00000-of-00065.parquet",
3431
"lint": "eslint .",
3532
"prepublishOnly": "npm run build",
33+
"preview:vite": "vite preview",
34+
"serve": "node bin/cli.js",
35+
"preserve": "npm run build",
3636
"test": "vitest run",
37-
"typecheck": "tsc --noEmit",
38-
"preview": "vite preview"
37+
"typecheck": "tsc --noEmit"
3938
},
4039
"dependencies": {
4140
"hightable": "0.11.0",

packages/cli/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/cli/LICENSE

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

0 commit comments

Comments
 (0)