Skip to content

Commit

Permalink
remove npm workspaces + use published utils package (#53)
Browse files Browse the repository at this point in the history
* remove npm workspaces + use published utils package

* fix CI

* fix CI

* transform to a commonjs module

* fix

* fix ci

* add missing dev dependency (it was installed globally when using workspaces)

* install react + depend on published package, not relative one
  • Loading branch information
severo authored Nov 20, 2024
1 parent 31df2aa commit 8cd859a
Show file tree
Hide file tree
Showing 19 changed files with 52 additions and 86 deletions.
34 changes: 13 additions & 21 deletions .github/workflows/ci_apps_cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ on:
push:
paths:
- 'packages/components/**'
- 'packages/utils/**'
- 'apps/cli/**'
- '.github/workflows/ci_apps_cli.yml'
- 'shared.eslint.config.js'

defaults:
run:
Expand All @@ -17,49 +17,41 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: npm i
- run: npm run build
working-directory: ./packages/utils
- run: npm run build
- run: |
npm i
npm run build
working-directory: ./packages/components
- run: npm run lint

typecheck:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./
steps:
- uses: actions/checkout@v4
- run: npm i
- run: npm run build
working-directory: ./packages/utils
- run: npm run build
- run: |
npm i
npm run build
working-directory: ./packages/components
- run: tsc
working-directory: ./apps/cli

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm i
- run: npm run build
working-directory: ./packages/utils
- run: npm run build
- run: |
npm i
npm run build
working-directory: ./packages/components
- run: npm run coverage

buildcheck:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./
steps:
- uses: actions/checkout@v4
- run: npm i
- run: npm run build
working-directory: ./packages/utils
- run: npm run build
- run: |
npm i
npm run build
working-directory: ./packages/components
- run: npm run build
working-directory: ./apps/cli
1 change: 1 addition & 0 deletions .github/workflows/ci_apps_hightable_demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
paths:
- 'apps/hightable-demo/**'
- '.github/workflows/ci_apps_hightable_demo.yml'
- 'shared.eslint.config.js'

defaults:
run:
Expand Down
10 changes: 1 addition & 9 deletions .github/workflows/ci_apps_hyparquet_demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: apps/hyparquet-demo
on:
push:
paths:
- 'packages/utils/**'
- 'apps/hyparquet-demo/**'
- '.github/workflows/ci_apps_hyparquet_demo.yml'
- 'shared.eslint.config.js'

defaults:
run:
Expand All @@ -16,33 +16,25 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: npm i
- run: npm run build
working-directory: ./packages/utils
- run: npm run lint

typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm i
- run: npm run build
working-directory: ./packages/utils
- run: tsc

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm i
- run: npm run build
working-directory: ./packages/utils
- run: npm run coverage

buildcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm i
- run: npm run build
working-directory: ./packages/utils
- run: npm run build
10 changes: 1 addition & 9 deletions .github/workflows/ci_packages_components.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ on:
push:
paths:
- 'packages/components/**'
- 'packages/utils/**'
- '.github/workflows/ci_packages_components.yml'
- 'shared.eslint.config.js'

defaults:
run:
Expand All @@ -16,26 +16,20 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: npm i
- run: npm run build
working-directory: ./packages/utils
- run: npm run lint

typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm i
- run: npm run build
working-directory: ./packages/utils
- run: tsc

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm i
- run: npm run build
working-directory: ./packages/utils
- run: npm run coverage

buildcheck:
Expand All @@ -44,5 +38,3 @@ jobs:
- uses: actions/checkout@v4
- run: npm i
- run: npm run build
working-directory: ./packages/utils
- run: npm run build
1 change: 1 addition & 0 deletions .github/workflows/ci_packages_utils.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
paths:
- 'packages/utils/**'
- '.github/workflows/ci_packages_utils.yml'
- 'shared.eslint.config.js'

defaults:
run:
Expand Down
17 changes: 6 additions & 11 deletions .github/workflows/deploy_pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,16 @@ jobs:
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Install dependencies
run: npm i
- name: Build @hyparam/utils package
run: npm run build
working-directory: ./packages/utils
- name: Build hyparquet demo
run: npm run build
run: |
npm i
npm run build
working-directory: ./apps/hyparquet-demo
- name: Build hightable demo
run: npm run build
working-directory: ./apps/hightable-demo
- name: Create index file content
run: |
id: index_content
npm i
npm run build
working-directory: ./apps/hightable-demo
- name: Move the build outputs to a folder
run: |
mkdir -p build_outputs_folder/apps
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ It also contains the following applications:
- [`hyperparam`](./apps/cli): a cli tool for viewing arbitrarily large datasets in the browser.
- [`hightable-demo`](./apps/hightable-demo): an example project showing how to use [hightable](https://github.com/hyparam/hightable).
- [`hyparquet-demo`](./apps/hyparquet-demo): an example project showing how to use [hyparquet](https://github.com/hyparam/hyparquet).

## Development

The dependencies between the packages and applications of this monorepo are pinned, and the packages are published to npm. It means that the changes in a dependency are not automatically reflected in the dependent package or application.

To make the development easier, you can locally replace the npm dependencies with the local packages, replacing the pinned versions (eg `"@hyparam/utils": "0.1.0",`) with a relative path (`"@hyparam/utils": "file:../../packages/utils",`). It's not ideal, we might switch to pnpm or yarn workspaces in the future.
3 changes: 2 additions & 1 deletion apps/cli/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import javascript from '@eslint/js'
import globals from 'globals'
import typescript from 'typescript-eslint'
import { sharedJsRules } from '../../shared.eslint.config.js'
import sharedEslintRules from '../../shared.eslint.config.js'
const { sharedJsRules } = sharedEslintRules

export default [
{
Expand Down
4 changes: 3 additions & 1 deletion apps/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
},
"dependencies": {
"highlight.js": "11.10.0",
"@hyparam/components": "file:../../packages/components"
"@hyparam/components": "0.1.0",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"devDependencies": {
"@rollup/plugin-commonjs": "28.0.1",
Expand Down
13 changes: 2 additions & 11 deletions apps/cli/public/build/app.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/cli/public/build/app.min.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion apps/hightable-demo/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import globals from 'globals'
import tseslint from 'typescript-eslint'
import { sharedJsRules, sharedTsRules } from '../../shared.eslint.config.js'
import sharedEslintRules from '../../shared.eslint.config.js'
const { sharedJsRules, sharedTsRules } = sharedEslintRules

export default tseslint.config(
{ ignores: ['dist'] },
Expand Down
3 changes: 2 additions & 1 deletion apps/hyparquet-demo/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import globals from 'globals'
import tseslint from 'typescript-eslint'
import { sharedJsRules, sharedTsRules } from '../../shared.eslint.config.js'
import sharedEslintRules from '../../shared.eslint.config.js'
const { sharedJsRules, sharedTsRules } = sharedEslintRules

export default tseslint.config(
{ ignores: ['dist'] },
Expand Down
2 changes: 1 addition & 1 deletion apps/hyparquet-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"test": "vitest run --dir test"
},
"dependencies": {
"@hyparam/utils": "file:../../packages/utils",
"@hyparam/utils": "0.1.0",
"hyparquet": "1.5.0",
"hyparquet-compressors": "0.1.4",
"hightable": "0.7.0",
Expand Down
14 changes: 0 additions & 14 deletions package.json

This file was deleted.

3 changes: 2 additions & 1 deletion packages/components/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import globals from 'globals'
import tseslint from 'typescript-eslint'
import { sharedJsRules, sharedTsRules } from '../../shared.eslint.config.js'
import sharedEslintRules from '../../shared.eslint.config.js'
const { sharedJsRules, sharedTsRules } = sharedEslintRules

export default tseslint.config(
{ ignores: ['coverage/', 'dist/', 'es/'] },
Expand Down
3 changes: 2 additions & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"test": "vitest run"
},
"dependencies": {
"@hyparam/utils": "file:../utils",
"@hyparam/utils": "0.1.0",
"hightable": "0.6.3",
"hyparquet": "1.5.0",
"hyparquet-compressors": "0.1.4"
Expand All @@ -60,6 +60,7 @@
"eslint-plugin-react-hooks": "5.0.0",
"eslint-plugin-react-refresh": "0.4.14",
"globals": "15.11.0",
"jsdom": "25.0.1",
"typescript": "5.6.3",
"typescript-eslint": "8.13.0",
"vite": "5.4.10",
Expand Down
3 changes: 2 additions & 1 deletion packages/utils/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import js from '@eslint/js'
import globals from 'globals'
import tseslint from 'typescript-eslint'
import { sharedJsRules, sharedTsRules } from '../../shared.eslint.config.js'
import sharedEslintRules from '../../shared.eslint.config.js'
const { sharedJsRules, sharedTsRules } = sharedEslintRules

export default tseslint.config(
{ ignores: ['coverage/', 'dist/', 'es/'] },
Expand Down
6 changes: 4 additions & 2 deletions shared.eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const sharedJsRules = {
const sharedJsRules = {
'arrow-spacing': 'error',
camelcase: 'off',
'comma-spacing': 'error',
Expand Down Expand Up @@ -36,7 +36,9 @@ export const sharedJsRules = {
'space-infix-ops': 'error',
}

export const sharedTsRules = {
const sharedTsRules = {
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/no-unused-vars': 'warn',
}

module.exports = { sharedJsRules, sharedTsRules }

0 comments on commit 8cd859a

Please sign in to comment.