Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
22bf9db
move components to a package
severo Nov 4, 2024
cdd3356
from master
severo Nov 4, 2024
0a0bc30
include hyparam libs in bundle
severo Nov 5, 2024
5afd2db
remove commented code
severo Nov 5, 2024
4069984
use the recommended way to load a worker
severo Nov 5, 2024
1610ef8
remove comments from JSON
severo Nov 5, 2024
a755dfd
inline the worker in build JS
severo Nov 5, 2024
1ca26e7
remove vite boilerplate
severo Nov 5, 2024
0cb5331
add intermediate Page component to later handle authentication
severo Nov 5, 2024
2306200
use urls in viewers, fix ts
severo Nov 5, 2024
325f17e
fix
severo Nov 5, 2024
938cd1e
addBreadcrumb component (even if it contains some redundant code for …
severo Nov 5, 2024
1849bac
include fixes and improvements from space
severo Nov 5, 2024
e7ad50c
split worker in two, fix eslint
severo Nov 5, 2024
8f32c31
fix tests
severo Nov 6, 2024
5092086
fix install
severo Nov 6, 2024
dbb05a9
fix CI for typechecking (only components)
severo Nov 6, 2024
268546d
remove temp comments
severo Nov 6, 2024
3d488f6
remove vite logo
severo Nov 6, 2024
cf75f3d
apply the same eslint rules as the root + lint/fix
severo Nov 6, 2024
5fab048
use components/index.ts as the entry point
severo Nov 6, 2024
b14324e
only one tsconfig file
severo Nov 6, 2024
f5bf86c
remove commented code
severo Nov 6, 2024
ab3b35e
fix eslint in the root
severo Nov 6, 2024
945f4eb
fix types
severo Nov 6, 2024
37a372a
add CI for the components
severo Nov 6, 2024
3ff5656
fix ci
severo Nov 6, 2024
7d0fa35
try to fix tsc issue in root
severo Nov 6, 2024
c3a8cac
Revert "try to fix tsc issue in root"
severo Nov 6, 2024
ad73e05
try to fix the CI
severo Nov 6, 2024
ae9e838
Revert "try to fix the CI"
severo Nov 6, 2024
e5ea7ab
remove typescript from the root app
severo Nov 6, 2024
c6f3e2d
ci: don't run twice
severo Nov 6, 2024
1c10ac7
merge the workers back together
severo Nov 6, 2024
79894fd
stricter lint rules
severo Nov 6, 2024
c0cb787
readme (still to be done)
severo Nov 6, 2024
caad233
disable rule that force explicit .toString()
severo Nov 6, 2024
02cab4d
type guard Error
severo Nov 6, 2024
f9416f7
lint
severo Nov 6, 2024
e9d954d
build app
severo Nov 6, 2024
112532f
run tests only on the app, not the workspace package
severo Nov 6, 2024
ba6069f
fix the test + add assert instead of forcing the type
severo Nov 6, 2024
e0911ec
better comment
severo Nov 6, 2024
f9bbd73
fix npm versions + add test
severo Nov 6, 2024
e637788
try to fix the CI tsc
severo Nov 6, 2024
8d9b275
build the package to get the types
severo Nov 6, 2024
0af082a
one sentence in the README
severo Nov 6, 2024
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
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: CI
on:
pull_request:
push:

jobs:
Expand All @@ -16,6 +15,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: npm i
- run: npm run build
working-directory: ./packages/components
Comment thread
severo marked this conversation as resolved.
Resolved
- run: tsc

test:
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/ci_components.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI in the components package
on:
push:
paths:
- 'packages/components/**'
- '.github/workflows/ci_components.yml'

defaults:
run:
working-directory: ./packages/components

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm i
- run: npm run lint

typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm i
- run: tsc

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm i
- run: npm run coverage
4 changes: 2 additions & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import javascript from '@eslint/js'
import typescript from 'typescript-eslint'
import globals from 'globals'
import typescript from 'typescript-eslint'

export default [
{
plugins: {
typescript,
},

ignores: ['public/build/*'],
ignores: ['public/build/*', 'packages/components/dist/*'],

languageOptions: {
globals: {
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@
"lint": "eslint",
"serve": "node src/cli.js",
"url": "node src/cli.js https://hyperparam.blob.core.windows.net/hyperparam/starcoderdata-js-00000-of-00065.parquet",
"test": "vitest run"
"test": "vitest run --dir test"
},
"dependencies": {
"highlight.js": "11.10.0",
"hightable": "0.6.3",
"hyparquet": "1.5.0",
"hyparquet-compressors": "0.1.4"
"@hyparam/components": "file:packages/components"
},
"devDependencies": {
"@rollup/plugin-commonjs": "28.0.1",
Expand All @@ -50,5 +48,8 @@
"typescript": "5.6.3",
"typescript-eslint": "8.12.2",
"vitest": "2.1.4"
}
},
"workspaces": [
"packages/components"
]
}
31 changes: 31 additions & 0 deletions packages/components/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 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/
7 changes: 7 additions & 0 deletions packages/components/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3 changes: 3 additions & 0 deletions packages/components/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# React components for hyparam apps

This package contains the React components for the hyparam apps.
92 changes: 92 additions & 0 deletions packages/components/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import js from '@eslint/js'
import react from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import globals from 'globals'
import tseslint from 'typescript-eslint'

export default tseslint.config(
{ ignores: ['coverage/', 'dist/'] },
{
settings: { react: { version: '18.3' } },
extends: [js.configs.recommended, ...tseslint.configs.strictTypeChecked, ...tseslint.configs.stylisticTypeChecked],
files: ['**/*.{ts,tsx,js}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
project: ['./tsconfig.json', './tsconfig.eslint.json'],
tsconfigRootDir: import.meta.dirname,
},
},
plugins: {
'react': react,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
Comment thread
severo marked this conversation as resolved.
Resolved
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
/// ^ from vite default configuration
...js.configs.recommended.rules,
...tseslint.configs.recommended.rules,
'arrow-spacing': 'error',
camelcase: 'off',
'comma-spacing': 'error',
'comma-dangle': ['error', 'always-multiline'],
'eol-last': 'error',
eqeqeq: 'error',
'func-style': ['error', 'declaration'],
indent: ['error', 2],
'no-constant-condition': 'off',
'no-extra-parens': 'error',
'no-multi-spaces': 'error',
'no-trailing-spaces': 'error',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'warn',
'no-useless-concat': 'error',
'no-useless-rename': 'error',
'no-useless-return': 'error',
'no-var': 'error',
'object-curly-spacing': ['error', 'always'],
'prefer-const': 'warn',
'prefer-destructuring': ['warn', {
object: true,
array: false,
}],
'prefer-promise-reject-errors': 'error',
quotes: ['error', 'single'],
'require-await': 'warn',
semi: ['error', 'never'],

'sort-imports': ['error', {
ignoreDeclarationSort: true,
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
}],

'space-infix-ops': 'error',

'@typescript-eslint/restrict-template-expressions': 'off',
},
},
{
files: ['test/**/*.{ts,tsx}', '*.{js,ts}'],
languageOptions: {
ecmaVersion: 2020,
globals: {
...globals.node,
...globals.browser,
},
},
},
{
files: ['**/*.js'],
...tseslint.configs.disableTypeChecked,
},
)
67 changes: 67 additions & 0 deletions packages/components/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"name": "@hyparam/components",
"version": "0.1.0",
"description": "React components for hyparam apps",
"keywords": [
"component",
"data",
"javascript",
"react"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/hyparam/hyperparam-cli.git",
"directory": "packages/components"
},
"type": "module",
"main": "dist/index.umd.js",
"module": "dist/index.es.js",
"exports": {
".": {
"import": "./dist/index.es.js",
"require": "./dist/index.umd.js",
"types": "./dist/components/index.d.ts"
}
},
"types": "dist/components/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "tsc && vite build",
"coverage": "vitest run --coverage --coverage.include=src",
"lint": "eslint .",
"preview": "vite preview",
"prepublishOnly": "npm run build",
"test": "vitest run"
},
"dependencies": {
"hightable": "0.6.3",
"hyparquet": "1.5.0",
"hyparquet-compressors": "0.1.4"
},
"peerDependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@eslint/js": "9.14.0",
"@testing-library/react": "16.0.1",
"@types/node": "22.9.0",
"@types/react": "18.3.12",
"@types/react-dom": "18.3.1",
"@vitejs/plugin-react": "4.3.3",
"@vitest/coverage-v8": "2.1.4",
"eslint": "9.14.0",
"eslint-plugin-react": "7.37.2",
"eslint-plugin-react-hooks": "5.0.0",
"eslint-plugin-react-refresh": "0.4.14",
"globals": "15.11.0",
"typescript": "5.6.3",
"typescript-eslint": "8.13.0",
"vite": "5.4.10",
"vite-plugin-dts": "4.3.0",
"vitest": "2.1.4"
}
}
7 changes: 7 additions & 0 deletions packages/components/src/components/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Page from './Page.tsx'

