Skip to content

Commit 298e78f

Browse files
committed
refactor: extract @beautiful-tree/types pkg
Signed-off-by: Andres Correa Casablanca <castarco@coderspirit.xyz>
1 parent 03b8405 commit 298e78f

21 files changed

+193
-35
lines changed
File renamed without changes.

.github/workflows/tests-react-svg.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Tests (React SVG)
1+
name: Tests
22

33
on:
44
push:
@@ -33,12 +33,23 @@ jobs:
3333
with:
3434
node-version: ${{ matrix.node-version }}
3535
cache: 'pnpm'
36-
- name: Install dependencies
36+
37+
# @beautiful-tree/types
38+
- name: (Types) Install dependencies
39+
run: pnpm --filter types install
40+
- name: (Types) Build Library
41+
run: pnpm --filter types run build
42+
- name: (Types) Run Linters
43+
if: ${{ matrix.os == 'ubuntu-22.04' }}
44+
run: pnpm --filter types run lint
45+
46+
# @beautiful-tree/react
47+
- name: (React SVG) Install dependencies
3748
run: pnpm --filter react install
38-
- name: Build Library
49+
- name: (React SVG) Build Library
3950
run: pnpm --filter react run build
40-
- name: Run Linters
51+
- name: (React SVG) Run Linters
4152
if: ${{ matrix.os == 'ubuntu-22.04' }}
4253
run: pnpm --filter react run lint
43-
- name: Run Tests
54+
- name: (React SVG) Run Tests
4455
run: pnpm --filter react run test:coverage

@beautiful-tree/react/.eslintrc.cjs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ module.exports = {
88
},
99
parser: '@typescript-eslint/parser',
1010
parserOptions: {
11-
ecmaVersion: 2020,
11+
ecmaVersion: 2020,
1212
sourceType: 'module',
13-
tsConfigRootDir: __dirname,
14-
project: ['./tsconfig.json'],
15-
},
13+
tsConfigRootDir: __dirname,
14+
project: ['./tsconfig.json'],
15+
},
1616
plugins: [
1717
'react-refresh',
1818
],
@@ -24,10 +24,10 @@ module.exports = {
2424
'plugin:storybook/recommended',
2525
],
2626
settings: {
27-
react: {
28-
version: 'detect'
29-
},
30-
},
27+
react: {
28+
version: 'detect'
29+
},
30+
},
3131
ignorePatterns: [
3232
'.eslintrc.cjs',
3333
'dist/**/*',

@beautiful-tree/react/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@beautiful-tree/react",
3-
"version": "0.1.3",
3+
"version": "0.2.0",
44
"private": false,
55
"author": "Andres Correa Casablanca <castarco@coderspirit.xyz>",
66
"license": "MIT",
@@ -37,20 +37,21 @@
3737
"dist"
3838
],
3939
"scripts": {
40-
"build": "rollup --config rollup.config.prod.mjs",
40+
"build": "rm -rf dist && rollup --config rollup.config.prod.mjs",
4141
"build-storybook": "storybook build",
42-
"install-githooks": "if [ -d .git ]; then git config core.hooksPath .hooks; fi",
4342
"lint": "tsc && eslint . --ext ts,mts,tsx --report-unused-disable-directives --max-warnings 0 && publint",
4443
"lint:eslint": "eslint . --ext ts,mts,tsx --report-unused-disable-directives --max-warnings 0",
4544
"lint:publint": "publint",
4645
"lint:tsc": "tsc",
4746
"storybook": "storybook dev -p 6006",
4847
"test": "vitest run",
4948
"test:coverage": "vitest run --coverage",
50-
"test:watch": "vitest"
49+
"test:watch": "vitest",
50+
"prepublishOnly": "pnpm run build"
5151
},
5252
"devDependencies": {
5353
"@arethetypeswrong/cli": "^0.10.2",
54+
"@beautiful-tree/types": "workspace:0.2.0",
5455
"@coderspirit/eslint-config": "^1.2.1",
5556
"@rollup/plugin-terser": "^0.4.3",
5657
"@rollup/plugin-typescript": "^11.1.3",

@beautiful-tree/react/rollup.config.prod.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,6 @@ export default defineConfig([
8585
{ format: 'es', file: 'dist/beautiful-tree.d.mts' },
8686
],
8787
external,
88-
plugins: [dts()],
88+
plugins: [dts({ respectExternal: true })],
8989
},
9090
])

@beautiful-tree/react/src/BeautifulTree.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { edgesIterator, postOrderIterator } from './traversal'
22
import { Fragment } from 'react'
3-
import type { Tree } from './types'
3+
import type { Tree } from '@beautiful-tree/types'
44
import type { WrappedTreeWithLayout } from './layouts'
55
import { computeSmartLayout } from './layouts'
66
export { computeNaiveLayout, computeSmartLayout } from './layouts'

@beautiful-tree/react/src/layouts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Tree, TreeChild, TreeWithLayout } from './types'
1+
import type { Tree, TreeChild, TreeWithLayout } from '@beautiful-tree/types'
22

33
export interface WrappedTreeWithLayout {
44
readonly tree: Readonly<TreeWithLayout>

@beautiful-tree/react/src/stories/BeautifulTree.stories.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
wideTree_E,
1818
wideTree_M,
1919
} from './treeFixtures'
20-
import type { Tree } from '../types'
20+
import type { Tree } from '@beautiful-tree/types'
2121

2222
const meta = {
2323
title: 'BeautifulTree',

@beautiful-tree/react/src/stories/treeFixtures.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Tree } from '../types'
1+
import type { Tree } from '@beautiful-tree/types'
22

33
const mirrorTree = (tree: Tree): Tree => {
44
const children = tree.children?.map((child) => ({

@beautiful-tree/react/src/tests/traversal.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, expect, it } from 'vitest'
22
import { edgesIterator, postOrderIterator } from '../traversal'
3-
import type { TreeWithLayout } from '../types'
3+
import type { TreeWithLayout } from '@beautiful-tree/types'
44

55
describe('postOrderIterator', () => {
66
const testTree = {

0 commit comments

Comments
 (0)