Repository navigation
[wip] Components package #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
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 cdd3356
from master
severo 0a0bc30
include hyparam libs in bundle
severo 5afd2db
remove commented code
severo 4069984
use the recommended way to load a worker
severo 1610ef8
remove comments from JSON
severo a755dfd
inline the worker in build JS
severo 1ca26e7
remove vite boilerplate
severo 0cb5331
add intermediate Page component to later handle authentication
severo 2306200
use urls in viewers, fix ts
severo 325f17e
fix
severo 938cd1e
addBreadcrumb component (even if it contains some redundant code for …
severo 1849bac
include fixes and improvements from space
severo e7ad50c
split worker in two, fix eslint
severo 8f32c31
fix tests
severo 5092086
fix install
severo dbb05a9
fix CI for typechecking (only components)
severo 268546d
remove temp comments
severo 3d488f6
remove vite logo
severo cf75f3d
apply the same eslint rules as the root + lint/fix
severo 5fab048
use components/index.ts as the entry point
severo b14324e
only one tsconfig file
severo f5bf86c
remove commented code
severo ab3b35e
fix eslint in the root
severo 945f4eb
fix types
severo 37a372a
add CI for the components
severo 3ff5656
fix ci
severo 7d0fa35
try to fix tsc issue in root
severo c3a8cac
Revert "try to fix tsc issue in root"
severo ad73e05
try to fix the CI
severo ae9e838
Revert "try to fix the CI"
severo e5ea7ab
remove typescript from the root app
severo c6f3e2d
ci: don't run twice
severo 1c10ac7
merge the workers back together
severo 79894fd
stricter lint rules
severo c0cb787
readme (still to be done)
severo caad233
disable rule that force explicit .toString()
severo 02cab4d
type guard Error
severo f9416f7
lint
severo e9d954d
build app
severo 112532f
run tests only on the app, not the workspace package
severo ba6069f
fix the test + add assert instead of forcing the type
severo e0911ec
better comment
severo f9bbd73
fix npm versions + add test
severo e637788
try to fix the CI tsc
severo 8d9b275
build the package to get the types
severo 0af082a
one sentence in the README
severo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: { | ||
|
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, | ||
| }, | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 /> | ||
| ) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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}) { | ||
|
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} /> | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.