export default function App() {
return (
<Page />
)
}
37 changes: 37 additions & 0 deletions packages/components/src/components/Breadcrumb.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { FileKey, UrlKey } from '../lib/key.ts'

interface BreadcrumbProps {
parsedKey: UrlKey | FileKey
}

function UrlBreadcrumb({ urlKey }: { urlKey: UrlKey}) {
return <nav className='top-header'>
<div className='path'>
<a href={`/files?key=${urlKey.raw}`}>{urlKey.raw}</a>
</div>
</nav>
}

function FileBreadcrumb({ fileKey }: { fileKey: FileKey}) {
Comment thread
severo marked this conversation as resolved.
Resolved
const path = fileKey.raw.split('/')

return <nav className='top-header'>
<div className='path'>
<a href='/files'>/</a>
{path.slice(0, -1).map((sub, depth) =>
<a href={`/files?key=${path.slice(0, depth + 1).join('/')}/`} key={depth}>{sub}/</a>,
)}
<a href={`/files?key=${fileKey.raw}`}>{fileKey.fileName}</a>
</div>
</nav>
}

/**
* Breadcrumb navigation
*/
export default function Breadcrumb({ parsedKey }: BreadcrumbProps) {
if (parsedKey.kind === 'url') {
return <UrlBreadcrumb urlKey={parsedKey} />
}
return <FileBreadcrumb fileKey={parsedKey} />
}
Loading